aliascss 1.3.4 → 1.3.6

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,24 +1,43 @@
1
1
  // custom.color will be provided {primary:'#2d3f3e....}
2
2
  export default function color(color, custom) {
3
+ // check for alpha
4
+ let alpha = null;
5
+ if (color.match(/\/[1-9]$/)) {
6
+ alpha = "0." + color.slice(-1);
7
+ color = color.replace(/\/[1-9]$/, '');
8
+ }
3
9
  // ----check for css variables
4
- if (color.match(/^--[a-zA-Z]/))
10
+ if (color.match(/^--[a-zA-Z]/)) {
11
+ if (alpha !== null)
12
+ return `oklch(from var(${color}) l c h/${alpha} )`;
5
13
  return `var(${color})`;
14
+ }
6
15
  // remove - before the color
7
16
  color = color.replace(/^[-]/, '');
8
17
  // custom-color
9
18
  if (custom.hasOwnProperty('colors') && typeof custom.colors === 'object') {
10
- if (custom.colors.hasOwnProperty(color))
19
+ if (custom.colors.hasOwnProperty(color)) {
20
+ if (alpha !== null)
21
+ return `oklch(from ${custom.colors[color]} l c h/${alpha} )`;
11
22
  return custom.colors[color];
23
+ }
12
24
  // custom-color try replacing -
13
- if (custom.colors.hasOwnProperty(color.replace(/-/g, '')))
25
+ if (custom.colors.hasOwnProperty(color.replace(/-/g, ''))) {
26
+ if (alpha !== null)
27
+ return `oklch(from ${color.replace(/-/g, '')} l c h/${alpha} )`;
14
28
  return custom.colors[color.replace(/-/g, '')];
29
+ }
15
30
  }
16
31
  // hexadecimal =+ alpha 00-ff
17
32
  if (/^[0-9a-fA-F]{3,8}$/.test(color)) {
33
+ if (alpha !== null)
34
+ return `oklch(from #${color} l c h/${alpha} )`;
18
35
  return `#${color}`;
19
36
  // Name
20
37
  }
21
38
  else if (/^[a-zA-Z]+$/.test(color)) {
39
+ if (alpha !== null)
40
+ return `oklch(from ${color} l c h/${alpha} )`;
22
41
  return color;
23
42
  // rgb/a in number
24
43
  }
package/lib/config.d.ts CHANGED
@@ -18,5 +18,6 @@ declare const config: {
18
18
  remUnitsNegative: string[];
19
19
  widths: string[];
20
20
  modes: string[];
21
+ makeStaticGlobalValues?: (a: string, b: string) => string[];
21
22
  };
22
23
  export default config;
package/lib/config.js CHANGED
@@ -14,6 +14,8 @@ const config = {
14
14
  createExtractorRegex: (fname) => new RegExp('(?:' + fname + ')' + "[\\s*]?(`|\\([" + `"'])` + "([^'`" + '"]+)' + "(`|" + `["']` + "\\))"),
15
15
  createCSSModuleRegex: (fname) => new RegExp("(?:" + fname + ")\\[[`'" + '"]([^`"' + "']+)(?:[`'" + '"]\\])'),
16
16
  globalValues: ['initial:ini', 'inherit:in', 'unset:un', 'revert:re', 'revert-layer:rl'],
17
+ // makeStaticGlobalValues:(property:string,alias?:string)=>{
18
+ // },
17
19
  styles: ['dotted:d', 'dashed:da', 'solid:s', 'double:db', 'groove:g', 'ridge:ri', 'inset:i', 'outset:o', 'none:n', 'hidden:h'],
18
20
  widths: ['medium:m', 'thin:t', 'thick:th:t2'],
19
21
  remUnits: [`${1 / 4}rem:1`,
@@ -54,7 +54,7 @@ const cssProps = {
54
54
  alias: 'accent',
55
55
  type: 'd',
56
56
  compiler: color,
57
- values: [],
57
+ values: ['auto:a'],
58
58
  },
59
59
  'align-content': {
60
60
  alias: 'ac',
@@ -193,7 +193,7 @@ const cssProps = {
193
193
  compiler: (value) => value.replace(/-/g, ' ').replace(/([\d])[p][\s]/, '$1% ').replace(/([\d])[p]$/, '$1%'),
194
194
  },
195
195
  'appearance': {
196
- alias: 'a2',
196
+ alias: 'ap',
197
197
  type: 's',
198
198
  compiler: (value) => value.replace(/^-/, '').replace(/moz/, '-moz'),
199
199
  values: ['none:n', 'auto:a', 'menulist-button:mb', 'textfield:t:tf'],
@@ -246,7 +246,7 @@ const cssProps = {
246
246
  values: ['normal:nl', 'multiply:m', 'screen:s', 'overlay:o', 'darken:d', 'lighten:l', 'color-dodge:cd', 'saturation:sa|s2', 'color:c', 'luminosity:lu:l2'],
247
247
  },
248
248
  'background-clip': {
249
- alias: 'bgc2',
249
+ alias: 'bgcl',
250
250
  type: 's',
251
251
  compiler: (value) => value.replace(/^-/, '').replace(/(-|__)/g, ', ').replace(/,[\s]b/g, '-b'),
252
252
  values: ['border-box:bb', 'padding-box:pb', 'content-box:cb'],
@@ -798,7 +798,7 @@ const cssProps = {
798
798
  alias: '',
799
799
  type: 's',
800
800
  // compiler:'',
801
- values: ['normal:n', 'dark:d', 'light dark:light-dark:ld', 'only light:only-light:ol']
801
+ values: ['normal:n', 'dark:d', 'only dark:only-dark:od:o-d', 'light dark:light-dark:l-d:ld', 'only light:only-light:o-l:ol', 'light:l']
802
802
  },
803
803
  'column-count': {
804
804
  alias: 'cc',
@@ -943,7 +943,7 @@ const cssProps = {
943
943
  values: ['none:n'],
944
944
  },
945
945
  'cursor': {
946
- alias: 'cu',
946
+ alias: 'cur',
947
947
  type: '',
948
948
  // compiler:'',
949
949
  values: ['alias:al', 'all-scroll:as', 'auto:a', 'cell:c', 'col-resize:cr', 'context-menu:cm', 'copy:cp',
@@ -989,7 +989,7 @@ const cssProps = {
989
989
  values: ['none:n', 'invert():invert:i', 'sepia():sepia:se', 'grayscale():grayscale:gs'],
990
990
  },
991
991
  'flex': {
992
- alias: '',
992
+ alias: 'fx',
993
993
  type: 'd',
994
994
  compiler: length,
995
995
  values: ['none:n'],
@@ -1007,7 +1007,7 @@ const cssProps = {
1007
1007
  values: ['row:r', 'row-reverse:rr', 'column:c', 'column-reverse:cr'],
1008
1008
  },
1009
1009
  'flex-flow': {
1010
- alias: '',
1010
+ alias: 'ffl',
1011
1011
  type: 'd',
1012
1012
  compiler: (value) => value.replace(/[-](w|n)/, " $1"),
1013
1013
  values: [''],
@@ -1019,13 +1019,13 @@ const cssProps = {
1019
1019
  values: [''],
1020
1020
  },
1021
1021
  'flex-shrink': {
1022
- alias: '',
1022
+ alias: 'fsk',
1023
1023
  type: 'd',
1024
1024
  compiler: length,
1025
1025
  values: [''],
1026
1026
  },
1027
1027
  'flex-wrap': {
1028
- alias: '',
1028
+ alias: 'fwp',
1029
1029
  type: 's',
1030
1030
  // compiler:'',
1031
1031
  values: ['nowrap:nw:n', 'wrap:w', 'wrap-reverse:wr'],
@@ -1085,7 +1085,7 @@ const cssProps = {
1085
1085
  values: ['ultra-condensed:uc', 'extra-condensed:ec', 'condensed:c', 'semi-condensed:sc', 'normal:nl', 'semi-expanded:se', 'expanded:e', 'extra-expanded:ee', 'ultra-expanded:ue'],
1086
1086
  },
1087
1087
  'font-style': {
1088
- alias: '', // --
1088
+ alias: 'fst', // --
1089
1089
  type: 's',
1090
1090
  // compiler:'',
1091
1091
  values: ['normal:nl', 'italic:i', 'oblique:o'],
@@ -2014,7 +2014,7 @@ const cssProps = {
2014
2014
  values: [''],
2015
2015
  },
2016
2016
  'place-items': {
2017
- alias: '',
2017
+ alias: 'pli',
2018
2018
  type: 'd',
2019
2019
  compiler: (value) => {
2020
2020
  const m = /[-]?(start|end|flex-start|flex-end|self-start|self-end|normal|center|baseline|first|last|auto|right|left|legacy|stretch|safe|unsafe)/g;
@@ -2299,7 +2299,7 @@ const cssProps = {
2299
2299
  values: [],
2300
2300
  },
2301
2301
  'shape-outside': {
2302
- alias: 'so',
2302
+ alias: '',
2303
2303
  type: 'd',
2304
2304
  compiler: clipPath,
2305
2305
  values: ['none:n', 'margin-box:mb', 'border-box:bb', 'padding-box:pb', 'content-box:cb'],
@@ -2443,7 +2443,7 @@ const cssProps = {
2443
2443
  values: ['none:n']
2444
2444
  },
2445
2445
  'text-underline-offset': {
2446
- alias: 'tup',
2446
+ alias: 'tuo',
2447
2447
  type: 'd',
2448
2448
  compiler: length,
2449
2449
  values: ['auto:a'],
@@ -2498,7 +2498,7 @@ const cssProps = {
2498
2498
  alias: 'tfo',
2499
2499
  type: 'd',
2500
2500
  compiler: length,
2501
- values: [''],
2501
+ values: ['left:l', 'right:r', 'top:t', 'bottom:b', 'center:c'],
2502
2502
  },
2503
2503
  'transform-style': {
2504
2504
  alias: 'tfs',
@@ -1,7 +1,38 @@
1
1
  import prebuild from "./prebuild.js";
2
2
  import { cssVarWithDefault } from "./utils/helper.js";
3
3
  import color from './compilers/color.js';
4
- const cssCustomCompilers = Object.assign(Object.assign({}, prebuild), { 'Color': {
4
+ const cssCustomCompilers = Object.assign(Object.assign({}, prebuild), {
5
+ // 'Button':{
6
+ // type:'group',
7
+ // compiler:(value,custom)=>{
8
+ // let stm='';
9
+ // const order=['color','background-color','border-color'];
10
+ // const values=value.replace(/^\(|\)$/g,'').split(',');
11
+ // values.forEach((e,i)=>{
12
+ // if(i<order.length){
13
+ // stm+=`${order[i]}:${color(e,custom)};`
14
+ // }
15
+ // });
16
+ // return stm;
17
+ // }
18
+ // options:{
19
+ // 'solid':'background-color:var(--main-color),color:var(--main-text-color,#fff)',
20
+ // 'outline':'--background-color:var(--outline-bg-color,transparent),--button-color:var(--main-color)',
21
+ // 'link':'background-color:var(--outline-bg-color,transparent),color:var(--main-color),border:none',
22
+ // 'ghost':'background:transparent',
23
+ // 'primary':'--button-main-color:var(--primary-color,),',
24
+ // 'success':'',
25
+ // 'error':'',
26
+ // 'warning':'',
27
+ // 'info':'',
28
+ // 'xs':'border-radius: 4px;padding: 0px 8px;font-size: 12px;height: 24px;line-height: 16px;gap: 4px;',
29
+ // 'sm':'border-radius: 4px;padding: 0px 12px;font-size: 14px;height: 32px;line-height: 20px;gap: 8px;',
30
+ // 'md':'border-radius: 4px;padding: 0px 15px;font-size: 15px;font-weight: 500;height: 35px;line-height: 1;',
31
+ // 'lg':'border-radius: 6px;padding: 0px 16px;font-size: 16px;height: 40px;line-height: 24px;gap: 12px;',
32
+ // 'lg':'border-radius: 6px; padding: 0px 24px;font-size: 18px;height: 48px;line-height: 26px;gap: 14px;',
33
+ // },
34
+ // },
35
+ 'Color': {
5
36
  type: 'group',
6
37
  compiler: (value, custom) => {
7
38
  let stm = '';
@@ -322,7 +353,7 @@ const cssCustomCompilers = Object.assign(Object.assign({}, prebuild), { 'Color':
322
353
  'x-row': {
323
354
  type: 'group',
324
355
  compiler: (value) => {
325
- return `--x-row-gap:${value.replace(/^-(\d)/, '$1')};display:flex;flex-wrap:wrap;margin-left:calc(var(--x-row-gap,${value.replace(/^-(\d)/, '$1')}) * -0.5);margin-right:calc(var(--x-row-gap,${value.replace(/^-(\d)/, '$1')}) * 0.5);`;
356
+ return `--x-row-gap:${value.trim() ? value.replace(/^-(\d)/, '$1') : '16px'};display:flex;flex-wrap:wrap;margin-left:calc(var(--x-row-gap,${value.replace(/^-(\d)/, '$1')}) * -0.5);margin-right:calc(var(--x-row-gap,${value.replace(/^-(\d)/, '$1')}) * 0.5);`;
326
357
  },
327
358
  groups: {
328
359
  'xs': `--x-row-gap:4px;display:flex;flex-wrap:wrap;margin-left:calc(var(--x-row-gap,4px) * -0.5);margin-right:calc(var(--x-row-gap,16px) * 0.5);`,
@@ -337,18 +368,18 @@ const cssCustomCompilers = Object.assign(Object.assign({}, prebuild), { 'Color':
337
368
  return `--x-col-width:${value.replace(/^-(\d)/, '$1')};padding-left:calc(var(--x-row-gap,16px) * 0.5);padding-right:calc(var(--x-row-gap,16px) * 0.5);box-sizing:border-box;flex:0 0 var(--x-col-width,${value.replace(/^-(\d)/, '$1')});max-width:var(--x-col-width,${value.replace(/^-(\d)/, '$1')});`;
338
369
  },
339
370
  groups: {
340
- '1': `padding-left:calc(var(--x-row-gap,16px) * 0.5);padding-right:calc(var(--x-row-gap,16px) * 0.5); box-sizing:border-box;flex:0 0 100%;max-width:100%;`,
341
- '2': `padding-left:calc(var(--x-row-gap,16px) * 0.5);padding-right:calc(var(--x-row-gap,16px) * 0.5); box-sizing:border-box;flex:0 0 50%;max-width:50%;`,
342
- '3': `padding-left:calc(var(--x-row-gap,16px) * 0.5);padding-right:calc(var(--x-row-gap,16px) * 0.5); box-sizing:border-box;flex:0 0 33.3333%;max-width:33.3333%;`,
343
- '4': `padding-left:calc(var(--x-row-gap,16px) * 0.5);padding-right:calc(var(--x-row-gap,16px) * 0.5); box-sizing:border-box;flex:0 0 25%;max-width:25%;`,
344
- '5': `padding-left:calc(var(--x-row-gap,16px) * 0.5);padding-right:calc(var(--x-row-gap,16px) * 0.5); box-sizing:border-box;flex:0 0 20%;max-width:20%;`,
345
- '6': `padding-left:calc(var(--x-row-gap,16px) * 0.5);padding-right:calc(var(--x-row-gap,16px) * 0.5); box-sizing:border-box;flex:0 0 16.6667%;max-width:16.6667%;`,
346
- '7': `padding-left:calc(var(--x-row-gap,16px) * 0.5);padding-right:calc(var(--x-row-gap,16px) * 0.5); box-sizing:border-box;flex:0 0 14.2857%;max-width:14.2857%;`,
347
- '8': `padding-left:calc(var(--x-row-gap,16px) * 0.5);padding-right:calc(var(--x-row-gap,16px) * 0.5); box-sizing:border-box;flex:0 0 12.5%;max-width:12.5%;`,
348
- '9': `padding-left:calc(var(--x-row-gap,16px) * 0.5);padding-right:calc(var(--x-row-gap,16px) * 0.5); box-sizing:border-box;flex:0 0 11.1111%;max-width:11.1111%;`,
349
- '10': `padding-left:calc(var(--x-row-gap,16px) * 0.5);padding-right:calc(var(--x-row-gap,16px) * 0.5); box-sizing:border-box;flex:0 0 10%;max-width:10%;`,
350
- '11': `padding-left:calc(var(--x-row-gap,16px) * 0.5);padding-right:calc(var(--x-row-gap,16px) * 0.5); box-sizing:border-box;flex:0 0 9.0909%;max-width:9.0909%;`,
351
- '12': `padding-left:calc(var(--x-row-gap,16px) * 0.5);padding-right:calc(var(--x-row-gap,16px) * 0.5); box-sizing:border-box;flex:0 0 8.3333%;max-width:8.3333%;`,
371
+ '1': `padding-left:calc(var(--x-row-gap,16px) * 0.5);padding-right:calc(var(--x-row-gap,16px) * 0.5); box-sizing:border-box;flex:0 0 8.333%;max-width:8.333%;`,
372
+ '2': `padding-left:calc(var(--x-row-gap,16px) * 0.5);padding-right:calc(var(--x-row-gap,16px) * 0.5); box-sizing:border-box;flex:0 0 16.6667%;max-width:16.6667%;`,
373
+ '3': `padding-left:calc(var(--x-row-gap,16px) * 0.5);padding-right:calc(var(--x-row-gap,16px) * 0.5); box-sizing:border-box;flex:0 0 25%;max-width:25%;`,
374
+ '4': `padding-left:calc(var(--x-row-gap,16px) * 0.5);padding-right:calc(var(--x-row-gap,16px) * 0.5); box-sizing:border-box;flex:0 0 33.3333%;max-width:33.3333%;`,
375
+ '5': `padding-left:calc(var(--x-row-gap,16px) * 0.5);padding-right:calc(var(--x-row-gap,16px) * 0.5); box-sizing:border-box;flex:0 0 41.6667%;max-width:41.6667%;`,
376
+ '6': `padding-left:calc(var(--x-row-gap,16px) * 0.5);padding-right:calc(var(--x-row-gap,16px) * 0.5); box-sizing:border-box;flex:0 0 50%;max-width:50%;`,
377
+ '7': `padding-left:calc(var(--x-row-gap,16px) * 0.5);padding-right:calc(var(--x-row-gap,16px) * 0.5); box-sizing:border-box;flex:0 0 58.3333%;max-width:58.3333%;`,
378
+ '8': `padding-left:calc(var(--x-row-gap,16px) * 0.5);padding-right:calc(var(--x-row-gap,16px) * 0.5); box-sizing:border-box;flex:0 0 66.6667%;max-width:66.6667%;`,
379
+ '9': `padding-left:calc(var(--x-row-gap,16px) * 0.5);padding-right:calc(var(--x-row-gap,16px) * 0.5); box-sizing:border-box;flex:0 0 75%;max-width:75%;`,
380
+ '10': `padding-left:calc(var(--x-row-gap,16px) * 0.5);padding-right:calc(var(--x-row-gap,16px) * 0.5); box-sizing:border-box;flex:0 0 83.3333%;max-width:83.3333%;`,
381
+ '11': `padding-left:calc(var(--x-row-gap,16px) * 0.5);padding-right:calc(var(--x-row-gap,16px) * 0.5); box-sizing:border-box;flex:0 0 91.6667%;max-width:91.6667%;`,
382
+ '12': `padding-left:calc(var(--x-row-gap,16px) * 0.5);padding-right:calc(var(--x-row-gap,16px) * 0.5); box-sizing:border-box;flex:0 0 100%;max-width:100%;`,
352
383
  },
353
384
  },
354
385
  // 'x-col-responsive':{
package/lib/prebuild.d.ts CHANGED
@@ -1,129 +1,37 @@
1
1
  declare const _default: {
2
- 'x-css-reset-normalize': {
3
- type: string;
4
- statement: string;
5
- };
6
- 'x-css-reset': {
7
- type: string;
8
- statement: string;
9
- };
10
- 'x-css-reset-josh': {
11
- type: string;
12
- statement: string;
13
- };
14
- 'x-css-reset-sanitize': {
15
- type: string;
16
- statement: string;
17
- };
18
- 'x-css-reset-preflight': {
19
- type: string;
20
- statement: string;
21
- };
22
- 'x-css-vars-color': {
23
- type: string;
24
- statement: string;
25
- };
26
- 'x-css-vars-color-gray': {
2
+ 'x-btn': {
27
3
  type: string;
28
4
  statement: string;
29
5
  };
30
- 'x-css-vars-color-grayDark': {
31
- type: string;
32
- statement: string;
33
- };
34
- 'x-css-vars-color-primary': {
35
- type: string;
36
- statement: string;
37
- };
38
- 'x-css-vars-color-brand': {
39
- type: string;
40
- statement: string;
41
- };
42
- 'x-css-vars-color-error': {
43
- type: string;
44
- statement: string;
45
- };
46
- 'x-css-vars-color-success': {
47
- type: string;
48
- statement: string;
49
- };
50
- 'x-css-vars-color-grayBlue': {
51
- type: string;
52
- statement: string;
53
- };
54
- 'x-css-vars-color-grayNeural': {
55
- type: string;
56
- statement: string;
57
- };
58
- 'x-css-vars-color-grayIron': {
59
- type: string;
60
- statement: string;
61
- };
62
- 'x-css-vars-color-grayWarm': {
63
- type: string;
64
- statement: string;
65
- };
66
- 'x-css-vars-color-greenLight': {
67
- type: string;
68
- statement: string;
69
- };
70
- 'x-css-vars-color-green': {
71
- type: string;
72
- statement: string;
73
- };
74
- 'x-css-vars-color-teal': {
75
- type: string;
76
- statement: string;
77
- };
78
- 'x-css-vars-color-cyan': {
79
- type: string;
80
- statement: string;
81
- };
82
- 'x-css-vars-color-blueLight': {
83
- type: string;
84
- statement: string;
85
- };
86
- 'x-css-vars-color-blue': {
87
- type: string;
88
- statement: string;
89
- };
90
- 'x-css-vars-color-blueDark': {
91
- type: string;
92
- statement: string;
93
- };
94
- 'x-css-vars-color-indigo': {
95
- type: string;
96
- statement: string;
97
- };
98
- 'x-css-vars-color-violet': {
6
+ 'x-button': {
99
7
  type: string;
100
8
  statement: string;
101
9
  };
102
- 'x-css-vars-color-purple': {
10
+ 'x-input': {
103
11
  type: string;
104
12
  statement: string;
105
13
  };
106
- 'x-css-vars-color-fuchsia': {
14
+ 'x-css-reset-normalize': {
107
15
  type: string;
108
16
  statement: string;
109
17
  };
110
- 'x-css-vars-color-pink': {
18
+ 'x-css-reset': {
111
19
  type: string;
112
20
  statement: string;
113
21
  };
114
- 'x-css-vars-color-rose': {
22
+ 'x-css-reset-josh': {
115
23
  type: string;
116
24
  statement: string;
117
25
  };
118
- 'x-css-vars-color-orangeDark': {
26
+ 'x-css-reset-sanitize': {
119
27
  type: string;
120
28
  statement: string;
121
29
  };
122
- 'x-css-vars-color-orange': {
30
+ 'x-css-reset-preflight': {
123
31
  type: string;
124
32
  statement: string;
125
33
  };
126
- 'x-css-vars-color-yellow': {
34
+ 'x-import-tokens': {
127
35
  type: string;
128
36
  statement: string;
129
37
  };
@@ -143,14 +51,6 @@ declare const _default: {
143
51
  type: string;
144
52
  statement: string;
145
53
  };
146
- 'x-button': {
147
- type: string;
148
- statement: string;
149
- };
150
- 'x-input': {
151
- type: string;
152
- statement: string;
153
- };
154
54
  'x-arrow': {
155
55
  type: string;
156
56
  statement: string;