aliascss 1.1.0
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.
- package/.prettierrc +5 -0
- package/LICENSE +21 -0
- package/README.md +544 -0
- package/READMEEdititng.md +615 -0
- package/aliascss.config.js +201 -0
- package/bin/aliascss.js +101 -0
- package/dist/aliascss.js +1 -0
- package/jestconfig.json +10 -0
- package/lib/build/index.d.ts +1 -0
- package/lib/build/index.js +63 -0
- package/lib/classPrinter.d.ts +6 -0
- package/lib/classPrinter.js +233 -0
- package/lib/compilers/border.d.ts +5 -0
- package/lib/compilers/border.js +50 -0
- package/lib/compilers/clipPath.d.ts +5 -0
- package/lib/compilers/clipPath.js +57 -0
- package/lib/compilers/color.d.ts +5 -0
- package/lib/compilers/color.js +61 -0
- package/lib/compilers/filter.d.ts +7 -0
- package/lib/compilers/filter.js +54 -0
- package/lib/compilers/font.d.ts +5 -0
- package/lib/compilers/font.js +19 -0
- package/lib/compilers/gradient.d.ts +5 -0
- package/lib/compilers/gradient.js +138 -0
- package/lib/compilers/length.d.ts +2 -0
- package/lib/compilers/length.js +10 -0
- package/lib/compilers/shadow.d.ts +5 -0
- package/lib/compilers/shadow.js +55 -0
- package/lib/compilers/stringAndContent.d.ts +6 -0
- package/lib/compilers/stringAndContent.js +23 -0
- package/lib/compilers/timingFunction.d.ts +5 -0
- package/lib/compilers/timingFunction.js +35 -0
- package/lib/compilers/transform.d.ts +2 -0
- package/lib/compilers/transform.js +117 -0
- package/lib/compilers/transition.d.ts +1 -0
- package/lib/compilers/transition.js +35 -0
- package/lib/compilers/url.d.ts +1 -0
- package/lib/compilers/url.js +33 -0
- package/lib/config.d.ts +20 -0
- package/lib/config.js +21 -0
- package/lib/css-properties-all.d.ts +16 -0
- package/lib/css-properties-all.js +2642 -0
- package/lib/index.d.ts +8 -0
- package/lib/index.js +7 -0
- package/lib/node/compileFile.d.ts +25 -0
- package/lib/node/compileFile.js +337 -0
- package/lib/node/extractClassNamesFromFile.d.ts +18 -0
- package/lib/node/extractClassNamesFromFile.js +105 -0
- package/lib/prefix/PseudoPrefix.d.ts +7 -0
- package/lib/prefix/PseudoPrefix.js +145 -0
- package/lib/prefix/attribute-selector.d.ts +5 -0
- package/lib/prefix/attribute-selector.js +14 -0
- package/lib/prefix/colonToDefaultConversion.d.ts +1 -0
- package/lib/prefix/colonToDefaultConversion.js +3 -0
- package/lib/prefix/element-selector.d.ts +5 -0
- package/lib/prefix/element-selector.js +25 -0
- package/lib/prefix/extractMediaPrefix.d.ts +3 -0
- package/lib/prefix/extractMediaPrefix.js +12 -0
- package/lib/prefix/extractPrefix.d.ts +1 -0
- package/lib/prefix/extractPrefix.js +66 -0
- package/lib/prefix/pseudoSelector.d.ts +1 -0
- package/lib/prefix/pseudoSelector.js +48 -0
- package/lib/prefix/pseudoSelectorNew.d.ts +1 -0
- package/lib/prefix/pseudoSelectorNew.js +78 -0
- package/lib/prefix/responsive.d.ts +10 -0
- package/lib/prefix/responsive.js +26 -0
- package/lib/returnPropertyAndValue.d.ts +8 -0
- package/lib/returnPropertyAndValue.js +42 -0
- package/lib/returnStatement.d.ts +5 -0
- package/lib/returnStatement.js +189 -0
- package/lib/static/customColors.d.ts +3 -0
- package/lib/static/customColors.js +376 -0
- package/lib/static/customStaticClassNames.d.ts +3 -0
- package/lib/static/customStaticClassNames.js +132 -0
- package/lib/static/staticClassNamesAlias.d.ts +3 -0
- package/lib/static/staticClassNamesAlias.js +1300 -0
- package/lib/utils/createCompilerObj.d.ts +35 -0
- package/lib/utils/createCompilerObj.js +97 -0
- package/lib/utils/cssFunc.d.ts +1 -0
- package/lib/utils/cssFunc.js +27 -0
- package/package.json +64 -0
- package/ts.js +5 -0
- package/tsconfig.json +14 -0
- package/tslint.json +9 -0
- package/webpack.config.js +11 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
|
|
2
|
+
const config={
|
|
3
|
+
input:['demo/**/*.html'],
|
|
4
|
+
output:{
|
|
5
|
+
location:'demo/acss.css',
|
|
6
|
+
"--file":true
|
|
7
|
+
},
|
|
8
|
+
'--module':true,
|
|
9
|
+
prefix:'',
|
|
10
|
+
importModuleAs:'x',
|
|
11
|
+
// minify:true,
|
|
12
|
+
extractorFunction:"x|@",
|
|
13
|
+
//reg:new RegExp('x' + "(`|\\(["+`"'])`+ "(.+)" + "(`|" + `["']` + "\\))") ,
|
|
14
|
+
media:{
|
|
15
|
+
prefix:{
|
|
16
|
+
xs:'@media (max-width : 24px)'
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
extend:{
|
|
20
|
+
'txt-shadow':{
|
|
21
|
+
property:'--webkit-text-shadow',
|
|
22
|
+
compiler:(value)=>value
|
|
23
|
+
},
|
|
24
|
+
'solor':{
|
|
25
|
+
property:'color',
|
|
26
|
+
extend:'color',
|
|
27
|
+
// compiler:(value)=>this.compiler(value)
|
|
28
|
+
},
|
|
29
|
+
$color:{extend:'color'},
|
|
30
|
+
test:{
|
|
31
|
+
property:'color',
|
|
32
|
+
compiler:(value,custom)=>{
|
|
33
|
+
return config.extend.$color.compiler(value,custom);
|
|
34
|
+
},
|
|
35
|
+
values:['red:sex']
|
|
36
|
+
},
|
|
37
|
+
'font-size':{
|
|
38
|
+
alias:'fs',
|
|
39
|
+
values:["2rem:xl"],
|
|
40
|
+
compiler:(value)=>{
|
|
41
|
+
return value;
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
'shadows':{
|
|
45
|
+
property:'box-shadow',
|
|
46
|
+
//alias:'sdo',
|
|
47
|
+
compiler:(value)=>{
|
|
48
|
+
value=value.slice(1);
|
|
49
|
+
const values={
|
|
50
|
+
'3xl': ' 0px 32px 64px -12px var(--shadow-color)',
|
|
51
|
+
'xxxl': ' 0px 32px 64px -12px var(--shadow-color)',
|
|
52
|
+
'2xl': ' 0px 24px 48px -12px var(--shadow-color)',
|
|
53
|
+
'xxl': ' 0px 24px 48px -12px var(--shadow-color)',
|
|
54
|
+
'xl': ' 0px 20px 24px -4px var(--shadow-color)',
|
|
55
|
+
'lg': ' 0px 12px 16px -4px var(--shadow-color)',
|
|
56
|
+
'md': ' 0px 4px 8px -2px var(--shadow-color)',
|
|
57
|
+
'sm': ' 0px 1px 3px var(--shadow-color)',
|
|
58
|
+
'xs': ' 0px 1px 2px var(--shadow-color)',
|
|
59
|
+
};
|
|
60
|
+
if(values.hasOwnProperty(value)) return values[value];
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
//statement:``,
|
|
66
|
+
custom:{
|
|
67
|
+
colors:{
|
|
68
|
+
white:'#e3e3e3',
|
|
69
|
+
'whiter':'#f3f3f3',
|
|
70
|
+
whitest:'#ffffff',
|
|
71
|
+
primary700:'red'
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
prebuild:{
|
|
75
|
+
'bg-dark':'background:#0f0f0f',
|
|
76
|
+
'flex-center':'display:flex;align-items:center;justify-content:center',
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
}
|
|
81
|
+
export default config;
|
|
82
|
+
|
|
83
|
+
const xconfig= {
|
|
84
|
+
// input glob pattern or array of glob pattern
|
|
85
|
+
input:'public/*.html',
|
|
86
|
+
|
|
87
|
+
// Output css file , file must exist or should be created manully if file doesnot exist
|
|
88
|
+
output:{
|
|
89
|
+
// path to main/master css file which include every compiled css declaration for given input
|
|
90
|
+
location:'./public/css/acss.css',
|
|
91
|
+
"--file":true// output css file for each file
|
|
92
|
+
},
|
|
93
|
+
|
|
94
|
+
//---------------Below this are all optional -------------------------
|
|
95
|
+
// Customize media prefix selector
|
|
96
|
+
media:{
|
|
97
|
+
prefix:{
|
|
98
|
+
xs:'@media (max-width : 600px)'
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
// support for css Module
|
|
102
|
+
'--module':true,
|
|
103
|
+
|
|
104
|
+
// import module as i.e import x form 'page.module.css'
|
|
105
|
+
importModuleAs:'x',
|
|
106
|
+
|
|
107
|
+
// uncomment minify is true if you want main css file to be minified by cssnano
|
|
108
|
+
|
|
109
|
+
// minify:true,
|
|
110
|
+
|
|
111
|
+
// name of extractorFunction
|
|
112
|
+
extractorFunction:"x",
|
|
113
|
+
|
|
114
|
+
// prefix aliascss ac-bgc-red ac--hover-color-red
|
|
115
|
+
// prefix:'ac',
|
|
116
|
+
|
|
117
|
+
//Truncate the css file , you should let it true unless you know what your are doing
|
|
118
|
+
truncate:true,
|
|
119
|
+
|
|
120
|
+
//ADD Custom color Value
|
|
121
|
+
custom:{
|
|
122
|
+
colors:{
|
|
123
|
+
//custom name for color value must not have "-" or "_" to work perfectly.
|
|
124
|
+
'main':"rgb(12,23,45)",// now you can use bgc-main
|
|
125
|
+
'theme':'#c6c6c6'
|
|
126
|
+
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
},
|
|
130
|
+
// Create your own compiler
|
|
131
|
+
extend:{
|
|
132
|
+
'font-size':{
|
|
133
|
+
alias:'fs',
|
|
134
|
+
values:["2rem:xl"],
|
|
135
|
+
compiler:(value)=>{
|
|
136
|
+
return value;
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
'txt-color':{
|
|
140
|
+
proerty:'color',
|
|
141
|
+
extend:'color' // now you can use txt-color in place color
|
|
142
|
+
},
|
|
143
|
+
|
|
144
|
+
// Now you can use shadow as className property e.g shadow-xs
|
|
145
|
+
'shadow':{
|
|
146
|
+
property:'box-shadow',
|
|
147
|
+
compiler:(value)=>{
|
|
148
|
+
value=value.slice(1);
|
|
149
|
+
const values={
|
|
150
|
+
'3xl': ' 0px 32px 64px -12px var(--shadow-color)',
|
|
151
|
+
'xxxl': ' 0px 32px 64px -12px var(--shadow-color)',
|
|
152
|
+
'2xl': ' 0px 24px 48px -12px var(--shadow-color)',
|
|
153
|
+
'xxl': ' 0px 24px 48px -12px var(--shadow-color)',
|
|
154
|
+
'xl': ' 0px 20px 24px -4px var(--shadow-color)',
|
|
155
|
+
'lg': ' 0px 12px 16px -4px var(--shadow-color)',
|
|
156
|
+
'md': ' 0px 4px 8px -2px var(--shadow-color)',
|
|
157
|
+
'sm': ' 0px 1px 3px var(--shadow-color)',
|
|
158
|
+
'xs': ' 0px 1px 2px var(--shadow-color)',
|
|
159
|
+
};
|
|
160
|
+
if(values.hasOwnProperty(value)) return values[value];
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
// predefine className
|
|
166
|
+
prebuild:{
|
|
167
|
+
|
|
168
|
+
'text-xl': 'font-size:20px;line-height:30px',
|
|
169
|
+
'text-lg': 'font-size:18px;line-height:28px',
|
|
170
|
+
'text-md': 'font-size:16px;line-height:24px',
|
|
171
|
+
'text-sm': 'font-size:14px;line-height:20px',
|
|
172
|
+
'text-xs': 'font-size:12px;line-height:18px',
|
|
173
|
+
|
|
174
|
+
'radius-xs':'border-radius:4px',
|
|
175
|
+
|
|
176
|
+
'flex-center':'display:flex;align-items:center;justify-content:center',
|
|
177
|
+
},
|
|
178
|
+
//Add some css statement in every compiled css file
|
|
179
|
+
statement:`
|
|
180
|
+
:root{
|
|
181
|
+
--bg-dark-color:rgba(111,111,111,1) ;
|
|
182
|
+
--bg-light-color:rgba(21,21,21,1) ;
|
|
183
|
+
--outline-color:blue;
|
|
184
|
+
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
body{
|
|
188
|
+
font-family:BlinkMacSystemFont , -apple-system , "Segoe UI" ;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
`,
|
|
192
|
+
|
|
193
|
+
// pre group valid Aliascss classNames in single className
|
|
194
|
+
group:{
|
|
195
|
+
'container':' df fdc bsbb aic flex-shrink-1 flex-grow-1 ',
|
|
196
|
+
'section':'flex-shrink0 bsbb'
|
|
197
|
+
},
|
|
198
|
+
// if some of the className collide with other CSS framework like bootstrap and tailwindcss
|
|
199
|
+
// You wanna tell aliascss to ignore it...
|
|
200
|
+
ignore:['fs12px', 'c-red'],// these classnames will be ignored
|
|
201
|
+
}
|
package/bin/aliascss.js
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import fs from 'fs'
|
|
4
|
+
import main,{watch} from "../lib/node/compileFile.js";
|
|
5
|
+
import pkg from '../package.json' assert { type: "json" };
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
const argSupplied=process.argv;
|
|
9
|
+
|
|
10
|
+
//Version
|
|
11
|
+
if(argSupplied.indexOf('--version')!=-1){
|
|
12
|
+
console.log( 'version' ,pkg.version);
|
|
13
|
+
process.exit();
|
|
14
|
+
}
|
|
15
|
+
//Initialize args
|
|
16
|
+
const isWatch=argSupplied.indexOf('--watch')==-1?false:true;
|
|
17
|
+
const isFile=argSupplied.indexOf('--file')==-1?false:true;
|
|
18
|
+
const isConfigFile=argSupplied.indexOf('--config')==-1?false:true;
|
|
19
|
+
const isModule=argSupplied.indexOf('--module')==-1?false:true;
|
|
20
|
+
let configFileName='aliascss.config.js';
|
|
21
|
+
|
|
22
|
+
//Check if it has minimum required arguments
|
|
23
|
+
if(!isConfigFile && argSupplied.length<4){
|
|
24
|
+
console.error("Insufficient argument Provided; Required at least [input] and [output] or --config flag");
|
|
25
|
+
process.exit();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
//Just checking if there is config file
|
|
29
|
+
if(fs.existsSync(path.resolve('aliascss.config.js'))){
|
|
30
|
+
configFileName='aliascss.config.js';
|
|
31
|
+
}else if(fs.existsSync(path.resolve('aliascss.config.mjs'))){
|
|
32
|
+
configFileName='aliascss.config.mjs';
|
|
33
|
+
}
|
|
34
|
+
if(isModule){
|
|
35
|
+
configFileName='aliascss.config.mjs';
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if(isConfigFile && fs.existsSync(path.resolve(configFileName))){
|
|
39
|
+
let configFile=await import(path.resolve(configFileName));
|
|
40
|
+
//check if it has input and out file
|
|
41
|
+
if(configFile.default.hasOwnProperty('output') && configFile.default.output.location ){
|
|
42
|
+
|
|
43
|
+
// fs.closeSync(fs.openSync(configFile.default.output.location, 'w'));
|
|
44
|
+
|
|
45
|
+
// if(!fs.existsSync(path.resolve(configFile.default.output.location))){
|
|
46
|
+
// console.error('Please check if output property in aliascss.config.js has location to the output file');
|
|
47
|
+
// process.exit();
|
|
48
|
+
// }
|
|
49
|
+
|
|
50
|
+
//check for input in config file
|
|
51
|
+
if(!configFile.default.input){
|
|
52
|
+
console.error('No Input to Process : Provide input (glob-pattern) in input property of aliascss.config.js');
|
|
53
|
+
process.exit();
|
|
54
|
+
}
|
|
55
|
+
if(isWatch){
|
|
56
|
+
watch(configFile.default)
|
|
57
|
+
}else{
|
|
58
|
+
main(configFile.default)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
}else{
|
|
62
|
+
console.error('Please check if there is output property in aliascss.config.js and it has valid path to the output file');
|
|
63
|
+
process.exit();
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
}else if(isConfigFile){
|
|
67
|
+
console.error('Make sure you have aliascss.config.js in your root directory');
|
|
68
|
+
process.exit();
|
|
69
|
+
}else{
|
|
70
|
+
let input=argSupplied[2];
|
|
71
|
+
// console.log(argSupplied[2]);
|
|
72
|
+
let output=argSupplied[3];
|
|
73
|
+
if(fs.existsSync(path.resolve(output)) && input){
|
|
74
|
+
|
|
75
|
+
let config={
|
|
76
|
+
input:input,
|
|
77
|
+
output:{
|
|
78
|
+
location:output,
|
|
79
|
+
'--file':isFile
|
|
80
|
+
|
|
81
|
+
}}
|
|
82
|
+
|
|
83
|
+
//Truncate File every time we bundle
|
|
84
|
+
//fs.truncateSync(path.resolve( AliasCSS.output));
|
|
85
|
+
|
|
86
|
+
console.log('AliasCSS is compiling............started')
|
|
87
|
+
if(isWatch){
|
|
88
|
+
watch(config)
|
|
89
|
+
}else{
|
|
90
|
+
main(config)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
}else{
|
|
94
|
+
console.error("Provide Valid Input or/and Output path");
|
|
95
|
+
process.exit();
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
//--------------------end of ifelse isConfigFile.......
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|