@use 'iro-sass/src/index' as iro; @function color($key, $tree: 'colors', $default: null, $global: false) { $key: iro.fn-list-prepend($key, --colors); @return iro.props-get($key, $tree, $default, $global); } @function global-color($key, $tree: 'colors', $default: null, $global: true) { @return color($key, $tree, $default, $global); } @function foreign-color($foreign-key, $key, $tree: 'colors', $default: null, $global: true) { @return iro.props-get(join($foreign-key --colors, $key), $tree, $default, $global); } @function dim($key, $tree: 'dims', $default: null, $global: false) { $key: iro.fn-list-prepend($key, --dims); @return iro.props-get($key, $tree, $default, $global); } @function global-dim($key, $tree: 'dims', $default: null, $global: true) { @return dim($key, $tree, $default, $global); } @function foreign-dim($foreign-key, $key, $tree: 'dims', $default: null, $global: true) { @return iro.props-get(join($foreign-key --dims, $key), $tree, $default, $global); } @function set-font($key, $overrides: ()) { $font: iro.props-get-static(join(--dims --font, $key), 'dims', $global: true); $map: (); @if (map-has-key($overrides, --family)) { $map: map-merge( $map, ( font-family: map-get($overrides, --family) ) ); } @else if (map-has-key($font, --family)) { $map: map-merge( $map, ( font-family: global-dim(--font $key --family) ) ); } @if (map-has-key($overrides, --size)) { $map: map-merge( $map, ( font-size: map-get($overrides, --size) ) ); } @else if (map-has-key($font, --size)) { $map: map-merge( $map, ( font-size: global-dim(--font $key --size) ) ); } @if (map-has-key($overrides, --weight)) { $map: map-merge( $map, ( font-weight: map-get($overrides, --weight) ) ); } @else if (map-has-key($font, --weight)) { $map: map-merge( $map, ( font-weight: global-dim(--font $key --weight) ) ); } @if (map-has-key($overrides, --style)) { $map: map-merge( $map, ( font-style: map-get($overrides, --style) ) ); } @else if (map-has-key($font, --style)) { $map: map-merge( $map, ( font-style: global-dim(--font $key --style) ) ); } @if (map-has-key($overrides, --line-height)) { $map: map-merge( $map, ( line-height: map-get($overrides, --line-height) ) ); } @else if (map-has-key($font, --line-height)) { $map: map-merge( $map, ( line-height: global-dim(--font $key --line-height) ) ); } @if (map-has-key($overrides, --transform)) { $map: map-merge( $map, ( text-transform: map-get($overrides, --transform) ) ); } @else if (map-has-key($font, --transform)) { $map: map-merge( $map, ( text-transform: global-dim(--font $key --transform) ) ); } @if (map-has-key($overrides, --variant-alternates)) { $map: map-merge( $map, ( font-variant-alternates: map-get($overrides, --variant-alternates) ) ); } @else if (map-has-key($font, --variant-alternates)) { $map: map-merge( $map, ( font-variant-alternates: global-dim(--font $key --variant-alternates) ) ); } @return $map; } @mixin set-font($basis, $values: ()) { $values: set-font($basis, $values); @each $prop, $value in $values { #{$prop}: $value; } }