From 4a46df61fac860a99ce84dfd587bb87ad07dd1a8 Mon Sep 17 00:00:00 2001 From: evecalm Date: Fri, 18 Jul 2014 16:09:24 +0800 Subject: [PATCH 1/5] add mixin `position` --- README.md | 34 +++++++++++++++++++- bower.json | 2 +- build/lesshat-prefixed.less | 59 ++++++++++++++++++++++++++++++++++- build/lesshat.less | 59 ++++++++++++++++++++++++++++++++++- mixins/position/position.less | 55 ++++++++++++++++++++++++++++++++ mixins/position/position.md | 31 ++++++++++++++++++ package.json | 2 +- 7 files changed, 237 insertions(+), 5 deletions(-) create mode 100644 mixins/position/position.less create mode 100644 mixins/position/position.md diff --git a/README.md b/README.md index 178b5d6..daba7e6 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ README.md file is automatically generated. **[Documentation](#documentation) |** --- -### Current version: v3.0.2 (2014-06-26) +### Current version: v3.0.3 (2014-07-18) ## What's new? * Compiling LESS Hat is much more faster (up to 60× times). @@ -1975,6 +1975,38 @@ Resources: **[CSS-Tricks](http://css-tricks.com/snippets/css/style-placeholder-t +### • position +**Summary:** + +This is helper mixin for fast position setup. + +**Syntax:** + + .position(, [,,,]) + +**Tips and tricks:** + + - When you call mixin with only one argument, second will be the same. + Also you can omit units and `position` adds `px` automatically. + - When set `position` to `static` you will get nothing. See more: [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/position#Values). + - You can use named variable to specify special side's offset. + +**Example:** + + div { + .position(absolute, 20, 30px, @left: 40px); + } + + // Result + div { + position: absolute; + top: 20px; + right: 30px; + left: 40px; + } + + + ### • rotate **Summary:** diff --git a/bower.json b/bower.json index f1cc6bd..02057a7 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "lesshat", - "version": "3.0.2", + "version": "3.0.3", "main": [ "./build/lesshat.less", "./build/lesshat-prefixed.less" diff --git a/build/lesshat-prefixed.less b/build/lesshat-prefixed.less index 39c904f..41aecce 100644 --- a/build/lesshat-prefixed.less +++ b/build/lesshat-prefixed.less @@ -6,7 +6,7 @@ // Handcrafted by Petr Brzek, lesshat.com // Works great with CSS Hat csshat.com -// version: v3.0.2 (2014-06-26) +// version: v3.0.3 (2014-07-18) // TABLE OF MIXINS: // align-content @@ -65,6 +65,7 @@ // perspective // perspective-origin // placeholder + // position // rotate // rotate3d // rotateX @@ -576,6 +577,62 @@ .inception(@arguments); } +.lh-position(@position: '', @top: '', @right: '', @bottom: '', @left: '') when (iskeyword(@position)) and not (@position = static ) { + + // default unit + @unit: 'px'; + + position: @position; + + .mix-top(@top) when (isnumber(@top)) { + // with unit + .mix(@top) when not (unit(@top) = @top) { + top: @top; + } + // without unit + .mix(@top) when (unit(@top) = @top) { + top: ~`@{top} + @{unit}`; + } + .mix(@top); + } + + .mix-right(@right) when (isnumber(@right)) { + .mix(@right) when not (unit(@right) = @right) { + right: @right; + } + .mix(@right) when (unit(@right) = @right) { + right: ~`@{right} + @{unit}`; + } + .mix(@right); + } + + .mix-bottom(@bottom) when (isnumber(@bottom)) { + .mix(@bottom) when not (unit(@bottom) = @bottom) { + bottom: @bottom; + } + .mix(@bottom) when (unit(@bottom) = @bottom) { + bottom: ~`@{bottom} + @{unit}`; + } + .mix(@bottom); + } + + .mix-left(@left) when (isnumber(@left)) { + .mix(@left) when not (unit(@left) = @left) { + left: @left; + } + .mix(@left) when (unit(@left) = @left) { + left: ~`@{left} + @{unit}`; + } + .mix(@left); + } + + // get top right bottom left + .mix-top(@top); + .mix-right(@right); + .mix-bottom(@bottom); + .mix-left(@left); +} + .lh-rotate(...) { @process: ~`(function(e){e=e||"0";var r=/\d/gi,t=/(?:\s|^)(\.?\d+\.?\d*)(?![^(]*\)|\w|%|\.)/gi;return r.test(e)&&(e=e.replace(t,function(e){return 0==e&&e||e+"deg"})),e})((function(){var e="@{arguments}";return e=e.replace(/^\[|\]$/g,"")})())`; -webkit-transform: rotate(@process); diff --git a/build/lesshat.less b/build/lesshat.less index 882c1dd..499476c 100644 --- a/build/lesshat.less +++ b/build/lesshat.less @@ -6,7 +6,7 @@ // Handcrafted by Petr Brzek, lesshat.com // Works great with CSS Hat csshat.com -// version: v3.0.2 (2014-06-26) +// version: v3.0.3 (2014-07-18) // TABLE OF MIXINS: // align-content @@ -65,6 +65,7 @@ // perspective // perspective-origin // placeholder + // position // rotate // rotate3d // rotateX @@ -576,6 +577,62 @@ .inception(@arguments); } +.position(@position: '', @top: '', @right: '', @bottom: '', @left: '') when (iskeyword(@position)) and not (@position = static ) { + + // default unit + @unit: 'px'; + + position: @position; + + .mix-top(@top) when (isnumber(@top)) { + // with unit + .mix(@top) when not (unit(@top) = @top) { + top: @top; + } + // without unit + .mix(@top) when (unit(@top) = @top) { + top: ~`@{top} + @{unit}`; + } + .mix(@top); + } + + .mix-right(@right) when (isnumber(@right)) { + .mix(@right) when not (unit(@right) = @right) { + right: @right; + } + .mix(@right) when (unit(@right) = @right) { + right: ~`@{right} + @{unit}`; + } + .mix(@right); + } + + .mix-bottom(@bottom) when (isnumber(@bottom)) { + .mix(@bottom) when not (unit(@bottom) = @bottom) { + bottom: @bottom; + } + .mix(@bottom) when (unit(@bottom) = @bottom) { + bottom: ~`@{bottom} + @{unit}`; + } + .mix(@bottom); + } + + .mix-left(@left) when (isnumber(@left)) { + .mix(@left) when not (unit(@left) = @left) { + left: @left; + } + .mix(@left) when (unit(@left) = @left) { + left: ~`@{left} + @{unit}`; + } + .mix(@left); + } + + // get top right bottom left + .mix-top(@top); + .mix-right(@right); + .mix-bottom(@bottom); + .mix-left(@left); +} + .rotate(...) { @process: ~`(function(e){e=e||"0";var r=/\d/gi,t=/(?:\s|^)(\.?\d+\.?\d*)(?![^(]*\)|\w|%|\.)/gi;return r.test(e)&&(e=e.replace(t,function(e){return 0==e&&e||e+"deg"})),e})((function(){var e="@{arguments}";return e=e.replace(/^\[|\]$/g,"")})())`; -webkit-transform: rotate(@process); diff --git a/mixins/position/position.less b/mixins/position/position.less new file mode 100644 index 0000000..76ec9d2 --- /dev/null +++ b/mixins/position/position.less @@ -0,0 +1,55 @@ +.position(@position: '', @top: '', @right: '', @bottom: '', @left: '') when (iskeyword(@position)) and not (@position = static ) { + + // default unit + @unit: 'px'; + + position: @position; + + .mix-top(@top) when (isnumber(@top)) { + // with unit + .mix(@top) when not (unit(@top) = @top) { + top: @top; + } + // without unit + .mix(@top) when (unit(@top) = @top) { + top: ~`@{top} + @{unit}`; + } + .mix(@top); + } + + .mix-right(@right) when (isnumber(@right)) { + .mix(@right) when not (unit(@right) = @right) { + right: @right; + } + .mix(@right) when (unit(@right) = @right) { + right: ~`@{right} + @{unit}`; + } + .mix(@right); + } + + .mix-bottom(@bottom) when (isnumber(@bottom)) { + .mix(@bottom) when not (unit(@bottom) = @bottom) { + bottom: @bottom; + } + .mix(@bottom) when (unit(@bottom) = @bottom) { + bottom: ~`@{bottom} + @{unit}`; + } + .mix(@bottom); + } + + .mix-left(@left) when (isnumber(@left)) { + .mix(@left) when not (unit(@left) = @left) { + left: @left; + } + .mix(@left) when (unit(@left) = @left) { + left: ~`@{left} + @{unit}`; + } + .mix(@left); + } + + // get top right bottom left + .mix-top(@top); + .mix-right(@right); + .mix-bottom(@bottom); + .mix-left(@left); +} diff --git a/mixins/position/position.md b/mixins/position/position.md new file mode 100644 index 0000000..ab20043 --- /dev/null +++ b/mixins/position/position.md @@ -0,0 +1,31 @@ +### • position +**Summary:** + +This is helper mixin for fast position setup. + +**Syntax:** + + .position(, [,,,]) + +**Tips and tricks:** + + - When you call mixin with only one argument, second will be the same. + Also you can omit units and `position` adds `px` automatically. + - When set `position` to `static` you will get nothing. See more: [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/position#Values). + - You can use named variable to specify special side's offset. + +**Example:** + + div { + .position(absolute, 20, 30px, @left: 40px); + } + + // Result + div { + position: absolute; + top: 20px; + right: 30px; + left: 40px; + } + + diff --git a/package.json b/package.json index 4dc7e8f..1a098a9 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "lesshat", "description": "Most advanced LESS CSS mixins library", - "version": "3.0.2", + "version": "3.0.3", "homepage": "http://lesshat.com/", "author": { "name": "Petr Brzek", From a3c37d326b60fe28763564b5eb9511c02989621c Mon Sep 17 00:00:00 2001 From: Saiya Date: Fri, 18 Jul 2014 16:19:50 +0800 Subject: [PATCH 2/5] add position to TOC --- README.md | 63 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 32 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index daba7e6..388351e 100644 --- a/README.md +++ b/README.md @@ -160,37 +160,38 @@ The structure of this repo is: 52. **[perspective](#perspective)** 53. **[perspective-origin](#perspective-origin)** 54. **[placeholder](#placeholder)** -55. **[rotate](#rotate)** `transform` -56. **[rotate3d](#rotate3d)** `transform` -57. **[rotateX](#rotateX)** `transform` -58. **[rotateY](#rotateY)** `transform` -59. **[rotateZ](#rotateZ)** `transform` -60. **[saturate](#saturate)** `filter` -61. **[scale](#scale)** `transform` -62. **[scale3d](#scale3d)** `transform` -63. **[scaleX](#scaleX)** `transform` -64. **[scaleY](#scaleY)** `transform` -65. **[scaleZ](#scaleZ)** `transform` -66. **[selection](#selection)** -67. **[sepia](#sepia)** `filter` -68. **[size](#size)** `width, height` -69. **[skew](#skew)** `transform` -70. **[skewX](#skewX)** `transform` -71. **[skewY](#skewY)** `transform` -72. **[transform](#transform)** -73. **[transform-origin](#transform-origin)** -74. **[transform-style](#transform-style)** -75. **[transition](#transition)** -76. **[transition-delay](#transition-delay)** -77. **[transition-duration](#transition-duration)** -78. **[transition-property](#transition-property)** -79. **[transition-timing-function](#transition-timing-function)** -80. **[translate](#translate)** `transform` -81. **[translate3d](#translate3d)** `transform` -82. **[translateX](#translateX)** `transform` -83. **[translateY](#translateY)** `transform` -84. **[translateZ](#translateZ)** `transform` -85. **[user-select](#user-select)** +55. **[position](#position)** +56. **[rotate](#rotate)** `transform` +57. **[rotate3d](#rotate3d)** `transform` +58. **[rotateX](#rotateX)** `transform` +59. **[rotateY](#rotateY)** `transform` +60. **[rotateZ](#rotateZ)** `transform` +61. **[saturate](#saturate)** `filter` +62. **[scale](#scale)** `transform` +63. **[scale3d](#scale3d)** `transform` +64. **[scaleX](#scaleX)** `transform` +65. **[scaleY](#scaleY)** `transform` +66. **[scaleZ](#scaleZ)** `transform` +67. **[selection](#selection)** +68. **[sepia](#sepia)** `filter` +69. **[size](#size)** `width, height` +70. **[skew](#skew)** `transform` +71. **[skewX](#skewX)** `transform` +72. **[skewY](#skewY)** `transform` +73. **[transform](#transform)** +74. **[transform-origin](#transform-origin)** +75. **[transform-style](#transform-style)** +76. **[transition](#transition)** +77. **[transition-delay](#transition-delay)** +78. **[transition-duration](#transition-duration)** +79. **[transition-property](#transition-property)** +80. **[transition-timing-function](#transition-timing-function)** +81. **[translate](#translate)** `transform` +82. **[translate3d](#translate3d)** `transform` +83. **[translateX](#translateX)** `transform` +84. **[translateY](#translateY)** `transform` +85. **[translateZ](#translateZ)** `transform` +86. **[user-select](#user-select)** *** From e70e8f48bf53a97a1594f80205603e805e42a589 Mon Sep 17 00:00:00 2001 From: evecalm Date: Tue, 22 Jul 2014 11:15:13 +0800 Subject: [PATCH 3/5] fixed position bug: support keyword(like `auto`) set top, left, bottom, right --- README.md | 2 +- build/lesshat-prefixed.less | 25 +++++++++++++++++++------ build/lesshat.less | 25 +++++++++++++++++++------ mixins/position/position.less | 23 ++++++++++++++++++----- 4 files changed, 57 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index daba7e6..b0b8aef 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ README.md file is automatically generated. **[Documentation](#documentation) |** --- -### Current version: v3.0.3 (2014-07-18) +### Current version: v3.0.3 (2014-07-22) ## What's new? * Compiling LESS Hat is much more faster (up to 60× times). diff --git a/build/lesshat-prefixed.less b/build/lesshat-prefixed.less index 41aecce..dc63180 100644 --- a/build/lesshat-prefixed.less +++ b/build/lesshat-prefixed.less @@ -6,7 +6,7 @@ // Handcrafted by Petr Brzek, lesshat.com // Works great with CSS Hat csshat.com -// version: v3.0.3 (2014-07-18) +// version: v3.0.3 (2014-07-22) // TABLE OF MIXINS: // align-content @@ -581,9 +581,12 @@ // default unit @unit: 'px'; - - position: @position; - + + // for keyword: auto + .mix-top(@top) when (iskeyword(@top)) { + top: @top; + } + // for number, percent, em, rem, px .mix-top(@top) when (isnumber(@top)) { // with unit .mix(@top) when not (unit(@top) = @top) { @@ -596,6 +599,9 @@ .mix(@top); } + .mix-right(@right) when (iskeyword(@right)) { + right: @right; + } .mix-right(@right) when (isnumber(@right)) { .mix(@right) when not (unit(@right) = @right) { right: @right; @@ -605,7 +611,10 @@ } .mix(@right); } - + + .mix-bottom(@bottom) when (iskeyword(@bottom)) { + bottom: @bottom; + } .mix-bottom(@bottom) when (isnumber(@bottom)) { .mix(@bottom) when not (unit(@bottom) = @bottom) { bottom: @bottom; @@ -616,6 +625,9 @@ .mix(@bottom); } + .mix-left(@left) when (iskeyword(@left)) { + left: @left; + } .mix-left(@left) when (isnumber(@left)) { .mix(@left) when not (unit(@left) = @left) { left: @left; @@ -625,7 +637,8 @@ } .mix(@left); } - + + position: @position; // get top right bottom left .mix-top(@top); .mix-right(@right); diff --git a/build/lesshat.less b/build/lesshat.less index 499476c..d996b29 100644 --- a/build/lesshat.less +++ b/build/lesshat.less @@ -6,7 +6,7 @@ // Handcrafted by Petr Brzek, lesshat.com // Works great with CSS Hat csshat.com -// version: v3.0.3 (2014-07-18) +// version: v3.0.3 (2014-07-22) // TABLE OF MIXINS: // align-content @@ -581,9 +581,12 @@ // default unit @unit: 'px'; - - position: @position; - + + // for keyword: auto + .mix-top(@top) when (iskeyword(@top)) { + top: @top; + } + // for number, percent, em, rem, px .mix-top(@top) when (isnumber(@top)) { // with unit .mix(@top) when not (unit(@top) = @top) { @@ -596,6 +599,9 @@ .mix(@top); } + .mix-right(@right) when (iskeyword(@right)) { + right: @right; + } .mix-right(@right) when (isnumber(@right)) { .mix(@right) when not (unit(@right) = @right) { right: @right; @@ -605,7 +611,10 @@ } .mix(@right); } - + + .mix-bottom(@bottom) when (iskeyword(@bottom)) { + bottom: @bottom; + } .mix-bottom(@bottom) when (isnumber(@bottom)) { .mix(@bottom) when not (unit(@bottom) = @bottom) { bottom: @bottom; @@ -616,6 +625,9 @@ .mix(@bottom); } + .mix-left(@left) when (iskeyword(@left)) { + left: @left; + } .mix-left(@left) when (isnumber(@left)) { .mix(@left) when not (unit(@left) = @left) { left: @left; @@ -625,7 +637,8 @@ } .mix(@left); } - + + position: @position; // get top right bottom left .mix-top(@top); .mix-right(@right); diff --git a/mixins/position/position.less b/mixins/position/position.less index 76ec9d2..2d2e5c0 100644 --- a/mixins/position/position.less +++ b/mixins/position/position.less @@ -2,9 +2,12 @@ // default unit @unit: 'px'; - - position: @position; - + + // for keyword: auto + .mix-top(@top) when (iskeyword(@top)) { + top: @top; + } + // for number, percent, em, rem, px .mix-top(@top) when (isnumber(@top)) { // with unit .mix(@top) when not (unit(@top) = @top) { @@ -17,6 +20,9 @@ .mix(@top); } + .mix-right(@right) when (iskeyword(@right)) { + right: @right; + } .mix-right(@right) when (isnumber(@right)) { .mix(@right) when not (unit(@right) = @right) { right: @right; @@ -26,7 +32,10 @@ } .mix(@right); } - + + .mix-bottom(@bottom) when (iskeyword(@bottom)) { + bottom: @bottom; + } .mix-bottom(@bottom) when (isnumber(@bottom)) { .mix(@bottom) when not (unit(@bottom) = @bottom) { bottom: @bottom; @@ -37,6 +46,9 @@ .mix(@bottom); } + .mix-left(@left) when (iskeyword(@left)) { + left: @left; + } .mix-left(@left) when (isnumber(@left)) { .mix(@left) when not (unit(@left) = @left) { left: @left; @@ -46,7 +58,8 @@ } .mix(@left); } - + + position: @position; // get top right bottom left .mix-top(@top); .mix-right(@right); From 0fba354988d6bdf3286fb71e03610a1855760bce Mon Sep 17 00:00:00 2001 From: evecalm Date: Wed, 23 Jul 2014 14:35:32 +0800 Subject: [PATCH 4/5] fixed bug in number's unit check. less' mixin sucks. --- README.md | 65 +++++++++++++++++------------------ build/lesshat-prefixed.less | 18 +++++----- build/lesshat.less | 18 +++++----- mixins/position/position.less | 16 ++++----- 4 files changed, 58 insertions(+), 59 deletions(-) diff --git a/README.md b/README.md index 8d5f072..2adca58 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ README.md file is automatically generated. **[Documentation](#documentation) |** --- -### Current version: v3.0.3 (2014-07-22) +### Current version: v3.0.3 (2014-07-23) ## What's new? * Compiling LESS Hat is much more faster (up to 60× times). @@ -160,38 +160,37 @@ The structure of this repo is: 52. **[perspective](#perspective)** 53. **[perspective-origin](#perspective-origin)** 54. **[placeholder](#placeholder)** -55. **[position](#position)** -56. **[rotate](#rotate)** `transform` -57. **[rotate3d](#rotate3d)** `transform` -58. **[rotateX](#rotateX)** `transform` -59. **[rotateY](#rotateY)** `transform` -60. **[rotateZ](#rotateZ)** `transform` -61. **[saturate](#saturate)** `filter` -62. **[scale](#scale)** `transform` -63. **[scale3d](#scale3d)** `transform` -64. **[scaleX](#scaleX)** `transform` -65. **[scaleY](#scaleY)** `transform` -66. **[scaleZ](#scaleZ)** `transform` -67. **[selection](#selection)** -68. **[sepia](#sepia)** `filter` -69. **[size](#size)** `width, height` -70. **[skew](#skew)** `transform` -71. **[skewX](#skewX)** `transform` -72. **[skewY](#skewY)** `transform` -73. **[transform](#transform)** -74. **[transform-origin](#transform-origin)** -75. **[transform-style](#transform-style)** -76. **[transition](#transition)** -77. **[transition-delay](#transition-delay)** -78. **[transition-duration](#transition-duration)** -79. **[transition-property](#transition-property)** -80. **[transition-timing-function](#transition-timing-function)** -81. **[translate](#translate)** `transform` -82. **[translate3d](#translate3d)** `transform` -83. **[translateX](#translateX)** `transform` -84. **[translateY](#translateY)** `transform` -85. **[translateZ](#translateZ)** `transform` -86. **[user-select](#user-select)** +55. **[rotate](#rotate)** `transform` +56. **[rotate3d](#rotate3d)** `transform` +57. **[rotateX](#rotateX)** `transform` +58. **[rotateY](#rotateY)** `transform` +59. **[rotateZ](#rotateZ)** `transform` +60. **[saturate](#saturate)** `filter` +61. **[scale](#scale)** `transform` +62. **[scale3d](#scale3d)** `transform` +63. **[scaleX](#scaleX)** `transform` +64. **[scaleY](#scaleY)** `transform` +65. **[scaleZ](#scaleZ)** `transform` +66. **[selection](#selection)** +67. **[sepia](#sepia)** `filter` +68. **[size](#size)** `width, height` +69. **[skew](#skew)** `transform` +70. **[skewX](#skewX)** `transform` +71. **[skewY](#skewY)** `transform` +72. **[transform](#transform)** +73. **[transform-origin](#transform-origin)** +74. **[transform-style](#transform-style)** +75. **[transition](#transition)** +76. **[transition-delay](#transition-delay)** +77. **[transition-duration](#transition-duration)** +78. **[transition-property](#transition-property)** +79. **[transition-timing-function](#transition-timing-function)** +80. **[translate](#translate)** `transform` +81. **[translate3d](#translate3d)** `transform` +82. **[translateX](#translateX)** `transform` +83. **[translateY](#translateY)** `transform` +84. **[translateZ](#translateZ)** `transform` +85. **[user-select](#user-select)** *** diff --git a/build/lesshat-prefixed.less b/build/lesshat-prefixed.less index dc63180..7b65f80 100644 --- a/build/lesshat-prefixed.less +++ b/build/lesshat-prefixed.less @@ -6,7 +6,7 @@ // Handcrafted by Petr Brzek, lesshat.com // Works great with CSS Hat csshat.com -// version: v3.0.3 (2014-07-22) +// version: v3.0.3 (2014-07-23) // TABLE OF MIXINS: // align-content @@ -589,11 +589,11 @@ // for number, percent, em, rem, px .mix-top(@top) when (isnumber(@top)) { // with unit - .mix(@top) when not (unit(@top) = @top) { + .mix(@top) when (ispixel(@top)), (isem(@top)), (ispercentage(@top)), (isunit(@top, 'rem')) { top: @top; } // without unit - .mix(@top) when (unit(@top) = @top) { + .mix(@top) when (default()) { top: ~`@{top} + @{unit}`; } .mix(@top); @@ -603,10 +603,10 @@ right: @right; } .mix-right(@right) when (isnumber(@right)) { - .mix(@right) when not (unit(@right) = @right) { + .mix(@right) when (ispixel(@right)), (isem(@right)), (ispercentage(@right)), (isunit(@right, 'rem')) { right: @right; } - .mix(@right) when (unit(@right) = @right) { + .mix(@right) when (default()) { right: ~`@{right} + @{unit}`; } .mix(@right); @@ -616,10 +616,10 @@ bottom: @bottom; } .mix-bottom(@bottom) when (isnumber(@bottom)) { - .mix(@bottom) when not (unit(@bottom) = @bottom) { + .mix(@bottom) when (ispixel(@bottom)), (isem(@bottom)), (ispercentage(@bottom)), (isunit(@bottom, 'rem')) { bottom: @bottom; } - .mix(@bottom) when (unit(@bottom) = @bottom) { + .mix(@bottom) when (default()) { bottom: ~`@{bottom} + @{unit}`; } .mix(@bottom); @@ -629,10 +629,10 @@ left: @left; } .mix-left(@left) when (isnumber(@left)) { - .mix(@left) when not (unit(@left) = @left) { + .mix(@left) when (ispixel(@left)), (isem(@left)), (ispercentage(@left)), (isunit(@left, 'rem')) { left: @left; } - .mix(@left) when (unit(@left) = @left) { + .mix(@left) when (default()) { left: ~`@{left} + @{unit}`; } .mix(@left); diff --git a/build/lesshat.less b/build/lesshat.less index d996b29..cba4d6a 100644 --- a/build/lesshat.less +++ b/build/lesshat.less @@ -6,7 +6,7 @@ // Handcrafted by Petr Brzek, lesshat.com // Works great with CSS Hat csshat.com -// version: v3.0.3 (2014-07-22) +// version: v3.0.3 (2014-07-23) // TABLE OF MIXINS: // align-content @@ -589,11 +589,11 @@ // for number, percent, em, rem, px .mix-top(@top) when (isnumber(@top)) { // with unit - .mix(@top) when not (unit(@top) = @top) { + .mix(@top) when (ispixel(@top)), (isem(@top)), (ispercentage(@top)), (isunit(@top, 'rem')) { top: @top; } // without unit - .mix(@top) when (unit(@top) = @top) { + .mix(@top) when (default()) { top: ~`@{top} + @{unit}`; } .mix(@top); @@ -603,10 +603,10 @@ right: @right; } .mix-right(@right) when (isnumber(@right)) { - .mix(@right) when not (unit(@right) = @right) { + .mix(@right) when (ispixel(@right)), (isem(@right)), (ispercentage(@right)), (isunit(@right, 'rem')) { right: @right; } - .mix(@right) when (unit(@right) = @right) { + .mix(@right) when (default()) { right: ~`@{right} + @{unit}`; } .mix(@right); @@ -616,10 +616,10 @@ bottom: @bottom; } .mix-bottom(@bottom) when (isnumber(@bottom)) { - .mix(@bottom) when not (unit(@bottom) = @bottom) { + .mix(@bottom) when (ispixel(@bottom)), (isem(@bottom)), (ispercentage(@bottom)), (isunit(@bottom, 'rem')) { bottom: @bottom; } - .mix(@bottom) when (unit(@bottom) = @bottom) { + .mix(@bottom) when (default()) { bottom: ~`@{bottom} + @{unit}`; } .mix(@bottom); @@ -629,10 +629,10 @@ left: @left; } .mix-left(@left) when (isnumber(@left)) { - .mix(@left) when not (unit(@left) = @left) { + .mix(@left) when (ispixel(@left)), (isem(@left)), (ispercentage(@left)), (isunit(@left, 'rem')) { left: @left; } - .mix(@left) when (unit(@left) = @left) { + .mix(@left) when (default()) { left: ~`@{left} + @{unit}`; } .mix(@left); diff --git a/mixins/position/position.less b/mixins/position/position.less index 2d2e5c0..e66c814 100644 --- a/mixins/position/position.less +++ b/mixins/position/position.less @@ -10,11 +10,11 @@ // for number, percent, em, rem, px .mix-top(@top) when (isnumber(@top)) { // with unit - .mix(@top) when not (unit(@top) = @top) { + .mix(@top) when (ispixel(@top)), (isem(@top)), (ispercentage(@top)), (isunit(@top, 'rem')) { top: @top; } // without unit - .mix(@top) when (unit(@top) = @top) { + .mix(@top) when (default()) { top: ~`@{top} + @{unit}`; } .mix(@top); @@ -24,10 +24,10 @@ right: @right; } .mix-right(@right) when (isnumber(@right)) { - .mix(@right) when not (unit(@right) = @right) { + .mix(@right) when (ispixel(@right)), (isem(@right)), (ispercentage(@right)), (isunit(@right, 'rem')) { right: @right; } - .mix(@right) when (unit(@right) = @right) { + .mix(@right) when (default()) { right: ~`@{right} + @{unit}`; } .mix(@right); @@ -37,10 +37,10 @@ bottom: @bottom; } .mix-bottom(@bottom) when (isnumber(@bottom)) { - .mix(@bottom) when not (unit(@bottom) = @bottom) { + .mix(@bottom) when (ispixel(@bottom)), (isem(@bottom)), (ispercentage(@bottom)), (isunit(@bottom, 'rem')) { bottom: @bottom; } - .mix(@bottom) when (unit(@bottom) = @bottom) { + .mix(@bottom) when (default()) { bottom: ~`@{bottom} + @{unit}`; } .mix(@bottom); @@ -50,10 +50,10 @@ left: @left; } .mix-left(@left) when (isnumber(@left)) { - .mix(@left) when not (unit(@left) = @left) { + .mix(@left) when (ispixel(@left)), (isem(@left)), (ispercentage(@left)), (isunit(@left, 'rem')) { left: @left; } - .mix(@left) when (unit(@left) = @left) { + .mix(@left) when (default()) { left: ~`@{left} + @{unit}`; } .mix(@left); From 8ebd14bf9f8e60864942621d2a0e0ce2ade4eec9 Mon Sep 17 00:00:00 2001 From: evecalm Date: Mon, 1 Sep 2014 14:18:44 +0800 Subject: [PATCH 5/5] fixed style bug by removing appended style "background-clip" in mixins/border-radius/border-radius.js --- README.md | 2 +- build/lesshat-prefixed.less | 8 ++++---- build/lesshat.less | 8 ++++---- mixins/border-radius/border-radius.js | 10 +++++----- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 2adca58..f4b084b 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ README.md file is automatically generated. **[Documentation](#documentation) |** --- -### Current version: v3.0.3 (2014-07-23) +### Current version: v3.0.3 (2014-09-01) ## What's new? * Compiling LESS Hat is much more faster (up to 60× times). diff --git a/build/lesshat-prefixed.less b/build/lesshat-prefixed.less index 7b65f80..a643b1d 100644 --- a/build/lesshat-prefixed.less +++ b/build/lesshat-prefixed.less @@ -6,7 +6,7 @@ // Handcrafted by Petr Brzek, lesshat.com // Works great with CSS Hat csshat.com -// version: v3.0.3 (2014-07-23) +// version: v3.0.3 (2014-09-01) // TABLE OF MIXINS: // align-content @@ -280,9 +280,9 @@ .lh-border-radius(...) { @process: ~`(function(e){e=e||"0";var t=/\d/gi,r=/(?:\s|^)(\.?\d+\.?\d*)(?![^(]*\)|\w|%|\.)/gi;return/^[^, ]*,/.test(e)&&(e=e.replace(/(?:,)(?![^(]*\))/g,"")),t.test(e)&&(e=e.replace(r,function(e){return 0==e&&e||e+"px"})),e})((function(){var e="@{arguments}";return e=e.replace(/^\[|\]$/g,"")})())`; - -webkit-border-radius: @process; -webkit-background-clip: padding-box; - -moz-border-radius: @process; -moz-background-clip: padding; - border-radius: @process; background-clip: padding-box; + -webkit-border-radius: @process; + -moz-border-radius: @process; + border-radius: @process; } .lh-border-top-left-radius(...) { diff --git a/build/lesshat.less b/build/lesshat.less index cba4d6a..f03c874 100644 --- a/build/lesshat.less +++ b/build/lesshat.less @@ -6,7 +6,7 @@ // Handcrafted by Petr Brzek, lesshat.com // Works great with CSS Hat csshat.com -// version: v3.0.3 (2014-07-23) +// version: v3.0.3 (2014-09-01) // TABLE OF MIXINS: // align-content @@ -280,9 +280,9 @@ .border-radius(...) { @process: ~`(function(e){e=e||"0";var t=/\d/gi,r=/(?:\s|^)(\.?\d+\.?\d*)(?![^(]*\)|\w|%|\.)/gi;return/^[^, ]*,/.test(e)&&(e=e.replace(/(?:,)(?![^(]*\))/g,"")),t.test(e)&&(e=e.replace(r,function(e){return 0==e&&e||e+"px"})),e})((function(){var e="@{arguments}";return e=e.replace(/^\[|\]$/g,"")})())`; - -webkit-border-radius: @process; -webkit-background-clip: padding-box; - -moz-border-radius: @process; -moz-background-clip: padding; - border-radius: @process; background-clip: padding-box; + -webkit-border-radius: @process; + -moz-border-radius: @process; + border-radius: @process; } .border-top-left-radius(...) { diff --git a/mixins/border-radius/border-radius.js b/mixins/border-radius/border-radius.js index 84f52a0..c5d9f3e 100644 --- a/mixins/border-radius/border-radius.js +++ b/mixins/border-radius/border-radius.js @@ -30,11 +30,11 @@ borderRadius.vendors = ['webkit', 'moz']; * Append CSS */ -borderRadius.appendCSS = { - all: 'background-clip: padding-box', - webkit: '-webkit-background-clip: padding-box', - moz: '-moz-background-clip: padding' -}; +// borderRadius.appendCSS = { +// all: 'background-clip: padding-box', +// webkit: '-webkit-background-clip: padding-box', +// moz: '-moz-background-clip: padding' +// }; /** * Export mixin