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

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 (200) hide show
  1. package/README.md +6 -8
  2. package/dist/index.d.ts +2 -40
  3. package/dist/index.mjs +1 -42
  4. package/package.json +1 -1
  5. package/src/base.css +1 -0
  6. package/src/index.css +1 -0
  7. package/src/theme.css +1 -0
  8. package/src/utilities.css +1 -0
  9. package/src/variants.css +1 -0
  10. package/dist/_virtual/_commonjsHelpers.cjs +0 -10
  11. package/dist/_virtual/_commonjsHelpers.mjs +0 -7
  12. package/dist/_virtual/css-escape.cjs +0 -5
  13. package/dist/_virtual/css-escape.mjs +0 -3
  14. package/dist/animation-rule.cjs +0 -24
  15. package/dist/animation-rule.d.ts +0 -11
  16. package/dist/animation-rule.mjs +0 -22
  17. package/dist/bin/index.cjs +0 -11
  18. package/dist/bin/index.d.ts +0 -1
  19. package/dist/bin/index.mjs +0 -9
  20. package/dist/common.cjs +0 -208
  21. package/dist/common.d.ts +0 -40
  22. package/dist/common.mjs +0 -180
  23. package/dist/config/animations.cjs +0 -113
  24. package/dist/config/animations.d.ts +0 -110
  25. package/dist/config/animations.mjs +0 -111
  26. package/dist/config/at.cjs +0 -19
  27. package/dist/config/at.d.ts +0 -16
  28. package/dist/config/at.mjs +0 -17
  29. package/dist/config/functions.cjs +0 -141
  30. package/dist/config/functions.d.ts +0 -138
  31. package/dist/config/functions.mjs +0 -139
  32. package/dist/config/index.cjs +0 -40
  33. package/dist/config/index.d.ts +0 -12
  34. package/dist/config/index.mjs +0 -29
  35. package/dist/config/modes.cjs +0 -312
  36. package/dist/config/modes.d.ts +0 -309
  37. package/dist/config/modes.mjs +0 -310
  38. package/dist/config/rules.cjs +0 -2277
  39. package/dist/config/rules.d.ts +0 -1485
  40. package/dist/config/rules.mjs +0 -2275
  41. package/dist/config/screens.cjs +0 -17
  42. package/dist/config/screens.d.ts +0 -14
  43. package/dist/config/screens.mjs +0 -15
  44. package/dist/config/selectors.cjs +0 -25
  45. package/dist/config/selectors.d.ts +0 -22
  46. package/dist/config/selectors.mjs +0 -23
  47. package/dist/config/utilities.cjs +0 -446
  48. package/dist/config/utilities.d.ts +0 -443
  49. package/dist/config/utilities.mjs +0 -444
  50. package/dist/config/variables.cjs +0 -99
  51. package/dist/config/variables.d.ts +0 -423
  52. package/dist/config/variables.mjs +0 -97
  53. package/dist/core.cjs +0 -674
  54. package/dist/core.d.ts +0 -128
  55. package/dist/core.mjs +0 -672
  56. package/dist/create.cjs +0 -10
  57. package/dist/create.d.ts +0 -3
  58. package/dist/create.mjs +0 -8
  59. package/dist/declarers/core.group.cjs +0 -99
  60. package/dist/declarers/core.group.d.ts +0 -2
  61. package/dist/declarers/core.group.mjs +0 -97
  62. package/dist/declarers/core.variable.cjs +0 -9
  63. package/dist/declarers/core.variable.d.ts +0 -4
  64. package/dist/declarers/core.variable.mjs +0 -7
  65. package/dist/declarers/index.cjs +0 -13
  66. package/dist/declarers/index.d.ts +0 -10
  67. package/dist/declarers/index.mjs +0 -11
  68. package/dist/declarers/pair.cjs +0 -12
  69. package/dist/declarers/pair.d.ts +0 -4
  70. package/dist/declarers/pair.mjs +0 -10
  71. package/dist/factories/with-syntax-layer.cjs +0 -83
  72. package/dist/factories/with-syntax-layer.d.ts +0 -26
  73. package/dist/factories/with-syntax-layer.mjs +0 -81
  74. package/dist/function-transformers/core.calc.cjs +0 -225
  75. package/dist/function-transformers/core.calc.d.ts +0 -2
  76. package/dist/function-transformers/core.calc.mjs +0 -223
  77. package/dist/function-transformers/core.variable.cjs +0 -23
  78. package/dist/function-transformers/core.variable.d.ts +0 -7
  79. package/dist/function-transformers/core.variable.mjs +0 -21
  80. package/dist/function-transformers/index.cjs +0 -11
  81. package/dist/function-transformers/index.d.ts +0 -8
  82. package/dist/function-transformers/index.mjs +0 -9
  83. package/dist/index.cjs +0 -118
  84. package/dist/layer.cjs +0 -52
  85. package/dist/layer.d.ts +0 -16
  86. package/dist/layer.mjs +0 -50
  87. package/dist/non-layer.cjs +0 -55
  88. package/dist/non-layer.d.ts +0 -12
  89. package/dist/non-layer.mjs +0 -53
  90. package/dist/polyfills/css-escape.cjs +0 -9
  91. package/dist/polyfills/css-escape.d.ts +0 -0
  92. package/dist/polyfills/css-escape.mjs +0 -7
  93. package/dist/polyfills/css-escape2.cjs +0 -76
  94. package/dist/polyfills/css-escape2.mjs +0 -74
  95. package/dist/register-global.cjs +0 -7
  96. package/dist/register-global.d.ts +0 -5
  97. package/dist/register-global.mjs +0 -5
  98. package/dist/rule.cjs +0 -16
  99. package/dist/rule.d.ts +0 -7
  100. package/dist/rule.mjs +0 -14
  101. package/dist/shared/utils/css-escape.cjs +0 -56
  102. package/dist/shared/utils/css-escape.mjs +0 -54
  103. package/dist/shared/utils/find-native-css-rule-index.cjs +0 -12
  104. package/dist/shared/utils/find-native-css-rule-index.mjs +0 -10
  105. package/dist/syntax-layer.cjs +0 -8
  106. package/dist/syntax-layer.d.ts +0 -18
  107. package/dist/syntax-layer.mjs +0 -6
  108. package/dist/syntax-rule-type.cjs +0 -27
  109. package/dist/syntax-rule-type.d.ts +0 -28
  110. package/dist/syntax-rule-type.mjs +0 -25
  111. package/dist/syntax-rule.cjs +0 -506
  112. package/dist/syntax-rule.d.ts +0 -44
  113. package/dist/syntax-rule.mjs +0 -504
  114. package/dist/transformers/auto-fill-solid.cjs +0 -31
  115. package/dist/transformers/auto-fill-solid.d.ts +0 -2
  116. package/dist/transformers/auto-fill-solid.mjs +0 -29
  117. package/dist/transformers/index.cjs +0 -9
  118. package/dist/transformers/index.d.ts +0 -6
  119. package/dist/transformers/index.mjs +0 -7
  120. package/dist/types/common.cjs +0 -2
  121. package/dist/types/common.d.ts +0 -1
  122. package/dist/types/common.mjs +0 -1
  123. package/dist/types/config.cjs +0 -2
  124. package/dist/types/config.d.ts +0 -79
  125. package/dist/types/config.mjs +0 -1
  126. package/dist/types/syntax.cjs +0 -2
  127. package/dist/types/syntax.d.ts +0 -89
  128. package/dist/types/syntax.mjs +0 -1
  129. package/dist/utils/compare-rule-priority.cjs +0 -143
  130. package/dist/utils/compare-rule-priority.d.ts +0 -7
  131. package/dist/utils/compare-rule-priority.mjs +0 -138
  132. package/dist/utils/equal-at-rules.cjs +0 -22
  133. package/dist/utils/equal-at-rules.d.ts +0 -2
  134. package/dist/utils/equal-at-rules.mjs +0 -20
  135. package/dist/utils/equal-declarations.cjs +0 -10
  136. package/dist/utils/equal-declarations.d.ts +0 -2
  137. package/dist/utils/equal-declarations.mjs +0 -8
  138. package/dist/utils/equal-selectors.cjs +0 -69
  139. package/dist/utils/equal-selectors.d.ts +0 -2
  140. package/dist/utils/equal-selectors.mjs +0 -67
  141. package/dist/utils/equal-variants.cjs +0 -10
  142. package/dist/utils/equal-variants.d.ts +0 -2
  143. package/dist/utils/equal-variants.mjs +0 -8
  144. package/dist/utils/extend-config.cjs +0 -97
  145. package/dist/utils/extend-config.d.ts +0 -11
  146. package/dist/utils/extend-config.mjs +0 -95
  147. package/dist/utils/flatten-meta-object.cjs +0 -38
  148. package/dist/utils/flatten-meta-object.d.ts +0 -13
  149. package/dist/utils/flatten-meta-object.mjs +0 -36
  150. package/dist/utils/flatten-object.cjs +0 -19
  151. package/dist/utils/flatten-object.d.ts +0 -1
  152. package/dist/utils/flatten-object.mjs +0 -17
  153. package/dist/utils/generate-at.cjs +0 -30
  154. package/dist/utils/generate-at.d.ts +0 -2
  155. package/dist/utils/generate-at.mjs +0 -28
  156. package/dist/utils/generate-css.cjs +0 -13
  157. package/dist/utils/generate-css.d.ts +0 -1
  158. package/dist/utils/generate-css.mjs +0 -11
  159. package/dist/utils/generate-selector.cjs +0 -50
  160. package/dist/utils/generate-selector.d.ts +0 -2
  161. package/dist/utils/generate-selector.mjs +0 -48
  162. package/dist/utils/get-single-at-number-rule-node.cjs +0 -9
  163. package/dist/utils/get-single-at-number-rule-node.d.ts +0 -2
  164. package/dist/utils/get-single-at-number-rule-node.mjs +0 -7
  165. package/dist/utils/hex-to-rgb.cjs +0 -30
  166. package/dist/utils/hex-to-rgb.d.ts +0 -1
  167. package/dist/utils/hex-to-rgb.mjs +0 -28
  168. package/dist/utils/is-core-rule.cjs +0 -9
  169. package/dist/utils/is-core-rule.d.ts +0 -1
  170. package/dist/utils/is-core-rule.mjs +0 -7
  171. package/dist/utils/minify-extended-config.cjs +0 -64
  172. package/dist/utils/minify-extended-config.d.ts +0 -9
  173. package/dist/utils/minify-extended-config.mjs +0 -62
  174. package/dist/utils/nest-meta-object.cjs +0 -25
  175. package/dist/utils/nest-meta-object.d.ts +0 -7
  176. package/dist/utils/nest-meta-object.mjs +0 -23
  177. package/dist/utils/parse-at.cjs +0 -156
  178. package/dist/utils/parse-at.d.ts +0 -39
  179. package/dist/utils/parse-at.mjs +0 -154
  180. package/dist/utils/parse-pair.cjs +0 -48
  181. package/dist/utils/parse-pair.d.ts +0 -8
  182. package/dist/utils/parse-pair.mjs +0 -46
  183. package/dist/utils/parse-selector.cjs +0 -114
  184. package/dist/utils/parse-selector.d.ts +0 -19
  185. package/dist/utils/parse-selector.mjs +0 -112
  186. package/dist/utils/parse-value.cjs +0 -39
  187. package/dist/utils/parse-value.d.ts +0 -2
  188. package/dist/utils/parse-value.mjs +0 -37
  189. package/dist/utils/replace-char-outside-quotes.cjs +0 -21
  190. package/dist/utils/replace-char-outside-quotes.d.ts +0 -1
  191. package/dist/utils/replace-char-outside-quotes.mjs +0 -19
  192. package/dist/utils/sort-readable-classes.cjs +0 -86
  193. package/dist/utils/sort-readable-classes.d.ts +0 -7
  194. package/dist/utils/sort-readable-classes.mjs +0 -84
  195. package/dist/utils/split-char-outside-quotes.cjs +0 -29
  196. package/dist/utils/split-char-outside-quotes.d.ts +0 -1
  197. package/dist/utils/split-char-outside-quotes.mjs +0 -27
  198. package/dist/variable-rule.cjs +0 -92
  199. package/dist/variable-rule.d.ts +0 -33
  200. package/dist/variable-rule.mjs +0 -87
@@ -1,10 +0,0 @@
1
- 'use strict';
2
-
3
- var equalSelectors = require('./equal-selectors.cjs');
4
- var equalAtRules = require('./equal-at-rules.cjs');
5
-
6
- function equalVariants(a, b) {
7
- return a.mode === b.mode && equalSelectors(a.selectorNodes, b.selectorNodes) && equalAtRules(a.atRules, b.atRules);
8
- }
9
-
10
- module.exports = equalVariants;
@@ -1,2 +0,0 @@
1
- import type { SyntaxRule } from '../syntax-rule';
2
- export default function equalVariants(a: SyntaxRule, b: SyntaxRule): boolean;
@@ -1,8 +0,0 @@
1
- import equalSelectors from './equal-selectors.mjs';
2
- import equalAtRules from './equal-at-rules.mjs';
3
-
4
- function equalVariants(a, b) {
5
- return a.mode === b.mode && equalSelectors(a.selectorNodes, b.selectorNodes) && equalAtRules(a.atRules, b.atRules);
6
- }
7
-
8
- export { equalVariants as default };
@@ -1,97 +0,0 @@
1
- 'use strict';
2
-
3
- var extend = require('json-safe-extend');
4
- var flattenObject = require('./flatten-object.cjs');
5
- var flattenMetaObject = require('./flatten-meta-object.cjs');
6
-
7
- function extendConfig(...configs) {
8
- const collectConfigs = (config, result = [])=>{
9
- if (!config) return result;
10
- if (config.extends?.length) {
11
- for (const ext of config.extends){
12
- collectConfigs('config' in ext ? ext.config : ext, result);
13
- }
14
- }
15
- const cleanConfig = {
16
- ...config
17
- };
18
- delete cleanConfig.extends;
19
- result.push(cleanConfig);
20
- return result;
21
- };
22
- const allConfigs = configs.reduce((acc, config)=>collectConfigs(config, acc), []);
23
- let extendedConfig = {
24
- __extended: true
25
- };
26
- for (const { variables, modes, components, animations, at, rules, utilities, selectors, functions, ...rest } of allConfigs){
27
- const isExtended = '__extended' in rest;
28
- if (isExtended) delete rest.__extended;
29
- // variables
30
- if (variables) {
31
- extendedConfig.variables ??= {};
32
- const flattened = isExtended ? {
33
- ...variables
34
- } : flattenMetaObject(variables, [], {});
35
- Object.assign(extendedConfig.variables, flattened);
36
- }
37
- // modes
38
- if (modes) {
39
- extendedConfig.modes ??= {};
40
- for (const [modeName, modeVars] of Object.entries(modes)){
41
- const flattenedMode = isExtended ? {
42
- ...modeVars
43
- } : flattenMetaObject(modeVars, [], {});
44
- extendedConfig.modes[modeName] = {
45
- ...extendedConfig.modes[modeName],
46
- ...flattenedMode
47
- };
48
- }
49
- }
50
- // components
51
- if (components) {
52
- extendedConfig.components ??= {};
53
- const flattened = isExtended ? {
54
- ...components
55
- } : flattenObject(components);
56
- Object.assign(extendedConfig.components, flattened);
57
- }
58
- // at
59
- if (at) {
60
- extendedConfig.at ??= {};
61
- const flattened = isExtended ? {
62
- ...at
63
- } : flattenObject(at);
64
- Object.assign(extendedConfig.at, flattened);
65
- }
66
- // animations
67
- if (animations) {
68
- extendedConfig.animations ??= {};
69
- Object.assign(extendedConfig.animations, animations);
70
- }
71
- // rules
72
- if (rules) {
73
- extendedConfig.rules ??= {};
74
- Object.assign(extendedConfig.rules, rules);
75
- }
76
- // utilities
77
- if (utilities) {
78
- extendedConfig.utilities ??= {};
79
- Object.assign(extendedConfig.utilities, utilities);
80
- }
81
- // selectors
82
- if (selectors) {
83
- extendedConfig.selectors ??= {};
84
- Object.assign(extendedConfig.selectors, selectors);
85
- }
86
- // functions
87
- if (functions) {
88
- extendedConfig.functions ??= {};
89
- Object.assign(extendedConfig.functions, functions);
90
- }
91
- // merge the rest (non-structured fields)
92
- extendedConfig = extend({}, extendedConfig, rest);
93
- }
94
- return extendedConfig;
95
- }
96
-
97
- module.exports = extendConfig;
@@ -1,11 +0,0 @@
1
- import type { Config } from '../types/config';
2
- import { Variable } from '../types/syntax';
3
- export declare type ExtendedConfig = {
4
- __extended?: boolean;
5
- variables?: Record<string, Variable>;
6
- modes?: Record<string, Record<string, Variable>>;
7
- at?: Record<string, string>;
8
- selectors?: Record<string, string>;
9
- components?: Record<string, string>;
10
- } & Omit<Config, 'variables' | 'modes'>;
11
- export default function extendConfig(...configs: (Config | undefined)[]): ExtendedConfig;
@@ -1,95 +0,0 @@
1
- import extend from 'json-safe-extend';
2
- import flattenObject from './flatten-object.mjs';
3
- import flattenMetaObject from './flatten-meta-object.mjs';
4
-
5
- function extendConfig(...configs) {
6
- const collectConfigs = (config, result = [])=>{
7
- if (!config) return result;
8
- if (config.extends?.length) {
9
- for (const ext of config.extends){
10
- collectConfigs('config' in ext ? ext.config : ext, result);
11
- }
12
- }
13
- const cleanConfig = {
14
- ...config
15
- };
16
- delete cleanConfig.extends;
17
- result.push(cleanConfig);
18
- return result;
19
- };
20
- const allConfigs = configs.reduce((acc, config)=>collectConfigs(config, acc), []);
21
- let extendedConfig = {
22
- __extended: true
23
- };
24
- for (const { variables, modes, components, animations, at, rules, utilities, selectors, functions, ...rest } of allConfigs){
25
- const isExtended = '__extended' in rest;
26
- if (isExtended) delete rest.__extended;
27
- // variables
28
- if (variables) {
29
- extendedConfig.variables ??= {};
30
- const flattened = isExtended ? {
31
- ...variables
32
- } : flattenMetaObject(variables, [], {});
33
- Object.assign(extendedConfig.variables, flattened);
34
- }
35
- // modes
36
- if (modes) {
37
- extendedConfig.modes ??= {};
38
- for (const [modeName, modeVars] of Object.entries(modes)){
39
- const flattenedMode = isExtended ? {
40
- ...modeVars
41
- } : flattenMetaObject(modeVars, [], {});
42
- extendedConfig.modes[modeName] = {
43
- ...extendedConfig.modes[modeName],
44
- ...flattenedMode
45
- };
46
- }
47
- }
48
- // components
49
- if (components) {
50
- extendedConfig.components ??= {};
51
- const flattened = isExtended ? {
52
- ...components
53
- } : flattenObject(components);
54
- Object.assign(extendedConfig.components, flattened);
55
- }
56
- // at
57
- if (at) {
58
- extendedConfig.at ??= {};
59
- const flattened = isExtended ? {
60
- ...at
61
- } : flattenObject(at);
62
- Object.assign(extendedConfig.at, flattened);
63
- }
64
- // animations
65
- if (animations) {
66
- extendedConfig.animations ??= {};
67
- Object.assign(extendedConfig.animations, animations);
68
- }
69
- // rules
70
- if (rules) {
71
- extendedConfig.rules ??= {};
72
- Object.assign(extendedConfig.rules, rules);
73
- }
74
- // utilities
75
- if (utilities) {
76
- extendedConfig.utilities ??= {};
77
- Object.assign(extendedConfig.utilities, utilities);
78
- }
79
- // selectors
80
- if (selectors) {
81
- extendedConfig.selectors ??= {};
82
- Object.assign(extendedConfig.selectors, selectors);
83
- }
84
- // functions
85
- if (functions) {
86
- extendedConfig.functions ??= {};
87
- Object.assign(extendedConfig.functions, functions);
88
- }
89
- // merge the rest (non-structured fields)
90
- extendedConfig = extend({}, extendedConfig, rest);
91
- }
92
- return extendedConfig;
93
- }
94
-
95
- export { extendConfig as default };
@@ -1,38 +0,0 @@
1
- 'use strict';
2
-
3
- function flattenMetaObject(obj, name = [], result = {}) {
4
- for (const [rawKey, rawValue] of Object.entries(obj)){
5
- const key = rawKey || name[0] || '';
6
- const path = [
7
- ...name,
8
- rawKey
9
- ].filter(Boolean);
10
- const flatKey = path.join('-');
11
- const groupPath = path.slice(0, -1).join('.');
12
- const namespace = path[0];
13
- const isObject = rawValue && typeof rawValue === 'object' && !Array.isArray(rawValue);
14
- const isSelfObject = isObject && Object.keys(rawValue).length === 1 && '' in rawValue;
15
- if (isSelfObject) {
16
- result[flatKey] = {
17
- name: flatKey,
18
- key,
19
- value: rawValue[''],
20
- group: path.length > 1 ? groupPath : undefined,
21
- namespace: path.length > 1 ? namespace : undefined
22
- };
23
- } else if (!isObject) {
24
- result[flatKey] = {
25
- name: flatKey,
26
- key,
27
- value: Array.isArray(rawValue) ? rawValue.join(',') : rawValue,
28
- group: path.length > 1 ? groupPath : undefined,
29
- namespace: path.length > 1 ? namespace : undefined
30
- };
31
- } else {
32
- flattenMetaObject(rawValue, path, result);
33
- }
34
- }
35
- return result;
36
- }
37
-
38
- module.exports = flattenMetaObject;
@@ -1,13 +0,0 @@
1
- export default function flattenMetaObject(obj: Record<string, any>, name?: string[], result?: Record<string, {
2
- name: string;
3
- value: any;
4
- key: string;
5
- group?: string;
6
- namespace?: string;
7
- }>): Record<string, {
8
- name: string;
9
- value: any;
10
- key: string;
11
- group?: string;
12
- namespace?: string;
13
- }>;
@@ -1,36 +0,0 @@
1
- function flattenMetaObject(obj, name = [], result = {}) {
2
- for (const [rawKey, rawValue] of Object.entries(obj)){
3
- const key = rawKey || name[0] || '';
4
- const path = [
5
- ...name,
6
- rawKey
7
- ].filter(Boolean);
8
- const flatKey = path.join('-');
9
- const groupPath = path.slice(0, -1).join('.');
10
- const namespace = path[0];
11
- const isObject = rawValue && typeof rawValue === 'object' && !Array.isArray(rawValue);
12
- const isSelfObject = isObject && Object.keys(rawValue).length === 1 && '' in rawValue;
13
- if (isSelfObject) {
14
- result[flatKey] = {
15
- name: flatKey,
16
- key,
17
- value: rawValue[''],
18
- group: path.length > 1 ? groupPath : undefined,
19
- namespace: path.length > 1 ? namespace : undefined
20
- };
21
- } else if (!isObject) {
22
- result[flatKey] = {
23
- name: flatKey,
24
- key,
25
- value: Array.isArray(rawValue) ? rawValue.join(',') : rawValue,
26
- group: path.length > 1 ? groupPath : undefined,
27
- namespace: path.length > 1 ? namespace : undefined
28
- };
29
- } else {
30
- flattenMetaObject(rawValue, path, result);
31
- }
32
- }
33
- return result;
34
- }
35
-
36
- export { flattenMetaObject as default };
@@ -1,19 +0,0 @@
1
- 'use strict';
2
-
3
- function flattenObject(obj, name = [], result = {}) {
4
- for (const [key, value] of Object.entries(obj)){
5
- const nextName = [
6
- ...name,
7
- key
8
- ].filter(Boolean);
9
- const flatKey = nextName.join('-');
10
- if (value && typeof value === 'object' && !Array.isArray(value)) {
11
- flattenObject(value, nextName, result);
12
- } else {
13
- result[flatKey] = Array.isArray(value) ? value.join(',') : value;
14
- }
15
- }
16
- return result;
17
- }
18
-
19
- module.exports = flattenObject;
@@ -1 +0,0 @@
1
- export default function flattenObject(obj: Record<string, any>, name?: string[], result?: Record<string, any>): Record<string, any>;
@@ -1,17 +0,0 @@
1
- function flattenObject(obj, name = [], result = {}) {
2
- for (const [key, value] of Object.entries(obj)){
3
- const nextName = [
4
- ...name,
5
- key
6
- ].filter(Boolean);
7
- const flatKey = nextName.join('-');
8
- if (value && typeof value === 'object' && !Array.isArray(value)) {
9
- flattenObject(value, nextName, result);
10
- } else {
11
- result[flatKey] = Array.isArray(value) ? value.join(',') : value;
12
- }
13
- }
14
- return result;
15
- }
16
-
17
- export { flattenObject as default };
@@ -1,30 +0,0 @@
1
- 'use strict';
2
-
3
- function generateAt(atRule) {
4
- const generate = (nodes)=>{
5
- let text = nodes.map((comp)=>{
6
- let current = '';
7
- if ('children' in comp) {
8
- const body = generate(comp.children);
9
- current = comp.type === 'group' ? '(' + body + ')' : body;
10
- } else {
11
- const value = comp.type === 'number' ? String(comp.value) + (comp.unit || '') : comp.value;
12
- if ('name' in comp) {
13
- if ('operator' in comp) {
14
- current = '(' + `${comp.name}${comp.operator}${value}` + ')';
15
- } else {
16
- current = '(' + `${comp.name}:${value}` + ')';
17
- }
18
- } else {
19
- current = value;
20
- }
21
- }
22
- return current;
23
- }).filter(Boolean).join(atRule.id === 'layer' ? '.' : ' ');
24
- return text;
25
- };
26
- const result = generate(atRule.nodes);
27
- return '@' + atRule.id + (result ? ' ' + result : '');
28
- }
29
-
30
- module.exports = generateAt;
@@ -1,2 +0,0 @@
1
- import { AtRule } from './parse-at';
2
- export default function generateAt(atRule: AtRule): string;
@@ -1,28 +0,0 @@
1
- function generateAt(atRule) {
2
- const generate = (nodes)=>{
3
- let text = nodes.map((comp)=>{
4
- let current = '';
5
- if ('children' in comp) {
6
- const body = generate(comp.children);
7
- current = comp.type === 'group' ? '(' + body + ')' : body;
8
- } else {
9
- const value = comp.type === 'number' ? String(comp.value) + (comp.unit || '') : comp.value;
10
- if ('name' in comp) {
11
- if ('operator' in comp) {
12
- current = '(' + `${comp.name}${comp.operator}${value}` + ')';
13
- } else {
14
- current = '(' + `${comp.name}:${value}` + ')';
15
- }
16
- } else {
17
- current = value;
18
- }
19
- }
20
- return current;
21
- }).filter(Boolean).join(atRule.id === 'layer' ? '.' : ' ');
22
- return text;
23
- };
24
- const result = generate(atRule.nodes);
25
- return '@' + atRule.id + (result ? ' ' + result : '');
26
- }
27
-
28
- export { generateAt as default };
@@ -1,13 +0,0 @@
1
- 'use strict';
2
-
3
- var create = require('../create.cjs');
4
-
5
- function generateCSS(classes, css = create()) {
6
- let text = '';
7
- css.add(...classes);
8
- text = css.text;
9
- css.remove(...classes);
10
- return text;
11
- }
12
-
13
- module.exports = generateCSS;
@@ -1 +0,0 @@
1
- export default function generateCSS(classes: string[], css?: import("..").MasterCSS): string;
@@ -1,11 +0,0 @@
1
- import createCSS from '../create.mjs';
2
-
3
- function generateCSS(classes, css = createCSS()) {
4
- let text = '';
5
- css.add(...classes);
6
- text = css.text;
7
- css.remove(...classes);
8
- return text;
9
- }
10
-
11
- export { generateCSS as default };
@@ -1,50 +0,0 @@
1
- 'use strict';
2
-
3
- var common = require('../common.cjs');
4
-
5
- const prefixMap = {
6
- 'class': '.',
7
- 'pseudo-class': ':',
8
- 'pseudo-element': '::',
9
- 'attribute': '',
10
- 'combinator': '',
11
- 'id': '#'
12
- };
13
- function generateSelector(nodes, body = '') {
14
- const generate = (node)=>{
15
- if (node.type === 'attribute') return `[${node.value}]`;
16
- if (node.type === 'combinator') return node.value;
17
- const prefix = node.type && prefixMap[node.type] || '';
18
- const base = node.value ? prefix + node.value : '';
19
- if ('children' in node && node.children?.length) {
20
- const childrenText = node.children.map(generate).join('');
21
- return node.value ? base + `(${childrenText})` : base + childrenText;
22
- }
23
- return base;
24
- };
25
- let pre = '';
26
- let current = '';
27
- const groups = [];
28
- const flatNodes = nodes.flatMap((node)=>!('value' in node) && 'children' in node && node.children?.length ? node.children : node);
29
- flatNodes.forEach((node)=>{
30
- if (node.value === ',') {
31
- groups.push(current);
32
- current = '';
33
- } else if (node.value === 'of' && 'children' in node) {
34
- pre += node.children.map(generate).join('');
35
- } else {
36
- current += generate(node);
37
- }
38
- });
39
- if (current) groups.push(current);
40
- if (pre) {
41
- const lastChar = pre.charAt(pre.length - 1);
42
- if (!common.SELECTOR_COMBINATORS.includes(lastChar) && lastChar !== ' ') {
43
- pre += ' ';
44
- }
45
- }
46
- const result = groups.length ? groups.map((text)=>pre + body + text).join(',') : pre + body;
47
- return result;
48
- }
49
-
50
- module.exports = generateSelector;
@@ -1,2 +0,0 @@
1
- import { SelectorNode } from './parse-selector';
2
- export default function generateSelector(nodes: SelectorNode[], body?: string): string;
@@ -1,48 +0,0 @@
1
- import { SELECTOR_COMBINATORS } from '../common.mjs';
2
-
3
- const prefixMap = {
4
- 'class': '.',
5
- 'pseudo-class': ':',
6
- 'pseudo-element': '::',
7
- 'attribute': '',
8
- 'combinator': '',
9
- 'id': '#'
10
- };
11
- function generateSelector(nodes, body = '') {
12
- const generate = (node)=>{
13
- if (node.type === 'attribute') return `[${node.value}]`;
14
- if (node.type === 'combinator') return node.value;
15
- const prefix = node.type && prefixMap[node.type] || '';
16
- const base = node.value ? prefix + node.value : '';
17
- if ('children' in node && node.children?.length) {
18
- const childrenText = node.children.map(generate).join('');
19
- return node.value ? base + `(${childrenText})` : base + childrenText;
20
- }
21
- return base;
22
- };
23
- let pre = '';
24
- let current = '';
25
- const groups = [];
26
- const flatNodes = nodes.flatMap((node)=>!('value' in node) && 'children' in node && node.children?.length ? node.children : node);
27
- flatNodes.forEach((node)=>{
28
- if (node.value === ',') {
29
- groups.push(current);
30
- current = '';
31
- } else if (node.value === 'of' && 'children' in node) {
32
- pre += node.children.map(generate).join('');
33
- } else {
34
- current += generate(node);
35
- }
36
- });
37
- if (current) groups.push(current);
38
- if (pre) {
39
- const lastChar = pre.charAt(pre.length - 1);
40
- if (!SELECTOR_COMBINATORS.includes(lastChar) && lastChar !== ' ') {
41
- pre += ' ';
42
- }
43
- }
44
- const result = groups.length ? groups.map((text)=>pre + body + text).join(',') : pre + body;
45
- return result;
46
- }
47
-
48
- export { generateSelector as default };
@@ -1,9 +0,0 @@
1
- 'use strict';
2
-
3
- function getSingleAtNumberRuleNode(nodes) {
4
- if (nodes.length !== 1) return;
5
- let atNumberRuleNode = nodes[0];
6
- if (atNumberRuleNode.type === 'number') return atNumberRuleNode;
7
- }
8
-
9
- module.exports = getSingleAtNumberRuleNode;
@@ -1,2 +0,0 @@
1
- import { AtRuleNode } from './parse-at';
2
- export default function getSingleAtNumberRuleNode(nodes: AtRuleNode[]): import("./parse-at").AtRuleNumberNode | undefined;
@@ -1,7 +0,0 @@
1
- function getSingleAtNumberRuleNode(nodes) {
2
- if (nodes.length !== 1) return;
3
- let atNumberRuleNode = nodes[0];
4
- if (atNumberRuleNode.type === 'number') return atNumberRuleNode;
5
- }
6
-
7
- export { getSingleAtNumberRuleNode as default };
@@ -1,30 +0,0 @@
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
- module.exports = hexToRgb;
@@ -1 +0,0 @@
1
- export default function hexToRgb(hex: string): (number | undefined)[];
@@ -1,28 +0,0 @@
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 as default };
@@ -1,9 +0,0 @@
1
- 'use strict';
2
-
3
- var rules = require('../config/rules.cjs');
4
-
5
- function isCoreRule(id) {
6
- return Object.hasOwnProperty.call(rules, id);
7
- }
8
-
9
- module.exports = isCoreRule;
@@ -1 +0,0 @@
1
- export default function isCoreRule(id: string): boolean;