aliascss 1.2.4 → 1.3.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.
package/lib/prebuild.js CHANGED
@@ -189,38 +189,6 @@ export default {
189
189
  [transform-tx--100p,l0,t0,zi-1]--as-x-screen-left
190
190
  [transform-tx-100p,r0,t0,zi-1]--as-x-screen-right `
191
191
  },
192
- // Box-and-button
193
- 'x-section': {
194
- type: 'statement',
195
- statement: `w--x-section-width:100p p--x-section-padding:20px [class~=x-section-spacious]--x-section-padding:80px height--x-section-height:auto`,
196
- },
197
- 'x-container': {
198
- type: 'statement',
199
- statement: `width-100p mla mra pl--x-container-padding:15px pl--x-container-padding:15px bsbb xw--x-container-width:initial
200
- [class~=x-container-fluid][--x-container-width:100%,m-0-auto]
201
- [class~=x-container-narrow][--x-container-width:800px]`,
202
- },
203
- 'x-row': {
204
- type: 'statement',
205
- statement: `df fww g-16px m--8px __all-margin-8px i__all-flex-1 [class~=x-row-no-wrap]-fwn [class~=x-row-center]-jcc`,
206
- },
207
- 'x-col': {
208
- type: 'statement',
209
- statement: `df fww g-16px m--8px __all-margin-8px i__all-flex-1 [class~=x-col-no-wrap]-fwn [class~=x-col-center]-jcc
210
- [class~=x-col-full][flex-grow:1]`,
211
- },
212
- 'x-box': {
213
- type: 'statement',
214
- statement: `bgc--x-box-bg:ffffff p--x-box-padding:16px br--x-box-border-radius:8px border--x-box-border:1px-solid-e0e0e0
215
- [class~=x-box-shadow]-bxs-0px-2px-8px-0000000000d1`,
216
- },
217
- 'x-card': {
218
- type: 'statement',
219
- statement: `bgc--x-card-bg:ffffff padding--x-card-padding:24px br--x-card-border-radius:12px bxs--x-card-shadow:0px-4px-12px-0000000000d1
220
- [class~=x-card-interactive][--hover-transform-translateY--4px,--hover-bxs-0-8px-24px-0000000000d15]
221
- transition-transform-0.3s-ease__box-shadow-0.3s-ease
222
- [class~=x-card-dark][--x-card-bg:1a1a1a,--x-card-shadow:0px-4px-12px-0000000000d3,color--x-card-color:ffffff]`,
223
- },
224
192
  'x-divider-text': {
225
193
  type: 'statement',
226
194
  statement: `[df,aic,g12px]
@@ -236,36 +204,41 @@ export default {
236
204
  },
237
205
  'x-button': {
238
206
  type: 'statement',
239
- statement: `dib aic jcc cp tdn tn-all-0d3s
240
- c--x-button-color:ffffff
241
- p--x-button-padding:8px-16px
242
- fs--x-button-font-size:16px
243
- br--x-button-border-radius:4px
244
- b--x-button-border:2px-solid--border-color
245
- --x-button-border-color:transparent
246
- bg--x-button-bg:gray-600
247
- --hover-opacity-0d9
248
- --hover-transform-translateY--1px
249
- --active-transform-translateY-0px
250
-
251
- [class~=x-button-primary][--x-button-bg:primary600,--x-button-soft-bg:primary100,--x-button-color:ffffff]
252
- [class~=x-button-success][--x-button-bg:success600,--x-button-soft-bg:success100,--x-button-color:ffffff]
253
- [class~=x-button-error][--x-button-bg:error600,--x-button-soft-bg:error100,--x-button-color:ffffff]
254
- [class~=x-button-warning][--x-button-bg:warning600,--x-button-soft-bg:warning100,--x-button-color:ffffff]
255
-
256
- [disabled]-bg-cccccc
257
- [disabled]-color-666666
258
- [disabled]-opacity-0.7
259
- [disabled]-cursor-not-allowed
260
-
261
- [class~=x-button-sm][--x-button-padding:6px-12px,--x-button-font-size:14px]
262
- [class~=x-button-lg][--x-button-padding:12px-24px,--x-button-font-size:18px]
263
- [class~=x-button-outline][bg-transparent,--x-button-color:--x-button-bg:gray-600,--border-color:--x-button-color,--hover-bg--x-button-color:gray-600,--hover-color-ffffff]
264
- [class~=x-button-text][bgc-transparent,--x-button-border:none,--hover-bg--x-button-soft-bg:gray100,--x-button-color:--x-button-bg:gray600,--x-button-padding:4px-8px]`,
207
+ statement: `@base-all-unset @base[-bsbb,usn,dif,aic,jcc,fw5,--ring-width:2px,tac,flex-shrink-0]
208
+ @base-[class~=x-button-size-xs][br-4px,p-0px-8px,fs-12px,h-24px,lh-16px,g-4px]
209
+ @base-[class~=x-button-size-sm][br-4px,p-0px-12px,fs-14px,h-32px,lh-20px,g-8px]
210
+ @base-[br-4px,p-0px-15px,fs-15px,lh-1,fw5,h-35px]
211
+ @base-[class~=x-button-size-md][br-4px,p-0px-15px,fs-15px,lh-1,fw5,h-35px]
212
+ @base-[class~=x-button-size-lg][br-6px,p-0px-16px,fs-16px,h-40px,lh-24px,g-12px]
213
+ @base-[class~=x-button-size-xl][br-6px,p-0px-24px,fs-18px,h-48px,lh-26px,g-14px]
214
+ [disabled][pen,bgc-gray-300,c-gray-400]
215
+ @base-[bgc-gray-600,c-gray-50,--ho-bgc-gray-700,--fo-ring-gray-300]
216
+ @base-[class~=x-button-success][bgc-success-600,c-success-100,--ho-bgc-success-700,--fo-ring-success-300]
217
+ @base-[class~=x-button-error][bgc-error-600,c-error-100,--ho-bgc-error-700,--fo-ring-error-300]
218
+ @base-[class~=x-button-warning][bgc-warning-600,c-warning-100,--ho-bgc-warning-700,--fo-ring-warning-300]
219
+ @base-[class~=x-button-primary][bgc-primary-600,c-primary-100,--ho-bgc-primary-700,--fo-ring-primary-300]
220
+ `
221
+ },
222
+ 'x-input': {
223
+ type: 'statement',
224
+ statement: `@base-all-unset @base-[bsbb,w-100p,df,aic,jcfs,fw4,--ring-width:1px,flex-1-0-auto]
225
+ @base-[br-6px,p-0px-14px,fs-16px,h-40px,lh-24px,g-12px]
226
+ @base-[class~=x-input-size-sm][br-4px,p-0px-10px,fs-15px,h-35px,lh-1,g-8px]
227
+ @base-[class~=x-input-size-xs][br-4px,p-0px-8px,fs-12px,h-26px,lh-1,g-4px]
228
+ @base-[class~=x-input-size-md][br-6px,p-0px-14px,fs-16px,h-40px,lh-24px,g-12px]
229
+ @base-[class~=x-input-size-lg][br-6px,p-0px-18px,fs-18px,h-48px,lh-26px,g-14px]
230
+ [disabled][pen,bgc-gray-300,c-gray-400,bn]
231
+ @base-[b-1px-s-gray-400,c-gray-600,--ho-c-gray-700,--fo-ring-gray-200]
232
+ @base-[class~=x-input-size-md][b-1px-s-gray-400,c-gray-600,--ho-c-gray-700,--fo-ring-gray-200]
233
+
234
+ @base-[class~=x-input-success][b-1px-s-success-600,--fo-ring-success-200]
235
+ @base-[class~=x-input-error][b-1px-s-error-600,--fo-ring-error-200]
236
+ @base-[class~=x-input-warning][b-1px-s-warning-600,--fo-ring-warning-200]
237
+ @base-[class~=x-input-primary][b-1px-s-primary-600,--fo-ring-primary-200] `
265
238
  },
266
239
  'x-arrow': {
267
240
  type: 'statement',
268
- statement: `[bss,bc--x-arrow-color:black,bw-0px-3px-3px-0,dib,p-3px] [class~=x-arrow-left]-tf-r-135deg [class~=x-arrow-up]-tf-r--135deg [class~=x-arrow-right]-tf-r--45deg [class~=x-arrow-down]-tf-r-45deg`,
241
+ statement: `[bss,bc--x-arrow-color:black,brw--x-arrow-width:3px,bbw--x-arrow-width:3px,dib,p-3px] [class~=x-arrow-left]-tf-r-135deg [class~=x-arrow-up]-tf-r--135deg [class~=x-arrow-right]-tf-r--45deg [class~=x-arrow-down]-tf-r-45deg`,
269
242
  },
270
243
  // CSS entities
271
244
  'x-currency-dollar': { type: 'statement', statement: '--bf-cont_0024'
@@ -278,57 +251,11 @@ export default {
278
251
  },
279
252
  'x-currency-yen': { type: 'statement', statement: '--bf-cont_00A5'
280
253
  },
281
- 'x-currency-latin-f': { type: 'statement', statement: '--bf-cont_0192' /* Florin */
282
- },
283
- 'x-currency-armenian-dram': { type: 'statement', statement: '--bf-cont_058F'
284
- },
285
- 'x-currency-afghani': { type: 'statement', statement: '--bf-cont_060B'
286
- },
287
- 'x-currency-bengali-mark': { type: 'statement', statement: '--bf-cont_09F2'
288
- },
289
- 'x-currency-bengali-sign': { type: 'statement', statement: '--bf-cont_09F3'
290
- },
291
- 'x-currency-gujarati-sign': { type: 'statement', statement: '--bf-cont_0AF1'
292
- },
293
- 'x-currency-tamil-sign': { type: 'statement', statement: '--bf-cont_0BF9'
294
- },
295
- 'x-currency-thai-baht': { type: 'statement', statement: '--bf-cont_0E3F'
296
- },
297
- 'x-currency-khmer-riel': { type: 'statement', statement: '--bf-cont_17DB',
298
- },
299
- 'x-currency-rial': { type: 'statement', statement: '--bf-cont_FDFC'
300
- },
301
- 'x-currency-wancho-ngun': { type: 'statement', statement: '--bf-cont_1E2FF',
302
- },
303
254
  'x-currency-euro-currency': { type: 'statement', statement: '--bf-cont_20A0', /* Historical ECU */
304
255
  },
305
256
  'x-currency-euro': { type: 'statement', statement: '--bf-cont_20AC',
306
257
  },
307
- 'x-currency-franc': { type: 'statement', statement: '--bf-cont_20A3',
308
- },
309
- 'x-currency-lira': { type: 'statement', statement: '--bf-cont_20A4',
310
- },
311
- 'x-currency-naira': { type: 'statement', statement: '--bf-cont_20A6',
312
- },
313
- 'x-currency-rupee': { type: 'statement', statement: '--bf-cont_20B9',
314
- },
315
- 'x-currency-peso': { type: 'statement', statement: '--bf-cont_20B1',
316
- },
317
- 'x-currency-shekel': { type: 'statement', statement: '--bf-cont_20AA',
318
- },
319
- 'x-currency-won': { type: 'statement', statement: '--bf-cont_20A9',
320
- },
321
- 'x-currency-tugrik': { type: 'statement', statement: '--bf-cont_20AE',
322
- },
323
- 'x-currency-drachma': { type: 'statement', statement: '--bf-cont_20AF',
324
- },
325
- 'x-currency-kip': { type: 'statement', statement: '--bf-cont_20AD',
326
- },
327
- 'x-currency-guarani': { type: 'statement', statement: '--bf-cont_20B2',
328
- },
329
- 'x-currency-hryvnia': { type: 'statement', statement: '--bf-cont_20B4',
330
- },
331
- 'x-currency-cedi': { type: 'statement', statement: '--bf-cont_20B5', },
258
+ 'x-currency-rupee': { type: 'statement', statement: '--bf-cont_20B9', },
332
259
  'x-symbol-copy-right': { type: 'statement', statement: '--bf-cont_00A9', },
333
260
  'x-symbol-registered': { type: 'statement', statement: '--bf-cont_00AE', },
334
261
  'x-symbol-divide': { type: 'statement', statement: '--bf-cont_00Ff7', },
@@ -344,7 +271,7 @@ export default {
344
271
  'x-menu': {
345
272
  type: 'statement',
346
273
  statement: `pr x-menu-rounded cp
347
- w-35px h-30px bg-lg-transparent_0px_12d5px-currentColor_12d5px_17d5px-transparent_17d5px_35px
274
+ w-35px h-30px bg-lg-transparent_0px_12d5px-currentColor_12d5px_17d5px-transparent_17d5px_35px
348
275
  tn-all-0d5s [class~=x-menu-open]-bg-none
349
276
  [x-menu-open]-bg-none
350
277
  --af[pa,t0,h-5px,w-35px,bgc-currentColor,cont]
@@ -428,20 +355,14 @@ export default {
428
355
  [background-color-warning-600,dark-background-color-warning-600]--as-bg-warning-solid
429
356
  [background-color-success-100,dark-background-color-success-600]--as-bg-success-primary
430
357
  [background-color-success-600,dark-background-color-success-600]--as-bg-success-solid
431
-
432
-
433
-
434
-
435
-
436
-
437
358
  `,
438
359
  },
439
360
  'x-acss-vars-dark': {
440
361
  type: 'statement',
441
362
  statement: `
442
- --text-primary:--gray-50
443
- --text-secondary:--gray-200
444
- --text-disabled:--gray-400
445
- `,
363
+ --text-primary:--gray-50
364
+ --text-secondary:--gray-200
365
+ --text-disabled:--gray-400
366
+ `,
446
367
  },
447
368
  };
@@ -1,3 +1,3 @@
1
1
  export default function extractMediaPrefix(className: string, prefix: {
2
2
  [key: string]: string;
3
- }, match: RegExp, bool?: boolean): [string, string];
3
+ }, match: RegExp, bool?: boolean): [string[], string];
@@ -1,12 +1,36 @@
1
1
  export default function extractMediaPrefix(className, prefix, match, bool = false) {
2
- var _a;
2
+ var _a, _b, _c;
3
+ const medias = [];
4
+ let cls = className;
5
+ const matchNestedMedia = /@\[(.*?)]/;
6
+ // case 1. single media
3
7
  if (className.match(match)) {
4
8
  const prefixMedia = (_a = className.match(match)) === null || _a === void 0 ? void 0 : _a[0];
5
9
  if (prefixMedia) {
6
10
  if (prefix.hasOwnProperty(prefixMedia)) {
7
- return [prefix[prefixMedia], className.replace(prefixMedia, '')];
11
+ medias.push(prefix[prefixMedia]);
12
+ cls = className.replace(prefixMedia, '');
13
+ // return [[], ]
8
14
  }
9
15
  }
10
16
  }
11
- return ['', className];
17
+ else if (className.match(matchNestedMedia)) { // Nested Media Selector
18
+ (_c = (_b = className.match(matchNestedMedia)) === null || _b === void 0 ? void 0 : _b[1]) === null || _c === void 0 ? void 0 : _c.split(',').map((e) => {
19
+ var _a, _b;
20
+ const suffixedMatch = e + "-";
21
+ if (suffixedMatch.match(match) || ("@" + suffixedMatch).match(match)) {
22
+ const prefixMedia = ((_a = suffixedMatch.match(match)) === null || _a === void 0 ? void 0 : _a[0]) || ((_b = ('@' + suffixedMatch).match(match)) === null || _b === void 0 ? void 0 : _b[0]);
23
+ if (prefixMedia) {
24
+ if (prefix.hasOwnProperty(prefixMedia)) {
25
+ medias.push(prefix[prefixMedia]);
26
+ // return [[], ]
27
+ }
28
+ }
29
+ }
30
+ });
31
+ if (medias.length) {
32
+ cls = className.replace(matchNestedMedia, '');
33
+ }
34
+ }
35
+ return [medias, cls];
12
36
  }
@@ -3,7 +3,16 @@ const media = {
3
3
  test: new RegExp("^(" + "print|xs|sm|md|lg|xl|xxl|-xs|-sm|-md|-lg|-xl|-xxl|-2xl" + ")(?=[-|_])"),
4
4
  target: {
5
5
  print: '@media print',
6
+ '@hover': '@media screen and (hover: hover)',
6
7
  '@print': '@media print',
8
+ '@landscape': '@media (orientation: landscape)',
9
+ '@portrait': '@media (orientation: portrait)',
10
+ '@container-xs': '@container (max-width : 576px)',
11
+ '@container-sm': '@container (min-width : 576px)',
12
+ '@container-md': '@container (min-width : 768px)',
13
+ '@container-lg': '@container (min-width : 992px)',
14
+ '@container-xl': '@container (min-width : 1200px)',
15
+ '@container-2xl': '@container (min-width : 1408px)',
7
16
  xs: '@media (max-width : 576px)',
8
17
  '@xs': '@media (max-width : 576px)',
9
18
  sm: '@media (min-width : 576px)',
@@ -14,8 +23,8 @@ const media = {
14
23
  '@lg': '@media (min-width : 992px)',
15
24
  xl: '@media (min-width : 1200px)',
16
25
  '@xl': '@media (min-width : 1200px)',
17
- xxl: '@media (min-width : 1408px)',
18
- '@xxl': '@media (min-width : 1408px)',
26
+ // xxl: '@media (min-width : 1408px)',
27
+ '@2xl': '@media (min-width : 1408px)',
19
28
  '2xl': '@media (min-width : 1408px)',
20
29
  '-xs': '@media (min-width : 576px)',
21
30
  '-@xs': '@media (min-width : 576px)',
@@ -27,8 +36,8 @@ const media = {
27
36
  '-lg': '@media (max-width : 992px)',
28
37
  '-@xl': '@media (max-width : 1200px)',
29
38
  '-xl': '@media (max-width : 1200px)',
30
- '-@xxl': '@media (max-width : 1408px)',
31
- '-xxl': '@media (max-width : 1408px)',
39
+ // '-@xxl': '@media (max-width : 1408px)',
40
+ // '-xxl': '@media (max-width : 1408px)',
32
41
  '-@2xl': '@media (max-width : 1408px)',
33
42
  '-2xl': '@media (max-width : 1408px)',
34
43
  'dark': '@media (prefers-color-scheme: dark)',
@@ -41,6 +50,8 @@ const media = {
41
50
  '@comps': '@layer components',
42
51
  '@utils': '@layer utilities',
43
52
  '@utilities': '@layer utilities',
53
+ '@starting-style': '@starting-style',
54
+ '@ss': '@starting-style',
44
55
  },
45
56
  };
46
57
  export function createRegexForMedia(prefix) {
@@ -107,9 +107,20 @@ bool = false) {
107
107
  }
108
108
  }
109
109
  const valuePortion = className.replace(propertyKey, '');
110
+ // New Update function value
111
+ if (/^\(.*\)[_]?$/.test(valuePortion)) {
112
+ if (valuePortion.match(/_$/)) {
113
+ const val = valuePortion.replace(/[(_)]/g, '').replace(/,/g, ' ');
114
+ return bool ? [prop, val] : prop + ":" + val;
115
+ }
116
+ else {
117
+ const val = valuePortion.replace(/[(_)]/g, '').replace(/,/g, ', ');
118
+ return bool ? [prop, val] : prop + ":" + val;
119
+ }
120
+ }
110
121
  // case 3: calc function
111
- if (/^--calc\(/.test(valuePortion)) {
112
- return bool ? [prop, valuePortion.replace(/^--/, '').replace(/([-+/*])([\d]|var\(|calc\()/g, ' $1 $2')] : prop + ":" + valuePortion.replace(/^--/, '').replace(/([-+/*])([\d]|var\(|calc\()/g, ' $1 $2');
122
+ if (/^-calc\(/.test(valuePortion)) {
123
+ return bool ? [prop, valuePortion.replace(/^-/, '').replace(/([-+/*])([\d]|var\(|calc\()/g, ' $1 $2')] : prop + ":" + valuePortion.replace(/^-/, '').replace(/([-+/*])([\d]|var\(|calc\()/g, ' $1 $2');
113
124
  }
114
125
  // case 4: CSS variable without --var keyword
115
126
  if (/^--[a-zA-Z]/.test(valuePortion)) {
@@ -3,6 +3,7 @@ import { customStaticClassNames } from "./static/customStaticClassNames.js";
3
3
  import media, { createRegexForMedia } from "./prefix/responsive.js";
4
4
  import { customColors } from './static/customColors.js';
5
5
  import { customColors as customColors2 } from './static/customColors2.js';
6
+ import { customColorsRadix } from './static/customColorsRadix.js';
6
7
  import extractPrefix from './prefix/extractPrefix.js';
7
8
  import extractMediaPrefix from './prefix/extractMediaPrefix.js';
8
9
  import { createCompilerObj, extractProperty } from "./utils/createCompilerObj.js";
@@ -17,7 +18,7 @@ const [staticClassNamesWithAlias, cssPropsWithAlias] = createCompilerObj(cssProp
17
18
  export const compiler = {
18
19
  // cache will cache propertyAndValue
19
20
  cache: { propertyAndValue: Object.assign({}, customStaticClassNames) },
20
- custom: Object.assign({ colors: Object.assign(Object.assign({}, customColors), customColors2) }),
21
+ custom: Object.assign({ colors: Object.assign(Object.assign(Object.assign({}, customColors), customColors2), customColorsRadix) }),
21
22
  mediaSelector: Object.assign({}, media.target),
22
23
  mediaTest: null,
23
24
  staticClassNames: Object.assign(Object.assign({}, staticClassNamesAlias), staticClassNamesWithAlias),
@@ -83,8 +84,10 @@ export const compiler = {
83
84
  if (!this.mediaTest)
84
85
  this.mediaTest = createRegexForMedia(this.mediaSelector);
85
86
  // 1. check and extract Media prefix and return className with prefix treatment,
86
- let [media, workingClassName] = extractMediaPrefix(unPrefixedClassName, this.mediaSelector, this.mediaTest);
87
- media = media;
87
+ let [extractedMedia, workingClassName] = extractMediaPrefix(unPrefixedClassName, this.mediaSelector, this.mediaTest);
88
+ const mediaEX = extractedMedia;
89
+ // lint escape for const
90
+ extractedMedia = extractedMedia;
88
91
  // 2. search for '&' which tells us to use selector before or after className
89
92
  if (workingClassName.match(/[&]/)) {
90
93
  const [before, after] = workingClassName.split('&');
@@ -154,8 +157,13 @@ export const compiler = {
154
157
  if (bool === true)
155
158
  return result;
156
159
  this.cache.propertyAndValue[pnv] = result;
157
- if (media) {
158
- stm = `${media}{${beforeClassNameSelector + '.' + className + elementAndPseudo}{${result}${important}}}`;
160
+ if (mediaEX.length) {
161
+ let [bf, af] = ['', ''];
162
+ mediaEX.map((e) => {
163
+ bf = bf + e + "{ ";
164
+ af = af + "}";
165
+ });
166
+ stm = `${bf}${beforeClassNameSelector + '.' + className + elementAndPseudo}{${result}${important}}${af}`;
159
167
  }
160
168
  else {
161
169
  stm = `${beforeClassNameSelector}.${className}${elementAndPseudo}{${result}${important}}`;
@@ -169,7 +177,7 @@ export const compiler = {
169
177
  }
170
178
  }
171
179
  else {
172
- console.log(`Unable to process ${className} [media:${media},pseudoSelector:${elementAndPseudo},imp:${important}]`);
180
+ console.log(`Unable to process ${className} [media:${mediaEX},pseudoSelector:${elementAndPseudo},imp:${important}]`);
173
181
  }
174
182
  },
175
183
  group(str, as) {