Skip to content

Commit fe8ed68

Browse files
Merge pull request #39 from angular-package/develop
v0.17.1-beta
2 parents 6b25b7f + 6a4c0f3 commit fe8ed68

File tree

5 files changed

+48
-29
lines changed

5 files changed

+48
-29
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# @angular-package/sass changelog
22

3+
### v0.17.1-beta [#](https://github.com/angular-package/sass/releases/tag/v0.17.1-beta)
4+
5+
- **Fix** `palette.create()` - adding color to variant colors. [2f277bf]
6+
- **Fix** `name.adjust()` - change `> 0` to `!=`. [2ab64bc]
7+
8+
[2f277bf]: https://github.com/angular-package/sass/commit/2f277bf3baae46d385921619a2b2455c22d544cc
9+
[2ab64bc]: https://github.com/angular-package/sass/commit/2ab64bcb8d161fbc8e8ed5571d3ef43600ecfbce
10+
11+
312
### v0.17.0-beta [#](https://github.com/angular-package/sass/releases/tag/v0.17.0-beta)
413

514
- **Update** `color/functions` - calculate using adjustment (from name too) all hsla values and move retrieve color to each hsla functions.

color/name/_name.adjust.function.scss

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@
4141
$saturation: adjustment.calculate($saturation, map.get($adjustment, saturation), map.get($adjust, saturation), 0%);
4242

4343
// Add hue, saturation, lightness or alpha to color name.
44-
@if $lightness and $lightness > 0% {
44+
@if $lightness and $lightness != 0% {
4545
$name: list-append.append(($name,), $lightness, $separator);
46-
@if $alpha and $alpha > 0 {
46+
@if $alpha and $alpha != 0 {
4747
$name: list-append.append($name, $alpha, $separator);
48-
@if $hue and $hue > 0deg {
48+
@if $hue and $hue != 0deg {
4949
$name: list-insert-nth.insert-nth($name, 2, $hue);
50-
@if $saturation and $saturation > 0% {
50+
@if $saturation and $saturation != 0% {
5151
$name: list-insert-nth.insert-nth($name, 3, $saturation);
5252
}
5353
}

color/palette/_palette.create.function.scss

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
// Modules.
66
@use '../../function';
77
@use '../../meta';
8+
@use '../../values';
89
@use '../../variant';
910
@use '../name';
1011
@use 'color';
1112

1213
// Functions.
1314
@use '../../list/get/get.list.function' as list-get-list;
14-
@use '../../list/list.insert-nth.function' as list-insert-nth;
15-
@use '../../list/list.invert.function' as list-invert;
15+
@use '../../list/list.append.function' as list-append;
1616
@use '../../list/list.range.function' as list-range;
1717
@use '../../list/remove/remove.nth.function' as list-remove-nth;
1818

@@ -30,45 +30,51 @@ function.$functions: map.set(function.$functions, color, name, meta.get-function
3030
@function create($values...) {
3131
$palette: ();
3232

33-
// FEATURE: Get additional colors.
34-
$variant-colors: ();
33+
// FEATURE: Prepare variant colors.
34+
$additional-colors: ();
35+
36+
// Iterate `$values`.
3537
$i: 1;
3638
@each $variant in $values {
3739
@if type-of($variant) == map {
3840
@each $class, $colors in $variant {
39-
$j: 1;
41+
// Variant colors to add after iterate.
42+
$variant-colors: ();
43+
44+
// Iterate colors to obtain variant colors.
4045
@each $color in $colors {
46+
// Get indicator index.
47+
$indicator-index: variant.indicator-index($color, '+');
48+
4149
// FEATURE: Nest colors.
42-
@if variant.indicator-index($color, '+') {
43-
$indicator-index: variant.indicator-index($color, '+');
50+
@if $indicator-index {
4451
$color: list.set-nth(
4552
$color,
4653
$indicator-index,
4754
variant.indicator-remove(list.nth($color, $indicator-index), '+')
4855
);
49-
$nested-colors: list-invert.invert(name.nest($color...));
50-
@each $nested-color in $nested-colors {
51-
$colors: list-insert-nth.insert-nth($colors, $j, $nested-color);
52-
}
53-
54-
$colors: list-remove-nth.nth($colors, $j + list.length($nested-colors));
56+
$variant-colors: values.join((separator: comma), $variant-colors, name.nest($color...));
5557
}
5658

5759
// FEATURE: Get additional colors.
5860
@else if list.separator($color) == space and list.length($color) > 1 and list.length(list-get-list.list($color, last)) == 0 {
61+
// Retrieve variant color.
5962
$variant-color: name.retrieve(list.nth($color, 1));
60-
$variant-colors: map.deep-merge(
61-
$variant-colors,
62-
($class: (map.get($variant-color, name): list-range.range($color, 2)))
63+
64+
// Add additional colors from range 2.
65+
$additional-colors: map.deep-merge(
66+
$additional-colors,
67+
(variant.indicator-remove($class, '+'): (map.get($variant-color, name): list-range.range($color, 2)))
6368
);
64-
$color: list.nth($color, 1);
65-
$colors: list.set-nth($colors, $j, $color);
66-
}
6769

68-
$j: $j + 1;
70+
// Append color to variant colors.
71+
$variant-colors: list-append.append($variant-colors, list.nth($color, 1), comma);
72+
} @else {
73+
$variant-colors: list-append.append($variant-colors, $color, comma);
74+
}
6975
}
7076

71-
$variant: map.deep-merge($variant, ($class: $colors));
77+
$variant: map.deep-merge($variant, ($class: $variant-colors));
7278
}
7379

7480
$values: list.set-nth($values, $i, $variant);
@@ -94,10 +100,9 @@ function.$functions: map.set(function.$functions, color, name, meta.get-function
94100
}
95101

96102
// FEATURE: Add additional colors to variant.
97-
@if list.length($variant-colors) > 0 {
98-
@each $name, $variant in $variant-colors {
103+
@if list.length($additional-colors) > 0 {
104+
@each $name, $variant in $additional-colors {
99105
@each $name in if(list.separator($name) == space, ($name,), $name) {
100-
$name: variant.indicator-remove($name, '+');
101106
@each $class, $colors in $variant {
102107
$palette: color.add($palette, $name, $class, space, $colors...);
103108
}

color/palette/_palette.create.mixin.spec.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353

5454
// FEATURE: Multiple colors in variant
5555
// core: ((primary dark) (secondary dark) (), error), // DONE
56+
// test: ((primary dark) (secondary dark) (), error), // DONE
5657

5758
// FEATURE: Color names
5859
// control: (disabled, error, info, success, warning), // (control: (disabled: disabled color, error: error color, info: info color, success: success color, warning: warning color))
@@ -84,6 +85,8 @@
8485
// (+bg, +border): (color, dark, light),
8586
// ('+gray', +secondary, +primary large): (+xs (color, dark, light),) // REVIEW: Check.
8687

88+
// core: (dark, light, accent, +primary (color, dark, light), +secondary (color, dark, light)),
89+
// +core: (+primary (color, dark, light), +secondary (color, dark, light)),
8790
)) using($palette) {
8891
@debug $palette;
8992

@@ -136,6 +139,8 @@
136139
// ([string, string]: [string, string])
137140
// @debug create(([primary, secondary]: [color, dark])); // (primary: (primary: primary color, primary dark: primary color dark), secondary: (secondary: secondary color, secondary dark: secondary color dark))
138141

142+
143+
// REMOVE: Bracketed removed.
139144
// Bracketed
140145
// ([string]: [string, [string]])
141146
// @debug create((['gray']: [xs [color, dark, light]])); // ("gray": (gray xs: gray xs color, gray xs dark: gray xs color dark, gray xs light: gray xs color light))

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@angular-package/sass",
33
"description": "Extension for sass modules and new modules.",
4-
"version": "0.17.0-beta",
4+
"version": "0.17.1-beta",
55
"main": "./index.scss",
66
"funding": [
77
{

0 commit comments

Comments
 (0)