aliascss 1.4.5 → 1.5.0

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 (75) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/bin/aliascss.js +118 -1
  3. package/dist/aliascss.js +1 -1
  4. package/lib/classPrinter.js +347 -21
  5. package/lib/compilers/color.js +5 -5
  6. package/lib/compilers/gradient.js +3 -3
  7. package/lib/compilers/stringAndContent.js +2 -1
  8. package/lib/component-elements.d.ts +155 -0
  9. package/lib/component-elements.js +223 -0
  10. package/lib/config.d.ts +2 -0
  11. package/lib/config.js +3 -1
  12. package/lib/css-properties-all.js +337 -202
  13. package/lib/custom-css-compilers.js +49 -116
  14. package/lib/extras-elements.d.ts +87 -0
  15. package/lib/extras-elements.js +184 -0
  16. package/lib/form-elements.d.ts +75 -0
  17. package/lib/form-elements.js +186 -0
  18. package/lib/layout-elements.d.ts +59 -0
  19. package/lib/layout-elements.js +113 -0
  20. package/lib/nav-elements.d.ts +71 -0
  21. package/lib/nav-elements.js +243 -0
  22. package/lib/node/compileFile-BK-291026.d.ts +27 -0
  23. package/lib/node/compileFile-BK-291026.js +309 -0
  24. package/lib/node/compileFile-bk.d.ts +14 -12
  25. package/lib/node/compileFile-bk.js +263 -252
  26. package/lib/node/compileFile.js +1 -1
  27. package/lib/node/extractClassNamesFromFile.js +208 -86
  28. package/lib/prebuild.d.ts +546 -12
  29. package/lib/prebuild.js +3 -852
  30. package/lib/prefix/PseudoPrefixNew.js +301 -16
  31. package/lib/prefix/attribute-selector.js +4 -2
  32. package/lib/prefix/element-selector.js +93 -20
  33. package/lib/prefix/extractPrefix.d.ts +1 -1
  34. package/lib/prefix/extractPrefix.js +113 -70
  35. package/lib/prefix/pseudoSelectorNew.js +184 -49
  36. package/lib/prefix/responsive.d.ts +13 -9
  37. package/lib/prefix/responsive.js +131 -9
  38. package/lib/returnPropertyAndValue.js +9 -4
  39. package/lib/returnStatement-bk-291026.d.ts +5 -0
  40. package/lib/returnStatement-bk-291026.js +470 -0
  41. package/lib/returnStatement-bk.d.ts +5 -0
  42. package/lib/returnStatement-bk.js +311 -0
  43. package/lib/returnStatement.d.ts +1 -0
  44. package/lib/returnStatement.js +262 -12
  45. package/lib/static/customStaticClassNames.js +35 -35
  46. package/lib/static/staticClassNamesAlias.js +18 -16
  47. package/lib/table-elements.d.ts +39 -0
  48. package/lib/table-elements.js +90 -0
  49. package/lib/utils/helper.d.ts +6 -0
  50. package/lib/utils/helper.js +52 -0
  51. package/lib/x-classes/x-bundle.d.ts +589 -0
  52. package/lib/x-classes/x-bundle.js +12 -0
  53. package/lib/x-classes/x-comps.d.ts +87 -0
  54. package/lib/x-classes/x-comps.js +189 -0
  55. package/lib/x-classes/x-extras.d.ts +155 -0
  56. package/lib/x-classes/x-extras.js +223 -0
  57. package/lib/x-classes/x-form-components.d.ts +75 -0
  58. package/lib/x-classes/x-form-components.js +186 -0
  59. package/lib/x-classes/x-helper-components.d.ts +63 -0
  60. package/lib/x-classes/x-helper-components.js +91 -0
  61. package/lib/x-classes/x-layout-components.d.ts +59 -0
  62. package/lib/x-classes/x-layout-components.js +113 -0
  63. package/lib/x-classes/x-menu.d.ts +23 -0
  64. package/lib/x-classes/x-menu.js +55 -0
  65. package/lib/x-classes/x-navs.d.ts +71 -0
  66. package/lib/x-classes/x-navs.js +243 -0
  67. package/lib/x-classes/x-row-col.d.ts +29 -0
  68. package/lib/x-classes/x-row-col.js +52 -0
  69. package/lib/x-classes/x-table.d.ts +39 -0
  70. package/lib/x-classes/x-table.js +90 -0
  71. package/lib/x-classes/x-theme.d.ts +15 -0
  72. package/lib/x-classes/x-theme.js +32 -0
  73. package/lib/x-imports.d.ts +31 -0
  74. package/lib/x-imports.js +748 -0
  75. package/package.json +1 -1
@@ -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
+ };