// Sass.
@use 'sass:list';
// Variables.
@forward 'dictionary.variables';
@use 'dictionary.variables' as variables;
// Functions.
@use 'dictionary.get.function' as *;
// Modules.
@use '../../../map';
// The `translator.dictionary-merge()` or `dictionary.merge()` function.
@function merge($key: null, $dictionary, $dictionaries...) {
$retrieved-dictionary: ();
@each $dictionary in list.join(($dictionary, ), $dictionaries, comma) {
$retrieved-dictionary: map.deep-merge($retrieved-dictionary, $dictionary);
}
variables.$dictionary: if(
$key,
map.merge(get() or (), list.append($key, $retrieved-dictionary)...),
map.deep-merge(get() or (), $retrieved-dictionary)
);
@return variables.$dictionary;
}
// Use.
@use '@angular-package/sass/translator';
// Examples.
$-dictionary: (
(extra large, 'extra large', extra-large): xl,
(extra small, 'extra small', extra-small): xs,
class: (prefix: class-prefix, suffix: class-suffix),
large: lg,
medium: md,
prefix: spectre,
size: s,
small: sm,
suffix: end,
var: (prefix: var-prefix, suffix: var-suffix),
);
// merge in `class` key
@debug translator.dictionary-merge(class, (prefix: spectre, suffix: end)); // (word: translation, class: (prefix: spectre, suffix: end))
// merge in nested (accordion, class) key
@debug translator.dictionary-merge((accordion, class), (prefix: spectre, suffix: end)); // (word: translation, class: (prefix: spectre, suffix: end), accordion: (class: (prefix: spectre, suffix: end)))