Source: spacing.scss

/**
 * @namespace Spacing
 */



/**
 * @namespace Spacing:spacing-value
 */

/**
 * Return a spacing value defined in the jig config, based on a breakpoint.
 *
 * @memberof Spacing:spacing-value
 * @function
 * @name spacing-value
 * @alias spacing-value
 *
 * @param {String} $size - on of the named sized defined in jig's spacing config (e.g. sm, l, xxl, ...)
 * @param {Literal|String} [$breakpoint='auto'] - either "auto" (to use the current breakpoint) or one of the defined named breakpoints
 * @returns {Number|null} the spacing value or null if nothing was found
 * @throws error if size is unknown
 *
 * @example
 * spacing-value(sm)
 *   => 12px
 * spacing-value(md, large)
 *   => 5rem
 */
@function spacing-value($size, $breakpoint:'auto'){
	$spacing: map-get($jig---spacing-config, $size);

	@if $spacing == null {
		@error 'jig:spacing-value | unknown size "#{$size}"';
	}

	@if type-of($spacing) == 'map' {
		@return breakpoint-value($spacing, $breakpoint);
	} @else {
		@return $spacing;
	}
}



/**
 * @namespace Spacing:spacing-based-attributes
 */

/**
 * Define (an) attribute(s) based on breakpoint-dependent spacing values.
 * This will render the given attributes with the corresponding spacing values for each defined breakpoint
 * in compiled media queries. Since this will result in many media queries being rendered, make sure before,
 * that there aren't many other media queries also needed to complete your definition. In that case, it might be
 * better and more performant to rather write the queries manually and get the spacing values via `[]` or
 * `spacing-value`.
 *
 * @memberof Spacing:spacing-based-attributes
 * @function
 * @name spacing-based-attributes
 * @alias spacing-based-attributes
 *
 * @param {Map} $attributes - keys are attribute names, while values are spacing sizes
 * @param {Number} [$factor=null] - if a float factor is provided all values will be multiplied with this factor
 * @throws error if size is unknown
 *
 * @see spacing-based-attribute
 *
 * @example
 * \@include spacing-based-attributes(
 *   (
 *     'padding-top' : 'sm',
 *     'padding-right' : 'md',
 *     'padding-bottom' : 'sm'
 *     'padding-left' : 'md'
 *     'margin-top' : 'l',
 *     'margin-bottom' : 'xl'
 *   ),
 *   2.0
 * );
 */
@mixin spacing-based-attributes($attributes, $factor:null){
	$spacing-attributes: ();
	@each $attribute-name, $attribute-size in $attributes {
		$size-definition: map-get($jig---spacing-config, $attribute-size);

		@if $size-definition == null {
			@error 'jig:spacing-based-attributes | unknown size "#{$size-definition}"';
		}

		$spacing-attributes: map-merge($spacing-attributes, ($attribute-name : $size-definition));
	}

	@include attributes-for-breakpoints($spacing-attributes, $factor);
}



/**
 * @namespace Spacing:spacing-based-attribute
 */

/**
 * Define an attribute based on breakpoint-dependent spacing values.
 * Since this version does not optimize the usage of media queries, please make sure to only use this mixin,
 * if you'll definitely only have one attribute to be defined in multiple breakpoints.
 *
 * @memberof Spacing:spacing-based-attribute
 * @function
 * @name spacing-based-attribute
 * @alias spacing-based-attribute
 *
 * @param {String} $attribute - the name of the attribute you want to set
 * @param {String} $size - on of the named sized defined in jig's spacing config (sm, l, xxl, ...)
 * @param {Number} [$factor=null] - if a float factor is provided the value will be multiplied with this factor
 * @throws error if size is unknown
 *
 * @see spacing-based-attributes
 *
 * @example
 * \@include spacing-based-attribute(margin-top, 'xl', 1.0);
 */
@mixin spacing-based-attribute($attribute, $size, $factor:null){
	$attributes: ();
	$attributes: map-merge($attributes, ('#{$attribute}' : $size));
	@include spacing-based-attributes($attributes, $factor);
}