@penskemediacorp/larva-scss 1.0.2-alpha.0 → 1.1.2
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.
- package/LICENSE +21 -0
- package/README.md +98 -4
- package/__tests__/a-crop-generator.test.scss +30 -0
- package/__tests__/a-grid-generator.test.scss +71 -0
- package/__tests__/basic-utility-generator.test.scss +31 -0
- package/__tests__/fixture/_settings.scss +1 -0
- package/__tests__/functions.test.scss +38 -0
- package/__tests__/larva-scss.test.js +15 -0
- package/__tests__/mixins.test.scss +25 -0
- package/__tests__/spacing-class-generator.test.scss +48 -0
- package/__tests__/text-utility-generators.test.scss +103 -0
- package/__tests__/token-utility-generator.test.scss +33 -0
- package/dist/_generators.scss +41 -0
- package/dist/_tokens.scss +6 -0
- package/dist/_tools.scss +1 -0
- package/lib/_setup.scss +15 -0
- package/{src/settings/colors.scss → lib/tokens/_colors.scss} +3 -6
- package/{src/settings/shadows.scss → lib/tokens/_shadows.scss} +2 -7
- package/lib/tokens/_sizing.scss +32 -0
- package/{src/settings/transition.scss → lib/tokens/_transition.scss} +4 -4
- package/{src/settings/typography.scss → lib/tokens/_typography.scss} +0 -0
- package/{src/settings/z-index.scss → lib/tokens/_z-index.scss} +0 -0
- package/lib/tools/_tools.scss +17 -0
- package/{src → lib}/tools/functions/_helpers.scss +0 -0
- package/lib/tools/functions/_pmc-inline-svg.scss +49 -0
- package/{src/tools/functions/pmc-rem.scss → lib/tools/functions/_pmc-rem.scss} +0 -0
- package/lib/tools/generators/README.md +12 -0
- package/{src/tools/generators/_crop-class-generator.scss → lib/tools/generators/_a-crop-generator.scss} +3 -3
- package/{src/tools/generators/_grid-class-generator.scss → lib/tools/generators/_a-grid-generator.scss} +12 -11
- package/lib/tools/generators/_basic-utility-generator.scss +20 -0
- package/{src/tools/generators/_spacing-class-generator.scss → lib/tools/generators/_spacing-utility-generator.scss} +3 -3
- package/{src/tools/generators/_text-class-generator.scss → lib/tools/generators/_text-utility-generator.scss} +6 -5
- package/lib/tools/generators/_token-utility-generator.scss +21 -0
- package/lib/tools/mixins/_pmc-breakpoint.scss +17 -0
- package/lib/tools/mixins/_pmc-font-family.scss +14 -0
- package/package.json +6 -15
- package/lib/larva-scss.js +0 -7
- package/src/settings/sizing.scss +0 -23
- package/src/setup.scss +0 -14
- package/src/tools/generators/README.md +0 -21
- package/src/tools/generators/_color-class-generator.scss +0 -27
- package/src/tools/mixins/pmc-breakpoint.scss +0 -18
- package/src/tools/mixins/pmc-unstyle-link.scss +0 -4
- package/src/tools/mixins/pmc-unstyle-list.scss +0 -6
- package/src/tools/tools.scss +0 -15
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019 Penske Media Corporation
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,11 +1,105 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Larva SCSS
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**Note:** As of 8.7.0-alpha, the recommended approach for class generation is NOT to use these generators, but to directly iterate over a map of tokens add rulesets within that loop.
|
|
4
|
+
|
|
5
|
+
This repository holds core SCSS tools and tokens for Larva. These include:
|
|
6
|
+
|
|
7
|
+
- Breakpoint mixin
|
|
8
|
+
- Variables (e.g. spacing, color, z-index, and transition values)
|
|
9
|
+
- Generators (i.e. mixins that generate classes according to a list of tokens) **NOT RECOMMENDED FOR UTILITIES**
|
|
10
|
+
|
|
11
|
+
This repository provides **Sass files only**. The consuming project is responsible for building the assets.
|
|
4
12
|
|
|
5
13
|
## Usage
|
|
6
14
|
|
|
15
|
+
Import a SCSS file for tools or tokens to use them in your project.
|
|
16
|
+
|
|
17
|
+
### Available Tools
|
|
18
|
+
|
|
19
|
+
#### Breakpoint Mixin
|
|
20
|
+
|
|
21
|
+
The breakpoint mixin includes breakpoints for the following:
|
|
22
|
+
|
|
23
|
+
* mobile-max = (max-width: 767px)
|
|
24
|
+
* tablet = (min-width: 768px)
|
|
25
|
+
* desktop = (min-width: 1000px)
|
|
26
|
+
* desktop-xl = (min-width: 1260px)
|
|
27
|
+
|
|
28
|
+
```language:scss
|
|
29
|
+
// assets/src/patterns/07-utilities/u-display.scss
|
|
30
|
+
@import '@penskemediacorp/larva-scss/dist/tools';
|
|
31
|
+
|
|
32
|
+
.u-display-none\@tablet {
|
|
33
|
+
@include pmc-breakpoint( tablet ) {
|
|
34
|
+
display: none;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Rem Mixin
|
|
40
|
+
|
|
41
|
+
```language:scss
|
|
42
|
+
// assets/src/patterns/07-utilities/u-width.scss
|
|
43
|
+
@import '@penskemediacorp/larva-scss/dist/tools';
|
|
44
|
+
|
|
45
|
+
.u-max-width-600 {
|
|
46
|
+
max-width: pmc-rem(600);
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Tokens
|
|
51
|
+
|
|
52
|
+
Refer to the directory lib/tokens in this package to see what tokens (a.k.a. Sass variables) are available to use.
|
|
53
|
+
|
|
54
|
+
You can import the file in a Larva project and use the tokens like this:
|
|
55
|
+
|
|
56
|
+
```language:scss
|
|
57
|
+
// assets/src/patterns/06-algorithms/a-specific-grid.scss
|
|
58
|
+
@import '@penskemediacorp/larva-scss/dist/tokens';
|
|
59
|
+
|
|
60
|
+
.a-specific-grid {
|
|
61
|
+
display: grid;
|
|
62
|
+
grid-template-columns: repeat( 1fr, 3 );
|
|
63
|
+
grid-gap: $spacer-150;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.a-specific-grid__top-bar {
|
|
67
|
+
margin-top: $spacer-2;
|
|
68
|
+
grid-column: 1 / -1;
|
|
69
|
+
}
|
|
7
70
|
```
|
|
8
|
-
const larvaScss = require('@penskemediacorp/larva-scss');
|
|
9
71
|
|
|
10
|
-
|
|
72
|
+
### Generators
|
|
73
|
+
|
|
74
|
+
For example, if you need to add grids that are not available in larva-css, you can use the grid algorithm generator. In a new file, `assets/src/patterns/06-algorithms/a-grid.scss`, add the following:
|
|
75
|
+
|
|
76
|
+
```language:scss
|
|
77
|
+
// assets/src/patterns/06-algorithms/a-grid.scss
|
|
78
|
+
@import '@penskemediacorp/larva-scss/dist/generators';
|
|
79
|
+
|
|
80
|
+
$grids: (
|
|
81
|
+
(
|
|
82
|
+
columns: 6,
|
|
83
|
+
spans: ( 2, 3, ),
|
|
84
|
+
breakpoint: tablet,
|
|
85
|
+
),
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
@include a-grid( $grids );
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Utility generators are used the same way, but added inside the utilities directory, instead, and indicate a simple, property: value declaration. To add additional colors to a consuming project, for example, add the following:
|
|
92
|
+
|
|
93
|
+
```language:scss
|
|
94
|
+
// assets/src/patterns/07-utilities/u-background.scss
|
|
95
|
+
|
|
96
|
+
@import '@penskemediacorp/larva-scss/dist/generators';
|
|
97
|
+
@import '@penskemediacorp/larva-scss/dist/tokens';
|
|
98
|
+
|
|
99
|
+
$color_list: (
|
|
100
|
+
blue: $color-blue-30,
|
|
101
|
+
blue-light: $color-blue-80,
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
@include token-utility-generator( $color_list );
|
|
11
105
|
```
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
@import "true";
|
|
2
|
+
@import "../lib/tools/tools";
|
|
3
|
+
|
|
4
|
+
@include test-module('@mixin _a-crop-generator') {
|
|
5
|
+
|
|
6
|
+
$aspect-ratios: (
|
|
7
|
+
'16x9': (16, 9),
|
|
8
|
+
'4x3': (4, 3)
|
|
9
|
+
);
|
|
10
|
+
|
|
11
|
+
@include test('generates non-namespaced crops') {
|
|
12
|
+
|
|
13
|
+
@include assert {
|
|
14
|
+
|
|
15
|
+
@include output {
|
|
16
|
+
@include _a-crop-generator( $aspect-ratios, '' );
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@include contains {
|
|
20
|
+
.a-crop-16x9 {
|
|
21
|
+
padding-bottom: calc( ( 9 / 16 ) * 100% );
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.a-crop-4x3 img {
|
|
25
|
+
object-fit: cover;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
@import "true";
|
|
2
|
+
@import "../lib/tools/tools";
|
|
3
|
+
|
|
4
|
+
@include test-module('@mixin _a-grid-generator') {
|
|
5
|
+
|
|
6
|
+
@include test('generates non-namepsaced grids') {
|
|
7
|
+
@include assert {
|
|
8
|
+
|
|
9
|
+
@include output {
|
|
10
|
+
$grids: (
|
|
11
|
+
(
|
|
12
|
+
columns: 2,
|
|
13
|
+
spans: ( 2, ),
|
|
14
|
+
),
|
|
15
|
+
(
|
|
16
|
+
columns: 3,
|
|
17
|
+
breakpoint: tablet,
|
|
18
|
+
spans: ( 2, ),
|
|
19
|
+
),
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
@include _a-grid-generator( $grids, '' );
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@include expect {
|
|
26
|
+
.a-cols2 {
|
|
27
|
+
--cols: 2;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.a-cols2 > * {
|
|
31
|
+
flex-basis: 50%;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@supports (display: grid) {
|
|
35
|
+
.a-span2 {
|
|
36
|
+
grid-column: span 2;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.a-cols2 > .a-span2 {
|
|
41
|
+
flex-basis: 100%;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@media( min-width: 48rem ) {
|
|
45
|
+
.a-cols3\@tablet {
|
|
46
|
+
--cols: 3;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.a-cols3\@tablet > * {
|
|
50
|
+
flex-basis: 33.33333%;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
@media( min-width: 48rem ) {
|
|
55
|
+
|
|
56
|
+
.a-span2\@tablet {
|
|
57
|
+
@supports ( display: grid ) {
|
|
58
|
+
grid-column: span 2;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.a-cols3\@tablet > .a-span2\@tablet {
|
|
63
|
+
flex-basis: 66.66667%;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
@import "true";
|
|
2
|
+
@import "../lib/tools/tools";
|
|
3
|
+
|
|
4
|
+
@include test-module('@mixin basic-utility-generator') {
|
|
5
|
+
$map: (
|
|
6
|
+
opacity-1: 1,
|
|
7
|
+
);
|
|
8
|
+
|
|
9
|
+
@include test('generates non-namespaced utility') {
|
|
10
|
+
@include assert {
|
|
11
|
+
|
|
12
|
+
@include output {
|
|
13
|
+
|
|
14
|
+
@include basic-utility-generator(
|
|
15
|
+
'opacity',
|
|
16
|
+
(
|
|
17
|
+
opacity-1,
|
|
18
|
+
),
|
|
19
|
+
$map,
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@include expect {
|
|
24
|
+
.u-opacity-1 {
|
|
25
|
+
opacity: 1;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Nothing here.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
@import "true";
|
|
2
|
+
@import "../lib/tools/tools";
|
|
3
|
+
|
|
4
|
+
// Functions
|
|
5
|
+
@include test-module('Functions') {
|
|
6
|
+
|
|
7
|
+
// Private _strip-unit function.
|
|
8
|
+
@include test('@function _strip-unit') {
|
|
9
|
+
@include assert-equal( _strip-unit(16px), 16 );
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// pmc-rem function.
|
|
13
|
+
@include test('@function pmc-rem') {
|
|
14
|
+
@include assert-equal( pmc-rem(16), '1rem' );
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// pmc-rem function.
|
|
18
|
+
@include test('@function pmc-inline-svg') {
|
|
19
|
+
|
|
20
|
+
$arrow: '<svg width="10" height="16" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><path d="M25.663 90.25l-6.75 6.429c-.226.214-.45.321-.788.321-.337 0-.563-.107-.788-.321-.45-.429-.45-1.072 0-1.5L23.3 89.5l-5.963-5.679c-.45-.428-.45-1.071 0-1.5a1.125 1.125 0 0 1 1.576 0l6.75 6.429c.45.429.45 1.071 0 1.5z" id="a"/></defs><use fill="#FFF" transform="matrix(-1 0 0 1 26.5 -81.5)" xlink:href="#a"/></svg>';
|
|
21
|
+
|
|
22
|
+
@include assert {
|
|
23
|
+
|
|
24
|
+
@include output {
|
|
25
|
+
.a-icon-right-arrow {
|
|
26
|
+
--icon: url( #{pmc-inline-svg( $arrow )} );
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@include expect {
|
|
31
|
+
.a-icon-right-arrow {
|
|
32
|
+
--icon: url( "data:image/svg+xml;charset=US-ASCII,%3Csvg%20width%3D%2710%27%20height%3D%2716%27%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20xmlns%3Axlink%3D%27http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%27%3E%3Cdefs%3E%3Cpath%20d%3D%27M25.663%2090.25l-6.75%206.429c-.226.214-.45.321-.788.321-.337%200-.563-.107-.788-.321-.45-.429-.45-1.072%200-1.5L23.3%2089.5l-5.963-5.679c-.45-.428-.45-1.071%200-1.5a1.125%201.125%200%200%201%201.576%200l6.75%206.429c.45.429.45%201.071%200%201.5z%27%20id%3D%27a%27%2F%3E%3C%2Fdefs%3E%3Cuse%20fill%3D%27%23FFF%27%20transform%3D%27matrix%28-1%200%200%201%2026.5%20-81.5%29%27%20xlink%3Ahref%3D%27%23a%27%2F%3E%3C%2Fsvg%3E" );
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const sassTrue = require('sass-true');
|
|
5
|
+
const glob = require('glob');
|
|
6
|
+
|
|
7
|
+
describe('@penskemediacorp/larva-scss', () => {
|
|
8
|
+
// Find all of the Sass files that end in `*.test.scss` in any directory in this project.
|
|
9
|
+
const sassTestFiles = glob.sync( path.resolve( __dirname, './**/*.test.scss' ) );
|
|
10
|
+
|
|
11
|
+
// Run True on every file found with the describe and it methods provided.
|
|
12
|
+
sassTestFiles.forEach( file =>
|
|
13
|
+
sassTrue.runSass( { file }, { describe, it } )
|
|
14
|
+
);
|
|
15
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
@import "true";
|
|
2
|
+
@import "../lib/tools/tools";
|
|
3
|
+
|
|
4
|
+
// Module Group
|
|
5
|
+
@include test-module('Mixins') {
|
|
6
|
+
|
|
7
|
+
// pmc-breakpoint mixin.
|
|
8
|
+
@include test('@mixin pmc-breakpoint') {
|
|
9
|
+
|
|
10
|
+
@include assert {
|
|
11
|
+
|
|
12
|
+
@include output {
|
|
13
|
+
@include pmc-breakpoint( desktop ) {
|
|
14
|
+
font-size: 1rem;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@include contains {
|
|
19
|
+
@media( min-width: $screen-desktop ) {
|
|
20
|
+
font-size: 1rem;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
@import "true";
|
|
2
|
+
@import "../lib/tools/tools";
|
|
3
|
+
|
|
4
|
+
@include test-module('@mixin _spacing-class-generator') {
|
|
5
|
+
|
|
6
|
+
$spacer-050: 0.5rem;
|
|
7
|
+
$spacer-1: 1rem;
|
|
8
|
+
|
|
9
|
+
$margins: (
|
|
10
|
+
('tb', $spacer-050),
|
|
11
|
+
('a', $spacer-1, desktop)
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
$paddings: (
|
|
15
|
+
('a', $spacer-1),
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
@include test('generates non-namespaced classes') {
|
|
19
|
+
@include assert {
|
|
20
|
+
|
|
21
|
+
@include output {
|
|
22
|
+
$spacer-050: 0.5rem;
|
|
23
|
+
$spacer-1: 1rem;
|
|
24
|
+
|
|
25
|
+
@include _spacing-class-generator( 'margin', $margins, '' );
|
|
26
|
+
@include _spacing-class-generator( 'padding', $paddings, '' );
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@include expect {
|
|
30
|
+
.u-margin-tb-050 {
|
|
31
|
+
margin-top: 0.5rem;
|
|
32
|
+
margin-bottom: 0.5rem;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@media (min-width: 62.5rem) {
|
|
36
|
+
.u-margin-a-1\@desktop {
|
|
37
|
+
margin: 1rem;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.u-padding-a-1 {
|
|
42
|
+
padding: 1rem;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
@import "true";
|
|
2
|
+
@import "../lib/tools/tools";
|
|
3
|
+
|
|
4
|
+
@include test-module('@mixin _text-utility-generator') {
|
|
5
|
+
|
|
6
|
+
@include test('generates non-namespaced classes') {
|
|
7
|
+
|
|
8
|
+
@include assert {
|
|
9
|
+
|
|
10
|
+
@include output {
|
|
11
|
+
|
|
12
|
+
$font-size-1: 1rem;
|
|
13
|
+
$font-size-2: 2rem;
|
|
14
|
+
|
|
15
|
+
$font-weights: (
|
|
16
|
+
bold: 600,
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
$line-heights: (
|
|
20
|
+
sm: 1,
|
|
21
|
+
md: 2,
|
|
22
|
+
lg: 3,
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
$font-family-balto: Balto, sans-serif;
|
|
26
|
+
|
|
27
|
+
$font-families: (
|
|
28
|
+
balto: ($font-family-balto, 'web',),
|
|
29
|
+
helvetica: (Helvetica, 'system',),
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
@include _text-class-generator(
|
|
34
|
+
'font-size',
|
|
35
|
+
(
|
|
36
|
+
( $font-size-1, ),
|
|
37
|
+
( $font-size-2, desktop, )
|
|
38
|
+
),
|
|
39
|
+
'',
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
@include _text-class-generator(
|
|
43
|
+
'line-height',
|
|
44
|
+
(
|
|
45
|
+
sm,
|
|
46
|
+
),
|
|
47
|
+
'',
|
|
48
|
+
$line-heights,
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
@include _text-class-generator(
|
|
52
|
+
'font-weight',
|
|
53
|
+
(
|
|
54
|
+
bold,
|
|
55
|
+
),
|
|
56
|
+
'',
|
|
57
|
+
$font-weights,
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
@include _text-class-generator(
|
|
61
|
+
'font-family',
|
|
62
|
+
(
|
|
63
|
+
balto,
|
|
64
|
+
helvetica
|
|
65
|
+
),
|
|
66
|
+
'',
|
|
67
|
+
$font-families,
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
@include expect {
|
|
72
|
+
.u-font-size-16 {
|
|
73
|
+
font-size: 1rem;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
@media( min-width: 62.5rem ) {
|
|
77
|
+
.u-font-size-32\@desktop {
|
|
78
|
+
font-size: 2rem;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.u-line-height-sm {
|
|
83
|
+
line-height: 1;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.u-font-weight-bold {
|
|
87
|
+
font-weight: 600;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.wf-active .u-font-family-balto {
|
|
91
|
+
font-family: Balto, sans-serif;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.u-font-family-helvetica {
|
|
95
|
+
font-family: Helvetica;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
}
|
|
103
|
+
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
@import "true";
|
|
2
|
+
@import "../lib/tools/tools";
|
|
3
|
+
|
|
4
|
+
@include test-module('@mixin token-utility-generator') {
|
|
5
|
+
$map: (
|
|
6
|
+
background-color-brand-primary: #FF00AA,
|
|
7
|
+
text-color-grey-light: #CCCCCC,
|
|
8
|
+
);
|
|
9
|
+
|
|
10
|
+
@include test('generates background color') {
|
|
11
|
+
@include assert {
|
|
12
|
+
|
|
13
|
+
@include output {
|
|
14
|
+
|
|
15
|
+
@include token-utility-generator(
|
|
16
|
+
'background-color',
|
|
17
|
+
(
|
|
18
|
+
background-color-brand-primary,
|
|
19
|
+
),
|
|
20
|
+
$map,
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@include expect {
|
|
25
|
+
.u-background-color-brand-primary {
|
|
26
|
+
background-color: #FF00AA;
|
|
27
|
+
background-color: var( --background-color-brand-primary, #FF00AA );
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
@import '../lib/tools/tools';
|
|
2
|
+
|
|
3
|
+
// -----------
|
|
4
|
+
// Algorithms
|
|
5
|
+
// -----------
|
|
6
|
+
|
|
7
|
+
@mixin a-grid( $grids, $NAMESPACE: '' ) {
|
|
8
|
+
@include _a-grid-generator( $grids, $NAMESPACE );
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
@mixin a-crop( $aspect-ratios, $NAMESPACE: '' ) {
|
|
12
|
+
@include _a-crop-generator( $aspect-ratios, $NAMESPACE );
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// -----------
|
|
16
|
+
// Utilities
|
|
17
|
+
// -----------
|
|
18
|
+
|
|
19
|
+
@mixin u-padding( $paddings, $NAMESPACE: '' ) {
|
|
20
|
+
@include _spacing-class-generator( 'padding', $paddings, $NAMESPACE );
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@mixin u-margin( $margins, $NAMESPACE: '' ) {
|
|
24
|
+
@include _spacing-class-generator( 'margin', $margins, $NAMESPACE );
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@mixin u-font-family( $tokens, $available_tokens, $NAMESPACE: '' ) {
|
|
28
|
+
@include _text-class-generator('font-family', $tokens, $NAMESPACE, $available_tokens );
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@mixin u-line-height( $tokens, $available_tokens, $NAMESPACE: '' ) {
|
|
32
|
+
@include _text-class-generator('line-height', $tokens, $NAMESPACE, $available_tokens );
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@mixin u-font-size( $tokens, $NAMESPACE: '' ) {
|
|
36
|
+
@include _text-class-generator( 'font-size', $tokens, $NAMESPACE );
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@mixin u-font-weight( $tokens, $available_tokens, $NAMESPACE: '' ) {
|
|
40
|
+
@include _text-class-generator('font-weight', $tokens, $NAMESPACE, $available_tokens );
|
|
41
|
+
}
|
package/dist/_tools.scss
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import './generators';
|
package/lib/_setup.scss
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// @import './tools/tools';
|
|
2
|
+
// @import './tokens/sizing.scss';
|
|
3
|
+
// @import './tokens/colors.scss';
|
|
4
|
+
|
|
5
|
+
// @mixin pmc-unstyle-list {
|
|
6
|
+
// list-style-type: none;
|
|
7
|
+
// padding-left: 0;
|
|
8
|
+
// margin-top: 0;
|
|
9
|
+
// margin-bottom: 0;
|
|
10
|
+
// }
|
|
11
|
+
|
|
12
|
+
// @mixin pmc-unstyle-link {
|
|
13
|
+
// color: currentColor;
|
|
14
|
+
// text-decoration: none;
|
|
15
|
+
// }
|
|
@@ -27,22 +27,19 @@ $color-geyser-85: #D3DDE2;
|
|
|
27
27
|
|
|
28
28
|
// Greys
|
|
29
29
|
$color-grey-100:#FFFFFF; // white
|
|
30
|
-
$color-grey-98: #
|
|
30
|
+
$color-grey-98: #F7F7F7; // grey-lightest
|
|
31
31
|
$color-grey-90: #E6E6E6; // grey-light
|
|
32
32
|
$color-grey-80: #CCCCCC; // grey-medium-light
|
|
33
|
-
$color-grey-70: #6A6A6A; // grey-medium
|
|
34
33
|
$color-grey-50: #8C8C8C;
|
|
34
|
+
$color-grey-70: #6A6A6A; // grey-medium
|
|
35
35
|
$color-grey-35: #595959; // grey-medium-dark
|
|
36
36
|
$color-grey-20: #323232; // grey-dark
|
|
37
37
|
$color-grey-10: #191919; // grey-darkest
|
|
38
|
-
$color-grey-0: #000000; //
|
|
39
|
-
|
|
38
|
+
$color-grey-0: #000000; // black
|
|
40
39
|
|
|
41
40
|
// Semantic Color Names
|
|
42
41
|
$color-white: $color-grey-100;
|
|
43
42
|
$color-black: $color-grey-0;
|
|
44
|
-
$color-brand-red: $color-red-31;
|
|
45
|
-
$color-exclusive: $color-yellow-50;
|
|
46
43
|
|
|
47
44
|
// Social Colors
|
|
48
45
|
$color-facebook: #4670D2;
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
3
|
-
// Style Guide: Settings.Shadows
|
|
4
|
-
|
|
5
|
-
// stylelint-disable unit-blacklist
|
|
1
|
+
// stylelint-disable unit-disallowed-list
|
|
6
2
|
$shadow-light: 0 2px 4px 0 rgba(0,0,0,0.08); // Used on sticky menu.
|
|
7
3
|
$shadow-medium: 0 -2px 9px 0 rgba(0,0,0,0.1);
|
|
8
4
|
$shadow-dark: 0 14px 8px -8px rgba(0,0,0,0.18); // Button.
|
|
9
5
|
$shadow-inset: inset 0 3px 6px 0 rgba(0,0,0,0.5); // Input inset.
|
|
10
|
-
|
|
11
|
-
// stylelint-enable unit-blacklist
|
|
6
|
+
// stylelint-enable unit-disallowed-list
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// Sizing
|
|
2
|
+
//
|
|
3
|
+
// Sizing Tokens. These are to be filled in as needed.
|
|
4
|
+
//
|
|
5
|
+
// Markup: sizing.html
|
|
6
|
+
//
|
|
7
|
+
// Style guide: Settings.Sizing
|
|
8
|
+
|
|
9
|
+
$spacer-0: 0;
|
|
10
|
+
$spacer-012: 0.125rem;
|
|
11
|
+
$spacer-025: 0.25rem;
|
|
12
|
+
$spacer-050: 0.5rem;
|
|
13
|
+
$spacer-075: 0.75rem;
|
|
14
|
+
$spacer-1: 1rem;
|
|
15
|
+
$spacer-125: 1.25rem;
|
|
16
|
+
$spacer-150: 1.5rem;
|
|
17
|
+
$spacer-175: 1.75rem;
|
|
18
|
+
$spacer-1875: 1.875rem;
|
|
19
|
+
$spacer-2: 2rem;
|
|
20
|
+
$spacer-250: 2.5rem;
|
|
21
|
+
$spacer-3: 3rem;
|
|
22
|
+
$spacer-350: 3.5rem;
|
|
23
|
+
$spacer-4: 4rem;
|
|
24
|
+
$spacer-5: 5rem;
|
|
25
|
+
|
|
26
|
+
$screen-desktop-xxl: 87.5rem; // 1400
|
|
27
|
+
$screen-desktop-xl: 78.75rem; // 1260
|
|
28
|
+
$screen-desktop-xl-max: 78.7499rem; // 1260
|
|
29
|
+
$screen-desktop: 62.5rem; // 1000
|
|
30
|
+
$screen-desktop-max: 62.499rem; // 999
|
|
31
|
+
$screen-tablet: 48rem; // 768
|
|
32
|
+
$screen-mobile-max: 47.999rem;
|
|
@@ -6,7 +6,7 @@ $ease-out-cubic: cubic-bezier( 0.215, 0.610, 0.355, 1.000 );
|
|
|
6
6
|
$ease-in-out-sine: cubic-bezier( 0.445, 0.050, 0.550, 0.950 );
|
|
7
7
|
$ease-out-expo: cubic-bezier(0.19, 1, 0.22, 1);
|
|
8
8
|
|
|
9
|
-
$transition-fade:
|
|
10
|
-
$transition-transform:
|
|
11
|
-
$transition-button:
|
|
12
|
-
$transition-
|
|
9
|
+
$transition-fade: $transition-duration-300 $ease-in-out-quad;
|
|
10
|
+
$transition-transform: $transition-duration-300 $ease-out-cubic;
|
|
11
|
+
$transition-button: $transition-duration-300 $ease-out-cubic;
|
|
12
|
+
$transition-hover: $transition-duration-300 $ease-out-expo;
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Functions
|
|
2
|
+
@import './functions/helpers';
|
|
3
|
+
@import './functions/pmc-rem';
|
|
4
|
+
@import './functions/pmc-inline-svg';
|
|
5
|
+
|
|
6
|
+
// Mixins
|
|
7
|
+
@import './mixins/pmc-breakpoint';
|
|
8
|
+
@import './mixins/pmc-font-family';
|
|
9
|
+
|
|
10
|
+
// Generators
|
|
11
|
+
@import './generators/a-grid-generator';
|
|
12
|
+
@import './generators/a-crop-generator';
|
|
13
|
+
@import './generators/spacing-utility-generator';
|
|
14
|
+
@import './generators/text-utility-generator';
|
|
15
|
+
@import './generators/token-utility-generator';
|
|
16
|
+
@import './generators/basic-utility-generator';
|
|
17
|
+
|
|
File without changes
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
@function str-replace($string, $search, $replace: '') {
|
|
2
|
+
$index: str-index($string, $search);
|
|
3
|
+
|
|
4
|
+
@if $index {
|
|
5
|
+
@return str-slice($string, 1, $index - 1) + $replace + str-replace(str-slice($string, $index + str-length($search)), $search, $replace);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
@return $string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
@function url-encode($string) {
|
|
12
|
+
$map: (
|
|
13
|
+
'%': '%25',
|
|
14
|
+
'<': '%3C',
|
|
15
|
+
'>': '%3E',
|
|
16
|
+
' ': '%20',
|
|
17
|
+
'!': '%21',
|
|
18
|
+
'*': '%2A',
|
|
19
|
+
'"': '%27',
|
|
20
|
+
'(': '%28',
|
|
21
|
+
')': '%29',
|
|
22
|
+
';': '%3B',
|
|
23
|
+
':': '%3A',
|
|
24
|
+
'@': '%40',
|
|
25
|
+
'&': '%26',
|
|
26
|
+
'=': '%3D',
|
|
27
|
+
'+': '%2B',
|
|
28
|
+
'$': '%24',
|
|
29
|
+
',': '%2C',
|
|
30
|
+
'/': '%2F',
|
|
31
|
+
'?': '%3F',
|
|
32
|
+
'#': '%23',
|
|
33
|
+
'[': '%5B',
|
|
34
|
+
']': '%5D'
|
|
35
|
+
);
|
|
36
|
+
$new: $string;
|
|
37
|
+
|
|
38
|
+
@each $search, $replace in $map {
|
|
39
|
+
$new: str-replace($new, $search, $replace);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@return $new;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@function pmc-inline-svg($string) {
|
|
46
|
+
$url: url-encode($string);
|
|
47
|
+
|
|
48
|
+
@return '"data:image/svg+xml;charset=US-ASCII,#{$url}"';
|
|
49
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Generators
|
|
2
|
+
|
|
3
|
+
Generators are Sass mixins that generate utility classes and algorithms based on a given map of values.
|
|
4
|
+
|
|
5
|
+
The types of generators are as follows:
|
|
6
|
+
* Generators for specific patterns (e.g. `a-crop`, `a-grid`, `u-padding`)
|
|
7
|
+
* Flexible generator for single purpose utility classes (e.g. project-utility-generator)
|
|
8
|
+
* Token-based generators that output custom properties that are expected to be available via larva-tokens
|
|
9
|
+
|
|
10
|
+
## Public API
|
|
11
|
+
|
|
12
|
+
Generators are designed to be wrapped in developer-friendly mixins for use in consuming projects. See the [Larva Wiki](https://github.com/penske-media-corp/pmc-larva/wiki) to learn which generators are available for public use.
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
@mixin
|
|
1
|
+
@mixin _a-crop-generator( $aspect-ratios, $NAMESPACE ) {
|
|
2
2
|
|
|
3
3
|
@if type-of($aspect-ratios) != 'map' {
|
|
4
4
|
@error "`#{$aspect-ratios}` is not a valid value for $aspect-ratios. It must be map.";
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
@each $name, $sizes in $aspect-ratios {
|
|
8
|
-
|
|
8
|
+
.#{$NAMESPACE}a-crop-#{$name} {
|
|
9
9
|
position: relative;
|
|
10
|
-
padding-bottom: calc( ( #{nth($sizes,
|
|
10
|
+
padding-bottom: calc( ( #{nth($sizes, 2)} / #{nth($sizes, 1)} ) * 100% );
|
|
11
11
|
|
|
12
12
|
img {
|
|
13
13
|
position: absolute;
|
|
@@ -9,15 +9,15 @@
|
|
|
9
9
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
@mixin _grid-selector( $columns, $breakpoint: false ) {
|
|
12
|
+
@mixin _grid-selector( $columns, $breakpoint: false, $NAMESPACE: '' ) {
|
|
13
13
|
@if $breakpoint {
|
|
14
14
|
@include pmc-breakpoint( $breakpoint ) {
|
|
15
|
-
|
|
15
|
+
.#{$NAMESPACE}a-cols#{$columns}\@#{$breakpoint} {
|
|
16
16
|
@include _grid( $columns );
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
} @else {
|
|
20
|
-
|
|
20
|
+
.#{$NAMESPACE}a-cols#{$columns} {
|
|
21
21
|
@include _grid( $columns );
|
|
22
22
|
}
|
|
23
23
|
}
|
|
@@ -33,34 +33,34 @@
|
|
|
33
33
|
flex-basis: ( $span / $columns * 100% );
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
@mixin _grid-span-selector( $columns, $span: 1, $breakpoint: false ) {
|
|
36
|
+
@mixin _grid-span-selector( $columns, $span: 1, $breakpoint: false, $NAMESPACE: '' ) {
|
|
37
37
|
|
|
38
38
|
@if $breakpoint {
|
|
39
39
|
@include pmc-breakpoint( $breakpoint ) {
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
.#{$NAMESPACE}a-span#{$span}\@#{$breakpoint} {
|
|
42
42
|
@include _grid-column( $columns, $span );
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
// Higher specificity to account for nested grids.
|
|
46
|
-
|
|
46
|
+
.#{$NAMESPACE}a-cols#{$columns}\@#{$breakpoint} > .#{$NAMESPACE}a-span#{$span}\@#{$breakpoint} {
|
|
47
47
|
@include _grid-column-fallback( $columns, $span );
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
}
|
|
51
51
|
} @else {
|
|
52
|
-
|
|
52
|
+
.#{$NAMESPACE}a-span#{$span} {
|
|
53
53
|
@include _grid-column( $columns, $span );
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
.#{$NAMESPACE}a-cols#{$columns} > .#{$NAMESPACE}a-span#{$span} {
|
|
57
57
|
@include _grid-column-fallback( $columns, $span );
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
@mixin
|
|
63
|
+
@mixin _a-grid-generator( $tokens, $NAMESPACE ) {
|
|
64
64
|
|
|
65
65
|
@if type-of($tokens) != 'list' {
|
|
66
66
|
@error "`#{$tokens}` is not a valid value for $tokens. It must be a list of maps.";
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
$spans: map-get( $grid, spans );
|
|
73
73
|
|
|
74
74
|
// Outputs pmc-colsX selector to be used in conjunction with .pmc-grid.
|
|
75
|
-
@include _grid-selector( $columns, $breakpoint );
|
|
75
|
+
@include _grid-selector( $columns, $breakpoint, $NAMESPACE );
|
|
76
76
|
|
|
77
77
|
@if $spans {
|
|
78
78
|
|
|
@@ -82,7 +82,8 @@
|
|
|
82
82
|
@include _grid-span-selector(
|
|
83
83
|
$columns,
|
|
84
84
|
$span,
|
|
85
|
-
map-get( $grid, breakpoint )
|
|
85
|
+
map-get( $grid, breakpoint ),
|
|
86
|
+
$NAMESPACE
|
|
86
87
|
);
|
|
87
88
|
}
|
|
88
89
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
@mixin basic-utility-generator( $property, $tokens, $map: (), $NAMESPACE: '' ) {
|
|
2
|
+
|
|
3
|
+
@if type-of($tokens) != 'list' {
|
|
4
|
+
@error "`#{$tokens}` is not a valid value for $values. It must be a list.";
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
@each $token in $tokens {
|
|
8
|
+
$property_name: $property;
|
|
9
|
+
|
|
10
|
+
@if map-get($map, $token) {
|
|
11
|
+
$value: map-get($map, $token);
|
|
12
|
+
|
|
13
|
+
.#{$NAMESPACE}u-#{$token} {
|
|
14
|
+
#{$property}: $value;
|
|
15
|
+
}
|
|
16
|
+
} @else {
|
|
17
|
+
@error "`#{$map}` does not contain #{$token}.";
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
@import "../mixins/pmc-breakpoint";
|
|
10
10
|
|
|
11
|
-
@mixin _spacing-class-generator( $property, $tokens ) {
|
|
11
|
+
@mixin _spacing-class-generator( $property, $tokens, $NAMESPACE ) {
|
|
12
12
|
@if $property != 'margin' and $property != 'padding' {
|
|
13
13
|
@error "`#{$property}` is not a valid value for $property. It must be either 'margin' or 'padding'.";
|
|
14
14
|
}
|
|
@@ -30,13 +30,13 @@
|
|
|
30
30
|
@if (length($token) == 3) {
|
|
31
31
|
$bp: nth($token, 3);
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
.#{$NAMESPACE}u-#{$property}-#{$sides}-#{$value}\@#{$bp} {
|
|
34
34
|
@include pmc-breakpoint($bp) {
|
|
35
35
|
@include _size-logic($sides, $property, nth($token, 2));
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
} @else {
|
|
39
|
-
|
|
39
|
+
.#{$NAMESPACE}u-#{$property}-#{$sides}-#{$value} {
|
|
40
40
|
@include _size-logic($sides, $property, nth($token, 2));
|
|
41
41
|
}
|
|
42
42
|
}
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
@import '../functions/pmc-rem';
|
|
10
10
|
@import '../mixins/pmc-breakpoint';
|
|
11
11
|
|
|
12
|
-
@mixin _text-class-generator( $property, $tokens, $available_tokens: () ) {
|
|
12
|
+
@mixin _text-class-generator( $property, $tokens, $NAMESPACE, $available_tokens: () ) {
|
|
13
|
+
|
|
13
14
|
@if $property != 'font-size' and $property != 'line-height' and $property != 'font-family' and $property != 'font-weight' {
|
|
14
15
|
@error "`#{$property}` is not a valid value for $property. It must be either 'font-size', 'line-height', 'font-family', 'font-weight'.";
|
|
15
16
|
}
|
|
@@ -37,15 +38,15 @@
|
|
|
37
38
|
|
|
38
39
|
@if (length($token) == 2) {
|
|
39
40
|
$at: \@;
|
|
40
|
-
$selector: "
|
|
41
|
+
$selector: ".#{$NAMESPACE}u-#{$property}-#{_strip-unit($value) * 16}#{$at}#{$breakpoint}";
|
|
41
42
|
} @else {
|
|
42
|
-
$selector: "
|
|
43
|
+
$selector: ".#{$NAMESPACE}u-#{$property}-#{_strip-unit($value) * 16}";
|
|
43
44
|
}
|
|
44
45
|
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
@if ($property == 'line-height' or $property == 'font-weight') {
|
|
48
|
-
$selector: "
|
|
49
|
+
$selector: ".#{$NAMESPACE}u-#{$property}-#{$token}";
|
|
49
50
|
$value: map-get($available_tokens, $token);
|
|
50
51
|
}
|
|
51
52
|
|
|
@@ -54,7 +55,7 @@
|
|
|
54
55
|
$token: map-get($available_tokens, $token);
|
|
55
56
|
$value: nth($token, 1);
|
|
56
57
|
$type: nth($token, 2);
|
|
57
|
-
$selector: "
|
|
58
|
+
$selector: ".#{$NAMESPACE}u-#{$property}-#{$token_name}";
|
|
58
59
|
|
|
59
60
|
@if ($type == 'web') {
|
|
60
61
|
$selector: ".wf-active #{$selector}";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
@mixin token-utility-generator( $property, $tokens, $map: (), $NAMESPACE: '' ) {
|
|
2
|
+
|
|
3
|
+
@if type-of($tokens) != 'list' {
|
|
4
|
+
@error "`#{$tokens}` is not a valid value for $values. It must be a list.";
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
@each $token in $tokens {
|
|
8
|
+
$property_name: $property;
|
|
9
|
+
|
|
10
|
+
@if map-get($map, $token) {
|
|
11
|
+
$value: map-get($map, $token);
|
|
12
|
+
|
|
13
|
+
.#{$NAMESPACE}u-#{$token} {
|
|
14
|
+
#{$property}: $value;
|
|
15
|
+
#{$property}: var( --#{$token}, #{$value} );
|
|
16
|
+
}
|
|
17
|
+
} @else {
|
|
18
|
+
@error "`#{$map}` does not contain #{$token}.";
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
@import '../../tokens/sizing';
|
|
2
|
+
|
|
3
|
+
@mixin pmc-breakpoint($point) {
|
|
4
|
+
@if $point == desktop-xl {
|
|
5
|
+
@media (min-width: $screen-desktop-xl) { @content; }
|
|
6
|
+
} @else if $point == desktop-xl-max {
|
|
7
|
+
@media (max-width: $screen-desktop-xl-max) { @content; }
|
|
8
|
+
} @else if $point == desktop-max {
|
|
9
|
+
@media (max-width: $screen-desktop-max) { @content; }
|
|
10
|
+
} @else if $point == desktop {
|
|
11
|
+
@media (min-width: $screen-desktop) { @content; }
|
|
12
|
+
} @else if $point == tablet {
|
|
13
|
+
@media (min-width: $screen-tablet) { @content; }
|
|
14
|
+
} @else if $point == mobile-max {
|
|
15
|
+
@media (max-width: $screen-mobile-max) { @content; }
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
|
|
2
|
+
// Required to be used with larva tokens, custom property
|
|
3
|
+
// font loading pattern, and webfontLoader.
|
|
4
|
+
|
|
5
|
+
@mixin pmc-font-family( $font-family, $map: $TOKENS-MAP ) {
|
|
6
|
+
|
|
7
|
+
$webfont-family: $font-family + '-fancy';
|
|
8
|
+
|
|
9
|
+
font-family: map-get( $map, $font-family );
|
|
10
|
+
|
|
11
|
+
.wf-active & {
|
|
12
|
+
font-family: map-get( $map, $webfont-family );
|
|
13
|
+
}
|
|
14
|
+
}
|
package/package.json
CHANGED
|
@@ -1,18 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@penskemediacorp/larva-scss",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.1.2",
|
|
4
|
+
"description": "Larva SCSS authoring tools.",
|
|
5
5
|
"author": "laras126 <laras126@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/penske-media-corp/pmc-larva#readme",
|
|
7
7
|
"license": "ISC",
|
|
8
8
|
"main": "lib/larva-scss.js",
|
|
9
|
-
"directories": {
|
|
10
|
-
"lib": "lib",
|
|
11
|
-
"test": "__tests__"
|
|
12
|
-
},
|
|
13
|
-
"files": [
|
|
14
|
-
"src"
|
|
15
|
-
],
|
|
16
9
|
"publishConfig": {
|
|
17
10
|
"access": "public"
|
|
18
11
|
},
|
|
@@ -21,16 +14,14 @@
|
|
|
21
14
|
"url": "git+https://github.com/penske-media-corp/pmc-larva.git"
|
|
22
15
|
},
|
|
23
16
|
"scripts": {
|
|
24
|
-
"test": "
|
|
17
|
+
"test": "../../node_modules/.bin/jest"
|
|
25
18
|
},
|
|
26
19
|
"bugs": {
|
|
27
20
|
"url": "https://github.com/penske-media-corp/pmc-larva/issues"
|
|
28
21
|
},
|
|
29
22
|
"devDependencies": {
|
|
30
|
-
"sass-true": "^5.0.0"
|
|
31
|
-
|
|
32
|
-
"dependencies": {
|
|
33
|
-
"node-sass": "^4.12.0"
|
|
23
|
+
"sass-true": "^5.0.0",
|
|
24
|
+
"stylelint": "^13.6.1"
|
|
34
25
|
},
|
|
35
|
-
"gitHead": "
|
|
26
|
+
"gitHead": "226d634b90913073b4b5734415acd3594570c79d"
|
|
36
27
|
}
|
package/lib/larva-scss.js
DELETED
package/src/settings/sizing.scss
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
// Sizing
|
|
2
|
-
//
|
|
3
|
-
// Deadline Sizing Tokens. These are to be filled in as needed.
|
|
4
|
-
//
|
|
5
|
-
// Markup: sizing.html
|
|
6
|
-
//
|
|
7
|
-
// Style guide: Settings.Sizing
|
|
8
|
-
|
|
9
|
-
$spacer-0: 0;
|
|
10
|
-
$spacer-012: 0.125rem;
|
|
11
|
-
$spacer-025: 0.25rem;
|
|
12
|
-
$spacer-050: 0.5rem;
|
|
13
|
-
$spacer-075: 0.75rem;
|
|
14
|
-
$spacer-1: 1rem;
|
|
15
|
-
$spacer-125: 1.25rem;
|
|
16
|
-
$spacer-150: 1.5rem;
|
|
17
|
-
$spacer-1875: 1.875rem;
|
|
18
|
-
$spacer-2: 2rem;
|
|
19
|
-
$spacer-250: 2.5rem;
|
|
20
|
-
$spacer-3: 3rem;
|
|
21
|
-
$spacer-4: 4rem;
|
|
22
|
-
|
|
23
|
-
$border-radius-button: 0.313rem;
|
package/src/setup.scss
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
@import './settings/sizing.scss';
|
|
2
|
-
@import './settings/colors.scss';
|
|
3
|
-
|
|
4
|
-
@mixin pmc-unstyle-list {
|
|
5
|
-
list-style-type: none;
|
|
6
|
-
padding-left: 0;
|
|
7
|
-
margin-top: 0;
|
|
8
|
-
margin-bottom: 0;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
@mixin pmc-unstyle-link {
|
|
12
|
-
color: currentColor;
|
|
13
|
-
text-decoration: none;
|
|
14
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
# Utility Class Generators
|
|
2
|
-
|
|
3
|
-
Generators output classes according to a list or map of tokens that are provided by a consuming project. Each generator is prefixed and underscore, and is called by a `pmc-*` wrapper mixin that outputs the actual classes. The `pmc-*` mixin is called in the theme, in a file that corresponds 1 to 1 with the name and location of the mixin's file in this repository.
|
|
4
|
-
|
|
5
|
-
## To add a new generator:
|
|
6
|
-
|
|
7
|
-
Generators should be added very sparingly and should be "brand agnostic" i.e. generators are meant to serve all brands and should not contain any values or CSS specific to a single design.
|
|
8
|
-
|
|
9
|
-
That being said, if a new generator is deemed appropriate, the following steps are generally how you would go about it:
|
|
10
|
-
|
|
11
|
-
1. Create a file in 01-tools/mixins/generators following the naming conventions established in the existing file names.
|
|
12
|
-
2. Import that file in 01-tools/tools.scss.
|
|
13
|
-
3. Add a test to 01-tools/tools.spec.scss.
|
|
14
|
-
4. Add a new file reflecting the wrapper mixin for the generator e.g. `u-#{$property}.scss`.
|
|
15
|
-
5. Create a wrapper mixin to be called in a consuming theme e.g. `@mixin pmc-u-#{$property}`.
|
|
16
|
-
|
|
17
|
-
## To use a generator in a theme:
|
|
18
|
-
|
|
19
|
-
1. Add a corresponding `u-*.scss` file in the theme's assets/patterns/07-utilities directory.
|
|
20
|
-
2. Import the generator's wrapper mixin using the alias provided by the theme's pmc.config.js. Likely @import '~@pmc/utilities/u-#{$property}.scss`.
|
|
21
|
-
3. Call the generator with values defined by the theme.
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
@mixin _color-class-generator( $property, $colors, $color_list: () ) {
|
|
2
|
-
@if $property != 'color' and $property != 'background-color' {
|
|
3
|
-
@error "`#{$property}` is not a valid value for $property. It must be either 'background', 'color', or 'background-color'.";
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
@if type-of($colors) != 'list' {
|
|
7
|
-
@error "`#{$colors}` is not a valid value for $colors. It must be a list.";
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
@each $name in $colors {
|
|
11
|
-
$property_name: $property;
|
|
12
|
-
|
|
13
|
-
@if $property == 'background-color' {
|
|
14
|
-
$property_name: 'background'
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
@if map-get($color_list, $name) {
|
|
18
|
-
$color: map-get($color_list, $name);
|
|
19
|
-
|
|
20
|
-
.pmc-u-#{$property_name}-#{$name} {
|
|
21
|
-
#{$property}: $color;
|
|
22
|
-
}
|
|
23
|
-
} @else {
|
|
24
|
-
@error "`#{$color_list}` does not contain #{$name}.";
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
$pmc-screen-desktop-xxl: 87.5rem; // 1400
|
|
2
|
-
$pmc-screen-desktop-xl: 78.75rem; // 1260
|
|
3
|
-
$pmc-screen-desktop: 62.5rem;
|
|
4
|
-
$pmc-screen-tablet: 48rem;
|
|
5
|
-
$pmc-screen-mobile: 48rem; // 768
|
|
6
|
-
$pmc-screen-mobile-max: 47.999rem;
|
|
7
|
-
|
|
8
|
-
@mixin pmc-breakpoint($point) {
|
|
9
|
-
@if $point == desktop-xl {
|
|
10
|
-
@media (min-width: $pmc-screen-desktop-xl) { @content; }
|
|
11
|
-
} @else if $point == desktop {
|
|
12
|
-
@media (min-width: $pmc-screen-desktop) { @content; }
|
|
13
|
-
} @else if $point == tablet {
|
|
14
|
-
@media (min-width: $pmc-screen-tablet) { @content; }
|
|
15
|
-
} @else if $point == mobile-max {
|
|
16
|
-
@media (max-width: $pmc-screen-mobile-max) { @content; }
|
|
17
|
-
}
|
|
18
|
-
}
|
package/src/tools/tools.scss
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// Functions
|
|
2
|
-
@import './functions/helpers';
|
|
3
|
-
@import './functions/pmc-rem';
|
|
4
|
-
|
|
5
|
-
// Mixins
|
|
6
|
-
@import './mixins/pmc-breakpoint';
|
|
7
|
-
@import './mixins/pmc-unstyle-list';
|
|
8
|
-
@import './mixins/pmc-unstyle-link';
|
|
9
|
-
|
|
10
|
-
// Generators
|
|
11
|
-
@import './generators/crop-class-generator';
|
|
12
|
-
@import './generators/spacing-class-generator';
|
|
13
|
-
@import './generators/text-class-generator';
|
|
14
|
-
@import './generators/grid-class-generator';
|
|
15
|
-
@import './generators/color-class-generator';
|