aliascss 1.3.5 → 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'],
@@ -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'],
package/lib/prebuild.d.ts CHANGED
@@ -31,6 +31,10 @@ declare const _default: {
31
31
  type: string;
32
32
  statement: string;
33
33
  };
34
+ 'x-import-tokens': {
35
+ type: string;
36
+ statement: string;
37
+ };
34
38
  'x-screen-root': {
35
39
  type: string;
36
40
  statement: string;
package/lib/prebuild.js CHANGED
@@ -226,6 +226,141 @@ export default {
226
226
  // type:'raw',
227
227
  // statement:`:root{--yellow-25:#FEFDF0;--yellow-50:#FEFBE8;--yellow-100:#FEF7C3;--yellow-200:#FEEE95;--yellow-300:#FDE272;--yellow-400:#FAC515;--yellow-500:#EAAA08;--yellow-600:#CA8504;--yellow-700:#A15C07;--yellow-800:#854A0E;--yellow-900:#713B12;--yellow-950:#542C0D;}`
228
228
  // },
229
+ 'x-import-tokens': {
230
+ type: 'raw',
231
+ statement: `
232
+ :root {
233
+
234
+ /* Fluid Display Scale */
235
+ --display-xs: clamp(1.125rem, calc(1rem + 0.625vw), 1.5rem); /* Scales from 18px to 24px */
236
+ --display-sm: clamp(1.25rem, calc(1.0417rem + 1.0417vw), 1.875rem); /* Scales from 20px to 30px */
237
+ --display-md: clamp(1.5rem, calc(1.25rem + 1.25vw), 2.25rem); /* Scales from 24px to 36px */
238
+ --display-lg: clamp(1.875rem, calc(1.5rem + 1.875vw), 3rem); /* Scales from 30px to 48px */
239
+ --display-xl: clamp(2.25rem, calc(1.75rem + 2.5vw), 3.75rem); /* Scales from 36px to 60px */
240
+ --display-2xl: clamp(2.5rem, calc(1.8333rem + 3.3333vw), 4.5rem); /* Scales from 40px to 72px */
241
+
242
+
243
+ /* Typography scale — fluid */
244
+
245
+
246
+ --text-xs: clamp(0.75rem, calc(0.7rem + 0.25vw), 0.875rem);
247
+ --text-sm: clamp(0.875rem, calc(0.8rem + 0.35vw), 1rem);
248
+ --text-base: clamp(1rem, calc(0.95rem + 0.25vw), 1.125rem);
249
+ --text-lg: clamp(1.125rem, calc(1rem + 0.75vw), 1.5rem);
250
+ --text-xl: clamp(1.5rem, calc(1.2rem + 1.25vw), 2.25rem);
251
+ --text-2xl: clamp(2rem, calc(1.2rem + 2.5vw), 3.5rem);
252
+ --text-3xl: clamp(2.5rem, calc(1rem + 4vw), 5rem);
253
+ --text-hero: clamp(3rem, calc(0.5rem + 7vw), 8rem);
254
+
255
+ /* Base spacing unit */
256
+
257
+ --space: var(--space-base,0.25rem);
258
+
259
+ /* Spacing scale */
260
+ --space-1: calc(var(--space) * 1);
261
+ --space-2: calc(var(--space) * 2);
262
+ --space-3: calc(var(--space) * 3);
263
+ --space-4: calc(var(--space) * 4);
264
+ --space-5: calc(var(--space) * 5);
265
+ --space-6: calc(var(--space) * 6);
266
+ --space-8: calc(var(--space) * 8);
267
+ --space-10: calc(var(--space) * 10);
268
+ --space-12: calc(var(--space) * 12);
269
+ --space-16: calc(var(--space) * 16);
270
+ --space-20: calc(var(--space) * 20);
271
+ --space-24: calc(var(--space) * 24);
272
+ --space-32: calc(var(--space) * 32);
273
+
274
+ /* Border radius */
275
+ --radius-sm: 0.375rem;
276
+ --radius-md: 0.5rem;
277
+ --radius-base: 0.5rem;
278
+ --radius-lg: 0.75rem;
279
+ --radius-xl: 1rem;
280
+ --radius-2xl: 1.5rem;
281
+ --radius-full: 9999px;
282
+
283
+ /* Colors — Light */
284
+ --color-bg: #f5f6fa;
285
+ --color-surface: #ffffff;
286
+ --color-surface-2: #f8f9fc;
287
+ --color-surface-offset: #eef0f6;
288
+ --color-surface-offset-2: #e4e7f0;
289
+ --color-surface-dynamic: #d9dde8;
290
+ --color-divider: #d0d4e0;
291
+ --color-border: #c4c9d8;
292
+
293
+ --color-text: #111827;
294
+ --color-text-muted: #4b5563;
295
+ --color-text-faint: #9ca3af;
296
+ --color-text-inverse: #f9fafb;
297
+
298
+ --color-primary: #0a4f6b;
299
+ /* --color-primary: red; */
300
+ --color-primary-hover: #063a52;
301
+ --color-primary-active: #04283a;
302
+ --color-primary-highlight: #cce3ed;
303
+ --color-primary-light: #e8f4f8;
304
+
305
+ --color-accent: #d97706;
306
+ --color-accent-hover: #b45309;
307
+ --color-accent-light: #fef3c7;
308
+
309
+ --color-success: #166534;
310
+ --color-success-bg: #dcfce7;
311
+ --color-success-highlight: #dcfce7;
312
+
313
+ --color-error: #991b1b;
314
+ --color-error-bg: #fee2e2;
315
+
316
+ --color-gold: #d19900;
317
+ --color-gold-bg: #fef9e7;
318
+
319
+
320
+
321
+ /* Base shadow color (Lightness Chroma Hue) */
322
+
323
+ --shadow-color: 0.2 0.03 245;
324
+
325
+ /* Shadows */
326
+
327
+ --shadow-sm: 0 1px 3px oklch(var(--shadow-color) / 0.08);
328
+ --shadow-md: 0 4px 14px oklch(var(--shadow-color) / 0.10);
329
+ --shadow-lg: 0 12px 40px oklch(var(--shadow-color) / 0.14);
330
+ --shadow-xl: 0 24px 60px oklch(var(--shadow-color) / 0.18);
331
+
332
+ /* subtle: Subtle contact + slight lift (Great for buttons and cards) */
333
+ --shadow-subtle:
334
+ 0 1px 2px oklch(var(--shadow-color) / 0.06),
335
+ 0 1px 4px oklch(var(--shadow-color) / 0.08);
336
+
337
+ /* light: Defined contact + medium spread (Great for dropdowns) */
338
+ --shadow-light:
339
+ 0 2px 4px oklch(var(--shadow-color) / 0.04),
340
+ 0 6px 16px oklch(var(--shadow-color) / 0.10);
341
+
342
+ /* soft: Soft contact + ambient mid + wide directional (Great for modals) */
343
+ --shadow-soft:
344
+ 0 4px 8px oklch(var(--shadow-color) / 0.03),
345
+ 0 12px 24px oklch(var(--shadow-color) / 0.06),
346
+ 0 20px 48px oklch(var(--shadow-color) / 0.12);
347
+
348
+ /* hard: Deep contact + soft ambient + massive spread (Great for floating palettes) */
349
+ --shadow-hard:
350
+ 0 6px 12px oklch(var(--shadow-color) / 0.03),
351
+ 0 16px 32px oklch(var(--shadow-color) / 0.06),
352
+ 0 32px 80px oklch(var(--shadow-color) / 0.14);
353
+
354
+
355
+
356
+
357
+ /* Layout */
358
+ --content-narrow: 640px;
359
+ --content-default: 960px;
360
+ --content-wide: 1200px;
361
+ }
362
+ `
363
+ },
229
364
  'x-screen-root': {
230
365
  type: 'statement',
231
366
  statement: `pr oh
@@ -59,6 +59,7 @@ const prefix = {
59
59
  '--ge': '::grammar-error',
60
60
  '--has': ':has', // --has
61
61
  '--hs': ':has', // -hs
62
+ '--Has': ' :has', // --has
62
63
  '--hover-after': ':hover::after', // -haf
63
64
  '--haf': ':hover::after', // -haf
64
65
  '--hover-before': ':hover::before', // -hbf
@@ -74,7 +75,8 @@ const prefix = {
74
75
  '--ind': ':indeterminate', // idt
75
76
  '--invalid': ':invalid', // -in
76
77
  '--inv': ':invalid', // -in
77
- '--is': ':is',
78
+ '--is': ' :is',
79
+ '--Is': ':is',
78
80
  // '--is':':is',
79
81
  '--lang': ':lang', // -ln
80
82
  '--lan': ':lan', // -ln
@@ -143,7 +145,9 @@ const prefix = {
143
145
  '--visited': ':visited', // -vi
144
146
  '--vi': ':visited', // -vi
145
147
  '--v': ':visited', // -vi
146
- '--where': ':where',
147
- '--w': ':where'
148
+ '--where': ' :where',
149
+ '--w': ' :where',
150
+ '--Where': ':where',
151
+ '--W': ':where'
148
152
  };
149
153
  export default prefix;
@@ -1,5 +1,5 @@
1
1
  const attribute = {
2
- test: /^[-,]?[\[][a-zA-Z0-9-_:]+([~*$^]?[=][a-zA-Z0-9-_:/.]+)?[\]]/,
2
+ test: /^[-,_]?[\[][a-zA-Z0-9-_:]+([~*$^]?[=][a-zA-Z0-9-_:/.]+)?[\]]/,
3
3
  process(className) {
4
4
  const match = className.match(this.test);
5
5
  if (match) {
@@ -9,7 +9,7 @@ const attribute = {
9
9
  const result = attr.replace(attrSplit, attrSplit.replace(/:/g, '\\:'))
10
10
  // .replace(/^([-]?[\[][a-z0-9-_:]+)([~*$^]?[=][a-z0-9-_:/.]+)?[\]]/,(m,s,b)=>s.replace(/\:/g,'\:')+b+']')
11
11
  .replace(/-(eql|equal)-/, '=').replace(/[=]([a-zA-Z0-9-_:/.]+)[\]]/, '="$1"]').replace(/^[-_]/, ""); // replace(/([\[|\]])/g,'\\$1').replace(/([=])/g,'\\$1');
12
- return [className.replace(attr, ''), result];
12
+ return [className.replace(attr, ''), /^[_]/.test(className) ? ' ' + result : result];
13
13
  }
14
14
  }
15
15
  }
@@ -4,21 +4,22 @@ const element = {
4
4
  const match = className.match(this.test);
5
5
  if (match) {
6
6
  const alias = match[0];
7
- if (alias) {
8
- const result = alias
9
- .replace('next', ' + ')
10
- .replace('child', ' > ')
11
- .replace('siblings', ' ~')
12
- .replace(/____/g, ' ~ ')
13
- .replace(/___/g, ' + ')
14
- .replace(/__/g, ' > ')
15
- .replace(/_/g, ' ')
16
- .replace(/[\s]all/, ' * ')
17
- .replace(/[\s](dot)/g, (e, a) => { return ' .' + a.toLowerCase(); })
18
- // .replace(/[\s]([A-Z])/g, (e, a) => { return ' .' + a.toLowerCase();})
19
- .replace(/[\s]+/g, " ").trim();
20
- return [className.replace(alias, ''), ' ' + result];
21
- }
7
+ if (match)
8
+ if (alias) {
9
+ const result = alias
10
+ .replace('next', ' + ')
11
+ .replace('child', ' > ')
12
+ .replace('siblings', ' ~')
13
+ .replace(/____/g, ' ~ ')
14
+ .replace(/___/g, ' + ')
15
+ .replace(/__/g, ' > ')
16
+ .replace(/_/g, ' ')
17
+ .replace(/[\s]all/, ' * ')
18
+ .replace(/[\s](dot)/g, (e, a) => { return ' .' + a.toLowerCase(); })
19
+ // .replace(/[\s]([A-Z])/g, (e, a) => { return ' .' + a.toLowerCase();})
20
+ .replace(/[\s]+/g, " ").trim();
21
+ return [className.replace(alias, (/[^_][_]$/.test(alias) ? '_' : '')), ' ' + result];
22
+ }
22
23
  }
23
24
  }
24
25
  };
@@ -8,7 +8,7 @@ export default function PseudoEleStateNew(data) {
8
8
  return null;
9
9
  const matchAndFunc = [
10
10
  {
11
- match: /^-([-]?(not|has|is|where|n|hs|w))\((.+)\)/,
11
+ match: /^-([-]?(not|has|Has|is|Is|where|Where|n|hs|w|W))\((.+)\)/,
12
12
  func(value) {
13
13
  const matched = value.match(this.match);
14
14
  const newData = matched === null || matched === void 0 ? void 0 : matched[3];
@@ -51,8 +51,8 @@ export default function PseudoEleStateNew(data) {
51
51
  // console.log(data,cn,alias,mch)
52
52
  return [cn, `${alias}(${cont})`];
53
53
  }
54
- else if (/(^-(-not|-has|-is|-where|-n|-hs|-w|-is)[-_])/.test(data)) {
55
- const mch = data.match(/(^-(-not|-has|-is|-where|-n|-hs|-w|-is)([_-]+[a-zA-Z0-9\.,]+)(?=[-|_]))/);
54
+ else if (/(^-(-not|-has|-Has|-is|-Is|-where|-Where|-n|-hs|-w|-W|-is)[-_])/.test(data)) {
55
+ const mch = data.match(/(^-(-not|-has|-Has|-is|-Is|-where|-Where|-n|-hs|-w|-W|-is)([_-]+[a-zA-Z0-9\.,]+)(?=[-|_]))/);
56
56
  const cn = (mch === null || mch === void 0 ? void 0 : mch[1]) ? data.replace(mch[1], '') : '';
57
57
  const alias = (mch === null || mch === void 0 ? void 0 : mch[2]) ? prefix['-' + mch[2].replace(/-$/, '')] : '';
58
58
  const cont = (_a = PseudoEleStateNew((mch === null || mch === void 0 ? void 0 : mch[3]) + '-dn')) === null || _a === void 0 ? void 0 : _a[1];
@@ -13,6 +13,20 @@ const media = {
13
13
  '@container-lg': '@container (min-width : 992px)',
14
14
  '@container-xl': '@container (min-width : 1200px)',
15
15
  '@container-2xl': '@container (min-width : 1408px)',
16
+ '@forced-color-active': '@media (forced-colors: active)',
17
+ '@fca': '@media (forced-colors: active)',
18
+ '@standalone': '@media (display-mode: standalone)',
19
+ '@browser': '@media (display-mode: browser)',
20
+ '@short-height': '@media (max-height: 600px)',
21
+ '@xsh': '@media (max-height: 600px)',
22
+ '@p3': '@media (color-gamut: p3)',
23
+ '@motion-reduce': '@media (prefers-reduced-motion: reduce)',
24
+ '@mouse': '@media (hover: hover) and (pointer: fine)',
25
+ '@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)',
28
+ '@contrast-more': '@media (prefers-contrast: more)',
29
+ '@data-reduce': '@media (prefers-reduced-data: reduce)',
16
30
  xs: '@media (max-width : 576px)',
17
31
  '@xs': '@media (max-width : 576px)',
18
32
  sm: '@media (min-width : 576px)',