|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261 |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- @function susy-normalize(
- $config,
- $context: null
- ) {
-
- @each $setting in ('spread', 'container-spread') {
- $value: map-get($config, $setting);
-
- @if $value {
- $value: susy-normalize-spread($value);
- $config: map-merge($config, ($setting: $value));
- }
- }
-
-
- $columns: map-get($config, 'columns');
-
- @if $columns {
- $columns: susy-normalize-columns($columns, $context);
- $config: map-merge($config, ('columns': $columns));
- }
-
- @if not $columns {
- $map: type-of($context) == 'map';
- $columns: if($map, map-get($context, 'columns'), null);
- $columns: $columns or susy-get('columns');
- }
-
-
- $span: map-get($config, 'span');
-
- @if $span {
- $span: susy-normalize-span($span, $columns);
- $config: map-merge($config, ('span': $span));
- }
-
-
- $location: map-get($config, 'location');
-
- @if $location {
- $location: susy-normalize-location($span, $location, $columns);
- $config: map-merge($config, ('location': $location));
- }
-
- @return $config;
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- @function susy-normalize-span(
- $span,
- $columns: susy-get('columns')
- ) {
- @if ($span == 'all') {
- @return length($columns);
- }
-
- @return $span;
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- @function susy-normalize-columns(
- $columns,
- $context: null
- ) {
- $context: $context or susy-settings();
-
- @if type-of($columns) == 'list' {
- @return _susy-flatten($columns);
- }
-
- @if (type-of($columns) == 'number') and (unitless($columns)) {
- $span: $columns;
- $context: map-get($context, 'columns');
- $symmetrical: susy-repeat(length($context), nth($context, 1));
-
- @if ($context == $symmetrical) {
- @return susy-repeat($span, nth($context, 1));
- } @else {
- $actual: 'of `#{$span}`';
- $columns: 'grid-columns `#{$context}`';
- @return _susy-error(
- 'context-slice #{$actual} can not be determined based on #{$columns}.',
- 'susy-normalize-columns');
- }
- }
-
- @return $columns;
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- @function susy-normalize-spread(
- $spread
- ) {
- $normal-spread: (
- 'narrow': -1,
- 'wide': 0,
- 'wider': 1,
- );
-
- @return map-get($normal-spread, $spread) or $spread;
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- @function susy-normalize-location(
- $span,
- $location,
- $columns
- ) {
- $count: length($columns);
- $normal-locations: (
- 'first': 1,
- 'alpha': 1,
- 'last': $count - $span + 1,
- 'omega': $count - $span + 1,
- );
-
- @return map-get($normal-locations, $location) or $location;
- }
|