aliascss 1.4.4 → 1.4.7

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 (63) hide show
  1. package/aliascss.config.js +32 -32
  2. package/dist/aliascss.js +1 -1
  3. package/lib/compilers/color.js +5 -5
  4. package/lib/compilers/gradient.js +3 -3
  5. package/lib/compilers/stringAndContent.js +2 -1
  6. package/lib/component-elements.d.ts +155 -0
  7. package/lib/component-elements.js +223 -0
  8. package/lib/config.d.ts +1 -0
  9. package/lib/config.js +2 -1
  10. package/lib/css-properties-all.js +337 -202
  11. package/lib/custom-css-compilers.js +54 -54
  12. package/lib/extras-elements.d.ts +87 -0
  13. package/lib/extras-elements.js +184 -0
  14. package/lib/form-elements.d.ts +75 -0
  15. package/lib/form-elements.js +186 -0
  16. package/lib/layout-elements.d.ts +59 -0
  17. package/lib/layout-elements.js +113 -0
  18. package/lib/nav-elements.d.ts +71 -0
  19. package/lib/nav-elements.js +243 -0
  20. package/lib/node/compileFile-bk.d.ts +27 -0
  21. package/lib/node/compileFile-bk.js +379 -0
  22. package/lib/node/compileFile.d.ts +11 -11
  23. package/lib/node/compileFile.js +170 -235
  24. package/lib/prebuild.d.ts +520 -12
  25. package/lib/prebuild.js +9 -852
  26. package/lib/prefix/PseudoPrefixNew.js +301 -16
  27. package/lib/prefix/attribute-selector.js +4 -2
  28. package/lib/prefix/pseudoSelectorNew.js +184 -49
  29. package/lib/prefix/responsive.d.ts +13 -9
  30. package/lib/prefix/responsive.js +131 -9
  31. package/lib/returnPropertyAndValue.js +9 -4
  32. package/lib/returnStatement-bk.d.ts +5 -0
  33. package/lib/returnStatement-bk.js +311 -0
  34. package/lib/returnStatement.js +165 -2
  35. package/lib/static/customStaticClassNames.js +35 -35
  36. package/lib/static/staticClassNamesAlias.js +18 -16
  37. package/lib/table-elements.d.ts +39 -0
  38. package/lib/table-elements.js +90 -0
  39. package/lib/utils/helper.d.ts +6 -0
  40. package/lib/utils/helper.js +52 -0
  41. package/lib/x-classes/x-bundle.d.ts +563 -0
  42. package/lib/x-classes/x-bundle.js +11 -0
  43. package/lib/x-classes/x-comps.d.ts +87 -0
  44. package/lib/x-classes/x-comps.js +189 -0
  45. package/lib/x-classes/x-extras.d.ts +155 -0
  46. package/lib/x-classes/x-extras.js +223 -0
  47. package/lib/x-classes/x-form-components.d.ts +75 -0
  48. package/lib/x-classes/x-form-components.js +186 -0
  49. package/lib/x-classes/x-helper-components.d.ts +63 -0
  50. package/lib/x-classes/x-helper-components.js +91 -0
  51. package/lib/x-classes/x-layout-components.d.ts +59 -0
  52. package/lib/x-classes/x-layout-components.js +113 -0
  53. package/lib/x-classes/x-menu.d.ts +23 -0
  54. package/lib/x-classes/x-menu.js +55 -0
  55. package/lib/x-classes/x-navs.d.ts +71 -0
  56. package/lib/x-classes/x-navs.js +243 -0
  57. package/lib/x-classes/x-table.d.ts +39 -0
  58. package/lib/x-classes/x-table.js +90 -0
  59. package/lib/x-classes/x-theme.d.ts +15 -0
  60. package/lib/x-classes/x-theme.js +32 -0
  61. package/lib/x-imports.d.ts +31 -0
  62. package/lib/x-imports.js +748 -0
  63. package/package.json +1 -1
@@ -1,10 +1,14 @@
1
- declare const media: {
2
- [key: string]: any;
3
- target: {
4
- [key: string]: string;
5
- };
6
- };
7
- export declare function createRegexForMedia(prefix: {
8
- [key: string]: string;
9
- }): RegExp;
1
+ export type MediaTarget = Record<string, string>;
2
+ export interface MediaConfig {
3
+ test: RegExp;
4
+ target: MediaTarget;
5
+ }
6
+ /**
7
+ * Builds the scope-prefix regex from a prefix map.
8
+ * - Keys are escaped, so custom prefixes may contain regex characters.
9
+ * - Keys are sorted longest first, so matching does not depend on object order.
10
+ * - An empty map returns a regex that never matches instead of throwing.
11
+ */
12
+ export declare function createRegexForMedia(prefix: MediaTarget): RegExp;
13
+ declare const media: MediaConfig;
10
14
  export default media;
@@ -1,62 +1,184 @@
1
+ const target = {
2
+ print: '@media print',
3
+ '@print': '@media print',
4
+ '@hover-capable': '@media screen and (hover: hover)',
5
+ '@landscape': '@media (orientation: landscape)',
6
+ '@portrait': '@media (orientation: portrait)',
7
+ // xs uses .99 to match the @xs media breakpoint and avoid 1px overlap with -sm.
8
+ '@container-xs': '@container (max-width: 575.99px)',
9
+ '@container-sm': '@container (min-width: 576px)',
10
+ '@container-md': '@container (min-width: 768px)',
11
+ '@container-lg': '@container (min-width: 992px)',
12
+ '@container-xl': '@container (min-width: 1200px)',
13
+ '@container-xxl': '@container (min-width: 1408px)',
14
+ '@forced-color-active': '@media (forced-colors: active)',
15
+ '@fca': '@media (forced-colors: active)',
16
+ '@standalone': '@media (display-mode: standalone)',
17
+ '@browser': '@media (display-mode: browser)',
18
+ '@short-height': '@media (max-height: 600px)',
19
+ '@xsh': '@media (max-height: 600px)',
20
+ '@p3': '@media (color-gamut: p3)',
21
+ '@motion-reduce': '@media (prefers-reduced-motion: reduce)',
22
+ '@mouse': '@media (hover: hover) and (pointer: fine)',
23
+ '@touch': '@media (hover: none) and (pointer: coarse)',
24
+ '@resolution-lg': '@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi)',
25
+ '@resolution-xl': '@media (-webkit-min-device-pixel-ratio: 3), (min-resolution: 288dpi)',
26
+ '@contrast-more': '@media (prefers-contrast: more)',
27
+ '@data-reduce': '@media (prefers-reduced-data: reduce)',
28
+ xs: '@media (max-width: 575.99px)',
29
+ '@xs': '@media (max-width: 575.99px)',
30
+ // NOTE: bare `sm` collides with the `sm` (scroll-margin) property alias:
31
+ // `sm-10px` is read as a media scope. Prefer `@sm` in authored classes.
32
+ sm: '@media (min-width: 576px)',
33
+ '@sm': '@media (min-width: 576px)',
34
+ md: '@media (min-width: 768px)',
35
+ '@md': '@media (min-width: 768px)',
36
+ lg: '@media (min-width: 992px)',
37
+ '@lg': '@media (min-width: 992px)',
38
+ xl: '@media (min-width: 1200px)',
39
+ '@xl': '@media (min-width: 1200px)',
40
+ xxl: '@media (min-width: 1408px)',
41
+ '@xxl': '@media (min-width: 1408px)',
42
+ dark: '@media (prefers-color-scheme: dark)',
43
+ '@dark': '@media (prefers-color-scheme: dark)',
44
+ light: '@media (prefers-color-scheme: light)',
45
+ '@light': '@media (prefers-color-scheme: light)',
46
+ '@theme': '@layer theme',
47
+ '@base': '@layer base',
48
+ '@reset': '@layer reset',
49
+ '@rs': '@layer reset',
50
+ '@components': '@layer components',
51
+ '@comps': '@layer components',
52
+ '@utils': '@layer utilities',
53
+ '@utilities': '@layer utilities',
54
+ '@starting-style': '@starting-style',
55
+ '@ss': '@starting-style',
56
+ };
57
+ const escapeRegExp = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
58
+ // A scope ends where the selector/state (`-`, `--`, `_`) or a group (`[`) begins.
59
+ const SCOPE_BOUNDARY = '(?=[-_\\[])';
60
+ // Matches nothing; used when no prefixes are configured.
61
+ const NEVER = /(?!)/;
62
+ /**
63
+ * Builds the scope-prefix regex from a prefix map.
64
+ * - Keys are escaped, so custom prefixes may contain regex characters.
65
+ * - Keys are sorted longest first, so matching does not depend on object order.
66
+ * - An empty map returns a regex that never matches instead of throwing.
67
+ */
68
+ export function createRegexForMedia(prefix) {
69
+ const keys = Object.keys(prefix);
70
+ if (keys.length === 0)
71
+ return NEVER;
72
+ const alternation = keys
73
+ .sort((a, b) => b.length - a.length)
74
+ .map(escapeRegExp)
75
+ .join('|');
76
+ return new RegExp(`^(${alternation})${SCOPE_BOUNDARY}`);
77
+ }
1
78
  const media = {
79
+ test: createRegexForMedia(target),
80
+ target,
81
+ };
82
+ export default media;
83
+ /*
84
+ const media :{
85
+ [key:string]:any,
86
+ target:
87
+ {[key:string]:string
88
+ }
89
+ }
90
+ = {
2
91
  // test:/^(print|xs|sm|md|lg|xl|xxl|-xs|-sm|-md|-lg|-xl|-xxl|-2xl)(?=[-|_])/,
3
- test: new RegExp("^(" + "print|xs|sm|md|lg|xl|xxl|-xs|-sm|-md|-lg|-xl|-xxl|-2xl" + ")(?=[-|_])"),
4
- target: {
92
+ test:new RegExp("^("+"print|xs|sm|md|lg|xl|xxl|-xs|-sm|-md|-lg|-xl|-xxl|-2xl"+")(?=[-|_])"),
93
+ target:{
5
94
  print: '@media print',
6
95
  '@print': '@media print',
96
+
7
97
  '@hover-capable': '@media screen and (hover: hover)',
98
+
8
99
  '@landscape': '@media (orientation: landscape)',
9
100
  '@portrait': '@media (orientation: portrait)',
101
+
10
102
  '@container-xs': '@container (max-width: 576px)',
11
103
  '@container-sm': '@container (min-width: 576px)',
12
104
  '@container-md': '@container (min-width: 768px)',
13
105
  '@container-lg': '@container (min-width: 992px)',
14
106
  '@container-xl': '@container (min-width: 1200px)',
15
107
  '@container-xxl': '@container (min-width: 1408px)',
108
+
16
109
  '@forced-color-active': '@media (forced-colors: active)',
17
110
  '@fca': '@media (forced-colors: active)',
111
+
18
112
  '@standalone': '@media (display-mode: standalone)',
19
113
  '@browser': '@media (display-mode: browser)',
114
+
20
115
  '@short-height': '@media (max-height: 600px)',
21
116
  '@xsh': '@media (max-height: 600px)',
117
+
22
118
  '@p3': '@media (color-gamut: p3)',
119
+
23
120
  '@motion-reduce': '@media (prefers-reduced-motion: reduce)',
121
+
24
122
  '@mouse': '@media (hover: hover) and (pointer: fine)',
25
123
  '@touch': '@media (hover: none) and (pointer: coarse)',
26
- '@resolution-lg': '@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi)',
27
- '@resolution-xl': '@media (-webkit-min-device-pixel-ratio: 3), (min-resolution: 288dpi)',
124
+
125
+ '@resolution-lg':
126
+ '@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi)',
127
+
128
+ '@resolution-xl':
129
+ '@media (-webkit-min-device-pixel-ratio: 3), (min-resolution: 288dpi)',
130
+
28
131
  '@contrast-more': '@media (prefers-contrast: more)',
29
132
  '@data-reduce': '@media (prefers-reduced-data: reduce)',
133
+
30
134
  xs: '@media (max-width: 575.99px)',
31
135
  '@xs': '@media (max-width: 575.99px)',
136
+
32
137
  sm: '@media (min-width: 576px)',
33
138
  '@sm': '@media (min-width: 576px)',
139
+
34
140
  md: '@media (min-width: 768px)',
35
141
  '@md': '@media (min-width: 768px)',
142
+
36
143
  lg: '@media (min-width: 992px)',
37
144
  '@lg': '@media (min-width: 992px)',
145
+
38
146
  xl: '@media (min-width: 1200px)',
39
147
  '@xl': '@media (min-width: 1200px)',
148
+
40
149
  xxl: '@media (min-width: 1408px)',
41
150
  '@xxl': '@media (min-width: 1408px)',
151
+
42
152
  dark: '@media (prefers-color-scheme: dark)',
43
153
  '@dark': '@media (prefers-color-scheme: dark)',
154
+
44
155
  light: '@media (prefers-color-scheme: light)',
45
156
  '@light': '@media (prefers-color-scheme: light)',
157
+
46
158
  '@theme': '@layer theme',
47
159
  '@base': '@layer base',
160
+
48
161
  '@reset': '@layer reset',
49
162
  '@rs': '@layer reset',
163
+
50
164
  '@components': '@layer components',
51
165
  '@comps': '@layer components',
166
+
52
167
  '@utils': '@layer utilities',
53
168
  '@utilities': '@layer utilities',
169
+
54
170
  '@starting-style': '@starting-style',
55
171
  '@ss': '@starting-style'
56
- },
57
- };
58
- export function createRegexForMedia(prefix) {
59
- const prefixAlias = Object.keys(prefix).reduce((previous, current) => previous + "|" + current);
60
- return new RegExp("^(" + prefixAlias + ")(?=[-|_])");
172
+ },
173
+
174
+ }
175
+
176
+ export function createRegexForMedia(prefix:{[key:string]:string
177
+ }){
178
+ const prefixAlias= Object.keys(prefix).reduce((previous,current)=>previous+"|"+current);
179
+ return new RegExp("^("+prefixAlias+")(?=[-|_])");
61
180
  }
181
+
62
182
  export default media;
183
+
184
+ */
@@ -42,8 +42,11 @@ bool = false) {
42
42
  else {
43
43
  const val = value.replace(/(?<!var\()(--[\w-]+)/g, 'var($1)')
44
44
  .replace(/^[(]/, '').replace(/[)]$/, '')
45
- .replace(/,/g, ' ');
46
- value = val.replace(/_/g, ' ');
45
+ // .replace(/,/g,' ');
46
+ .replace(/,/g, ', ');
47
+ // value=val.replace(/_/g,' ');
48
+ value = val.replace(/\\_|_/g, (m) => (m === '_' ? ' ' : '_'));
49
+ ;
47
50
  }
48
51
  return bool ? [property, value] : property + ":" + value;
49
52
  }
@@ -140,8 +143,10 @@ bool = false) {
140
143
  else {
141
144
  const val = valuePortion.replace(/(?<!var\()(--[\w-]+)/g, 'var($1)')
142
145
  .replace(/^[(]/, '').replace(/[)]$/, '')
143
- .replace(/,/g, ' ')
144
- .replace(/[_]/g, ' ');
146
+ // .replace(/,/g,' ')
147
+ .replace(/,/g, ', ')
148
+ // .replace(/[_]/g,' ');
149
+ .replace(/\\_|_/g, (m) => (m === '_' ? ' ' : '_'));
145
150
  return bool ? [prop, val] : prop + ":" + val;
146
151
  }
147
152
  }
@@ -0,0 +1,5 @@
1
+ export declare const compiler: {
2
+ make: (a: string, b?: string, c?: boolean) => string;
3
+ group: (a: string, b: string) => string;
4
+ [key: string]: any;
5
+ };
@@ -0,0 +1,311 @@
1
+ import getPropertyAndValue from "./returnPropertyAndValue.js";
2
+ import { customStaticClassNames } from "./static/customStaticClassNames.js";
3
+ import media, { createRegexForMedia } from "./prefix/responsive.js";
4
+ import { customColors } from './static/customColors.js';
5
+ import { customColorsRa } from './static/customColorsRA.js';
6
+ // import {customColors as customColors2} from './static/customColors2.js'
7
+ import { customColorsRadixUi } from './static/customColorsRadix.js';
8
+ import extractPrefix from './prefix/extractPrefix.js';
9
+ import extractMediaPrefix from './prefix/extractMediaPrefix.js';
10
+ import { createCompilerObj, extractProperty } from "./utils/createCompilerObj.js";
11
+ import config from "./config.js";
12
+ import cssProps from "./css-properties-all.js";
13
+ import { staticClassNamesAlias } from "./static/staticClassNamesAlias.js";
14
+ import postcss from "postcss";
15
+ import { splitByCommaOutsideParens } from "./utils/helper.js";
16
+ import cssCustomCompilers from "./custom-css-compilers.js";
17
+ // import customGroups from './prebuild.js';
18
+ const [staticClassNamesWithAlias, cssPropsWithAlias] = createCompilerObj(cssProps, config.globalValues);
19
+ export const compiler = {
20
+ // cache will cache propertyAndValue
21
+ cache: { propertyAndValue: Object.assign({}, customStaticClassNames) },
22
+ // custom:{...{colors:{...customColors,...customColors2,...customColorsRadix}}},
23
+ custom: Object.assign({ colors: Object.assign(Object.assign(Object.assign({}, customColors), customColorsRadixUi), customColorsRa) }),
24
+ mediaSelector: Object.assign({}, media.target),
25
+ mediaTest: null,
26
+ staticClassNames: Object.assign(Object.assign({}, staticClassNamesAlias), staticClassNamesWithAlias),
27
+ cssProps: Object.assign(Object.assign({}, cssPropsWithAlias), cssCustomCompilers),
28
+ prefix: null,
29
+ rawCSS: null,
30
+ customGroupStatement: null,
31
+ extend(data) {
32
+ Object.keys(data).forEach((key) => {
33
+ if (data[key].hasOwnProperty('extend')) {
34
+ if (cssProps.hasOwnProperty(data[key].extend)) {
35
+ Object.keys(cssProps[data[key].extend]).forEach((each) => {
36
+ if (each === 'values') {
37
+ data[key].values = [...cssProps[data[key].extend].values || [], ...data[key].values || []];
38
+ }
39
+ else if (each === 'compiler') {
40
+ data[key].compiler = cssProps[data[key].extend].compiler;
41
+ }
42
+ });
43
+ }
44
+ }
45
+ });
46
+ const [staticClassNames, compiler] = createCompilerObj(data, config.globalValues);
47
+ this.cssProps = Object.assign(Object.assign({}, this.cssProps), compiler);
48
+ this.staticClassNames = Object.assign(Object.assign({}, this.staticClassNames), staticClassNames);
49
+ },
50
+ // className as another-name, bool->only return property and value
51
+ make(className, as, bool) {
52
+ var _a;
53
+ // --Group Statement
54
+ if (this.cssProps.hasOwnProperty(className)) {
55
+ if (this.cssProps[className].hasOwnProperty('type') && (this.cssProps[className].type === 'statement')) {
56
+ return this.group(this.cssProps[className].statement, className);
57
+ }
58
+ if (this.cssProps[className].hasOwnProperty('type') && (this.cssProps[className].type === 'raw')) {
59
+ return this.cssProps[className].statement;
60
+ }
61
+ }
62
+ if (/--as-[a-zA-Z0-9-_]+$/.test(className)) {
63
+ const asMatch = (_a = className.match(/--as-([a-zA-Z0-9-_]+)$/)) !== null && _a !== void 0 ? _a : [null, null];
64
+ if (asMatch[0] && asMatch[1]) {
65
+ return this.group(className.replace(asMatch[0], ''), asMatch[1]);
66
+ }
67
+ }
68
+ let unPrefixedClassName = className;
69
+ // check for [group-acss,]
70
+ const matchGroupCSS = className.match(/\[([^[]*)\]$/);
71
+ if (matchGroupCSS) {
72
+ const asString = splitByCommaOutsideParens(matchGroupCSS[1])
73
+ // .split(',')
74
+ .map(e => (className.replace(matchGroupCSS[0], '') + "-").replace(/--$/, '-') + e.replace(/^--/, '-'))
75
+ .join(' ');
76
+ return this.group(asString, as ? as : className);
77
+ }
78
+ //
79
+ let beforeClassNameSelector = '';
80
+ if (this.prefix && !className.match(new RegExp('^' + this.prefix + "[-]"))) {
81
+ return null;
82
+ }
83
+ else if (this.prefix) {
84
+ unPrefixedClassName = className.replace(new RegExp('^' + this.prefix + "[-]"), '');
85
+ }
86
+ if (!this.mediaTest)
87
+ this.mediaTest = createRegexForMedia(this.mediaSelector);
88
+ // 1. check and extract Media prefix and return className with prefix treatment,
89
+ let [extractedMedia, workingClassName] = extractMediaPrefix(unPrefixedClassName, this.mediaSelector, this.mediaTest);
90
+ const mediaEX = extractedMedia;
91
+ // lint escape for const
92
+ extractedMedia = extractedMedia;
93
+ // 2. search for '&' which tells us to use selector before or after className
94
+ if (workingClassName.match(/[&]/)) {
95
+ const [before, after] = workingClassName.split('&');
96
+ beforeClassNameSelector = extractPrefix(before + "-display-none")[0] + " ";
97
+ if (!beforeClassNameSelector.trim()) {
98
+ console.error('Not a valid AliasCSS className:' + className, 'Make sure to provide valid css aliascss selector before "&" identifier');
99
+ return null;
100
+ }
101
+ else {
102
+ beforeClassNameSelector = beforeClassNameSelector.replace(/^([\s]?[+~>])(.*)/, "$2$1 ");
103
+ }
104
+ workingClassName = workingClassName.replace(before, '').replace('&', '');
105
+ }
106
+ let [elementAndPseudo, important] = ['', ''];
107
+ // workingClassName=workingClassName.replace(/[_][\.]([a-zA-Z])/g,(s,e)=>"_"+'ACSS').replace(/[.]/g,"d").replace(/[%]/g,'p')
108
+ // 3. Process --important flag
109
+ if (/(-i|--important)$/.test(className)) {
110
+ important = ' !important';
111
+ workingClassName = workingClassName.replace(/(-i|--important)$/, '');
112
+ }
113
+ // 4. process Pseudo State
114
+ const prefixPseudoElementAttribute = extractPrefix(workingClassName);
115
+ workingClassName = prefixPseudoElementAttribute[1];
116
+ elementAndPseudo = prefixPseudoElementAttribute[0];
117
+ // ---------------------------------------------------------------------
118
+ const pnv = workingClassName.replace(/^-([a-zA-Z])/, '$1');
119
+ let result = '';
120
+ // x-class
121
+ // if(/^(x-width|x-height)/.test(pnv)){
122
+ // const extract=getPropertyAndValue(pnv.replace('x-',''), this.cssProps, this.staticClassNames, this.custom,extractProperty);
123
+ // if(typeof extract === 'string'){
124
+ // const [p,v]=extract.split(':');
125
+ // if(p && v){
126
+ // result=`${p}:calc(${v} + var(--x-${p}-grow,0px) - var(--x-${p}-shrink,0px));`
127
+ // }
128
+ // }
129
+ // }else
130
+ if (this.cache.propertyAndValue.hasOwnProperty(pnv)) {
131
+ result = this.cache.propertyAndValue[pnv];
132
+ }
133
+ else {
134
+ try {
135
+ result = getPropertyAndValue(pnv, this.cssProps, this.staticClassNames, this.custom, extractProperty);
136
+ }
137
+ catch (error) {
138
+ console.log(error);
139
+ }
140
+ }
141
+ // if(result){
142
+ // className=className.replace(/([$.&%=\]\[@~:*#+\(\)\/^])/g,'\\$1');
143
+ // if(bool===true) return result;
144
+ // this.cache.propertyAndValue[pnv]=result;
145
+ // if(media){
146
+ // return `${media}{${
147
+ // beforeClassNameSelector+'.'+(as?as:className)+ elementAndPseudo
148
+ // }{${result}${important}}}`;
149
+ // }else{
150
+ // return `${beforeClassNameSelector}.${(as?as:className)}${elementAndPseudo}{${result}${important}}`;
151
+ // }
152
+ // }else{
153
+ // console.log(`Unable to process ${className} [media:${media},pseudoSelector:${elementAndPseudo},imp:${important}]`)
154
+ // }
155
+ // ------------PostCSSParse
156
+ if (result) {
157
+ let stm = '';
158
+ className = (as ? as : className).replace(/([$.&%=\]\[@~,:*#+\(\)\/^/</>])/g, '\\$1');
159
+ if (bool === true)
160
+ return result;
161
+ this.cache.propertyAndValue[pnv] = result;
162
+ if (mediaEX.length) {
163
+ let [bf, af] = ['', ''];
164
+ mediaEX.map((e) => {
165
+ const mediaQuery = e.split('::::')[0];
166
+ const mediaPrefix = e.split('::::')[1].replace(/^@/, '');
167
+ if (['xs', 'sm', 'md', 'lg', 'xl', 'xxl'].indexOf(mediaPrefix) !== -1) {
168
+ bf = bf + `@layer ${mediaPrefix}{ ${mediaQuery} {`;
169
+ af = af + "}}";
170
+ }
171
+ else {
172
+ bf = bf + mediaQuery + "{ ";
173
+ af = af + "}";
174
+ }
175
+ });
176
+ stm = `${bf}${beforeClassNameSelector + '.' + className + elementAndPseudo}{${result}${important}}${af}`;
177
+ }
178
+ else {
179
+ stm = `${beforeClassNameSelector}.${className}${elementAndPseudo}{${result}${important}}`;
180
+ }
181
+ try {
182
+ postcss.parse(stm);
183
+ return stm;
184
+ }
185
+ catch (error) {
186
+ console.log('Not a Valid CSS Statement, PostCSS Parse:', stm);
187
+ }
188
+ }
189
+ else {
190
+ console.log(`Unable to process ${className} [media:${mediaEX},pseudoSelector:${elementAndPseudo},imp:${important}]`);
191
+ }
192
+ },
193
+ // groupSingle(str:string, as:string){
194
+ // let pnv='';
195
+ // },
196
+ group(str, as) {
197
+ let statement = '';
198
+ [...str.trim().split(/\s+/)].forEach((e) => {
199
+ const getEachClassNameCompiled = this.make(e, as);
200
+ if (getEachClassNameCompiled)
201
+ statement += getEachClassNameCompiled + ' \n';
202
+ });
203
+ return statement;
204
+ },
205
+ groupMulti(str, as) {
206
+ let statement = '.' + as + '{\n';
207
+ [...str.trim().split(/\s+/)].forEach((e) => {
208
+ const getEachClassNameCompiled = this.make(e, as, true);
209
+ if (getEachClassNameCompiled)
210
+ statement += getEachClassNameCompiled + '; \n';
211
+ });
212
+ return statement + '}';
213
+ },
214
+ prebuild(a, b) {
215
+ if (typeof a === 'object') {
216
+ for (const key in a) {
217
+ if (a.hasOwnProperty(key))
218
+ this.cache.propertyAndValue[key] = a[key];
219
+ }
220
+ }
221
+ else {
222
+ if (a && b) {
223
+ this.cache.propertyAndValue[a] = b;
224
+ }
225
+ }
226
+ },
227
+ groupForJs(str, bool) {
228
+ if (!str.trim())
229
+ return '';
230
+ const jsStyle = {};
231
+ const list = str.trim().split(/\s+/);
232
+ list.forEach((e) => {
233
+ let pNv = '';
234
+ if (this.cache.propertyAndValue.hasOwnProperty(e)) {
235
+ pNv = this.cache.propertyAndValue[e];
236
+ }
237
+ else {
238
+ pNv = getPropertyAndValue(e, this.cssProps, this.staticClassNames, this.custom, extractProperty);
239
+ if (pNv)
240
+ this.cache.propertyAndValue[e] = pNv;
241
+ }
242
+ if (!pNv)
243
+ return '';
244
+ const result = pNv.split(':');
245
+ if (result.length === 2) {
246
+ const key = result[0].replace(/-([a-z])/g, (e, a) => {
247
+ return a.toUpperCase();
248
+ });
249
+ let value = bool === true ? result[1].replace(/px$/g, '') : result[1];
250
+ if (typeof value === 'string' && value.trim().match(/^[\d\.]+$/)) {
251
+ value = parseFloat(value.toString());
252
+ }
253
+ jsStyle[key] = value;
254
+ }
255
+ });
256
+ return jsStyle;
257
+ },
258
+ // obj:{'container':'p20px m-12pxx, 'section':'mt16px'}
259
+ groupObj(obj) {
260
+ if (typeof obj !== 'object')
261
+ return false;
262
+ let statement = '';
263
+ for (const key in obj) {
264
+ if (obj.hasOwnProperty(key)) {
265
+ const result = this.group(obj[key], key);
266
+ if (result) {
267
+ statement += result + '\n';
268
+ }
269
+ }
270
+ }
271
+ return statement;
272
+ },
273
+ addCustom(name, obj) {
274
+ name = (name === 'color' ? 'colors' : name);
275
+ if (typeof obj === 'object') {
276
+ if (!this.custom[name])
277
+ this.custom[name] = {};
278
+ for (const key in obj) {
279
+ if (obj.hasOwnProperty(key))
280
+ this.custom[name][key] = obj[key];
281
+ }
282
+ }
283
+ },
284
+ addMedia(obj) {
285
+ this.mediaSelector = Object.assign(Object.assign({}, this.mediaSelector), obj);
286
+ },
287
+ addPseudo(obj) {
288
+ // this.mediaSelector={...this.mediaSelector,...obj}
289
+ },
290
+ // styleToAliascss(value:string,bool:boolean){
291
+ // let classValue='';
292
+ // let styleValue='';
293
+ // value.split(/\s*;\s*/).forEach((each)=>{
294
+ // const [property,value]=each.match(/:/)?each.split(':'):['',''];
295
+ // if(property && value){
296
+ // if(cssProps.hasOwnProperty(property.trim())){
297
+ // classValue+=`${(bool===true && cssProps[property.trim()].alias)?cssProps[property.trim()].alias:property}-${
298
+ // value.trim().replace(/['"]/g, '').replace(/#/g, '').replace(/\((^\()\)/g, (m,s)=>'-'+s.replace(/[\s]*,[\s]*/g,'-'))
299
+ // .replace(/\s/g, '-').replace(/^var---/g,'-').replace(/-var-/g,'')
300
+ // }`
301
+ // }else{
302
+ // styleValue+=each+'; ';
303
+ // }
304
+ // }else {
305
+ // styleValue+=each+'; ';
306
+ // }
307
+ // })
308
+ // }
309
+ };
310
+ // compiler.staticClassNames={...helper().generateStaticClassNames(compiler.cssProps,config['css-global-values'])};
311
+ // compiler.addCustom('color',customColors)