purgetss 3.0.4 → 3.1.2
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/.editorconfig +1 -1
- package/README.md +3 -3
- package/assets/fonts/bootstrap-icons.ttf +0 -0
- package/assets/fonts/tabler-icons.ttf +0 -0
- package/assets/images/blend-modes.png +0 -0
- package/assets/images/shadow.png +0 -0
- package/bin/purgetss +6 -5
- package/dist/bootstrapicons.js +1714 -0
- package/dist/bootstrapicons.tss +1692 -0
- package/dist/tablericons.js +95 -1
- package/dist/tablericons.tss +94 -0
- package/dist/tailwind.tss +3242 -411
- package/docs/configuring-guide.md +18 -5
- package/docs/glossary.md +3 -4
- package/docs/new-glossary.md +8313 -0
- package/docs/whats-new/v2.5.0.md +6 -6
- package/docs/whats-new/v3.0.4.md +7 -6
- package/docs/whats-new/v3.0.5.md +136 -0
- package/docs/whats-new/v3.1.0.md +614 -0
- package/docs/whats-new/v3.1.1.md +262 -0
- package/index.js +397 -246
- package/lib/build-bootstrap-icons-js.js +64 -0
- package/lib/build-bootstrap-icons-tss.js +50 -0
- package/lib/build-fonts-folder.js +7 -0
- package/lib/build-tailwind.js +78 -16
- package/lib/helpers.js +2027 -764
- package/lib/templates/bootstrap-icons/bootstrap-icons.css +1705 -0
- package/lib/templates/bootstrap-icons/bootstrap-icons.ttf +0 -0
- package/lib/templates/bootstrap-icons/reset.tss +6 -0
- package/lib/templates/bootstrap-icons/template.js +4 -0
- package/lib/templates/bootstrap-icons/template.tss +2 -0
- package/lib/templates/custom-template.tss +1 -1
- package/lib/templates/tablericons/template.js +1 -1
- package/lib/templates/tailwind/custom-template.tss +1 -1
- package/lib/templates/tailwind/template.tss +1 -1
- package/lib/test-function.js +9 -0
- package/package.json +8 -5
- package/purgetss.config.js +950 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const _ = require('lodash');
|
|
3
|
+
const read = require('read-css');
|
|
4
|
+
const colores = require('./colores').colores;
|
|
5
|
+
const purgeLabel = colores.purgeLabel;
|
|
6
|
+
|
|
7
|
+
if (!fs.existsSync('./dist')) {
|
|
8
|
+
fs.mkdirSync('./dist')
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
(function constructor() {
|
|
12
|
+
'use strict';
|
|
13
|
+
|
|
14
|
+
read('./lib/templates/bootstrap-icons/bootstrap-icons.css', (err, data) => {
|
|
15
|
+
if (err) throw err
|
|
16
|
+
|
|
17
|
+
let rules = _.map(data.stylesheet.rules, rule => {
|
|
18
|
+
if (rule.type === 'rule' && rule.selectors[0].includes('::before') && !rule.selectors[0].includes('bi::before')) {
|
|
19
|
+
return {
|
|
20
|
+
'selector': rule.selectors[0].replace('::before', '').replace('.', ''),
|
|
21
|
+
'property': rule.declarations[0].value.replace('\"\\', '').replace('\"', '')
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
let bootstrapicons = fs.readFileSync('./lib/templates/bootstrap-icons/template.js', 'utf8');
|
|
27
|
+
|
|
28
|
+
bootstrapicons += '\n' + fs.readFileSync('./lib/templates/icon-functions.js', 'utf8');
|
|
29
|
+
|
|
30
|
+
let exportIcons = '\nconst icons = {\n';
|
|
31
|
+
|
|
32
|
+
_.each(rules, rule => {
|
|
33
|
+
if (rule) {
|
|
34
|
+
exportIcons += `\t'${prettifyFontName(rule.selector)}': '\\u${rule.property}',\n`;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
exportIcons += '};\n';
|
|
39
|
+
|
|
40
|
+
exportIcons += 'exports.icons = icons;\n';
|
|
41
|
+
|
|
42
|
+
bootstrapicons += exportIcons;
|
|
43
|
+
|
|
44
|
+
fs.writeFileSync('./dist/bootstrapicons.js', bootstrapicons, err => {
|
|
45
|
+
throw err;
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
console.log(`${purgeLabel} './dist/bootstrapicons.js' file created!`);
|
|
49
|
+
});
|
|
50
|
+
}());
|
|
51
|
+
|
|
52
|
+
function prettifyFontName(str) {
|
|
53
|
+
str = str.replace('bi-', '');
|
|
54
|
+
var temp = str.split('-'), i, pretty;
|
|
55
|
+
|
|
56
|
+
for (i = 0; i < temp.length; i++) {
|
|
57
|
+
temp[i] = temp[i].charAt(0).toUpperCase() + temp[i].slice(1);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
pretty = temp.join('');
|
|
61
|
+
pretty = pretty.replace(/^.{1}/g, pretty[0].toLowerCase());
|
|
62
|
+
|
|
63
|
+
return pretty;
|
|
64
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const _ = require('lodash');
|
|
3
|
+
const readCSS = require('read-css');
|
|
4
|
+
const colores = require('./colores').colores;
|
|
5
|
+
const purgeLabel = colores.purgeLabel;
|
|
6
|
+
|
|
7
|
+
if (!fs.existsSync('./dist')) {
|
|
8
|
+
fs.mkdirSync('./dist')
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
(function constructor() {
|
|
12
|
+
'use strict';
|
|
13
|
+
|
|
14
|
+
readCSS('./lib/templates/bootstrap-icons/bootstrap-icons.css', (err, data) => {
|
|
15
|
+
if (err) throw err
|
|
16
|
+
|
|
17
|
+
let tssClasses = fs.readFileSync('./lib/templates/bootstrap-icons/template.tss', 'utf8') + '\n';
|
|
18
|
+
|
|
19
|
+
tssClasses += fs.readFileSync('./lib/templates/bootstrap-icons/reset.tss', 'utf8');
|
|
20
|
+
|
|
21
|
+
tssClasses += processCSS(data);
|
|
22
|
+
|
|
23
|
+
fs.writeFileSync('./dist/bootstrapicons.tss', tssClasses, err => {
|
|
24
|
+
throw err;
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
console.log(`${purgeLabel} './dist/bootstrapicons.tss' file created!`);
|
|
28
|
+
});
|
|
29
|
+
}());
|
|
30
|
+
|
|
31
|
+
function processCSS(data) {
|
|
32
|
+
let rules = _.map(data.stylesheet.rules, rule => {
|
|
33
|
+
if (rule.type === 'rule' && rule.selectors[0].includes('::before') && !rule.selectors[0].includes('bi::before')) {
|
|
34
|
+
return {
|
|
35
|
+
'selector': rule.selectors[0].replace('::before', ''),
|
|
36
|
+
'property': rule.declarations[0].value.replace('\"\\', '').replace('\"', '')
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
let paraTSS = '';
|
|
42
|
+
|
|
43
|
+
_.each(rules, rule => {
|
|
44
|
+
if (rule) {
|
|
45
|
+
paraTSS += `'${rule.selector}': { text: '\\u${rule.property}', title: '\\u${rule.property}' }\n`;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
return paraTSS;
|
|
50
|
+
}
|
|
@@ -44,4 +44,11 @@ function callback(err) {
|
|
|
44
44
|
fs.copyFile(sourceFontsFolder + '/tabler-icons.ttf', detinationFontsFolder + '/tabler-icons.ttf', callback);
|
|
45
45
|
|
|
46
46
|
console.log(`${purgeLabel} tabler-icons.ttf copied to './assets/fonts'`);
|
|
47
|
+
|
|
48
|
+
// bootstrap-icons
|
|
49
|
+
sourceFontsFolder = './lib/templates/bootstrap-icons';
|
|
50
|
+
|
|
51
|
+
fs.copyFile(sourceFontsFolder + '/bootstrap-icons.ttf', detinationFontsFolder + '/bootstrap-icons.ttf', callback);
|
|
52
|
+
|
|
53
|
+
console.log(`${purgeLabel} bootstrap-icons.ttf copied to './assets/fonts'`);
|
|
47
54
|
}());
|
package/lib/build-tailwind.js
CHANGED
|
@@ -29,90 +29,148 @@ if (!fs.existsSync('./dist')) {
|
|
|
29
29
|
|
|
30
30
|
// Template
|
|
31
31
|
let combinedColors = { transparent: 'transparent', ...defaultColors };
|
|
32
|
-
let combinedSpacing = { ...defaultTheme.spacing };
|
|
32
|
+
// let combinedSpacing = { ...defaultTheme.spacing };
|
|
33
|
+
let combinedSpacing = { ...defaultTheme.width({ theme: () => (defaultTheme.spacing) }), ...defaultTheme.height({ theme: () => (defaultTheme.spacing) }) };
|
|
33
34
|
let convertedStyles = fs.readFileSync('./lib/templates/tailwind/template.tss', 'utf8');
|
|
34
35
|
|
|
35
36
|
combinedSpacing = fixOneThirds(combinedSpacing);
|
|
36
37
|
|
|
38
|
+
delete combinedSpacing.min;
|
|
39
|
+
delete combinedSpacing.max;
|
|
40
|
+
delete combinedSpacing.fit;
|
|
41
|
+
|
|
37
42
|
convertedStyles += helpers.resetStyles();
|
|
43
|
+
//
|
|
44
|
+
convertedStyles += helpers.activeIconIsMask();
|
|
38
45
|
convertedStyles += helpers.activeTintColor(combinedColors);
|
|
39
46
|
convertedStyles += helpers.activeTitleColor(combinedColors);
|
|
47
|
+
convertedStyles += helpers.activityEnterTransition();
|
|
48
|
+
convertedStyles += helpers.activityExitTransition();
|
|
49
|
+
convertedStyles += helpers.activityIndicatorStyle();
|
|
50
|
+
convertedStyles += helpers.activityReenterTransition();
|
|
51
|
+
convertedStyles += helpers.activityReturnTransition();
|
|
52
|
+
convertedStyles += helpers.activitySharedElementEnterTransition();
|
|
53
|
+
convertedStyles += helpers.activitySharedElementExitTransition();
|
|
54
|
+
convertedStyles += helpers.activitySharedElementReenterTransition();
|
|
55
|
+
convertedStyles += helpers.activitySharedElementReturnTransition();
|
|
56
|
+
convertedStyles += helpers.allowUserCustomization();
|
|
57
|
+
convertedStyles += helpers.autoAdjustScrollViewInsets();
|
|
40
58
|
convertedStyles += helpers.autocapitalization();
|
|
41
59
|
convertedStyles += helpers.autocorrect();
|
|
42
60
|
convertedStyles += helpers.autofillType();
|
|
43
61
|
convertedStyles += helpers.autoLink();
|
|
44
62
|
convertedStyles += helpers.autoreverse();
|
|
63
|
+
convertedStyles += helpers.backgroundBlendMode();
|
|
45
64
|
convertedStyles += helpers.backgroundColor(combinedColors);
|
|
46
65
|
convertedStyles += helpers.backgroundSelectedColor(combinedColors);
|
|
47
66
|
convertedStyles += helpers.barColor(combinedColors);
|
|
67
|
+
convertedStyles += helpers.barTitleColor(combinedColors);
|
|
68
|
+
convertedStyles += helpers.barTitleShadow();
|
|
69
|
+
convertedStyles += helpers.barTitleShadowColor(combinedColors);
|
|
48
70
|
convertedStyles += helpers.borderColor(combinedColors);
|
|
49
71
|
convertedStyles += helpers.borderRadiusExtraStyles({ ...combinedSpacing, ...defaultTheme.borderRadius });
|
|
50
72
|
convertedStyles += helpers.borderStyle();
|
|
51
73
|
convertedStyles += helpers.borderWidth(defaultTheme.borderWidth);
|
|
52
|
-
convertedStyles += helpers.
|
|
74
|
+
convertedStyles += helpers.bottomNavigation(combinedSpacing);
|
|
75
|
+
convertedStyles += helpers.bubbleParent();
|
|
53
76
|
convertedStyles += helpers.cacheSize();
|
|
54
77
|
convertedStyles += helpers.clipMode();
|
|
55
78
|
convertedStyles += helpers.currentPageIndicatorColor(combinedColors);
|
|
79
|
+
convertedStyles += helpers.disableBounce();
|
|
56
80
|
convertedStyles += helpers.displayCaps();
|
|
57
81
|
convertedStyles += helpers.displayUtilities();
|
|
58
82
|
convertedStyles += helpers.draggingConstraints();
|
|
59
83
|
convertedStyles += helpers.draggingType();
|
|
84
|
+
convertedStyles += helpers.dropShadow();
|
|
85
|
+
convertedStyles += helpers.dropShadowColor(combinedColors);
|
|
60
86
|
convertedStyles += helpers.editable();
|
|
61
87
|
convertedStyles += helpers.ellipsize();
|
|
62
88
|
convertedStyles += helpers.enableCopy();
|
|
63
89
|
convertedStyles += helpers.enableReturnKey();
|
|
64
|
-
convertedStyles += helpers.extendBackground();
|
|
65
90
|
convertedStyles += helpers.exitOnClose();
|
|
91
|
+
convertedStyles += helpers.extendBackground();
|
|
92
|
+
convertedStyles += helpers.extendEdges();
|
|
93
|
+
convertedStyles += helpers.extendSafeArea();
|
|
94
|
+
convertedStyles += helpers.flagSecure();
|
|
66
95
|
convertedStyles += helpers.flip();
|
|
67
96
|
convertedStyles += helpers.fontSize(defaultTheme.fontSize);
|
|
68
97
|
convertedStyles += helpers.fontStyle();
|
|
69
98
|
convertedStyles += helpers.fontWeight(defaultTheme.fontWeight);
|
|
70
|
-
convertedStyles += helpers.
|
|
99
|
+
convertedStyles += helpers.fullscreen();
|
|
100
|
+
convertedStyles += helpers.gap(combinedSpacing);
|
|
71
101
|
convertedStyles += helpers.gradientColorStops(combinedColors);
|
|
72
102
|
convertedStyles += helpers.gridColumnsStartEnd();
|
|
73
103
|
convertedStyles += helpers.gridFlow();
|
|
74
104
|
convertedStyles += helpers.gridSystem();
|
|
75
|
-
|
|
76
|
-
convertedStyles += helpers.
|
|
105
|
+
convertedStyles += helpers.height(combinedSpacing);
|
|
106
|
+
convertedStyles += helpers.hidesBackButton();
|
|
107
|
+
convertedStyles += helpers.hidesBarsOnSwipe();
|
|
108
|
+
convertedStyles += helpers.hidesBarsOnTap();
|
|
109
|
+
convertedStyles += helpers.hidesBarsWhenKeyboardAppears();
|
|
110
|
+
convertedStyles += helpers.hideShadow();
|
|
111
|
+
convertedStyles += helpers.hidesSearchBarWhenScrolling();
|
|
112
|
+
convertedStyles += helpers.homeIndicatorAutoHidden();
|
|
113
|
+
convertedStyles += helpers.iconIsMask();
|
|
114
|
+
convertedStyles += helpers.includeOpaqueBars();
|
|
115
|
+
convertedStyles += helpers.indicatorColor(combinedColors);
|
|
77
116
|
convertedStyles += helpers.interactivity();
|
|
78
117
|
convertedStyles += helpers.items();
|
|
79
118
|
convertedStyles += helpers.keepScreenOn();
|
|
119
|
+
convertedStyles += helpers.keepSectionsInSearch();
|
|
80
120
|
convertedStyles += helpers.keyboardAppearance();
|
|
121
|
+
convertedStyles += helpers.keyboardDismissMode();
|
|
81
122
|
convertedStyles += helpers.keyboardType();
|
|
123
|
+
convertedStyles += helpers.largeTitleDisplayMode();
|
|
124
|
+
convertedStyles += helpers.largeTitleEnabled();
|
|
82
125
|
convertedStyles += helpers.layout();
|
|
126
|
+
convertedStyles += helpers.lazyLoadingEnabled();
|
|
83
127
|
convertedStyles += helpers.linearGradient();
|
|
128
|
+
convertedStyles += helpers.loginKeyboardType();
|
|
129
|
+
convertedStyles += helpers.loginReturnKeyType();
|
|
84
130
|
convertedStyles += helpers.margin(combinedSpacing);
|
|
131
|
+
convertedStyles += helpers.modal();
|
|
132
|
+
convertedStyles += helpers.navBarHidden();
|
|
85
133
|
convertedStyles += helpers.navTintColor(combinedColors);
|
|
86
134
|
convertedStyles += helpers.opacity(defaultTheme.opacity);
|
|
135
|
+
convertedStyles += helpers.orientationModes();
|
|
87
136
|
convertedStyles += helpers.origin();
|
|
88
137
|
convertedStyles += helpers.overlay();
|
|
89
138
|
convertedStyles += helpers.padding(combinedSpacing);
|
|
90
|
-
|
|
91
139
|
convertedStyles += helpers.pageIndicatorColor(combinedColors);
|
|
92
140
|
convertedStyles += helpers.pagingControl();
|
|
93
141
|
convertedStyles += helpers.pagingControlAlpha(defaultTheme.opacity);
|
|
94
142
|
convertedStyles += helpers.pagingControlColor(combinedColors);
|
|
95
|
-
convertedStyles += helpers.pagingControlHeight(
|
|
143
|
+
convertedStyles += helpers.pagingControlHeight(combinedSpacing);
|
|
96
144
|
convertedStyles += helpers.pagingControlOnTop();
|
|
97
|
-
convertedStyles += helpers.pagingControlTimeout(defaultTheme.transitionDelay);
|
|
98
|
-
|
|
145
|
+
convertedStyles += helpers.pagingControlTimeout({ ...{ '0': '0ms', '25': '25ms', '50': '50ms', '2000': '2000ms', '3000': '3000ms', '4000': '4000ms', '5000': '5000ms' }, ...defaultTheme.transitionDelay });
|
|
146
|
+
convertedStyles += helpers.passwordKeyboardType();
|
|
147
|
+
convertedStyles += helpers.pickerType();
|
|
99
148
|
convertedStyles += helpers.placeholderColor(combinedColors);
|
|
100
149
|
convertedStyles += helpers.placement();
|
|
101
150
|
convertedStyles += helpers.preventDefaultImage();
|
|
102
|
-
|
|
103
151
|
convertedStyles += helpers.radialGradient();
|
|
104
152
|
convertedStyles += helpers.repeat();
|
|
105
153
|
convertedStyles += helpers.returnKeyType();
|
|
106
154
|
convertedStyles += helpers.rotate(defaultTheme.rotate);
|
|
107
|
-
convertedStyles += helpers.scale(defaultTheme.scale);
|
|
155
|
+
convertedStyles += helpers.scale({ ...{ 5: '.05', 10: '.10', 25: '.25' }, ...defaultTheme.scale });
|
|
108
156
|
convertedStyles += helpers.scrollableRegion();
|
|
109
157
|
convertedStyles += helpers.scrollIndicators();
|
|
110
|
-
convertedStyles += helpers.
|
|
158
|
+
convertedStyles += helpers.scrollingEnabled();
|
|
111
159
|
convertedStyles += helpers.scrollType();
|
|
112
160
|
convertedStyles += helpers.shadow();
|
|
113
161
|
convertedStyles += helpers.shadowColor(combinedColors);
|
|
162
|
+
convertedStyles += helpers.shiftMode();
|
|
163
|
+
convertedStyles += helpers.showAsAction();
|
|
114
164
|
convertedStyles += helpers.showCancel();
|
|
165
|
+
convertedStyles += helpers.smoothScrollOnTabClick();
|
|
166
|
+
convertedStyles += helpers.statusBar();
|
|
167
|
+
convertedStyles += helpers.sustainedPerformanceMode();
|
|
168
|
+
convertedStyles += helpers.swipeToClose();
|
|
169
|
+
convertedStyles += helpers.tabBarHidden();
|
|
170
|
+
convertedStyles += helpers.tabGroupStyle();
|
|
115
171
|
convertedStyles += helpers.tabsBackgroundColor(combinedColors);
|
|
172
|
+
convertedStyles += helpers.tabsBackgroundSelectedColor(combinedColors);
|
|
173
|
+
convertedStyles += helpers.tabsTranslucent();
|
|
116
174
|
convertedStyles += helpers.textAlign();
|
|
117
175
|
convertedStyles += helpers.textColor(combinedColors);
|
|
118
176
|
convertedStyles += helpers.tiMedia();
|
|
@@ -120,10 +178,14 @@ if (!fs.existsSync('./dist')) {
|
|
|
120
178
|
convertedStyles += helpers.titleColor(combinedColors);
|
|
121
179
|
convertedStyles += helpers.touchFeedbackColor(combinedColors);
|
|
122
180
|
convertedStyles += helpers.transition();
|
|
123
|
-
convertedStyles += helpers.transitionDelay(defaultTheme.transitionDelay);
|
|
124
|
-
convertedStyles += helpers.transitionDuration(defaultTheme.transitionDuration);
|
|
181
|
+
convertedStyles += helpers.transitionDelay({ ...{ '0': '0ms', '25': '25ms', '50': '50ms', '2000': '2000ms', '3000': '3000ms', '4000': '4000ms', '5000': '5000ms' }, ...defaultTheme.transitionDelay });
|
|
182
|
+
convertedStyles += helpers.transitionDuration({ ...{ 0: '0ms', 25: '25ms', 50: '50ms' }, ...defaultTheme.transitionDuration });
|
|
183
|
+
convertedStyles += helpers.translucent();
|
|
184
|
+
convertedStyles += helpers.useSpinner();
|
|
125
185
|
convertedStyles += helpers.verticalAlignment();
|
|
126
|
-
convertedStyles += helpers.width(
|
|
186
|
+
convertedStyles += helpers.width(combinedSpacing);
|
|
187
|
+
convertedStyles += helpers.windowPixelFormat();
|
|
188
|
+
convertedStyles += helpers.windowSoftInputMode();
|
|
127
189
|
convertedStyles += helpers.zIndex(defaultTheme.zIndex);
|
|
128
190
|
|
|
129
191
|
saveFile('./dist/tailwind.tss', convertedStyles);
|