From 2ab64bcb8d161fbc8e8ed5571d3ef43600ecfbce Mon Sep 17 00:00:00 2001 From: angularpackage Date: Fri, 15 Dec 2023 01:19:06 +0000 Subject: [PATCH 1/4] fix(name.adjust()): change > 0 to !=. --- color/name/_name.adjust.function.scss | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/color/name/_name.adjust.function.scss b/color/name/_name.adjust.function.scss index c92b3dc..9dd9268 100644 --- a/color/name/_name.adjust.function.scss +++ b/color/name/_name.adjust.function.scss @@ -41,13 +41,13 @@ $saturation: adjustment.calculate($saturation, map.get($adjustment, saturation), map.get($adjust, saturation), 0%); // Add hue, saturation, lightness or alpha to color name. - @if $lightness and $lightness > 0% { + @if $lightness and $lightness != 0% { $name: list-append.append(($name,), $lightness, $separator); - @if $alpha and $alpha > 0 { + @if $alpha and $alpha != 0 { $name: list-append.append($name, $alpha, $separator); - @if $hue and $hue > 0deg { + @if $hue and $hue != 0deg { $name: list-insert-nth.insert-nth($name, 2, $hue); - @if $saturation and $saturation > 0% { + @if $saturation and $saturation != 0% { $name: list-insert-nth.insert-nth($name, 3, $saturation); } } From 2f277bf3baae46d385921619a2b2455c22d544cc Mon Sep 17 00:00:00 2001 From: angularpackage Date: Fri, 15 Dec 2023 01:19:55 +0000 Subject: [PATCH 2/4] fix(palette.create()): fix adding color to variant colors and update. --- color/palette/_palette.create.function.scss | 53 ++++++++++--------- color/palette/_palette.create.mixin.spec.scss | 5 ++ 2 files changed, 34 insertions(+), 24 deletions(-) diff --git a/color/palette/_palette.create.function.scss b/color/palette/_palette.create.function.scss index 40d201a..55bbd10 100644 --- a/color/palette/_palette.create.function.scss +++ b/color/palette/_palette.create.function.scss @@ -5,14 +5,14 @@ // Modules. @use '../../function'; @use '../../meta'; +@use '../../values'; @use '../../variant'; @use '../name'; @use 'color'; // Functions. @use '../../list/get/get.list.function' as list-get-list; -@use '../../list/list.insert-nth.function' as list-insert-nth; -@use '../../list/list.invert.function' as list-invert; +@use '../../list/list.append.function' as list-append; @use '../../list/list.range.function' as list-range; @use '../../list/remove/remove.nth.function' as list-remove-nth; @@ -30,45 +30,51 @@ function.$functions: map.set(function.$functions, color, name, meta.get-function @function create($values...) { $palette: (); - // FEATURE: Get additional colors. - $variant-colors: (); + // FEATURE: Prepare variant colors. + $additional-colors: (); + + // Iterate `$values`. $i: 1; @each $variant in $values { @if type-of($variant) == map { @each $class, $colors in $variant { - $j: 1; + // Variant colors to add after iterate. + $variant-colors: (); + + // Iterate colors to obtain variant colors. @each $color in $colors { + // Get indicator index. + $indicator-index: variant.indicator-index($color, '+'); + // FEATURE: Nest colors. - @if variant.indicator-index($color, '+') { - $indicator-index: variant.indicator-index($color, '+'); + @if $indicator-index { $color: list.set-nth( $color, $indicator-index, variant.indicator-remove(list.nth($color, $indicator-index), '+') ); - $nested-colors: list-invert.invert(name.nest($color...)); - @each $nested-color in $nested-colors { - $colors: list-insert-nth.insert-nth($colors, $j, $nested-color); - } - - $colors: list-remove-nth.nth($colors, $j + list.length($nested-colors)); + $variant-colors: values.join((separator: comma), $variant-colors, name.nest($color...)); } // FEATURE: Get additional colors. @else if list.separator($color) == space and list.length($color) > 1 and list.length(list-get-list.list($color, last)) == 0 { + // Retrieve variant color. $variant-color: name.retrieve(list.nth($color, 1)); - $variant-colors: map.deep-merge( - $variant-colors, - ($class: (map.get($variant-color, name): list-range.range($color, 2))) + + // Add additional colors from range 2. + $additional-colors: map.deep-merge( + $additional-colors, + (variant.indicator-remove($class, '+'): (map.get($variant-color, name): list-range.range($color, 2))) ); - $color: list.nth($color, 1); - $colors: list.set-nth($colors, $j, $color); - } - $j: $j + 1; + // Append color to variant colors. + $variant-colors: list-append.append($variant-colors, list.nth($color, 1), comma); + } @else { + $variant-colors: list-append.append($variant-colors, $color, comma); + } } - $variant: map.deep-merge($variant, ($class: $colors)); + $variant: map.deep-merge($variant, ($class: $variant-colors)); } $values: list.set-nth($values, $i, $variant); @@ -94,10 +100,9 @@ function.$functions: map.set(function.$functions, color, name, meta.get-function } // FEATURE: Add additional colors to variant. - @if list.length($variant-colors) > 0 { - @each $name, $variant in $variant-colors { + @if list.length($additional-colors) > 0 { + @each $name, $variant in $additional-colors { @each $name in if(list.separator($name) == space, ($name,), $name) { - $name: variant.indicator-remove($name, '+'); @each $class, $colors in $variant { $palette: color.add($palette, $name, $class, space, $colors...); } diff --git a/color/palette/_palette.create.mixin.spec.scss b/color/palette/_palette.create.mixin.spec.scss index 0ea5917..7b41a8a 100644 --- a/color/palette/_palette.create.mixin.spec.scss +++ b/color/palette/_palette.create.mixin.spec.scss @@ -53,6 +53,7 @@ // FEATURE: Multiple colors in variant // core: ((primary dark) (secondary dark) (), error), // DONE + // test: ((primary dark) (secondary dark) (), error), // DONE // FEATURE: Color names // 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 @@ // (+bg, +border): (color, dark, light), // ('+gray', +secondary, +primary large): (+xs (color, dark, light),) // REVIEW: Check. + // core: (dark, light, accent, +primary (color, dark, light), +secondary (color, dark, light)), + // +core: (+primary (color, dark, light), +secondary (color, dark, light)), )) using($palette) { @debug $palette; @@ -136,6 +139,8 @@ // ([string, string]: [string, string]) // @debug create(([primary, secondary]: [color, dark])); // (primary: (primary: primary color, primary dark: primary color dark), secondary: (secondary: secondary color, secondary dark: secondary color dark)) + +// REMOVE: Bracketed removed. // Bracketed // ([string]: [string, [string]]) // @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)) From e44281967ec13068ca62648b5feacba7e6590a4d Mon Sep 17 00:00:00 2001 From: angularpackage Date: Fri, 15 Dec 2023 01:23:01 +0000 Subject: [PATCH 3/4] docs(CHANGELOG.md): v0.17.1-beta --- CHANGELOG.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b3b6304..bb32b7f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # @angular-package/sass changelog +### v0.17.1-beta [#](https://github.com/angular-package/sass/releases/tag/v0.17.1-beta) + +- **Fix** `palette.create()` - adding color to variant colors. [2f277bf] +- **Fix** `name.adjust()` - change `> 0` to `!=`. [2ab64bc] + +[2f277bf]: https://github.com/angular-package/sass/commit/2f277bf3baae46d385921619a2b2455c22d544cc +[2ab64bc]: https://github.com/angular-package/sass/commit/2ab64bcb8d161fbc8e8ed5571d3ef43600ecfbce + + ### v0.17.0-beta [#](https://github.com/angular-package/sass/releases/tag/v0.17.0-beta) - **Update** `color/functions` - calculate using adjustment (from name too) all hsla values and move retrieve color to each hsla functions. From 6a4c0f3e22ee3866f2cb26fa8de2f377821c5211 Mon Sep 17 00:00:00 2001 From: angularpackage Date: Fri, 15 Dec 2023 01:23:30 +0000 Subject: [PATCH 4/4] 0.17.1-beta --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f24ba00..e62c302 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@angular-package/sass", "description": "Extension for sass modules and new modules.", - "version": "0.17.0-beta", + "version": "0.17.1-beta", "main": "./index.scss", "funding": [ {