aliascss 1.4.2 → 1.4.4

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.
@@ -1,5 +1,6 @@
1
1
  import { compiler as statementMaker } from './returnStatement.js';
2
2
  import config from './config.js';
3
+ import { splitByCommaOutsideParens } from './utils/helper.js';
3
4
  // import mapRawAttributeNames from './utils/browser-helper.js';
4
5
  export default statementMaker;
5
6
  export let classPrinter = {
@@ -93,7 +94,8 @@ export let classPrinter = {
93
94
  split.forEach((each) => {
94
95
  try {
95
96
  const [at, pNv] = each.replace(/\]\[/, ']-[').replace("-", "=").split("=");
96
- const result = returnPnV(pNv.replace(/^\[|\]$/g, '').split(','));
97
+ // const result=returnPnV(pNv.replace(/^\[|\]$/g,'').split(','));
98
+ const result = returnPnV(splitByCommaOutsideParens(pNv.replace(/^\[|\]$/g, '')));
97
99
  kfStatement += ` ${at.replace('@', '').replace(/:/g, ',').replace(/,/g, "%,").replace(/[\[|\]]/g, '')}% {${result ? result : ''}}`;
98
100
  }
99
101
  catch (error) {
@@ -39,6 +39,7 @@ const cssCustomCompilers = Object.assign(Object.assign({}, prebuild), {
39
39
  const val = value.replace(/^\(/, '').replace(/\)$/, '').trim();
40
40
  const stm = `
41
41
  --lightness-1000: 67.0121%;
42
+ --border-color: var(--gray-400,${color('grayRATheme400', custom)});
42
43
  --border-color-disabled: var(--gray-300,${color('grayRATheme300', custom)});
43
44
  --border-color-hover: var(--gray-500,${color('grayRATheme500', custom)});
44
45
  --invalid-color: oklch(from ${color('redRA', custom)} var(--lightness-1000) c h);
@@ -178,7 +179,7 @@ const cssCustomCompilers = Object.assign(Object.assign({}, prebuild), {
178
179
 
179
180
  &:where([data-hovered], [data-pressed]) {
180
181
  --button-background: ${color('accentRATheme200', custom)};
181
- --button-text: var(--tint-1400);
182
+ --button-text: var(--${name}-1400);
182
183
  box-shadow: 0 0 0 1px ${color('accentRATheme200', custom)};
183
184
  }
184
185
  }
@@ -264,27 +265,85 @@ const cssCustomCompilers = Object.assign(Object.assign({}, prebuild), {
264
265
  // });
265
266
  return stm;
266
267
  }
267
- }, 'x-color-scale-tint': {
268
+ }, 'UseColorScale': {
268
269
  type: 'group',
269
- compiler: (value) => {
270
+ compiler: (value, custom) => {
271
+ let name = 'tint';
272
+ const values = value.replace(/^\(|\)$/g, '').split(',');
273
+ if (values.length === 2 && values[1])
274
+ name = values[1];
275
+ if (!values[0])
276
+ return;
270
277
  return `
271
278
 
272
- --tint-100: oklch(from var(--tint) var(--lightness-100) var(--chroma-100) h);
273
- --tint-200: oklch(from var(--tint) var(--lightness-200) var(--chroma-200) h);
274
- --tint-300: oklch(from var(--tint) var(--lightness-300) var(--chroma-300) h);
275
- --tint-400: oklch(from var(--tint) var(--lightness-400) var(--chroma-400) h);
276
- --tint-500: oklch(from var(--tint) var(--lightness-500) var(--chroma-500) h);
277
- --tint-600: oklch(from var(--tint) var(--lightness-600) var(--chroma-600) h);
278
- --tint-700: oklch(from var(--tint) var(--lightness-700) var(--chroma-700) h);
279
- --tint-800: oklch(from var(--tint) var(--lightness-800) var(--chroma-800) h);
280
- --tint-900: oklch(from var(--tint) var(--lightness-900) var(--chroma-900) h);
281
- --tint-1000: oklch(from var(--tint) var(--lightness-1000) var(--chroma-1000) h);
282
- --tint-1100: oklch(from var(--tint) var(--lightness-1100) var(--chroma-1100) h);
283
- --tint-1200: oklch(from var(--tint) var(--lightness-1200) var(--chroma-1200) h);
284
- --tint-1300: oklch(from var(--tint) var(--lightness-1300) var(--chroma-1300) h);
285
- --tint-1400: oklch(from var(--tint) var(--lightness-1400) var(--chroma-1400) h);
286
- --tint-1500: oklch(from var(--tint) var(--lightness-1500) var(--chroma-1500) h);
287
- --tint-1600: oklch(from var(--tint) var(--lightness-1600) var(--chroma-1600) h);
279
+ --${name}:${color(values[0], custom)};
280
+ --lightness-100: 98.1187%;
281
+ --lightness-200: 95.2045%;
282
+ --lightness-300: 91.1434%;
283
+ --lightness-400: 85.1751%;
284
+ --lightness-500: 79.1773%;
285
+ --lightness-600: 72.3297%;
286
+ --lightness-700: 67.0121%;
287
+ --lightness-800: 62.3039%;
288
+ --lightness-900: 57.9699%;
289
+ --lightness-1000: 51.9076%;
290
+ --lightness-1100: 46.9058%;
291
+ --lightness-1200: 41.0821%;
292
+ --lightness-1300: 35.3616%;
293
+ --lightness-1400: 29.6725%;
294
+ --lightness-1500: 24.5366%;
295
+ --lightness-1600: 16.6959%;
296
+ --chroma-100: calc(l * c * 0.5);
297
+ --chroma-200: calc(l * c * 0.6);
298
+ --chroma-300: calc(l * c * 0.7);
299
+ --chroma-400: calc(l * c * 0.8);
300
+ --chroma-500: calc(l * c * 0.9);
301
+ --chroma-600: c;
302
+ --chroma-700: c;
303
+ --chroma-800: c;
304
+ --chroma-900: c;
305
+ --chroma-1000: c;
306
+ --chroma-1100: c;
307
+ --chroma-1200: c;
308
+ --chroma-1300: c;
309
+ --chroma-1400: c;
310
+ --chroma-1500: c;
311
+ --chroma-1600: c;
312
+ @media (prefers-color-scheme: dark) {
313
+ --lightness-100: 29.6725%;
314
+ --lightness-200: 35.3616%;
315
+ --lightness-300: 41.0821%;
316
+ --lightness-400: 46.9058%;
317
+ --lightness-500: 51.9076%;
318
+ --lightness-600: 57.9699%;
319
+ --lightness-700: 56.1347%;
320
+ --lightness-800: 59.2866%;
321
+ --lightness-900: 62.3039%;
322
+ --lightness-1000: 67.0121%;
323
+ --lightness-1100: 72.3297%;
324
+ --lightness-1200: 79.1773%;
325
+ --lightness-1300: 85.1751%;
326
+ --lightness-1400: 91.1434%;
327
+ --lightness-1500: 95.2045%;
328
+ --lightness-1600: 100%;
329
+ }
330
+
331
+ --${name}-100: oklch(from var(--${name}) var(--lightness-100) var(--chroma-100) h);
332
+ --${name}-200: oklch(from var(--${name}) var(--lightness-200) var(--chroma-200) h);
333
+ --${name}-300: oklch(from var(--${name}) var(--lightness-300) var(--chroma-300) h);
334
+ --${name}-400: oklch(from var(--${name}) var(--lightness-400) var(--chroma-400) h);
335
+ --${name}-500: oklch(from var(--${name}) var(--lightness-500) var(--chroma-500) h);
336
+ --${name}-600: oklch(from var(--${name}) var(--lightness-600) var(--chroma-600) h);
337
+ --${name}-700: oklch(from var(--${name}) var(--lightness-700) var(--chroma-700) h);
338
+ --${name}-800: oklch(from var(--${name}) var(--lightness-800) var(--chroma-800) h);
339
+ --${name}-900: oklch(from var(--${name}) var(--lightness-900) var(--chroma-900) h);
340
+ --${name}-1000: oklch(from var(--${name}) var(--lightness-1000) var(--chroma-1000) h);
341
+ --${name}-1100: oklch(from var(--${name}) var(--lightness-1100) var(--chroma-1100) h);
342
+ --${name}-1200: oklch(from var(--${name}) var(--lightness-1200) var(--chroma-1200) h);
343
+ --${name}-1300: oklch(from var(--${name}) var(--lightness-1300) var(--chroma-1300) h);
344
+ --${name}-1400: oklch(from var(--${name}) var(--lightness-1400) var(--chroma-1400) h);
345
+ --${name}-1500: oklch(from var(--${name}) var(--lightness-1500) var(--chroma-1500) h);
346
+ --${name}-1600: oklch(from var(--${name}) var(--lightness-1600) var(--chroma-1600) h);
288
347
 
289
348
  `;
290
349
  }
@@ -388,7 +447,7 @@ const cssCustomCompilers = Object.assign(Object.assign({}, prebuild), {
388
447
  });
389
448
  return stm;
390
449
  }
391
- }, 'theme': {
450
+ }, 'Theme': {
392
451
  type: 'group',
393
452
  compiler: (value, custom) => {
394
453
  const values = value.replace(/^\(|\)$/g, '').split(',');
@@ -9,6 +9,7 @@ import postcssDiscardDuplicates from 'postcss-discard-duplicates';
9
9
  import cssnano from 'cssnano';
10
10
  import chokidar from 'chokidar';
11
11
  import sortMediaQueries from 'postcss-sort-media-queries';
12
+ import { splitByCommaOutsideParens } from '../utils/helper.js';
12
13
  const init = {
13
14
  classList: [], // hold className for MasterCSS to avoid repeating
14
15
  groups: [],
@@ -133,7 +134,8 @@ export function keyframesStatement(name, timeLine, statementMaker) {
133
134
  split.forEach((each) => {
134
135
  try {
135
136
  const [at, pNv] = each.replace(/\]\[/, ']-[').replace("-", "=").split("=");
136
- kfStatement += ` ${at.replace('@', '').replace(/:/g, ',').replace(/,/g, "%,").replace(/[\[|\]]/g, '')}% {${returnPnV(pNv.replace(/^\[|\]$/g, '').split(','))}}`;
137
+ // kfStatement+=` ${at.replace('@','').replace(/:/g,',').replace(/,/g,"%,").replace(/[\[|\]]/g,'')}% {${returnPnV(pNv.replace(/^\[|\]$/g,'').split(','))}}`
138
+ kfStatement += ` ${at.replace('@', '').replace(/:/g, ',').replace(/,/g, "%,").replace(/[\[|\]]/g, '')}% {${returnPnV(splitByCommaOutsideParens(pNv.replace(/^\[|\]$/g, '')))}}`;
137
139
  }
138
140
  catch (error) {
139
141
  console.error('Not a valid entry for AliasCSS keyframes processor : ' + each, error);
package/lib/prebuild.js CHANGED
@@ -19,7 +19,7 @@ export default {
19
19
  'x-absolute-right': {
20
20
  type: 'statement',
21
21
  statement: `tp-transform tdu-0.35s ttf(cubic-bezier(0.16,1,0.3,1))_ will-change-transform
22
- pa btm-0 t-0 w-220px r-0 [class~=x-absolute-hide]-tf-tx-100% [data-absolute-hide]-tf-tx-100%
22
+ pa btm-0 t-0 r-0 [class~=x-absolute-hide]-tf-tx-100% [data-absolute-hide]-tf-tx-100%
23
23
  `
24
24
  },
25
25
  'x-absolute-left': {
@@ -214,7 +214,7 @@ export default {
214
214
  },
215
215
  'x-arrow': {
216
216
  type: 'statement',
217
- 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`,
217
+ statement: `[bss,bc--x-arrow-color:black,brw--x-arrow-width:3px,bbw--x-arrow-width:3px,dib,p-3px,btw-0px,blw-0px] [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`,
218
218
  },
219
219
  // CSS entities
220
220
  // 'x-currency-dollar' :{type:'statement',statement:'--bf-cont_0024'
@@ -28,7 +28,7 @@ export default function extractMediaPrefix(className, prefix, match, bool = fals
28
28
  }
29
29
  }
30
30
  else {
31
- medias.push('@' + e + '::::' + 'Custom');
31
+ medias.push('@' + e.replace(/_/g, ' ').replace(/[(]/g, ' (').replace(/[)]/g, ') ') + '::::' + 'Custom');
32
32
  }
33
33
  });
34
34
  if (medias.length) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aliascss",
3
- "version": "1.4.2",
3
+ "version": "1.4.4",
4
4
  "description": "AliasCSS is a CSS post processor.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",