modular-scale 2.0.0.alpha1 → 2.0.0.alpha2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d9d19e3ba952241eb84c685a2ec590ada850b49e
|
4
|
+
data.tar.gz: ebd81cb6ee870e5fd4d65c7f62df7e5d1aa1acdf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7284ed53897d94d33ec8f737622ddf3e3e685efc4de6dd39db44492f123be01c020ab0b1e2693386df5481566a7154d6edc9aba9a1229ecc255c1aae3624045e
|
7
|
+
data.tar.gz: 8480a4a2de44c058719bfbace86fac80178aa7133e6a7b6c847f4a202f079a044bbd2f6d3f581c4d51ec8e3dc029f229015da382cfb18db9d3af03421d47d8e1
|
data/lib/modular-scale.rb
CHANGED
@@ -7,38 +7,12 @@
|
|
7
7
|
@return ms-calc($Value, $Bases, $Ratios);
|
8
8
|
}
|
9
9
|
|
10
|
-
// Use cached values if they exist
|
11
|
-
@if $MS-maps-exist {
|
12
|
-
// Find the map
|
13
|
-
// it's labeld with the base and ratio values
|
14
|
-
@if map-get($MS-cache, "#{$Bases} #{$Ratios}") {
|
15
|
-
// Positive list
|
16
|
-
$MS-pos: map-get(map-get($MS-cache, "#{$Bases} #{$Ratios}"), pos);
|
17
|
-
// See if the map matches the range
|
18
|
-
@if $Value >= 0 and length($MS-pos) > $Value {
|
19
|
-
@return nth($MS-pos, $Value + 1);
|
20
|
-
}
|
21
|
-
// And again for negitive values
|
22
|
-
$MS-neg: map-get(map-get($MS-cache, "#{$Bases} #{$Ratios}"), neg);
|
23
|
-
@if $Value < 0 and length($MS-neg) > abs($Value - 1) {
|
24
|
-
@return nth($MS-neg, $Value - 1);
|
25
|
-
}
|
26
|
-
}
|
27
|
-
// If nothing matched criteria in map
|
28
|
-
// then just carry on with calculaitons.
|
29
|
-
}
|
30
|
-
|
31
10
|
// Generate a list of all possible values
|
32
11
|
$Return: ms-generate-list($Value, $Bases, $Ratios);
|
33
12
|
|
34
13
|
// Sort the generated lists
|
35
14
|
$Return: ms-sort-list($Return);
|
36
15
|
|
37
|
-
// Cache
|
38
|
-
@if $MS-maps-exist {
|
39
|
-
$MS-cache: ms-cache($Value, $Bases, $Ratios, $Return) !global;
|
40
|
-
}
|
41
|
-
|
42
16
|
// Normalize value for counting from 1
|
43
17
|
// Because CSS counts things from 1
|
44
18
|
// So Sass does as well
|
@@ -10,19 +10,4 @@
|
|
10
10
|
@return false;
|
11
11
|
}
|
12
12
|
|
13
|
-
$MS-pow-exists: ms-pow-exists();
|
14
|
-
|
15
|
-
|
16
|
-
// Test if map capability exists
|
17
|
-
// maps are used to cache calculations
|
18
|
-
|
19
|
-
@function ms-maps-exist() {
|
20
|
-
@if function-exists(map-get) == true {
|
21
|
-
@return true;
|
22
|
-
}
|
23
|
-
@else {
|
24
|
-
@return false;
|
25
|
-
}
|
26
|
-
}
|
27
|
-
|
28
|
-
$MS-maps-exist: ms-maps-exist();
|
13
|
+
$MS-pow-exists: ms-pow-exists();
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: modular-scale
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.
|
4
|
+
version: 2.0.0.alpha2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- First Last
|
@@ -34,7 +34,6 @@ files:
|
|
34
34
|
- license.md
|
35
35
|
- lib/modular-scale.rb
|
36
36
|
- stylesheets/_modular-scale.scss
|
37
|
-
- stylesheets/modular-scale/_cache.scss
|
38
37
|
- stylesheets/modular-scale/_calc.scss
|
39
38
|
- stylesheets/modular-scale/_function-list.scss
|
40
39
|
- stylesheets/modular-scale/_function.scss
|
@@ -1,25 +0,0 @@
|
|
1
|
-
// An empty cache map
|
2
|
-
$MS-cache: ();
|
3
|
-
|
4
|
-
@function ms-cache($Value, $Bases, $Ratios, $Return) {
|
5
|
-
|
6
|
-
$MS-new-map: ();
|
7
|
-
|
8
|
-
@if $Value >= 0 {
|
9
|
-
$MS-new-map: (
|
10
|
-
"#{$Bases} #{$Ratios}": (
|
11
|
-
pos: $Return,
|
12
|
-
),
|
13
|
-
);
|
14
|
-
}
|
15
|
-
|
16
|
-
@if $Value < 0 {
|
17
|
-
$MS-new-map: (
|
18
|
-
"#{$Bases} #{$Ratios}": (
|
19
|
-
neg: $Return,
|
20
|
-
),
|
21
|
-
);
|
22
|
-
}
|
23
|
-
|
24
|
-
@return map-merge($MS-cache, $MS-new-map);
|
25
|
-
}
|