|
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- @function susy-parse(
- $shorthand,
- $context-only: false
- ) {
- $parse-error: 'Unknown shorthand property:';
- $options: (
- 'first': 'location',
- 'last': 'location',
- 'alpha': 'location',
- 'omega': 'location',
- 'narrow': 'spread',
- 'wide': 'spread',
- 'wider': 'spread',
- );
-
- $return: ();
- $span: null;
- $columns: null;
-
- $of: null;
- $next: false;
-
-
- @if ($context-only) and (not index($shorthand, 'of')) {
- @if su-valid-columns($shorthand, 'fail-silent') {
- $shorthand: 'of' $shorthand;
- } @else {
- $shorthand: join('of', $shorthand);
- }
- }
-
-
- @for $i from 1 through length($shorthand) {
- $item: nth($shorthand, $i);
- $type: type-of($item);
- $error: false;
- $details: '[#{$type}] `#{$item}`';
-
-
- @if $next {
-
-
- $return: map-merge($return, ($next: $item));
-
-
- $next: false;
-
- } @else {
-
-
- @if ($type == 'string') {
-
- @if map-has-key($options, $item) {
- $setting: map-get($options, $item);
-
-
- @if ($setting == 'spread') and ($of) {
- $return: map-merge($return, ('container-spread': $item));
- } @else {
- $return: map-merge($return, ($setting: $item));
- }
-
- } @else if ($item == 'all') {
-
- $span: 'all';
- } @else if ($item == 'at') {
-
- $next: 'location';
- } @else if ($item == 'set-gutters') {
- $next: 'gutters';
- } @else if ($item == 'of') {
- $of: true;
- } @else {
- $error: true;
- }
-
- } @else if ($type == 'number') or ($type == 'list') {
-
- @if not ($span or $of) {
-
- $span: $item;
- } @else if ($of) and (not $columns) {
-
- $columns: $item;
- } @else {
- $error: true;
- }
-
- } @else {
- $error: true;
- }
- }
-
- @if $error {
- @return _susy-error('#{$parse-error} #{$details}', 'susy-parse');
- }
- }
-
-
- @if $span {
- $return: map-merge($return, ('span': $span));
- }
-
-
- @if $columns {
- $return: map-merge($return, ('columns': $columns));
- }
-
-
- @return $return;
- }
|