Skip to content

Commit b3ea8fc

Browse files
committed
Update to tailwind.tss v2.0.3
1 parent a07893b commit b3ea8fc

19 files changed

+4203
-93
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ tmp
1010
.project
1111
.settings
1212
Thumbs.db
13+
/node_modules

.vscode/extensions.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"recommendations": [
3+
"axway.vscode-titanium"
4+
]
5+
}

.vscode/settings.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"files.exclude": {
3+
"build/": true,
4+
"i18n/": true,
5+
"platform/": true,
6+
"Resources/": true,
7+
"node_modules/": true,
8+
"package-lock.json": true
9+
},
10+
"search.exclude": {
11+
"build/": true,
12+
"i18n/": true,
13+
"platform/": true,
14+
"Resources/": true,
15+
"node_modules/": true,
16+
"package-lock.json": true
17+
},
18+
"files.watcherExclude": {
19+
"build/": true,
20+
"i18n/": true,
21+
"platform/": true,
22+
"Resources/": true,
23+
"node_modules/": true,
24+
"package-lock.json": true
25+
}
26+
}

app/alloy.jmk

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
task('pre:compile', function(event, logger) {
2+
require('child_process').execSync('purgetss', logger.warn('::purgeTSS:: Auto-Purging ' + event.dir.project));
3+
});
2.15 KB
Binary file not shown.
0 Bytes
Binary file not shown.
548 Bytes
Binary file not shown.

app/config.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@
77
"os:android": {},
88
"os:ios": {},
99
"os:windows": {},
10-
"dependencies": {}
10+
"dependencies": {},
11+
"backbone": "1.4.0"
1112
}

app/lib/contrastRatio.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// function from https://stackoverflow.com/a/5624139/3695983
2+
function hexToRgb(hex) {
3+
var shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
4+
hex = hex.replace(shorthandRegex, function(m, r, g, b) {
5+
return r + r + g + g + b + b;
6+
});
7+
8+
var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
9+
return result ? {
10+
r: parseInt(result[ 1 ], 16),
11+
g: parseInt(result[ 2 ], 16),
12+
b: parseInt(result[ 3 ], 16)
13+
} : null;
14+
}
15+
16+
// function from https://stackoverflow.com/a/9733420/3695983
17+
function luminance(r, g, b) {
18+
var a = [ r, g, b ].map(function(v) {
19+
v /= 255;
20+
return v <= 0.03928
21+
? v / 12.92
22+
: Math.pow((v + 0.055) / 1.055, 2.4);
23+
});
24+
return a[ 0 ] * 0.2126 + a[ 1 ] * 0.7152 + a[ 2 ] * 0.0722;
25+
}
26+
27+
// usage:
28+
function calculateRatio(color1, color2) {
29+
const color1rgb = hexToRgb(color1);
30+
const color2rgb = hexToRgb(color2);
31+
32+
// calculate the relative luminance
33+
const color1luminance = luminance(color1rgb.r, color1rgb.g, color1rgb.b);
34+
const color2luminance = luminance(color2rgb.r, color2rgb.g, color2rgb.b);
35+
36+
// calculate the color contrast ratio
37+
const ratio = color1luminance > color2luminance
38+
? ((color2luminance + 0.05) / (color1luminance + 0.05))
39+
: ((color1luminance + 0.05) / (color2luminance + 0.05));
40+
41+
return Number(1 / ratio).toFixed(2);
42+
}
43+
exports.calculateRatio = calculateRatio;

app/styles/_app.tss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
contentHeight: Ti.UI.SIZE
55
}
66

7-
'ScrollView[plaform=android]': {
7+
'ScrollView[platform=android]': {
88
scrollType: 'vertical'
99
}
1010

0 commit comments

Comments
 (0)