Skip to content

Commit c93aa02

Browse files
Merge pull request #17 from angular-package/develop
v0.7.0-beta
2 parents c3add53 + 39fb4e3 commit c93aa02

30 files changed

+813
-4
lines changed

CHANGELOG.md

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

3+
### v0.7.0-beta [#](https://github.com/angular-package/sass/releases/tag/v0.7.0-beta)
4+
5+
- Fix `map.set()` - add checking whether `$key` is comma-separated list to have ability to add space separated keys. [1d46564]
6+
- Add `query` module to search in `list` by using query. [3e2c20c]
7+
- Add experimental `object` module to handle multiple multiple `keys` in `map` variable as objects. [5274590] [6e16608]
8+
- Add `map.is()` function to check whether the `$value` is `map` of optionally `$length`. [1a3c52c]
9+
10+
[6e16608]: https://github.com/angular-package/sass/commit/6e166083a52cdafc4c338d3a0e65a2467f7915c8
11+
[1d46564]: https://github.com/angular-package/sass/commit/1d46564fce0eb819a331f74b691e62320b6d001a
12+
[3e2c20c]: https://github.com/angular-package/sass/commit/3e2c20c300f1daa4317a4ec6861bf2982cd9f245
13+
[5274590]: https://github.com/angular-package/sass/commit/52745909997a1c514b348183a07cbb3203acd169
14+
[1a3c52c]: https://github.com/angular-package/sass/commit/1a3c52cf6fe2b24119cca6325e6c5fc59242b3fd
15+
316
### v0.6.1-beta [#](https://github.com/angular-package/sass/releases/tag/v0.6.1-beta)
417

518
- Fix `color.hsla-color()` and `color.retrieve()` by removing `values.map` import and change `values.map` to `list.to-map()`. [e8fe993]

index.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@
88
@forward 'math' as math-*;
99
@forward 'meta' as meta-*;
1010
@forward 'number' as number-*;
11+
@forward 'object' as object-*;
1112
@forward 'property' as property-* hide property;
1213
@forward 'property/property.mixin';
14+
@forward 'query' as query-*;
1315
@forward 'selector' as selector-*;
1416
@forward 'string' as string-*;
1517
@forward 'translator' as translator-*;

map/_map.is.function.scss

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Sass.
2+
@use 'sass:list';
3+
4+
// Status: DONE
5+
// The `map.is()` function checks whether `$value` is `map` type, optionally of `$length`.
6+
// @param `$value` The value to check against `map` type.
7+
// @returns The returned value is a `bool` indicating whether `$value` is a map, optionally of `$length`.
8+
@function is($value, $length: null) {
9+
@return if(
10+
$length,
11+
type-of($value) == map and list.length($value) == $length,
12+
type-of($value) == map
13+
);
14+
}
15+
16+
// Examples.
17+
// @debug is((a: 1, b: 2, c: 3));
18+
// @debug is((a: 1, b: 2, c: 3), 2);
19+
// @debug is((a: 1, b: 2, c: 3), 3);

map/_map.set.function.scss

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,26 @@
55

66
// Status: DONE
77
// The `map.set()` function sets `$allowed` `$value` under `$key` in `$map`.
8-
// ? Original sass `map.set()` function modified, by adding `$allowed...` arbitrary argument to check if `$value` is allowed to be set.
98
// @param `$map` A map to set `$value` at `$key`.
109
// @param `$key` A key under which `$value` is set.
1110
// @param `$value` The value to set in `$map` under `key`.
1211
// @arbitrary `$allowed...` Allowed value types and/or values to set in `$map`.
13-
// @return The return value is updated `$map` with `$value` at `$key`.
12+
// @returns The return value is updated `$map` with `$value` at `$key`.
1413
@function set($map, $key, $value, $allowed...) {
1514
@return if(
1615
if(
1716
list.length($allowed) > 0,
1817
if(list.index($allowed, meta.type-of($value)) or list.index($allowed, $value), true, false),
1918
true
2019
),
21-
map.set($map, list.append($key, $value, comma)...),
20+
map.set(
21+
$map,
22+
list.append(
23+
if(meta.type-of($key) == list and list.separator($key) == comma, $key, ($key,)),
24+
$value,
25+
comma
26+
)...
27+
),
2228
$map
2329
);
2430
}

ng-package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
"./math/**/*.scss",
1616
"./meta/**/*.scss",
1717
"./number/**/*.scss",
18+
"./object/**/*.scss",
1819
"./property/**/*.scss",
20+
"./query/**/*.scss",
1921
"./selector/**/*.scss",
2022
"./string/**/*.scss",
2123
"./translator/**/*.scss",

object/_index.scss

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
@forward 'object.copy.function';
2+
@forward 'object.create.function';
3+
@forward 'object.get.function';
4+
@forward 'object.keys.function';
5+
@forward 'object.last-id.function';
6+
@forward 'object.last-name.function';
7+
@forward 'object.merge.function';
8+
@forward 'object.move.function';
9+
@forward 'object.pick.function';
10+
@forward 'object.remove.function';
11+
@forward 'object.set.function';
12+
@forward 'object.use.function';
13+
@forward 'object.var';

object/_object.copy.function.scss

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Sass.
2+
@use 'sass:list';
3+
4+
// Variables.
5+
@use 'object.var' as object;
6+
7+
// Modules.
8+
@use '../map';
9+
10+
// Functions.
11+
@use 'object.get.function' as *;
12+
@use 'object.set.function' as *;
13+
@use 'object.use.function' as *;
14+
15+
// Status: DONE
16+
// The `object.copy()` function.
17+
// @param `$from`
18+
// @param `$to`
19+
// @returns
20+
@function copy($from, $to) {
21+
@return set($to, get($from));
22+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Sass.
2+
@use 'sass:list';
3+
@use 'sass:map';
4+
@use 'sass:meta';
5+
6+
// Object.
7+
@use 'object.var' as object;
8+
9+
// Functions.
10+
@use 'object.get.function' as *;
11+
12+
// Status: DONE
13+
// The `object.create()` function sets `map` type object in `object.$object` variable under `$name` key.
14+
// @param `$object` A `map` type value to set in `object.$object` under `$name`.
15+
// @param `$name` The name under which `$object` of `map` type is stored, `null` indicates add new object under incremented `number`.
16+
// @returns The returned value is `$object` of `map` type under `$name` key of `object.$object`.
17+
@function create($object, $name: list.length(object.$object) + 1) {
18+
$object: if(meta.type-of(list) and list.length($object) == 0, map.remove((1:1), 1), $object);
19+
@if type-of($object) == map {
20+
object.$object: map.set(object.$object, $name, $object);
21+
}
22+
@return get();
23+
}

object/_object.get.function.scss

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Sass.
2+
@use 'sass:list';
3+
4+
// Object.
5+
@use 'object.var' as object;
6+
7+
// Modules.
8+
@use '../map';
9+
10+
// Functions.
11+
@use 'object.last-name.function' as *;
12+
@use 'object.use.function' as *;
13+
14+
// Status: DONE
15+
// The `object.get()` function gets `map` from `object.$object` variable of key `$name`, where by default is last created or set by `object.use()`.
16+
// @param `$key` An optional key of `map` from `object.$object` to get.
17+
// @param `$fallback` Fallback value if retrieved is `null`.
18+
// // @param `$name` A name of `map` in `object.$object` to get, `null` indicates last created object.
19+
// @returns The returned value is a `map` retrieved from `object.$object` of `$name`, optionally value retrieved from `$key`.
20+
@function get($key: null, $fallback: null) {
21+
$name: object.$name or last-name();
22+
@if type-of($key) == map {
23+
@each $name, $key in $key {
24+
@return map.get(object.$object, list.append($name, $key, comma), $fallback);
25+
}
26+
}
27+
@return map.get(object.$object, if($key, list.append($name, $key, comma), $name), $fallback);
28+
}

object/_object.keys.function.scss

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Sass.
2+
@use 'sass:list';
3+
@use 'sass:map';
4+
5+
// Object.
6+
@use 'object.var' as object;
7+
8+
// Functions.
9+
@use 'object.get.function' as *;
10+
@use 'object.last-name.function' as *;
11+
12+
// Status: DONE
13+
// The `object.keys()` function.
14+
// @param `$key`
15+
// @returns
16+
@function keys($key: null) {
17+
@return map.keys(get($key));
18+
}

0 commit comments

Comments
 (0)