aliascss 1.1.14 → 1.1.15
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,4 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
type Property = {
|
|
2
|
+
alias?: string;
|
|
3
|
+
property?: string;
|
|
4
|
+
type?: string;
|
|
5
|
+
values?: string[];
|
|
6
|
+
groups?: {
|
|
7
|
+
[key: string]: string;
|
|
8
|
+
};
|
|
9
|
+
compiler?: (...args: any[]) => any;
|
|
10
|
+
};
|
|
11
|
+
export default function getPropertyAndValue(className: string, cssPropertiesWithAlias: {
|
|
12
|
+
[key: string]: Property;
|
|
13
|
+
}, staticClassNames: {
|
|
2
14
|
[key: string]: string;
|
|
3
15
|
}, custom: {
|
|
4
16
|
[key: string]: {
|
|
@@ -6,3 +18,4 @@ export default function getPropertyAndValue(className: string, cssPropertiesWith
|
|
|
6
18
|
};
|
|
7
19
|
}, extractProperty: any, // (a:string,b:{[key:string]:Property})=>[Property,string],
|
|
8
20
|
bool?: boolean): string[] | null | {};
|
|
21
|
+
export {};
|
|
@@ -12,6 +12,16 @@ bool = false) {
|
|
|
12
12
|
return bool ? [property, "var(" + value + ')'] : property + ": var(" + value + ')';
|
|
13
13
|
}
|
|
14
14
|
else {
|
|
15
|
+
// check for string and color
|
|
16
|
+
if (/color$/.test(property)) {
|
|
17
|
+
console.log(cssPropertiesWithAlias.color);
|
|
18
|
+
const v = cssPropertiesWithAlias.color.compiler ? cssPropertiesWithAlias.color.compiler(value, custom) : value;
|
|
19
|
+
return bool ? [property, v] : property + ":" + v;
|
|
20
|
+
}
|
|
21
|
+
else if (/text$/.test(property)) {
|
|
22
|
+
const v = '"' + value.replace(/([_]?)[_]/g, '$1 ').replace(/_[\s]/g, '_') + '"';
|
|
23
|
+
return bool ? [property, v] : property + ":" + v;
|
|
24
|
+
}
|
|
15
25
|
return bool ? [property, value.replace(/[-]([-]?[\w])/g, ' $1').replace(/([\d])d([\d])/g, '$1.$2').replace(/([\d])p[\s]/g, "$1% ").replace(/([\d])p$/, "$1%").replace(/[\s]by[\s]/g, ' / ').replace(/auto flow/g, 'auto-flow')]
|
|
16
26
|
:
|
|
17
27
|
property + ":" + value.replace(/[-]([-]?[\w])/g, ' $1').replace(/([\d])d([\d])/g, '$1.$2').replace(/([\d])p[\s]/g, "$1% ").replace(/([\d])p$/, "$1%").replace(/[\s]by[\s]/g, ' / ').replace(/auto flow/g, 'auto-flow');
|