moda-themes 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +38 -10
- data/lib/assets/stylesheets/moda-themes/_themer.scss +16 -6
- data/lib/assets/stylesheets/moda-themes/_themes.scss +23 -11
- data/lib/moda-themes/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a7967d6f67a53eabd8b4d773ffd8a567c1e29d63905802d2e78221b9c8176e02
|
4
|
+
data.tar.gz: 10d07b43b35c7681fca2d8c617c6061a8f69f702cbb4466a6f7e9af60ce98d27
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 638a8b0fa98daa13f6eeea584943c728540b1ef869848898b34ea9bd99fdf0a0aa0551e637405451b2f424a2515eedbd70e51240f639c89a304aff85525eddd2
|
7
|
+
data.tar.gz: af5b064ce190d1a89a78695e911bdddf3c3a4571730e7dd622252628e48090907e3046fec18feb75a981fcd0fc5084a511452af499a59e9aeffd13b2b9accdbe
|
data/README.md
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
## Meta
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
- **State**: production
|
6
|
+
- **Point people**: [@dzucconi](https://github.com/dzucconi)
|
7
7
|
|
8
8
|
## Getting started
|
9
9
|
|
@@ -22,7 +22,7 @@ bundle install
|
|
22
22
|
Use the functions + mixins in your SASS/SCSS files:
|
23
23
|
|
24
24
|
```scss
|
25
|
-
@import
|
25
|
+
@import "moda-themes";
|
26
26
|
|
27
27
|
// Include this once to generate the `data-theme` attr styling. This is not auto-included
|
28
28
|
// to prevent duplicate imports.
|
@@ -45,7 +45,7 @@ Use the functions + mixins in your SASS/SCSS files:
|
|
45
45
|
|
46
46
|
// Use the functions to access themed values:
|
47
47
|
p {
|
48
|
-
font-family: font-family(
|
48
|
+
font-family: font-family("sans");
|
49
49
|
// font-family: var(--theme-font-families-sans);
|
50
50
|
}
|
51
51
|
```
|
@@ -63,13 +63,11 @@ Configure node-sass `includePaths`:
|
|
63
63
|
For Parcel: Create a .sassrc.js:
|
64
64
|
|
65
65
|
```javascript
|
66
|
-
const modaThemes = require(
|
66
|
+
const modaThemes = require("moda-themes");
|
67
67
|
|
68
68
|
module.exports = {
|
69
|
-
|
70
|
-
|
71
|
-
]
|
72
|
-
}
|
69
|
+
includePaths: [...modaThemes.includePaths]
|
70
|
+
};
|
73
71
|
```
|
74
72
|
|
75
73
|
For Webpack: Configure sass-loader:
|
@@ -104,9 +102,39 @@ Use the functions + mixins in your SASS/SCSS files:
|
|
104
102
|
```scss
|
105
103
|
@import "moda-themes/all";
|
106
104
|
|
107
|
-
//
|
105
|
+
// ...
|
108
106
|
```
|
109
107
|
|
108
|
+
## API
|
109
|
+
|
110
|
+
### Functions
|
111
|
+
|
112
|
+
#### `font-family($name)`
|
113
|
+
|
114
|
+
Returns a font-family variable.
|
115
|
+
|
116
|
+
#### `get-from-theme($theme-name, $keys...)`
|
117
|
+
|
118
|
+
Undocumented.
|
119
|
+
|
120
|
+
#### `themed-value-exists($category, $key)`
|
121
|
+
|
122
|
+
Undocumented.
|
123
|
+
|
124
|
+
### Mixins
|
125
|
+
|
126
|
+
#### `set-root-theme($theme-name)`
|
127
|
+
|
128
|
+
Sets theme variables at the `:root` (include this once)
|
129
|
+
|
130
|
+
#### `data-themes()`
|
131
|
+
|
132
|
+
Inlcudes the full set of themes under `[data-theme="name"]` selectors. (include this once)
|
133
|
+
|
134
|
+
#### `theme-variables-for($theme)`
|
135
|
+
|
136
|
+
Allows you to pull in a set of themed variables manually.
|
137
|
+
|
110
138
|
## Releasing
|
111
139
|
|
112
140
|
[Increment the versions](https://semver.org/) in [package.json](package.json) and [lib/moda-themes/version.rb](lib/moda-themes/version.rb).
|
@@ -1,17 +1,27 @@
|
|
1
|
-
@import
|
1
|
+
@import "themes";
|
2
2
|
|
3
|
-
@mixin
|
4
|
-
|
5
|
-
@
|
6
|
-
|
3
|
+
@mixin set-root-theme($theme-name) {
|
4
|
+
:root {
|
5
|
+
@if map-has-key($themes, $theme-name) {
|
6
|
+
@include theme-variables-for($theme-name);
|
7
|
+
} @else {
|
8
|
+
@error "ERROR: Specified theme: <#{$theme-name}> does not exist";
|
7
9
|
}
|
8
10
|
}
|
9
11
|
}
|
10
12
|
|
11
13
|
@mixin data-themes() {
|
12
|
-
@each $theme-name
|
14
|
+
@each $theme-name in map-keys($map: $themes) {
|
13
15
|
[data-theme="#{$theme-name}"] {
|
14
16
|
@include theme-variables-for($theme-name);
|
15
17
|
}
|
16
18
|
}
|
17
19
|
}
|
20
|
+
|
21
|
+
@mixin theme-variables-for($theme) {
|
22
|
+
@each $category-key, $category-values in map-get($themes, $theme) {
|
23
|
+
@each $key, $value in $category-values {
|
24
|
+
--theme-#{$category-key}-#{$key}: #{$value};
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
@@ -1,9 +1,9 @@
|
|
1
|
-
$font-stack-gotham:
|
2
|
-
$font-stack-miller-headline:
|
1
|
+
$font-stack-gotham: "Gotham", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
2
|
+
$font-stack-miller-headline: "Miller Headline", Georgia, "Times New Roman",
|
3
3
|
Times, serif;
|
4
|
-
$font-stack-moda-sans:
|
5
|
-
$font-stack-moda-serif:
|
6
|
-
$font-stack-caslon:
|
4
|
+
$font-stack-moda-sans: "Moda Operandi Sans", Arial, sans-serif;
|
5
|
+
$font-stack-moda-serif: "Moda Operandi Serif", "Times New Roman", Times, serif;
|
6
|
+
$font-stack-caslon: "Caslon", "Times New Roman", Times, serif;
|
7
7
|
|
8
8
|
$themes: (
|
9
9
|
legacy: (
|
@@ -24,21 +24,33 @@ $themes: (
|
|
24
24
|
)
|
25
25
|
);
|
26
26
|
|
27
|
-
@function
|
27
|
+
@function __var__($var) {
|
28
|
+
@return var(--#{$var});
|
29
|
+
}
|
30
|
+
|
31
|
+
@function __deep-map-get__($map, $keys...) {
|
28
32
|
@each $key in $keys {
|
29
33
|
$map: map-get($map, $key);
|
30
34
|
}
|
31
35
|
@return $map;
|
32
36
|
}
|
33
37
|
|
34
|
-
@function theme($theme, $keys...) {
|
35
|
-
@return map-
|
38
|
+
@function get-from-theme($theme-name, $keys...) {
|
39
|
+
@return __deep-map-get__($themes, $theme-name, $keys...);
|
36
40
|
}
|
37
41
|
|
38
|
-
@function
|
39
|
-
@
|
42
|
+
@function themed-value-exists($category, $key) {
|
43
|
+
@each $theme-name in map-keys($map: $themes) {
|
44
|
+
@if null == get-from-theme($theme-name, $category, $key) {
|
45
|
+
@error "ERROR: '#{$key}' is missing in #{$category} of the #{$theme-name} theme";
|
46
|
+
}
|
47
|
+
}
|
48
|
+
|
49
|
+
@return true;
|
40
50
|
}
|
41
51
|
|
42
52
|
@function font-family($name) {
|
43
|
-
@
|
53
|
+
@if themed-value-exists("font-families", $name) {
|
54
|
+
@return __var__("theme-font-families-#{$name}");
|
55
|
+
}
|
44
56
|
}
|
data/lib/moda-themes/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: moda-themes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- dzucconi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-07-
|
11
|
+
date: 2019-07-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sass
|