From 818e019e2e02dfdaf6f7440de33c5e52e5827b65 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Mon, 1 Nov 2010 10:45:51 -0700 Subject: [PATCH] What I'd like the box shadow upgrade to be -- not legal syntax. --- .../stylesheets/compass/css3/_box-shadow.scss | 89 ++++++++++++++++--- 1 file changed, 75 insertions(+), 14 deletions(-) diff --git a/frameworks/compass/stylesheets/compass/css3/_box-shadow.scss b/frameworks/compass/stylesheets/compass/css3/_box-shadow.scss index cf111806..59c228a6 100644 --- a/frameworks/compass/stylesheets/compass/css3/_box-shadow.scss +++ b/frameworks/compass/stylesheets/compass/css3/_box-shadow.scss @@ -5,6 +5,8 @@ @import "shared"; +$legacy-box-shadow: true !default; + // The default color for box shadows $default-box-shadow-color: #333333 !default; @@ -23,10 +25,43 @@ $default-box-shadow-spread : false !default; // The default shadow instet: inset or false (for standard shadow). $default-box-shadow-inset : false !default; +@if $legacy-box-shadow { + @mixin box-shadow( + $color : $default-box-shadow-color, + $hoff : $default-box-shadow-h-offset, + $voff : $default-box-shadow-v-offset, + $blur : $default-box-shadow-blur, + $spread : $default-box-shadow-spread, + $inset : $default-box-shadow-inset + ) { + @warn "This usage of the box-shadow mixin has been deprecated. Please read: http://compass-style.org/docs/upgrading/box-shadow-api/ for details." + @include legacy-box-shadow($color, $hoff, $voff, $blur, $spread, $inset); + } +} @else { + @mixin box-shadow( + $shadow-1, + $shadow-2 : false, + $shadow-3 : false, + $shadow-4 : false, + $shadow-5 : false, + $shadow-6 : false, + $shadow-7 : false, + $shadow-8 : false, + $shadow-9 : false, + $shadow-10: false + ) { + @include mult-box-shadow( + $shadow-1, $shadow-2, $shadow-3, + $shadow-4, $shadow-5, $shadow-6, + $shadow-7, $shadow-8, $shadow-9, $shadow-10 + ); + } +} + // Provides cross-browser CSS box shadows for Webkit, Gecko, and CSS3. // Arguments are color, horizontal offset, vertical offset, blur length, spread length, and inset. - -@mixin box-shadow( +// @deprecated +@mixin legacy-box-shadow( $color : $default-box-shadow-color, $hoff : $default-box-shadow-h-offset, $voff : $default-box-shadow-v-offset, @@ -34,20 +69,46 @@ $default-box-shadow-inset : false !default; $spread : $default-box-shadow-spread, $inset : $default-box-shadow-inset ) { - $full : $color $hoff $voff $blur $spread; - @if $inset { - @if not ($inset == true or $inset == inset) { - @warn "$inset expected to be true or the inset keyword. Got #{$inset} instead. The box shadow will be inset." - } - $full: $full inset; + @if not ($inset == true or $inset == false or $inset == inset) { + @warn "$inset expected to be true or the inset keyword. Got #{$inset} instead. Using: inset"; } + @if $color == none { - @include experimental(box-shadow, none, - -moz, -webkit, -o, not -ms, not -khtml, official - ); + @include mult-box-shadow(none); } @else { - @include experimental(box-shadow, $full, - -moz, -webkit, -o, not -ms, not -khtml, official - ); + $full : $hoff $voff; + @if $blur { $full: $full $blur; } + @if $spread { $full: $full $spread; } + @if $color { $full: $full $color; } + @if $inset { $full: inset $full; } + @include mult-box-shadow($full); } } + +// Provides cross-browser box shadows when one or more box shadows are to be used. +@mixin mult-box-shadow( + $shadow-1, + $shadow-2 : false, + $shadow-3 : false, + $shadow-4 : false, + $shadow-5 : false, + $shadow-6 : false, + $shadow-7 : false, + $shadow-8 : false, + $shadow-9 : false, + $shadow-10: false +) { + $shadow : $shadow-1; + @if $shadow-2 { $shadow: $shadow, $shadow-2; } + @if $shadow-3 { $shadow: $shadow, $shadow-3; } + @if $shadow-4 { $shadow: $shadow, $shadow-4; } + @if $shadow-5 { $shadow: $shadow, $shadow-5; } + @if $shadow-6 { $shadow: $shadow, $shadow-6; } + @if $shadow-7 { $shadow: $shadow, $shadow-7; } + @if $shadow-8 { $shadow: $shadow, $shadow-8; } + @if $shadow-9 { $shadow: $shadow, $shadow-9; } + @if $shadow-10 { $shadow: $shadow, $shadow-10; } + @include experimental(box-shadow, $shadow, + -moz, -webkit, -o, not -ms, not -khtml, official + ); +}