aliascss 1.1.3 → 1.1.5

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.
@@ -82,7 +82,7 @@ export default function extractClassNamesFromFile(file, config) {
82
82
  let classExtracted = each[2];
83
83
  const match = group.match(/\[(.)+\]/);
84
84
  if (match) {
85
- console.log(match);
85
+ // console.log(match);
86
86
  group = group.replace(match[0], '');
87
87
  classExtracted = classExtracted.trim().split(/\s+/).map(e => match[0].replace(/^\[/, '').replace(/\]$/, '') + (/^[_-]/.test(e) ? '' : '-') + e).join(" ");
88
88
  }
@@ -5,7 +5,17 @@ bool = false) {
5
5
  return staticClassNames[className];
6
6
  }
7
7
  const [property, propertyKey] = extractProperty(className, cssPropertiesWithAlias);
8
+ // console.log(propertyKey,'ttt',property,className)
8
9
  if (property) {
10
+ // check for type='group'
11
+ if (property.hasOwnProperty('type') && property.type === "group") {
12
+ const valuePortion = className.replace(propertyKey, '');
13
+ if (property.hasOwnProperty('groups') && property.groups.hasOwnProperty(valuePortion.replace(/^-/, ''))) {
14
+ return property.groups[valuePortion.replace(/^-/, '')];
15
+ }
16
+ return property.compiler(valuePortion, custom) || '';
17
+ }
18
+ // --End of Group type
9
19
  const prop = property.property ? property.property : propertyKey;
10
20
  // Case 2: CSS Variables
11
21
  if (/--var--/.test(className)) {
@@ -16,12 +26,13 @@ bool = false) {
16
26
  }
17
27
  // case 3: CSS variable without --var keyword
18
28
  const valuePortion = className.replace(propertyKey, '');
19
- if (/^--[a-z]/.test(valuePortion)) {
29
+ if (/^--[a-zA-Z]/.test(valuePortion)) {
20
30
  return bool ? [prop, "var(" + valuePortion + ')'] : prop + ": var(" + valuePortion + ')';
21
31
  }
22
32
  if (property.hasOwnProperty('compiler') && typeof property.compiler === 'function') {
23
33
  // const value=property.compiler(valuePortion.replace(/^-/,'') ,custom);
24
34
  const value = property.compiler(valuePortion, custom);
35
+ // console.log(value,valuePortion,property)
25
36
  if (value && value !== '-') {
26
37
  const val = value.replace(/([-]?)([\d]|10|11|12)col/g, (m, p1, p2) => `${p1}${parseFloat(((100 / 12) * parseFloat(p2)).toFixed(6))}%`);
27
38
  return bool ? [prop, val] : prop + ":" + val;
@@ -3,6 +3,9 @@ type Property = {
3
3
  property?: string;
4
4
  type?: string;
5
5
  values?: string[];
6
+ groups?: {
7
+ [key: string]: string;
8
+ };
6
9
  compiler?: (a: string, b: {
7
10
  [key: string]: {
8
11
  [key: string]: string;
@@ -34,7 +34,7 @@ export function staticValueCompiler(property, alias = false, values) {
34
34
  export function extractProperty(className, data) {
35
35
  // we just need parts before '--' or __ as they can't be in property is any;
36
36
  const splittedClassName = className.split('--')[0];
37
- const extractPossiblePropertyPortion = splittedClassName.match(/^[a-z-]+/);
37
+ const extractPossiblePropertyPortion = splittedClassName.match(/^[A-Z]?[a-z-]+/);
38
38
  // Not a valid Aliascss class name
39
39
  if (!extractPossiblePropertyPortion)
40
40
  return [null, null];
@@ -76,6 +76,11 @@ export function createCompilerObj(obj, globalValue = []) {
76
76
  const [staticClassNames, compilerObj] = [{}, {}];
77
77
  Object.keys(obj).map((key) => {
78
78
  var _a, _b;
79
+ // check compiler for type=group
80
+ if (obj[key].type === 'group') {
81
+ compilerObj[key] = obj[key];
82
+ return;
83
+ }
79
84
  // createStaticClassNames from Obj
80
85
  const [property, alias, values] = [(obj[key].property || key), (obj[key].property ? key : (obj[key].alias || false)), [...(obj[key].values || []), ...globalValue]
81
86
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aliascss",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
4
4
  "description": "AliasCSS is a CSS post processor.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
package/ui/button.html CHANGED
@@ -1,53 +1,25 @@
1
- <div data-size="xxl" data-type="secondary">
2
- <button
3
- class="c-fff cp _all-bsbb p8px-12px bg-7F56D9 bxs-0px-1px-2px-0160240400d05 br-8px jcc aic g-4px dif b1px-primary600-solid text-sm fw6 btn-md btn-lg btn-xl btn-2xl btn-xxl btn"
4
- class-btn='--is-[data-type=secondary]&--hover-bgc-f9fafb --is-[data-type=secondary]&--hover-bc-d0d4dd --is-[data-type=secondary]&bgc-fff --is-[data-type=secondary]&bc-d0d5dd --is-[data-type=secondary]&c-344054 --is-[disabled]&-bgc-F2F4F7 --is-[disabled]&-bc-EAECF0 --is-[disabled]&-c-98A2B3'
5
- class-btn[--hover]="--is-[disabled]&-bgc-F2F4F7 --is-[disabled]&cna --is-[disabled]&-bc-EAECF0 b-1px-s-6941C6 bgc-6941C6 bxs-0px-1px-2px-0px-0160240400d05"
6
- class-btn-md="--is-[data-size=md]&-p10px-14px"
7
- class-btn-lg=" --is-[data-size=lg]&-p10px-16px --is-[data-size=lg]&-text-md"
8
- class-btn-xl="--is-[data-size=xl]&-p12px-18px --is-[data-size=xl]&-g-6px --is-[data-size=xl]&-text-md"
9
- class-btn-xxl="--is-[data-size=xxl]&-p16px-22px --is-[data-size=xxl]&-g-10px --is-[data-size=xxl]&-text-lg"
10
- class-btn-2xl="--is-[data-size=2xl]&-p16px-22px --is-[data-size=2xl]&-g-10px --is-[data-size=2xl]&-text-lg"
11
- style="">
12
- <span class="btn-addon"
13
- class-btn-addon="--is-[data-size=xxl]&-w24px --is-[data-size=xxl]&-h24px --is-[data-size=2xl]&-w24px --is-[data-size=2xl]&-h24px --is-[disabled]&-b-1d67px-solid-98A2B3 --is-[data-type=secondary]&-bc-98A2B3 lt df bsbb w20px h20px br100p b-1d67px-white-solid"
14
- style=""></span>
15
- <span class=" ff-Inter ww-break-word ">Button CTA</span>
16
- <span class="rt btn-addon"></span>
17
- </button>
18
- </div>
19
- <div data-size="xxl" data-type="secondary" [data-type]>
20
- <div class="
21
- ac-wrapper
22
- _button-c-fff _button-cp _all-bsbb _button-p8px-12px _button-bg-7F56D9 _button-bxs-0px-1px-2px-0160240400d05
23
- _button-br-8px _button-jcc _button-aic _button-g-4px _button-dif _button-b1px-primary600-solid text-sm
24
- _button-fw6 btn-md btn-lg btn-xl btn-2xl btn-xxl btn
25
- "
26
- class-btn="c-fff cp _all-bsbb p8px-12px bg-7F56D9 bxs-0px-1px-2px-0160240400d05 br-8px jcc aic g-4px dif b1px-primary600-solid text-sm fw6"
27
- class-btn[--hover]="--is-[disabled]&-bgc-F2F4F7 --is-[disabled]&cna --is-[disabled]&-bc-EAECF0 b-1px-s-6941C6 bgc-6941C6 bxs-0px-1px-2px-0px-0160240400d05"
28
- class-btn-md="--is-[data-size=md]&-p10px-14px"
29
- class-btn-lg=" --is-[data-size-eql-lg]&-p10px-16px --is-[data-size=lg]&-text-md"
30
- class-btn-xl="--is-[data-size=xl]&-p12px-18px --is-[data-size=xl]&-g-6px --is-[data-size=xl]&-text-md"
31
- class-btn-xxl="--is-[data-size=xxl]&-p16px-22px --is-[data-size=xxl]&-g-10px --is-[data-size=xxl]&-text-lg"
32
- >
33
-
34
- <!-- Main Content -->
35
- <button
36
- class="c-fff cp _all-bsbb p8px-12px bg-7F56D9 bxs-0px-1px-2px-0160240400d05 br-8px jcc aic g-4px dif b1px-primary600-solid text-sm fw6 btn-md btn-lg btn-xl btn-2xl btn-xxl btn"
37
- class-btn='--is-[data-type=secondary]&--hover-bgc-f9fafb --is-[data-type=secondary]&--hover-bc-d0d4dd --is-[data-type=secondary]&bgc-fff --is-[data-type=secondary]&bc-d0d5dd --is-[data-type=secondary]&c-344054 --is-[disabled]&-bgc-F2F4F7 --is-[disabled]&-bc-EAECF0 --is-[disabled]&-c-98A2B3'
38
- class-btn[--hover]="--is-[disabled]&-bgc-F2F4F7 --is-[disabled]&cna --is-[disabled]&-bc-EAECF0 b-1px-s-6941C6 bgc-6941C6 bxs-0px-1px-2px-0px-0160240400d05"
39
- class-btn-md="--is-[data-size=md]&-p10px-14px"
40
- class-btn-lg=" --is-[data-size=lg]&-p10px-16px --is-[data-size=lg]&-text-md"
41
- class-btn-xl="--is-[data-size=xl]&-p12px-18px --is-[data-size=xl]&-g-6px --is-[data-size=xl]&-text-md"
42
- class-btn-xxl="--is-[data-size=xxl]&-p16px-22px --is-[data-size=xxl]&-g-10px --is-[data-size=xxl]&-text-lg"
43
- class-btn-2xl="--is-[data-size=2xl]&-p16px-22px --is-[data-size=2xl]&-g-10px --is-[data-size=2xl]&-text-lg"
44
- style="">
45
- <span class="btn-addon"
46
- class-btn-addon="--is-[data-size=xxl]&-w24px --is-[data-size=xxl]&-h24px --is-[data-size=2xl]&-w24px --is-[data-size=2xl]&-h24px --is-[disabled]&-b-1d67px-solid-98A2B3 --is-[data-type=secondary]&-bc-98A2B3 lt df bsbb w20px h20px br100p b-1d67px-white-solid"
47
- style=""></span>
48
- <span class=" ff-Inter ww-break-word ">Button CTA</span>
49
- <span class="rt btn-addon"></span>
1
+ <div class="button _.btn-af-cont-hello_world button-200811-1284" class-button-200811-1284[_.btn-af]="c-red"
2
+ data-size="xxl" xdata-type="secondary" xdisabled>
3
+ <!-- Acss-Wrapper -->
4
+ <div class=""
5
+ class-btn="_all-bsbb-i c-fff cp _all-bsbb p8px-12px bg-7F56D9 bxs-0px-1px-2px-0160240400d05 br-8px jcc aic g-4px dif b1px-primary600-solid text-sm fw6 -h-b-1px-s-6941C6 -h-bgc-6941C6 -h-bxs-0px-1px-2px-0px-0160240400d05"
6
+ class-btn[--is-[data-type-eql-secondary]&]=" __.addon-bc-344054 --hover-bgc-f9fafb --hover-bc-d0d4dd bgc-fff bc-d0d5dd c-344054"
7
+ class-btn[--is-[disabled]&]="_.addon-b-1d67px-solid-98A2B3 bgc-F2F4F7 bc-EAECF0 c-98A2B3 -h-bgc-F2F4F7 -h-cna -h-bc-EAECF0"
8
+ class-btn[--is(_.button[data-size-eql-md])&]="p10px-14px"
9
+ class-btn[--is(_.button[data-size-eql-lg])&]="p10px-16px text-md"
10
+ class-btn[--is(_.button[data-size-eql-xl])&]="p12px-18px g-6px text-md"
11
+ class-btn[--is(_.button[data-size-eql-xxl])&]="p16px-22px g-10px text-lg __.addon-h24px __.addon-w24px"
12
+ class-btn[--is(_.button[data-size-eql-2xl])&]="p16px-22px g-10px text-lg __.addon-h24px __.addon-w24px"
13
+ class-button[_.addon]="df bsbb w20px h20px br100p b-1d67px-solid">
14
+ <!-- Component -->
15
+ <button class="btn ">
16
+ <!-- button-addon-rt -->
17
+ <span class="rt addon "></span>
18
+ <span class="">Button CTA</span>
19
+ <!-- button-addon-lt -->
20
+ <span class="lt addon"></span>
50
21
  </button>
51
- <!-- End Main Content -->
52
- </div>
22
+ <!-- End-Of-Component -->
23
+ </div>
24
+ <!-- End -Of-Acss-Wrapper -->
53
25
  </div>
@@ -0,0 +1,53 @@
1
+ <div data-size="xxl" data-type="secondary">
2
+ <button
3
+ class="c-fff cp _all-bsbb p8px-12px bg-7F56D9 bxs-0px-1px-2px-0160240400d05 br-8px jcc aic g-4px dif b1px-primary600-solid text-sm fw6 btn-md btn-lg btn-xl btn-2xl btn-xxl btn"
4
+ class-btn='--is-[data-type=secondary]&--hover-bgc-f9fafb --is-[data-type=secondary]&--hover-bc-d0d4dd --is-[data-type=secondary]&bgc-fff --is-[data-type=secondary]&bc-d0d5dd --is-[data-type=secondary]&c-344054 --is-[disabled]&-bgc-F2F4F7 --is-[disabled]&-bc-EAECF0 --is-[disabled]&-c-98A2B3'
5
+ class-btn[--hover]="--is-[disabled]&-bgc-F2F4F7 --is-[disabled]&cna --is-[disabled]&-bc-EAECF0 b-1px-s-6941C6 bgc-6941C6 bxs-0px-1px-2px-0px-0160240400d05"
6
+ class-btn-md="--is-[data-size=md]&-p10px-14px"
7
+ class-btn-lg=" --is-[data-size=lg]&-p10px-16px --is-[data-size=lg]&-text-md"
8
+ class-btn-xl="--is-[data-size=xl]&-p12px-18px --is-[data-size=xl]&-g-6px --is-[data-size=xl]&-text-md"
9
+ class-btn-xxl="--is-[data-size=xxl]&-p16px-22px --is-[data-size=xxl]&-g-10px --is-[data-size=xxl]&-text-lg"
10
+ class-btn-2xl="--is-[data-size=2xl]&-p16px-22px --is-[data-size=2xl]&-g-10px --is-[data-size=2xl]&-text-lg"
11
+ style="">
12
+ <span class="btn-addon"
13
+ class-btn-addon="--is-[data-size=xxl]&-w24px --is-[data-size=xxl]&-h24px --is-[data-size=2xl]&-w24px --is-[data-size=2xl]&-h24px --is-[disabled]&-b-1d67px-solid-98A2B3 --is-[data-type=secondary]&-bc-98A2B3 lt df bsbb w20px h20px br100p b-1d67px-white-solid"
14
+ style=""></span>
15
+ <span class=" ff-Inter ww-break-word ">Button CTA</span>
16
+ <span class="rt btn-addon"></span>
17
+ </button>
18
+ </div>
19
+ <div data-size="xxl" data-type="secondary" [data-type]>
20
+ <div class="
21
+ ac-wrapper
22
+ _button-c-fff _button-cp _all-bsbb _button-p8px-12px _button-bg-7F56D9 _button-bxs-0px-1px-2px-0160240400d05
23
+ _button-br-8px _button-jcc _button-aic _button-g-4px _button-dif _button-b1px-primary600-solid text-sm
24
+ _button-fw6 btn-md btn-lg btn-xl btn-2xl btn-xxl btn
25
+ "
26
+ class-btn="c-fff cp _all-bsbb p8px-12px bg-7F56D9 bxs-0px-1px-2px-0160240400d05 br-8px jcc aic g-4px dif b1px-primary600-solid text-sm fw6"
27
+ class-btn[--hover]="--is-[disabled]&-bgc-F2F4F7 --is-[disabled]&cna --is-[disabled]&-bc-EAECF0 b-1px-s-6941C6 bgc-6941C6 bxs-0px-1px-2px-0px-0160240400d05"
28
+ class-btn-md="--is-[data-size=md]&-p10px-14px"
29
+ class-btn-lg=" --is-[data-size-eql-lg]&-p10px-16px --is-[data-size=lg]&-text-md"
30
+ class-btn-xl="--is-[data-size=xl]&-p12px-18px --is-[data-size=xl]&-g-6px --is-[data-size=xl]&-text-md"
31
+ class-btn-xxl="--is-[data-size=xxl]&-p16px-22px --is-[data-size=xxl]&-g-10px --is-[data-size=xxl]&-text-lg"
32
+ >
33
+
34
+ <!-- Main Content -->
35
+ <button
36
+ class="c-fff cp _all-bsbb p8px-12px bg-7F56D9 bxs-0px-1px-2px-0160240400d05 br-8px jcc aic g-4px dif b1px-primary600-solid text-sm fw6 btn-md btn-lg btn-xl btn-2xl btn-xxl btn"
37
+ class-btn='--is-[data-type=secondary]&--hover-bgc-f9fafb --is-[data-type=secondary]&--hover-bc-d0d4dd --is-[data-type=secondary]&bgc-fff --is-[data-type=secondary]&bc-d0d5dd --is-[data-type=secondary]&c-344054 --is-[disabled]&-bgc-F2F4F7 --is-[disabled]&-bc-EAECF0 --is-[disabled]&-c-98A2B3'
38
+ class-btn[--hover]="--is-[disabled]&-bgc-F2F4F7 --is-[disabled]&cna --is-[disabled]&-bc-EAECF0 b-1px-s-6941C6 bgc-6941C6 bxs-0px-1px-2px-0px-0160240400d05"
39
+ class-btn-md="--is-[data-size=md]&-p10px-14px"
40
+ class-btn-lg=" --is-[data-size=lg]&-p10px-16px --is-[data-size=lg]&-text-md"
41
+ class-btn-xl="--is-[data-size=xl]&-p12px-18px --is-[data-size=xl]&-g-6px --is-[data-size=xl]&-text-md"
42
+ class-btn-xxl="--is-[data-size=xxl]&-p16px-22px --is-[data-size=xxl]&-g-10px --is-[data-size=xxl]&-text-lg"
43
+ class-btn-2xl="--is-[data-size=2xl]&-p16px-22px --is-[data-size=2xl]&-g-10px --is-[data-size=2xl]&-text-lg"
44
+ style="">
45
+ <span class="btn-addon"
46
+ class-btn-addon="--is-[data-size=xxl]&-w24px --is-[data-size=xxl]&-h24px --is-[data-size=2xl]&-w24px --is-[data-size=2xl]&-h24px --is-[disabled]&-b-1d67px-solid-98A2B3 --is-[data-type=secondary]&-bc-98A2B3 lt df bsbb w20px h20px br100p b-1d67px-white-solid"
47
+ style=""></span>
48
+ <span class=" ff-Inter ww-break-word ">Button CTA</span>
49
+ <span class="rt btn-addon"></span>
50
+ </button>
51
+ <!-- End Main Content -->
52
+ </div>
53
+ </div>