Skip to content

Commit

Permalink
Version 2.0.15
Browse files Browse the repository at this point in the history
  • Loading branch information
Petr Brzek committed Jan 31, 2014
1 parent 290c7e2 commit 6ebf795
Show file tree
Hide file tree
Showing 9 changed files with 201 additions and 42 deletions.
28 changes: 27 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ README.md file is automatically generated.
**[Documentation](#documentation) |**

---
### Current version: v2.0.14 (2014-01-23)
### Current version: v2.0.15 (2014-01-31)
## Intro
Why LESS Hat? In August 2012, while we were developing and extending [CSS Hat](www.csshat.com) for LESS we needed universal mixins. Unfortunately, none of available were good enough that would satisfy our needs and that’s why we created new custom ones on our own, which have become the most popular mixin library for the whole LESS CSS.

Expand Down Expand Up @@ -1666,6 +1666,32 @@ Default value: 0



### <a name="hyphens"></a> &#8226; hyphens
**Summary:**

The hyphens CSS property tells the browser how to go about splitting words to improve the layout of text when line-wrapping.

Resources: **[MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/hyphens)**

**Syntax:**

Default value: manual

.hyphens(none | manual | auto)

**Example:**

div {
.hyphens(none);
}

// Result
div {
-webkit-hyphens: none;
-moz-hyphens: none;
-ms-hyphens: none;
}

### <a name="invert"></a> &#8226; invert
**Summary:**

Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "lesshat",
"version": "2.0.14",
"version": "2.0.15",
"main": "./build/lesshat.less"
}
62 changes: 49 additions & 13 deletions build/lesshat-prefixed.less
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Handcrafted by Petr Brzek, lesshat.com
// Works great with CSS Hat csshat.com

// version: v2.0.14 (2014-01-23)
// version: v2.0.15 (2014-01-31)

// TABLE OF MIXINS:
// align-content
Expand Down Expand Up @@ -56,6 +56,7 @@
// font-face
// grayscale
// hue-rotate
// hyphens
// invert
// justify-content
// keyframes
Expand Down Expand Up @@ -1429,6 +1430,35 @@

}

.lh-hyphens(...) {

@webkit_local: true;
@moz_local: true;
@ms_local: true;
@w3c_local: true;

@process: ~`(function(value){return value=value||"manual"})((function(){var args="@{arguments}";return args=args.replace(/^\[|\]$/g,"")})())`;

.result (@arguments, @signal, @boolean, @local_boolean) when (@boolean = true) and (@local_boolean = true) {
.inception (@signal, @arguments) when (@signal = 1) and (isstring(@process)) and not (iscolor(@process)) and not (isnumber(@process)) and not (iskeyword(@process)) and not (isurl(@process)) and not (ispixel(@process)) and not (ispercentage(@process)) and not (isem(@process)) { -webkit-hyphens: @process; }
.inception (@signal, @arguments) when (@signal = 1) and not (isstring(@process)) and not (iscolor(@process)) and not (isnumber(@process)) and not (iskeyword(@process)) and not (isurl(@process)) and not (ispixel(@process)) and not (ispercentage(@process)) and not (isem(@process)) {}
.inception (@signal, @arguments) when (@signal = 2) and (isstring(@process)) and not (iscolor(@process)) and not (isnumber(@process)) and not (iskeyword(@process)) and not (isurl(@process)) and not (ispixel(@process)) and not (ispercentage(@process)) and not (isem(@process)) { -moz-hyphens: @process; }
.inception (@signal, @arguments) when (@signal = 2) and not (isstring(@process)) and not (iscolor(@process)) and not (isnumber(@process)) and not (iskeyword(@process)) and not (isurl(@process)) and not (ispixel(@process)) and not (ispercentage(@process)) and not (isem(@process)) {}
.inception (@signal, @arguments) when (@signal = 3) and (isstring(@process)) and not (iscolor(@process)) and not (isnumber(@process)) and not (iskeyword(@process)) and not (isurl(@process)) and not (ispixel(@process)) and not (ispercentage(@process)) and not (isem(@process)) { -ms-hyphens: @process; }
.inception (@signal, @arguments) when (@signal = 3) and not (isstring(@process)) and not (iscolor(@process)) and not (isnumber(@process)) and not (iskeyword(@process)) and not (isurl(@process)) and not (ispixel(@process)) and not (ispercentage(@process)) and not (isem(@process)) {}
.inception (@signal, @arguments) when (@signal = 4) and (isstring(@process)) and not (iscolor(@process)) and not (isnumber(@process)) and not (iskeyword(@process)) and not (isurl(@process)) and not (ispixel(@process)) and not (ispercentage(@process)) and not (isem(@process)) { hyphens: @process; }
.inception (@signal, @arguments) when (@signal = 4) and not (isstring(@process)) and not (iscolor(@process)) and not (isnumber(@process)) and not (iskeyword(@process)) and not (isurl(@process)) and not (ispixel(@process)) and not (ispercentage(@process)) and not (isem(@process)) {}
.inception(@signal, @arguments);
}
.result (@arguments, @signal, @boolean, @local_boolean) when not (@boolean = true), not (@local_boolean = true) {}

.result(@arguments, 1, @webkit, @webkit_local);
.result(@arguments, 2, @moz, @moz_local);
.result(@arguments, 3, @ms, @ms_local);
.result(@arguments, 4, @w3c, @w3c_local);

}

.lh-invert(...) {

@webkit_local: true;
Expand Down Expand Up @@ -2248,23 +2278,29 @@

.lh-size(@width, @height) {
@unit: 'px';
.process(@width, @height) when (ispixel(@width)) and (ispixel(@height)), (isem(@width)) and (isem(@height)), (ispercentage(@width)) and (ispercentage(@height)), (iskeyword(@width)) and (iskeyword(@height)) {
width: @width;
height: @height;
.process(@width, @height) when (ispixel(@width)), (isem(@width)), (ispercentage(@width)), (iskeyword(@width)) {
.kittens(@height) when (ispixel(@height)), (isem(@height)), (ispercentage(@height)), (iskeyword(@height)) {
width: @width;
height: @height;
}
.kittens(@height) when not (ispixel(@height)) and not (isem(@height)) and not (ispercentage(@height)) and not (iskeyword(@height)) {
width: @width;
height: ~`@{height} + @{unit}`;
}
.kittens(@height);
}

.process(@width, @height) when not (ispixel(@width)) and not (ispixel(@height)) and not (isem(@width)) and not (isem(@height)) and not (ispercentage(@width)) and not (ispercentage(@height)) and not (iskeyword(@width)) and not (iskeyword(@height)) {
width: ~`@{width} + @{unit}`;
height: ~`@{height} + @{unit}`;
.process(@width, @height) when (ispixel(@height)), (isem(@height)), (ispercentage(@height)), (iskeyword(@height)) {
.kittens(@width) when (ispixel(@width)), (isem(@width)), (ispercentage(@width)), (iskeyword(@width)) {}
.kittens(@width) when not (ispixel(@width)) and not (isem(@width)) and not (ispercentage(@width)) and not (iskeyword(@width)) {
width: ~`@{width} + @{unit}`;
height: @height;
}
.kittens(@width);
}

.process(@width, @height) when not (ispixel(@width)) and (ispixel(@height)), not (isem(@width)) and (isem(@height)), not (ispercentage(@width)) and (ispercentage(@height)), not (iskeyword(@width)) and (iskeyword(@height)) {
.process(@width, @height) when not (ispixel(@width)) and not (isem(@width)) and not (ispercentage(@width)) and not (iskeyword(@width)) and not (ispixel(@height)) and not (isem(@height)) and not (ispercentage(@height)) and not (iskeyword(@height)) {
width: ~`@{width} + @{unit}`;
height: @height;
}

.process(@width, @height) when (ispixel(@width)) and not (ispixel(@height)), (isem(@width)) and not (isem(@height)), (ispercentage(@width)) and not (ispercentage(@height)), (iskeyword(@width)) and not (iskeyword(@height)) {
width: @width;
height: ~`@{height} + @{unit}`;
}

Expand Down
62 changes: 49 additions & 13 deletions build/lesshat.less
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Handcrafted by Petr Brzek, lesshat.com
// Works great with CSS Hat csshat.com

// version: v2.0.14 (2014-01-23)
// version: v2.0.15 (2014-01-31)

// TABLE OF MIXINS:
// align-content
Expand Down Expand Up @@ -56,6 +56,7 @@
// font-face
// grayscale
// hue-rotate
// hyphens
// invert
// justify-content
// keyframes
Expand Down Expand Up @@ -1429,6 +1430,35 @@

}

.hyphens(...) {

@webkit_local: true;
@moz_local: true;
@ms_local: true;
@w3c_local: true;

@process: ~`(function(value){return value=value||"manual"})((function(){var args="@{arguments}";return args=args.replace(/^\[|\]$/g,"")})())`;

.result (@arguments, @signal, @boolean, @local_boolean) when (@boolean = true) and (@local_boolean = true) {
.inception (@signal, @arguments) when (@signal = 1) and (isstring(@process)) and not (iscolor(@process)) and not (isnumber(@process)) and not (iskeyword(@process)) and not (isurl(@process)) and not (ispixel(@process)) and not (ispercentage(@process)) and not (isem(@process)) { -webkit-hyphens: @process; }
.inception (@signal, @arguments) when (@signal = 1) and not (isstring(@process)) and not (iscolor(@process)) and not (isnumber(@process)) and not (iskeyword(@process)) and not (isurl(@process)) and not (ispixel(@process)) and not (ispercentage(@process)) and not (isem(@process)) {}
.inception (@signal, @arguments) when (@signal = 2) and (isstring(@process)) and not (iscolor(@process)) and not (isnumber(@process)) and not (iskeyword(@process)) and not (isurl(@process)) and not (ispixel(@process)) and not (ispercentage(@process)) and not (isem(@process)) { -moz-hyphens: @process; }
.inception (@signal, @arguments) when (@signal = 2) and not (isstring(@process)) and not (iscolor(@process)) and not (isnumber(@process)) and not (iskeyword(@process)) and not (isurl(@process)) and not (ispixel(@process)) and not (ispercentage(@process)) and not (isem(@process)) {}
.inception (@signal, @arguments) when (@signal = 3) and (isstring(@process)) and not (iscolor(@process)) and not (isnumber(@process)) and not (iskeyword(@process)) and not (isurl(@process)) and not (ispixel(@process)) and not (ispercentage(@process)) and not (isem(@process)) { -ms-hyphens: @process; }
.inception (@signal, @arguments) when (@signal = 3) and not (isstring(@process)) and not (iscolor(@process)) and not (isnumber(@process)) and not (iskeyword(@process)) and not (isurl(@process)) and not (ispixel(@process)) and not (ispercentage(@process)) and not (isem(@process)) {}
.inception (@signal, @arguments) when (@signal = 4) and (isstring(@process)) and not (iscolor(@process)) and not (isnumber(@process)) and not (iskeyword(@process)) and not (isurl(@process)) and not (ispixel(@process)) and not (ispercentage(@process)) and not (isem(@process)) { hyphens: @process; }
.inception (@signal, @arguments) when (@signal = 4) and not (isstring(@process)) and not (iscolor(@process)) and not (isnumber(@process)) and not (iskeyword(@process)) and not (isurl(@process)) and not (ispixel(@process)) and not (ispercentage(@process)) and not (isem(@process)) {}
.inception(@signal, @arguments);
}
.result (@arguments, @signal, @boolean, @local_boolean) when not (@boolean = true), not (@local_boolean = true) {}

.result(@arguments, 1, @webkit, @webkit_local);
.result(@arguments, 2, @moz, @moz_local);
.result(@arguments, 3, @ms, @ms_local);
.result(@arguments, 4, @w3c, @w3c_local);

}

.invert(...) {

@webkit_local: true;
Expand Down Expand Up @@ -2248,23 +2278,29 @@

.size(@width, @height) {
@unit: 'px';
.process(@width, @height) when (ispixel(@width)) and (ispixel(@height)), (isem(@width)) and (isem(@height)), (ispercentage(@width)) and (ispercentage(@height)), (iskeyword(@width)) and (iskeyword(@height)) {
width: @width;
height: @height;
.process(@width, @height) when (ispixel(@width)), (isem(@width)), (ispercentage(@width)), (iskeyword(@width)) {
.kittens(@height) when (ispixel(@height)), (isem(@height)), (ispercentage(@height)), (iskeyword(@height)) {
width: @width;
height: @height;
}
.kittens(@height) when not (ispixel(@height)) and not (isem(@height)) and not (ispercentage(@height)) and not (iskeyword(@height)) {
width: @width;
height: ~`@{height} + @{unit}`;
}
.kittens(@height);
}

.process(@width, @height) when not (ispixel(@width)) and not (ispixel(@height)) and not (isem(@width)) and not (isem(@height)) and not (ispercentage(@width)) and not (ispercentage(@height)) and not (iskeyword(@width)) and not (iskeyword(@height)) {
width: ~`@{width} + @{unit}`;
height: ~`@{height} + @{unit}`;
.process(@width, @height) when (ispixel(@height)), (isem(@height)), (ispercentage(@height)), (iskeyword(@height)) {
.kittens(@width) when (ispixel(@width)), (isem(@width)), (ispercentage(@width)), (iskeyword(@width)) {}
.kittens(@width) when not (ispixel(@width)) and not (isem(@width)) and not (ispercentage(@width)) and not (iskeyword(@width)) {
width: ~`@{width} + @{unit}`;
height: @height;
}
.kittens(@width);
}

.process(@width, @height) when not (ispixel(@width)) and (ispixel(@height)), not (isem(@width)) and (isem(@height)), not (ispercentage(@width)) and (ispercentage(@height)), not (iskeyword(@width)) and (iskeyword(@height)) {
.process(@width, @height) when not (ispixel(@width)) and not (isem(@width)) and not (ispercentage(@width)) and not (iskeyword(@width)) and not (ispixel(@height)) and not (isem(@height)) and not (ispercentage(@height)) and not (iskeyword(@height)) {
width: ~`@{width} + @{unit}`;
height: @height;
}

.process(@width, @height) when (ispixel(@width)) and not (ispixel(@height)), (isem(@width)) and not (isem(@height)), (ispercentage(@width)) and not (ispercentage(@height)), (iskeyword(@width)) and not (iskeyword(@height)) {
width: @width;
height: ~`@{height} + @{unit}`;
}

Expand Down
21 changes: 21 additions & 0 deletions mixins/hyphens/hyphens.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* Hyphens mixin
*/

var hyphens = function hyphens(value) {
value = value || 'manual';

return value;
};

/**
* For which browsers is this mixin specified
*/

hyphens.vendors = ['webkit','moz','ms'];

/**
* Export mixin
*/

module.exports = hyphens;
25 changes: 25 additions & 0 deletions mixins/hyphens/hyphens.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
### <a name="hyphens"></a> &#8226; hyphens
**Summary:**

The hyphens CSS property tells the browser how to go about splitting words to improve the layout of text when line-wrapping.

Resources: **[MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/hyphens)**

**Syntax:**

Default value: manual

.hyphens(none | manual | auto)

**Example:**

div {
.hyphens(none);
}

// Result
div {
-webkit-hyphens: none;
-moz-hyphens: none;
-ms-hyphens: none;
}
9 changes: 9 additions & 0 deletions mixins/hyphens/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
var assert = require('assert');

describe('hyphens', function() {

it('should return the same value', function(done) {
test.hyphens('none', 'none', done);
});

});
32 changes: 19 additions & 13 deletions mixins/size/size.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.size(@square) {
.size(@square) {
@unit: 'px';
.process(@square) when (ispixel(@square)), (isem(@square)), (ispercentage(@square)), (iskeyword(@square)) {
width: @square;
Expand All @@ -16,23 +16,29 @@

.size(@width, @height) {
@unit: 'px';
.process(@width, @height) when (ispixel(@width)) and (ispixel(@height)), (isem(@width)) and (isem(@height)), (ispercentage(@width)) and (ispercentage(@height)), (iskeyword(@width)) and (iskeyword(@height)) {
width: @width;
height: @height;
.process(@width, @height) when (ispixel(@width)), (isem(@width)), (ispercentage(@width)), (iskeyword(@width)) {
.kittens(@height) when (ispixel(@height)), (isem(@height)), (ispercentage(@height)), (iskeyword(@height)) {
width: @width;
height: @height;
}
.kittens(@height) when not (ispixel(@height)) and not (isem(@height)) and not (ispercentage(@height)) and not (iskeyword(@height)) {
width: @width;
height: ~`@{height} + @{unit}`;
}
.kittens(@height);
}

.process(@width, @height) when not (ispixel(@width)) and not (ispixel(@height)) and not (isem(@width)) and not (isem(@height)) and not (ispercentage(@width)) and not (ispercentage(@height)) and not (iskeyword(@width)) and not (iskeyword(@height)) {
width: ~`@{width} + @{unit}`;
height: ~`@{height} + @{unit}`;
.process(@width, @height) when (ispixel(@height)), (isem(@height)), (ispercentage(@height)), (iskeyword(@height)) {
.kittens(@width) when (ispixel(@width)), (isem(@width)), (ispercentage(@width)), (iskeyword(@width)) {}
.kittens(@width) when not (ispixel(@width)) and not (isem(@width)) and not (ispercentage(@width)) and not (iskeyword(@width)) {
width: ~`@{width} + @{unit}`;
height: @height;
}
.kittens(@width);
}

.process(@width, @height) when not (ispixel(@width)) and (ispixel(@height)), not (isem(@width)) and (isem(@height)), not (ispercentage(@width)) and (ispercentage(@height)), not (iskeyword(@width)) and (iskeyword(@height)) {
.process(@width, @height) when not (ispixel(@width)) and not (isem(@width)) and not (ispercentage(@width)) and not (iskeyword(@width)) and not (ispixel(@height)) and not (isem(@height)) and not (ispercentage(@height)) and not (iskeyword(@height)) {
width: ~`@{width} + @{unit}`;
height: @height;
}

.process(@width, @height) when (ispixel(@width)) and not (ispixel(@height)), (isem(@width)) and not (isem(@height)), (ispercentage(@width)) and not (ispercentage(@height)), (iskeyword(@width)) and not (iskeyword(@height)) {
width: @width;
height: ~`@{height} + @{unit}`;
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "lesshat",
"description": "Most advanced LESS CSS mixins library",
"version": "2.0.14",
"version": "2.0.15",
"homepage": "http://lesshat.com/",
"author": {
"name": "Petr Brzek",
Expand Down

0 comments on commit 6ebf795

Please sign in to comment.