From 5be8dd31e97ad8450bf3f605634a2ffa81030512 Mon Sep 17 00:00:00 2001 From: Dennis Thompson Date: Mon, 16 Jan 2017 21:25:32 -0800 Subject: [PATCH] 3.1.0-beta3 * Adding doc * Removing some mixins --- README.md | 1 + bower.json | 2 +- gulpfile.js | 6 +- package.json | 2 +- skeleton/core/_functions.scss | 48 ++++- skeleton/core/_mixins.scss | 25 ++- skeleton/themes/fresh/_vars.scss | 4 +- skeleton/themes/fresh/mixins/_mixins.scss | 2 - skeleton/themes/original/mixins/_private.scss | 75 +------- skeleton/themes/original/mixins/_public.scss | 173 +++++++++++------- 10 files changed, 182 insertions(+), 156 deletions(-) delete mode 100644 skeleton/themes/fresh/mixins/_mixins.scss diff --git a/README.md b/README.md index cda239a..79d37d2 100644 --- a/README.md +++ b/README.md @@ -309,6 +309,7 @@ Changelog * Renaming `marrow` folders to `mixins` * Renaming `_skeleton.scss` to `_grid.scss` * Moving to [sassdoc](http://sassdoc.com/); no more manual documentation! +* Removing graident support in theme mixins ### 3.0.3 * Addressing issue #24 diff --git a/bower.json b/bower.json index a62dc30..f3ff3fe 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "skeleton-sass", - "version": "3.1.0-beta2", + "version": "3.1.0-beta3", "author": "Dennis Thompson", "homepage": "http://atomicpages.github.io/skeleton-sass/", "repository": { diff --git a/gulpfile.js b/gulpfile.js index 65b5b19..415769d 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -5,7 +5,7 @@ const sassdoc = require('sassdoc'); const sourcemaps = require('gulp-sourcemaps'); gulp.task('clean', function () { - del('sassdoc'); + del('docs'); return del('main.css*'); }); @@ -20,12 +20,14 @@ gulp.task('sass', ['clean'], function () { gulp.task('doc', function () { return gulp.src('skeleton/**/*.scss') .pipe(sassdoc({ + dest: './docs', display: { alias: true, watermark: true }, groups: { - core: 'Core' + core: 'Core API', + theme: 'Theme API' } })); }); diff --git a/package.json b/package.json index 03ee302..9dbd1bf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "skeleton-sass-official", - "version": "3.1.0-beta2", + "version": "3.1.0-beta3", "description": "Skeleton Sass is a highly modular version of Skeleton CSS", "main": "skeleton/core/_config.scss", "scripts": { diff --git a/skeleton/core/_functions.scss b/skeleton/core/_functions.scss index 7a85d4d..41a798b 100644 --- a/skeleton/core/_functions.scss +++ b/skeleton/core/_functions.scss @@ -2,29 +2,51 @@ @import "dependencies"; -// addresses https://github.com/nex3/sass/issues/533 -// number strip-units ( number $number ) +/// Strips the units from strings +/// @param {string|number} $number - The number to remove units from. +/// @return {number} Unitless number. +/// @group core +/// @access public +/// @link https://github.com/nex3/sass/issues/533 @function strip-units($number) { @return $number / ($number * 0 + 1); } -// to determine the unit. If it's a percentage, then our equation changes. -// number em ( number $px, [ number $base: $base-font-size ] ) +/// Takes in an absolute unit and gives back a relative one. +/// @param {number} $px - A absolute unit. +/// @param {number} $base [ $base-font-size ] - The base font size to calculate with. +/// @return {number} Realtive `em` unit. +/// @group core +/// @access public @function em($px, $base: $base-font-size) { @return _calcRU($px, $base, "em"); } -// number rem ( number $px, [ number $base: $base-font-size ] ) +/// Takes in an absolute unit and gives back a relative one. +/// @param {number} $px - A absolute unit. +/// @param {number} $base [ $base-font-size ] - The base font size to calculate with. +/// @return {number} Realtive `rem` unit. +/// @group core +/// @access public @function rem($px, $base: $base-font-size) { @return _calcRU($px, $base, "rem"); } -// number percent ( number $px, [ number $base: $base-font-size ] ) +/// Takes in an absolute unit and gives back a relative one. +/// @param {number} $px - A absolute unit. +/// @param {number} $base [ $base-font-size ] - The base font size to calculate with. +/// @return {number} Realtive `%` unit. +/// @group core +/// @access public @function percent($px, $base: $base-font-size) { @return _calcRU($px, $base, "%"); } -// number relative ( number $size ) +/// Takes in an absolute unit and gives back a relative one. +/// @param {number} $size - A absolute unit. +/// @group core +/// @access public +/// @return {number} A relative unit based on the values of `$use-rem`, `$use-em`, and `$use-percent`. @function relative($size) { @if($use-rem == true and $use-em == false and $use-percent == false) { @return rem($size); @@ -37,7 +59,11 @@ @return $size; // we're still using pixels } -// list triad ( color $color ) +/// Takes in a color and provides a list of triad-compatible colors. +/// @param {color} $color - The color to calculate traid colors for. +/// @return {list} A list of triad colors. +/// @group core +/// @access public @function triad($color) { @if(type-of($color) != "color") { @warn "Type must be color to continue. Aborting."; @@ -60,7 +86,11 @@ @return $triad; } -// list square ( color $color ) +/// Takes in a color and provides a list of square-compatible colors. +/// @param {color} $color - The color to calculate traid colors for. +/// @return {list} A list of square colors. +/// @group core +/// @access public @function square($color) { @if(type-of($color) != "color") { @warn "Type must be color to continue. Aborting."; diff --git a/skeleton/core/_mixins.scss b/skeleton/core/_mixins.scss index 9f29fa0..302d557 100644 --- a/skeleton/core/_mixins.scss +++ b/skeleton/core/_mixins.scss @@ -1,7 +1,13 @@ // Core mixins with global scope. // Note: all logic for private mixins are in _dependencies.scss -// grid ( [ number $width: 960px, [ boolean $fluid: false, [ number $gutterWidth: 20px, [ number $colCount: 16 ] ] ] ] ) +/// Creates the grid +/// @param {number} $width [ $base-width ] - The with of the grid as defined in `.container` +/// @param {bool} $fluid [ $is-fluid ] - Set true to generate a fluid grid. +/// @param {number} $gutterWidth [ $base-gutter-width ] - Adjusts the gutter width. +/// @param {number} $colCount [ $base-col-count ] - Adjusts the number of columns to generate. +/// @group core +/// @access public @mixin grid($width: $base-width, $fluid: $is-fluid, $gutterWidth: $base-gutter-width, $colCount: $base-col-count) { @if($fluid) { @include _fluidGrid($colCount, $new: $use-new-grid); @@ -13,12 +19,21 @@ } } -// mobileGrid ( [ number $width: 960px, [ number $colCount: 16 ] ] ) +/// Creates the mobile grid. +/// @param {number} $width [ $base-width ] - The with of the grid as defined in `.container` +/// @param {bool} $fluid [ $is-fluid ] - Set true to generate a fluid grid. +/// @param {number} $colCount [ $base-col-count ] - Adjusts the number of columns to generate. +/// @group core +/// @access public @mixin mobileGrid($width: $base-width, $isFluid: $is-fluid, $colCount: $base-col-count) { @include _mobileGrid($width, $colCount, $isFluid); } -// font-size ( [ number $size, [ boolean $fallback: true ] ] ) +/// Calculates the font-size automatically based on config settings. +/// @param {number} $size - The font size to convert. +/// @param {bool} $fallback [ $use-px-fallback ] - Set true to fallback to px for legacy browsers. +/// @group core +/// @access public @mixin font-size($size, $fallback: $use-px-fallback) { @if($fallback) { font-size: $size; @@ -38,7 +53,9 @@ } } -// hide-text ( ) +/// Helper mixin to easily hide text. +/// @group core +/// @access public @mixin hide-text { text-indent: 100%; white-space: nowrap; diff --git a/skeleton/themes/fresh/_vars.scss b/skeleton/themes/fresh/_vars.scss index e2df975..3cc7b52 100644 --- a/skeleton/themes/fresh/_vars.scss +++ b/skeleton/themes/fresh/_vars.scss @@ -3,9 +3,9 @@ // stored in the marrow folder, but to also create project-level // variables. -@import "mixins/mixins"; +@import "../original/mixins/private"; +@import "../original/mixins/public"; -// Yep, taken right from bourbon - https://github.com/thoughtbot/bourbon/blob/master/dist/settings/_prefixer.scss $prefix-for-webkit: true !default; $prefix-for-mozilla: true !default; $prefix-for-microsoft: true !default; diff --git a/skeleton/themes/fresh/mixins/_mixins.scss b/skeleton/themes/fresh/mixins/_mixins.scss deleted file mode 100644 index 68bf6ed..0000000 --- a/skeleton/themes/fresh/mixins/_mixins.scss +++ /dev/null @@ -1,2 +0,0 @@ -@import "../../original/mixins/private"; -@import "../../original/mixins/public"; diff --git a/skeleton/themes/original/mixins/_private.scss b/skeleton/themes/original/mixins/_private.scss index 42f1696..fdf3e0a 100644 --- a/skeleton/themes/original/mixins/_private.scss +++ b/skeleton/themes/original/mixins/_private.scss @@ -1,74 +1,15 @@ -// Private mixins scoped at the theme level. Change with discretion. +// Private mixins scoped at the theme level // ---------- MIXIN DEPENDENCIES + +/// Sets prefixes for border-radius +/// @param {string} $vert - The vertical direction of the border radius. +/// @param {string} $horiz - The horizontal direction of the border radius. +/// @param {number} $radius - The radius to set. +/// @group theme +/// @access private @mixin _bd($vert, $horiz, $radius) { -webkit-border-#{$vert}-#{$horiz}-radius: $radius; -moz-border-radius-#{$vert}#{$horiz}: $radius; border-#{$vert}-#{$horiz}-radius: $radius; } - -// _buildRadialGradient ( mixed $start, mixed $stop, boolean $ie ) -@mixin _buildRadialGradient($start, $stop, $ie) { - // TODO: needs multiple stop support - // TODO: needs center adjustment support - - @if type-of($start) != "list" { - $start: append($start, 0%, space); - } - - @if type-of($stop) != "list" { - $stop: append($stop, 100%, space); - } - - background: nth($start, 1); - background: -moz-radial-gradient(center, ellipse cover, nth($start, 1) nth($start, 2), nth($stop, 1) nth($stop, 2)); - background: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(nth($start, 2), nth($start, 1)), color-stop(nth($stop, 2), nth($stop, 1))); - background: -webkit-radial-gradient(center, ellipse cover, nth($start, 1) nth($start, 2), nth($stop, 1) nth($stop, 2)); - background: -o-radial-gradient(center, ellipse cover, nth($start, 1) nth($start, 2), nth($stop, 1) nth($stop, 2)); - background: -ms-radial-gradient(center, ellipse cover, nth($start, 1) nth($start, 2), nth($stop, 1) nth($stop, 2)); - background: radial-gradient(ellipse at center, nth($start, 1) nth($start, 2), nth($stop, 1) nth($stop, 2)); - - @if($ie) { - @include filter-gradient($start, $stop, 1); - } -} - -// needs multiple stop support -// _buildGradient ( string $direction, list $start, list $stop, boolean $ie ) -@mixin _buildGradient($direction, $start, $stop, $ie) { - $direction: unquote($direction); - $webkitGradientDirection: ""; - $linearGradientDirection: ""; - $ieDirection: 0; - - @if($direction == left or $direction == horizontal) { - $webkitGradientDirection: linear, left top, right top; - $linearGradientDirection: to right; - $ieDirection: 1; - } @else if($direction == top or $direction == vertical) { - $webkitGradientDirection: linear, left top, left bottom; - $linearGradientDirection: to bottom; - } @else if($direction == left top) { - $direction: -45deg; - $webkitGradientDirection: linear, left top, right bottom; - $linearGradientDirection: 135deg; - $ieDirection: 1; - } @else if($direction == left bottom) { - $direction: 45deg; - $webkitGradientDirection: linear, left bottom, right top; - $linearGradientDirection: $direction; - $ieDirection: 1; - } - - background: nth($start, 1); - background: -moz-linear-gradient($direction, $start, $stop); - background: -webkit-gradient($webkitGradientDirection, color-stop(nth($start, 1), nth($start, 2)), color-stop(nth($stop, 1), nth($stop, 2))); - background: -webkit-linear-gradient($direction, $start, $stop); - background: -o-linear-gradient($direction, $start, $stop); - background: -ms-linear-gradient($direction, $start, $stop); - background: linear-gradient($linearGradientDirection, $start, $stop); - - @if($ie) { - @include filter-gradient(nth($start, 1), nth($stop, 1), $ieDirection); - } -} diff --git a/skeleton/themes/original/mixins/_public.scss b/skeleton/themes/original/mixins/_public.scss index e327088..d40fc00 100644 --- a/skeleton/themes/original/mixins/_public.scss +++ b/skeleton/themes/original/mixins/_public.scss @@ -1,12 +1,13 @@ -// Project-scoped mixins? Oh, boy! Am I allowed to use these in my own theme? You bet! -// I have a fix... how do I help? Check the README! - @import "private"; // don't remove me // ---- MIXINS ---- -// Yep, taken right from bourbon - https://github.com/thoughtbot/bourbon/blob/master/dist/addons/_prefixer.scss -// @prefixer ( string $property, mixed $value, list $prefixes ) +/// Prefixes CSS properties +/// @param {string} $property - The property name to prefix. +/// @param {any} $value - The value of the property. +/// @param {list} $prefixes - A list of prefixes to use (e.g. webkit moz ms o spec) +/// @group theme +/// @access public @mixin prefixer($property, $value, $prefixes) { @each $prefix in $prefixes { @if $prefix == webkit { @@ -40,60 +41,95 @@ } } -// @see https://developer.mozilla.org/en-US/docs/Web/CSS/box-shadow -// @box-shadow ( [ none | inset? && [ ? ? ? ] ] ] ) +/// Auto-prefixes the `box-shadow` property. +/// @param {list} $shadow - The shadow properties to include (e.g. 5px, inset 5px 6px, etc.) +/// @group theme +/// @access public @mixin box-shadow($shadow...) { @if length($shadow) > 4 { @warn("$shadow should only accept four argument for each side of the box. Using more may cause undesired results"); } + @include prefixer(box-shadow, $shadow, webkit moz ms o spec); } -// @border-radius ( $radii... ) +/// Auto-prefixes the `border-radius` property. +/// @param {list} $radii - The border-radius properties to include (e.g. 5px, 3px 5px, etc.) +/// @group theme +/// @access public @mixin border-radius($radii...) { @if length($radii) > 4 { @warn("$radii should only accept four argument for each side of the box. Using more may cause undesired results"); } + @include prefixer(border-radius, $radii, webkit moz ms o spec); } -// @border-top-left-radius ( [ $radius: $default-border-radius ] ) +/// Auto-prefixes specified border-radius variant propery +/// @param {number} $radius [ $default-border-radius ] - The radius to set. +/// @group theme +/// @access public @mixin border-top-left-radius($radius: $default-border-radius) { @include _bd("top", "left", $radius); } -// @border-top-right-radius ( [ $radius: $default-border-radius ] ) +/// Auto-prefixes specified border-radius variant propery +/// @param {number} $radius [ $default-border-radius ] - The radius to set. +/// @group theme +/// @access public @mixin border-top-right-radius($radius: $default-border-radius) { @include _bd("top", "right", $radius); } -// @border-bottom-left-radius ( [ $radius: $default-border-radius ] ) +/// Auto-prefixes specified border-radius variant propery +/// @param {number} $radius [ $default-border-radius ] - The radius to set. +/// @group theme +/// @access public @mixin border-bototm-left-radius($radius: $default-border-radius) { @include _bd("bottom", "left", $radius); } -// @border-bottom-right-radius ( [ $radius: $default-border-radius ] ) +/// Auto-prefixes specified border-radius variant propery +/// @param {number} $radius [ $default-border-radius ] - The radius to set. +/// @group theme +/// @access public @mixin border-bottom-right-radius($radius: $default-border-radius) { @include _bd("bottom", "right", $radius); } -// @border-top-radius ( [ $radius: $default-border-radius ] ) +/// Auto-prefixes specified border-radius variant propery +/// @param {number} $radius [ $default-border-radius ] - The radius to set. +/// @group theme +/// @access public @mixin border-top-radius($radius: $default-border-radius) { @include border-top-left-radius($radius); @include border-top-right-radius($radius); } -// @border-right-radius ( [ $radius: $default-border-radius ] ) +/// Auto-prefixes specified border-radius variant propery +/// @param {number} $radius [ $default-border-radius ] - The radius to set. +/// @group theme +/// @access public @mixin border-right-radius($radius: $default-border-radius) { @include border-top-right-radius($radius); @include border-bottom-right-radius($radius); } -// @border-bottom-radius ( [ $radius: $default-border-radius ] ) +/// Auto-prefixes specified border-radius variant propery +/// @param {number} $radius [ $default-border-radius ] - The radius to set. +/// @group theme +/// @access public @mixin border-bottom-radius($radius: $default-border-radius) { @include border-bottom-left-radius($radius); @include border-bottom-right-radius($radius); } -// @border-left-radius ( [ $radius: $default-border-radius ] ) +/// Auto-prefixes specified border-radius variant propery +/// @param {number} $radius [ $default-border-radius ] - The radius to set. +/// @group theme +/// @access public @mixin border-left-radius($radius: $default-border-radius) { @include border-top-left-radius($radius); @include border-bottom-left-radius($radius); } -// @opacity ( number $alpha [ boolean $ie: true ] ) +/// Sets the opacity with or without IE support. +/// @param {number} $alpha - A decmal value between 0 and 1. +/// @param {bool} $ie [ true ] - Set true to support legacy IE clients. +/// @group theme +/// @access public @mixin opacity($alpha, $ie: true) { @if(type-of($alpha) != number) { @warn "$alpha must be a number. Setting to 0.5."; @@ -110,13 +146,22 @@ opacity: $alpha; } -// @box-sixing ( string $type ) +/// Auto-prefixes the `box-sizing` property. +/// @param {string} $type - A valid value of the `box-sizing` property. +/// @group theme +/// @access public @mixin box-sizing($type) { $type: unquote($type); @include prefixer(box-sizing, $type, webkit moz spec); } -// @single-transition ( string $property, number $duration, string $function, [ number $delay: false ] ) +/// Sets a single transition. +/// @param {string} $property - The property to animate (e.g. all, opacity, etc.) +/// @param {number} $duration - The duration of animation. +/// @param {string} $function - The particular easing function to use (e.g. linear) +/// @param {number} $delay - The amount of time to wait before animating. +/// @group theme +/// @access public @mixin single-transition($property, $duration, $function, $delay: false) { @if($delay == false) { $delay: ""; @@ -125,68 +170,56 @@ @include prefixer(transition, $transition, webkit moz ms o spec); } -// @transition ( list $transition... ) +/// Sets multiple transitions +/// @param {list} $transition - A list of transitions. +/// @see single-transition +/// @group theme +/// @access public @mixin transition($transition...) { @include prefixer(transition, $transition, webkit moz ms o spec); } -// @filter-gradient ( color $start, color $stop, [ number $direction: 0 ] ) -@mixin filter-gradient($start, $stop, $direction) { - @if $direction < 0 or $direction > 1 { - @warn "Invalid value for $direction. Defaulting to 0"; - $direction: 0; - } - - *zoom: 1; - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#{ie-hex-str($start)}', endColorstr='#{ie-hex-str($stop)}', gradientType='#{$direction}'); - -ms-filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#{ie-hex-str($start)}', endColorstr='#{ie-hex-str($stop)}', gradientType='#{$direction}'); -} - -// needs multiple stop support -// @linear-gradient ( string $direction, list $start, list $stop, [ boolean $ie: true ] ) -@mixin linear-gradient($direction, $start, $stop, $ie: true) { - @if(type-of($start) != "list") { - @warn "Bad parameter for $start. Expected list got #{type-of($start)}, defaulting to false."; - $start: false; - } @else if(type-of($stop) != "list") { - @warn "Bad parameter for $stop. Expected list got #{type-of($stop)}, defaulting to false."; - $stop: false; - } - @include _buildGradient($direction, $start, $stop, $ie); -} - -// @radial-gradient ( mixed $start, mixed $stop, [ boolean $ie: true ] ) -@mixin radial-gradient($start, $stop, $ie: true) { - @include _buildRadialGradient($start, $stop, $ie); -} - -// @reset-box-model ( ) +/// Resets the box model. +/// @group theme +/// @access public @mixin reset-box-model { margin: 0; padding: 0; border: 0; } -// @reset-font ( ) +/// Resets fonts. +/// @group theme +/// @access public @mixin reset-font { font-size: 100%; font: inherit; vertical-align: baseline; } -// @reset-focus ( ) +/// Wipes all focus outline styles. +/// @group theme +/// @access public @mixin reset-focus { outline: 0; } -// @reset-body ( ) +/// Resets line-height values. +/// @group theme +/// @access public @mixin reset-body { line-height: 1; } -// @reset-list-style ( ) +/// Wipes all list styles. +/// @group theme +/// @access public @mixin reset-list-style { list-style: none; } -// @reset-image-anchor-border ( ) +/// Resets image anchors. +/// @group theme +/// @access public @mixin reset-image-anchor-border { border: none; } -// @reset-table ( ) +/// Normalizes table styles. +/// @group theme +/// @access public @mixin reset-table { border: { collapse: collapse; @@ -194,14 +227,18 @@ } } -// @reset-table-cell ( ) +/// Resets table cell alignment and font-weights. +/// @group theme +/// @access public @mixin reset-table-cell { text-align: left; font-weight: normal; vertical-align: middle; } -// @reset-quotation ( ) +/// Reset quotations. +/// @group theme +/// @access public @mixin reset-quotation { quotes: none; &:before, &:after { @@ -210,20 +247,18 @@ } } -// @reset-html5 ( ) +/// Reset HTML5 elements (mainly for legacy browsers). +/// @group theme +/// @access public @mixin reset-html5 { /* HTML5 display-role reset for older browsers */ article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section { display: block; } } -@mixin reset-filter-gradient { - // see http://stackoverflow.com/questions/1768161/how-do-i-reset-or-override-ie-css-filters - filter: "progid:DXImageTransform.Microsoft.gradient(enabled=false)" !important; - -ms-filter: "progid:DXImageTransform.Microsoft.gradient(enabled=false)" !important; -} - -// @global-reset ( ) +/// Eric Meyer's global reset. +/// @group theme +/// @access public @mixin global-reset { html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, @@ -250,7 +285,9 @@ } } -// @nested-reset ( ) +/// Nested elements reset. +/// @group theme +/// @access public @mixin nested-reset { div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre,