app/assets/stylesheets/bootstrap/mixins.less in bootstrap-on-rails-0.0.1 vs app/assets/stylesheets/bootstrap/mixins.less in bootstrap-on-rails-0.0.2

- old
+ new

@@ -25,15 +25,15 @@ &:after { clear: both; } } -// Webkit-style focus +// WebKit-style focus .tab-focus() { // Default outline: thin dotted #333; - // Webkit + // WebKit outline: 5px auto -webkit-focus-ring-color; outline-offset: -2px; } // Center-align a block level element @@ -171,14 +171,45 @@ .translate3d(@x; @y; @z) { -webkit-transform: translate3d(@x, @y, @z); transform: translate3d(@x, @y, @z); } +.rotateX(@degrees) { + -webkit-transform: rotateX(@degrees); + -ms-transform: rotateX(@degrees); // IE9+ + transform: rotateX(@degrees); +} +.rotateY(@degrees) { + -webkit-transform: rotateY(@degrees); + -ms-transform: rotateY(@degrees); // IE9+ + transform: rotateY(@degrees); +} +.perspective(@perspective) { + -webkit-perspective: @perspective; + -moz-perspective: @perspective; + perspective: @perspective; +} +.perspective-origin(@perspective) { + -webkit-perspective-origin: @perspective; + -moz-perspective-origin: @perspective; + perspective-origin: @perspective; +} +.transform-origin(@origin) { + -webkit-transform-origin: @origin; + -moz-transform-origin: @origin; + transform-origin: @origin; +} + +// Animations +.animation(@animation) { + -webkit-animation: @animation; + animation: @animation; +} + // Backface visibility // Prevent browsers from flickering when using CSS 3D transforms. // Default value is `visible`, but can be changed to `hidden` -// See git pull https://github.com/dannykeane/bootstrap.git backface-visibility for examples .backface-visibility(@visibility){ -webkit-backface-visibility: @visibility; -moz-backface-visibility: @visibility; backface-visibility: @visibility; } @@ -258,11 +289,11 @@ // // Creates two color stops, start and end, by specifying a color and position for each color stop. // Color stops are not available in IE9 and below. .vertical(@start-color: #555; @end-color: #333; @start-percent: 0%; @end-percent: 100%) { background-image: -webkit-gradient(linear, left @start-percent, left @end-percent, from(@start-color), to(@end-color)); // Safari 4+, Chrome 2+ - background-image: -webkit-linear-gradient(top, @start-color, @start-percent, @end-color, @end-percent); // Safari 5.1+, Chrome 10+ + background-image: -webkit-linear-gradient(top, @start-color @start-percent, @end-color @end-percent); // Safari 5.1+, Chrome 10+ background-image: -moz-linear-gradient(top, @start-color @start-percent, @end-color @end-percent); // FF 3.6+ background-image: linear-gradient(to bottom, @start-color @start-percent, @end-color @end-percent); // Standard, IE10 background-repeat: repeat-x; filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=0)",argb(@start-color),argb(@end-color))); // IE9 and down } @@ -294,15 +325,15 @@ background-image: -webkit-radial-gradient(circle, @inner-color, @outer-color); background-image: -moz-radial-gradient(circle, @inner-color, @outer-color); background-image: radial-gradient(circle, @inner-color, @outer-color); background-repeat: no-repeat; } - .striped(@color: #555; @angle: 45deg) { - background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(.25, rgba(255,255,255,.15)), color-stop(.25, transparent), color-stop(.5, transparent), color-stop(.5, rgba(255,255,255,.15)), color-stop(.75, rgba(255,255,255,.15)), color-stop(.75, transparent), to(transparent)); - background-image: -webkit-linear-gradient(@angle, rgba(255,255,255,.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.15) 50%, rgba(255,255,255,.15) 75%, transparent 75%, transparent); - background-image: -moz-linear-gradient(@angle, rgba(255,255,255,.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.15) 50%, rgba(255,255,255,.15) 75%, transparent 75%, transparent); - background-image: linear-gradient(@angle, rgba(255,255,255,.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.15) 50%, rgba(255,255,255,.15) 75%, transparent 75%, transparent); + .striped(@color: rgba(255,255,255,.15); @angle: 45deg) { + background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(.25, @color), color-stop(.25, transparent), color-stop(.5, transparent), color-stop(.5, @color), color-stop(.75, @color), color-stop(.75, transparent), to(transparent)); + background-image: -webkit-linear-gradient(@angle, @color 25%, transparent 25%, transparent 50%, @color 50%, @color 75%, transparent 75%, transparent); + background-image: -moz-linear-gradient(@angle, @color 25%, transparent 25%, transparent 50%, @color 50%, @color 75%, transparent 75%, transparent); + background-image: linear-gradient(@angle, @color 25%, transparent 25%, transparent 50%, @color 50%, @color 75%, transparent 75%, transparent); } } // Reset filters for IE // @@ -360,17 +391,22 @@ // Panels // ------------------------- .panel-variant(@border; @heading-text-color; @heading-bg-color; @heading-border;) { border-color: @border; + & > .panel-heading { color: @heading-text-color; background-color: @heading-bg-color; border-color: @heading-border; + + .panel-collapse .panel-body { border-top-color: @border; } + & > .dropdown .caret { + border-color: @heading-text-color transparent; + } } & > .panel-footer { + .panel-collapse .panel-body { border-bottom-color: @border; } @@ -381,10 +417,11 @@ // ------------------------- .alert-variant(@background; @border; @text-color) { background-color: @background; border-color: @border; color: @text-color; + hr { border-top-color: darken(@border, 5%); } .alert-link { color: darken(@text-color, 10%); @@ -402,11 +439,10 @@ > td.@{state}, > th.@{state}, &.@{state} > td, &.@{state} > th { background-color: @background; - border-color: @border; } } // Hover states for `.table-hover` // Note: this is not available for cells or rows within `thead` or `tfoot`. @@ -414,11 +450,10 @@ > td.@{state}:hover, > th.@{state}:hover, &.@{state}:hover > td, &.@{state}:hover > th { background-color: darken(@background, 5%); - border-color: darken(@border, 5%); } } } // Button variants @@ -451,11 +486,11 @@ &:hover, &:focus, &:active, &.active { background-color: @background; - border-color: @border + border-color: @border; } } } // Button sizes @@ -515,11 +550,11 @@ // Progress bars // ------------------------- .progress-bar-variant(@color) { background-color: @color; .progress-striped & { - #gradient > .striped(@color); + #gradient > .striped(); } } // Responsive utilities // ------------------------- @@ -530,16 +565,17 @@ th&, td& { display: table-cell !important; } } .responsive-invisibility() { - display: none !important; - tr& { display: none !important; } + &, + tr&, th&, td& { display: none !important; } } + // Grid System // ----------- // Centered container element .container-fixed() { @@ -616,11 +652,11 @@ float: left; width: percentage((@columns / @grid-columns)); } } -// Generate the large column offsets +// Generate the medium column offsets .make-md-column-offset(@columns) { @media (min-width: @screen-md-min) { margin-left: percentage((@columns / @grid-columns)); } } @@ -667,18 +703,96 @@ right: percentage((@columns / @grid-columns)); } } +// Framework grid generation +// +// Used only by Bootstrap to generate the correct number of grid classes given +// any value of `@grid-columns`. + +.make-grid-columns() { + // Common styles for all sizes of grid columns, widths 1-12 + .col(@index) when (@index = 1) { // initial + @item: ~".col-xs-@{index}, .col-sm-@{index}, .col-md-@{index}, .col-lg-@{index}"; + .col(@index + 1, @item); + } + .col(@index, @list) when (@index =< @grid-columns) { // general; "=<" isn't a typo + @item: ~".col-xs-@{index}, .col-sm-@{index}, .col-md-@{index}, .col-lg-@{index}"; + .col(@index + 1, ~"@{list}, @{item}"); + } + .col(@index, @list) when (@index > @grid-columns) { // terminal + @{list} { + position: relative; + // Prevent columns from collapsing when empty + min-height: 1px; + // Inner gutter via padding + padding-left: (@grid-gutter-width / 2); + padding-right: (@grid-gutter-width / 2); + } + } + .col(1); // kickstart it +} + +.make-grid-columns-float(@class) { + .col(@index) when (@index = 1) { // initial + @item: ~".col-@{class}-@{index}"; + .col(@index + 1, @item); + } + .col(@index, @list) when (@index < @grid-columns) { // general + @item: ~".col-@{class}-@{index}"; + .col(@index + 1, ~"@{list}, @{item}"); + } + .col(@index, @list) when (@index = @grid-columns) { // terminal + @{list} { + float: left; + } + } + .col(1); // kickstart it +} + +.calc-grid(@index, @class, @type) when (@type = width) and (@index > 0) { + .col-@{class}-@{index} { + width: percentage((@index / @grid-columns)); + } +} +.calc-grid(@index, @class, @type) when (@type = push) { + .col-@{class}-push-@{index} { + left: percentage((@index / @grid-columns)); + } +} +.calc-grid(@index, @class, @type) when (@type = pull) { + .col-@{class}-pull-@{index} { + right: percentage((@index / @grid-columns)); + } +} +.calc-grid(@index, @class, @type) when (@type = offset) { + .col-@{class}-offset-@{index} { + margin-left: percentage((@index / @grid-columns)); + } +} + +// Basic looping in LESS +.make-grid(@index, @class, @type) when (@index >= 0) { + .calc-grid(@index, @class, @type); + // next iteration + .make-grid(@index - 1, @class, @type); +} + + // Form validation states // // Used in forms.less to generate the form validation CSS for warnings, errors, // and successes. .form-control-validation(@text-color: #555; @border-color: #ccc; @background-color: #f5f5f5) { // Color the label and help text .help-block, - .control-label { + .control-label, + .radio, + .checkbox, + .radio-inline, + .checkbox-inline { color: @text-color; } // Set the border and box shadow on specific inputs to match .form-control { border-color: @border-color;