|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213 |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- @function su-valid-span(
- $span
- ) {
- $type: type-of($span);
- @if ($type == 'number') {
- @return $span;
- } @else if ($type == 'list') and su-valid-columns($span, 'silent-failure') {
- @return $span;
- }
-
- $actual: '[#{type-of($span)}] `#{inspect($span)}`';
- @return _susy-error(
- '#{$actual} is not a valid number, length, or column-list for $span.',
- 'su-valid-span');
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- @function su-valid-columns(
- $columns,
- $silent-failure: false
- ) {
- @if (type-of($columns) == 'list') {
- $fail: false;
-
- @each $col in $columns {
- @if (type-of($col) != 'number') {
- $fail: true;
- }
- }
-
- @if not $fail {
- @return $columns;
- }
- }
-
-
- @if $silent-failure {
- @return null;
- }
-
-
- $actual: '[#{type-of($columns)}] `#{inspect($columns)}`';
-
- @return _susy-error(
- '#{$actual} is not a valid list of numbers for $columns.',
- 'su-valid-columns');
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- @function su-valid-gutters(
- $gutters
- ) {
- $type: type-of($gutters);
-
- @if ($type == 'number') {
- @return $gutters;
- }
-
- $actual: '[#{$type}] `#{inspect($gutters)}`';
- @return _susy-error(
- '#{$actual} is not a number or length for $gutters.',
- 'su-valid-gutters');
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- @function su-valid-spread(
- $spread
- ) {
- @if index(0 1 -1, $spread) {
- @return $spread;
- }
-
- $actual: '[#{type-of($spread)}] `#{inspect($spread)}`';
- @return _susy-error(
- '#{$actual} is not a normalized [0 | 1 | -1] value for `$spread`.',
- 'su-valid-spread');
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- @function su-valid-location(
- $span,
- $location,
- $columns
- ) {
- $count: length($columns);
-
- @if $location {
- @if (type-of($location) != 'number') or (not unitless($location)) {
- $actual: '[#{type-of($location)}] `#{$location}`';
- @return _susy-error(
- '#{$actual} is not a unitless number for $location.',
- 'su-valid-location');
- } @else if (round($location) != $location) {
- @return _susy-error(
- 'Location (`#{$location}`) must be a 1-indexed intiger position.',
- 'su-valid-location');
- } @else if ($location > $count) or ($location < 1) {
- @return _susy-error(
- 'Position `#{$location}` does not exist in grid `#{$columns}`.',
- 'su-valid-location');
- } @else if ($location + $span - 1 > $count) {
- $details: 'grid `#{$columns}` for span `#{$span}` at `#{$location}`';
- @return _susy-error(
- 'There are not enough columns in #{$details}.',
- 'su-valid-location');
- }
- }
-
- @return $location;
- }
|