|
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- @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;
- }
|