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