@penskemediacorp/larva-css 1.10.0-alpha.0 → 1.10.0

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.
Files changed (111) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +183 -45
  3. package/__tests__/fixtures/expected.js +29 -0
  4. package/__tests__/lib/generators.test.js +11 -0
  5. package/build/css/algorithms.common.async.css +4 -36
  6. package/build/css/algorithms.common.inline.css +21 -322
  7. package/build/css/generic.common.inline.css +4 -68
  8. package/build/css/js.common.async.css +3 -0
  9. package/build/css/js.common.inline.css +6 -9
  10. package/build/css/utilities.common.async.css +8 -81
  11. package/build/css/utilities.common.inline.css +29 -497
  12. package/gulpfile.js +110 -82
  13. package/lib/generators.js +93 -0
  14. package/package.json +14 -6
  15. package/src/01-generic/elements.common.inline.scss +33 -1
  16. package/src/01-generic/forms.common.inline.scss +7 -2
  17. package/src/01-generic/side-skins.common.inline.scss +10 -0
  18. package/src/01-generic/typography.common.inline.scss +23 -15
  19. package/src/02-algorithms/a-buy-now/a-buy-now.common.inline.scss +112 -0
  20. package/src/02-algorithms/a-carousel-grid/a-carousel-grid.common.inline.scss +66 -0
  21. package/src/02-algorithms/a-children-border/a-children-border.common.inline.scss +43 -0
  22. package/src/02-algorithms/a-children-link-color/a-children-link-color.common.inline.scss +15 -0
  23. package/src/02-algorithms/a-children-link-decoration/a-children-link-decoration.common.inline.scss +13 -0
  24. package/src/02-algorithms/a-counter/a-counter.common.inline.scss +26 -0
  25. package/src/02-algorithms/a-crop/README.md +17 -13
  26. package/src/02-algorithms/a-crop/a-crop.common.inline.scss +96 -12
  27. package/src/02-algorithms/a-crop/a-crop.html +2 -2
  28. package/src/02-algorithms/a-floated/a-floated.common.inline.scss +12 -6
  29. package/src/02-algorithms/a-font/a-font.common.inline.scss +3 -0
  30. package/src/02-algorithms/a-glue/a-glue.common.inline.scss +63 -6
  31. package/src/02-algorithms/a-glue/a-glue.html +2 -2
  32. package/src/02-algorithms/a-grid/README.md +141 -14
  33. package/src/02-algorithms/a-grid/a-grid.common.inline.scss +49 -5
  34. package/src/02-algorithms/a-grid/a-grid.html +4 -4
  35. package/src/02-algorithms/a-hidden/a-hidden.common.inline.scss +43 -0
  36. package/src/02-algorithms/a-hover-dropup/a-hover-dropup.common.async.scss +7 -7
  37. package/src/02-algorithms/a-hover-dropup/a-hover-dropup.html +3 -3
  38. package/src/02-algorithms/a-hover-effect/a-hover-effect.common.async.scss +25 -0
  39. package/src/02-algorithms/a-hover-effect/a-hover-effect.html +16 -0
  40. package/src/02-algorithms/a-icon/a-icon.common.async.scss +28 -3
  41. package/src/02-algorithms/a-icon/a-icon.common.inline.scss +51 -73
  42. package/src/02-algorithms/a-screen-reader-only/a-screen-reader-only.common.inline.scss +12 -6
  43. package/src/02-algorithms/a-scrollable-grid/a-scrollable-grid.common.inline.scss +52 -0
  44. package/src/02-algorithms/a-show-on-hover/a-show-on-hover.common.inline.scss +16 -0
  45. package/src/02-algorithms/a-space-children/a-space-children.common.inline.scss +88 -17
  46. package/src/02-algorithms/a-truncate-ellipsis/a-truncate-ellipsis.common.async.scss +71 -0
  47. package/src/02-algorithms/a-unstyle-button/a-unstyle-button.common.inline.scss +2 -2
  48. package/src/02-algorithms/a-unstyle-link/a-unstyle-link.common.inline.scss +7 -0
  49. package/src/02-algorithms/a-unstyle-list/a-unstyle-list.common.inline.scss +1 -1
  50. package/src/02-algorithms/a-wrapper/a-wrapper.common.inline.scss +14 -2
  51. package/src/03-utilities/u-background-color.common.async.scss +15 -0
  52. package/src/03-utilities/u-background-color.common.inline.scss +37 -0
  53. package/src/03-utilities/u-border-color.common.async.scss +33 -14
  54. package/src/03-utilities/u-border-radius.common.async.scss +23 -3
  55. package/src/03-utilities/u-border.common.inline.scss +200 -16
  56. package/src/03-utilities/u-box-alignment.common.inline.scss +64 -4
  57. package/src/03-utilities/u-box-shadow.common.async.scss +34 -3
  58. package/src/03-utilities/u-color.common.async.scss +17 -33
  59. package/src/03-utilities/u-color.common.inline.scss +39 -0
  60. package/src/03-utilities/u-cursor.common.async.scss +1 -1
  61. package/src/03-utilities/u-display.common.inline.scss +87 -4
  62. package/src/03-utilities/u-filter.common.async.scss +5 -0
  63. package/src/03-utilities/u-flex.common.inline.scss +151 -9
  64. package/src/03-utilities/u-font-family.common.inline.scss +41 -17
  65. package/src/03-utilities/u-font-size.common.inline.scss +58 -5
  66. package/src/03-utilities/u-font-style.common.inline.scss +9 -0
  67. package/src/03-utilities/u-font-weight.common.inline.scss +50 -12
  68. package/src/03-utilities/u-height.common.inline.scss +38 -8
  69. package/src/03-utilities/u-left.common.inline.scss +7 -0
  70. package/src/03-utilities/u-letter-spacing.common.inline.scss +11 -0
  71. package/src/03-utilities/u-line-height.common.inline.scss +49 -13
  72. package/src/03-utilities/u-list-style.common.async.scss +3 -0
  73. package/src/03-utilities/u-margin.common.inline.scss +182 -47
  74. package/src/03-utilities/u-max-width.common.inline.scss +25 -0
  75. package/src/03-utilities/u-opacity.common.inline.scss +3 -0
  76. package/src/03-utilities/u-order.common.inline.scss +29 -2
  77. package/src/03-utilities/u-overflow.common.inline.scss +14 -2
  78. package/src/03-utilities/u-padding.common.inline.scss +156 -52
  79. package/src/03-utilities/u-position.common.inline.scss +11 -0
  80. package/src/03-utilities/u-text-align.common.inline.scss +27 -4
  81. package/src/03-utilities/u-text-decoration.common.inline.scss +11 -0
  82. package/src/03-utilities/u-text-transform.common.inline.scss +14 -2
  83. package/src/03-utilities/u-top.common.inline.scss +7 -0
  84. package/src/03-utilities/u-transform.common.inline.scss +12 -0
  85. package/src/03-utilities/u-vertical-align.common.inline.scss +7 -0
  86. package/src/03-utilities/u-whitespace.common.inline.scss +1 -1
  87. package/src/03-utilities/u-width.common.inline.scss +198 -12
  88. package/src/04-js/README.md +5 -0
  89. package/src/04-js/js-Collapsible.common.inline.scss +15 -0
  90. package/src/04-js/js-ExpandableSearch.common.async.scss +33 -0
  91. package/src/04-js/js-Flickity.common.async.scss +91 -0
  92. package/src/04-js/js-Header.common.inline.scss +6 -0
  93. package/src/04-js/js-MegaMenu.common.inline.scss +50 -0
  94. package/src/04-js/js-MobileHeightToggle.common.inline.scss +7 -5
  95. package/src/04-js/js-PopOver.common.async.scss +13 -0
  96. package/src/04-js/js-Tooltip.common.inline.scss +17 -0
  97. package/src/04-js/js-VideoShowcase.common.inline.scss +33 -0
  98. package/src/04-js/partials/expandable-search.scss +202 -0
  99. package/src/04-js/partials/flickity.scss +149 -0
  100. package/src/_generated/_a-font.scss +1027 -0
  101. package/src/larva-ui/prism.scss +127 -0
  102. package/src/setup.scss +7 -0
  103. package/stylelint.config.js +10 -11
  104. package/.DS_Store +0 -0
  105. package/src/.DS_Store +0 -0
  106. package/src/01-generic/config.common.inline.scss +0 -18
  107. package/src/02-algorithms/.DS_Store +0 -0
  108. package/src/02-algorithms/a-glue/.DS_Store +0 -0
  109. package/src/02-algorithms/a-icon/a-icon.html +0 -20
  110. package/src/02-algorithms/a-unstyle-link/a-unstyle-link.common.async.scss +0 -5
  111. package/src/03-utilities/u-background.common.async.scss +0 -32
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,84 +1,222 @@
1
1
  # Larva CSS
2
2
 
3
- This package contains Larva's base CSS, CSS algorithms, utlities, and CSS for JS patterns from larva-js.
3
+ This package contains Larva's base CSS, CSS algorithms, utlities, and CSS for JS patterns from larva-js. Design-related utilities e.g. typography, spacing, and color, are generated according to configuration in [larva-tokens](https://github.com/penske-media-corp/pmc-larva/tree/master/packages/larva-tokens).
4
4
 
5
- ## Usage
5
+ ## Overview of Functionality
6
+
7
+ This package provides the source files for the larva.css stylesheet. They are built together and available as larva.css from the @penskemediacorp/larva package, but are available in chunks from this repository in order to support project-level additions to the library.
8
+
9
+ CSS rulesets are provided in a variety of ways. Many utilities, for example, are generated by iterating over design tokens provided in the SCSS map from larva-tokens, while other rules, such as flex-related utilities or generic styling resets, are added statically since their values are not controlled by tokens. Still others, specifically CSS algorithms, or rulesets that are more complicated than single declarations, are generated by SCSS mixins available in larva-scss (`a-grid`, `a-crop`), or are generated from a Node script (`a-font` - see below for details).
10
+
11
+ The CSS is ordered intentionally, following the ideology of low specificity and adherence to the cascade via layering similar to [ITCSS](https://www.xfive.co/blog/itcss-scalable-maintainable-css-architecture/).
12
+
13
+ Contribution to this repository is relatively infrequent, and will genereally be for the purposes of increasing the capability of the library.
14
+
15
+ ## Development Setup
16
+
17
+ 1. Clone this repository and follow the root README setup instructions.
18
+ 2. Make changes to this package, paying careful attention to where you are adding CSS, and ensuring it aligns with existing conventions.
19
+ 3. From the root of this repo, run `npm run prod:scss`
20
+
21
+ Note: For more immediate feedback during development, it is possible to run `npm run dev` in this package, and `npm run dev:scss` from the root.
22
+
23
+ ## Using larva-css in Projects
24
+
25
+ The easiest way to access the contents of larva-css is by using the built larva.css that is available in the package @penskemediacorp/larva. However, it is possible to use larva-css on its own.
26
+
27
+ First, install the package:
6
28
 
7
29
  ```
8
30
  npm install @penskemediacorp/larva-css --save
9
31
  ```
10
32
 
11
- Then include the CSS from @penskemediacorp/larva-css/build/css in your asset pipeline. Make sure that the CSS files containing `inline` and `async` are loaded accordingly.
33
+ Then, using the below details, determine how to load larva-css in your project.
34
+
35
+ ### Loading larva-css into your project's build
36
+
37
+ larva-css files can be accessed as CSS directly by linking the stylesheets available in the build directory, but the current recommended approach is to load them into a local project build and output a single file.
38
+
39
+ #### Option 1: Without project-level utility generation (simple)
40
+
41
+ In your local build, inlcude these files into your main stylesheet:
42
+
43
+ ```language:scss
44
+ // larva.scss => larva.css
45
+ @import '@penskemediacorp/larva-css/build/css/generic.common.inline';
46
+ @import '@penskemediacorp/larva-css/build/css/algorithms.common.inline';
47
+ @import '@penskemediacorp/larva-css/build/css/algorithms.common.async';
48
+ @import '@penskemediacorp/larva-css/build/css/utilities.common.inline';
49
+ @import '@penskemediacorp/larva-css/build/css/utilities.common.async';
50
+ @import '@penskemediacorp/larva-css/build/css/js.common.inline';
51
+
52
+ ```
53
+
54
+ If you are splitting inline CSS, you can load inline CSS separately by including the following in a file that will be inlined:
55
+
56
+ ```language:scss
57
+ // larva-inline.scss => larva-inline.css
58
+ @import '@penskemediacorp/larva-css/build/css/generic.inline';
59
+ @import '@penskemediacorp/larva-css/build/css/algorithms.inline';
60
+ @import '@penskemediacorp/larva-css/build/css/utilities.inline';
61
+ @import '@penskemediacorp/larva-css/build/css/js.inline';
62
+ ```
63
+
64
+ Note that at present, there are no js or generic files for async CSS from larva-css.
65
+ #### Option 2: With project-level utilities (complex, not recommended)
66
+
67
+ This approach is not recommended because accrues technical debt, but it also indicates the areas where the design system is not supporting designs requirements (and vice versa). Generally speaking, this approach allows a project to build the larva.css stylesheet locally and provides areas to plug in additional functionality while maintaining the same, strict architecture.
68
+
69
+ Prerequisites to this approach:
70
+
71
+ 1. Your project is using the `larva` binary for its build step.
72
+ 2. Your project includes a CSS architecture and directory structure that matches that of [pmc-spark/assets](https://bitbucket.org/penskemediacorp/pmc-spark/src/master/assets/).
73
+
74
+ Include the source .scss files from this repository in your top-level common stylesheet in assets/entries/:
75
+
76
+ In all of the following, replace `default` with the brand name containing tokens.
77
+
78
+ ```language:scss
79
+ // common.async.scss
80
+ @import '@penskemediacorp/larva-tokens/build/default.custom-properties';
81
+
82
+ @import '@penskemediacorp/larva-css/src/01-generic/*.scss';
83
+ @import '01-generic/*.common.*.scss';
84
+
85
+ @import '@penskemediacorp/larva-css/src/02-algorithms/**/*.scss';
86
+ @import '02-algorithms/*.common.*.scss';
87
+
88
+ @import '@penskemediacorp/larva-css/src/03-utilities/*.scss';
89
+ @import '03-utilities/*.common.*.scss';
90
+
91
+ @import '@penskemediacorp/larva-css/src/04-js/*.scss';
92
+ @import '04-js/*.common.*.scss';
93
+ ```
94
+
95
+ In a corresponding stylesheet for inline CSS, include only the .inline.scss extensions.
96
+
97
+ ```language:scss
98
+ // common.inline.scss
99
+ @import '@penskemediacorp/larva-tokens/build/default.custom-properties';
12
100
 
13
- ## Concepts
101
+ @import '@penskemediacorp/larva-css/src/01-generic/*.inline.scss';
102
+ @import '01-generic/*.common.inline.scss';
14
103
 
15
- ### "Atomic" or "Functional" CSS
104
+ @import '@penskemediacorp/larva-css/src/02-algorithms/**/*.inline.scss';
105
+ @import '02-algorithms/*.common.inline.scss';
16
106
 
17
- Coming soon!
107
+ @import '@penskemediacorp/larva-css/src/03-utilities/*.inline.scss';
108
+ @import '03-utilities/*.common.inline.scss';
18
109
 
19
- ### Removing the Burden of Naming
110
+ @import '@penskemediacorp/larva-css/src/04-js/*.inline.scss';
111
+ @import '04-js/*.common.inline.scss';
112
+ ```
20
113
 
21
- Unless you are authoring a CSS algorithm, you should not have to name a new class.
114
+ Next, create a file for project-level tokens in in assets/src/scss/00-tools/tokens.scss that contains the following:
22
115
 
23
- ### Cascading and Specificity
116
+ ```
117
+ @import '@penskemediacorp/larva-tokens/build/default.map.scss';
24
118
 
25
- Directories are ordered according to the cascading of styles, inspired by ITCSS. Generic CSS will almost always be overridden, so it is first. Unless selector specificty says otherwise (e.g. `a-space-children` or the image in `a-crop`), CSS algorithms should be overridden by utilities. The CSS related to JS interactivity comes last because it should be the most important in the cascade.
119
+ $local-tokens: (
120
+ 'font-size-12': pmc-rem(12),
121
+ 'opacity-075': 0.75,
122
+ );
26
123
 
27
- ## Terminology
124
+ $TOKENS-MAP: map-merge( $default-map, $local-tokens );
125
+ ```
28
126
 
29
- *Generic* styles are any basic reset styles, usually applied to general elements. Larva does not use a formal reset like Normalize, rather, any initial property values are overridden in this directory as needed. For example, removing margins from headings and adding box-sizing: border-box to all elements.
127
+ And in assets/src/scss/setup.scss, import the tokens:
128
+ ```
129
+ @import '00-tools/tokens.scss';
130
+ ```
131
+
132
+ Be sure to `@import 'setup'` at the top of all of your local utility files. Font size is already generated from the larva-css repo, but opacity is not.
30
133
 
31
- A *utility* is a single* declaration ruleset that is named according to the declaration and prefixed with a `u-*`. These sometimes come from SCSS generators, but many are authored by hand. A few examples (namespaced with pmc-* to indicate they come from this repository):
134
+ If a property is **not** generated from larva-css, you can iterate over the local tokens map with the following Sass:
32
135
 
33
- * pmc-u-display-block
34
- * pmc-u-color-brand-primary
35
- * pmc-u-margin-tb-1@tablet
136
+ ```
137
+ // Example: u-opacity.common.inline.scss
138
+ @import 'setup';
36
139
 
37
- \* The only time a utility would have more than one declaration is for margin and padding where top/bottom and right/left values can be in the same ruleset.
140
+ @each $token, $value in $TOKENS-MAP {
141
+ $token-str: quote( $token );
38
142
 
39
- An *algorithm* is a more involved ruleset or set of rulesets that accomplished a specific styling goal that is not reasonable to accomplish with utilties, and generally makes use of browser algorithms or familiar CSS programming patterns. A few examples:
143
+ @if str-index( $token-str, 'opacity' ) {
144
+ .u-#{$token} {
145
+ opacity: $value;
146
+ }
40
147
 
41
- * pmc-a-space-children - utilized the owl selector pattern to apply space between child elements.
42
- * pmc-a-glue - an algorithm for "glueing" one element onto another with absolute positioning.
43
- * pmc-a-unstyle-list – a straightforward set of declarations that remove basic list styling.
148
+ // If you would like to generate a hover selector,
149
+ // that could happen here, but media queries need
150
+ // to be in an additional loops to maintain the cascade
151
+
152
+ }
153
+ }
154
+
155
+ //
156
+ // Media Queries
157
+ //
158
+
159
+
160
+ @include pmc-breakpoint( desktop ) {
161
+
162
+ @each $token, $value in $TOKENS-MAP {
163
+ $token-str: quote( $token );
164
+
165
+ @if str-index( $token-str, 'opacity' ) {
166
+ .u-#{$token}\@desktop {
167
+ opacity: $value;
168
+ }
169
+ }
170
+ }
171
+
172
+ }
173
+
174
+ @include pmc-breakpoint( desktop-xl ) {
175
+
176
+ @each $token, $value in $TOKENS-MAP {
177
+ $token-str: quote( $token );
178
+
179
+ @if str-index( $token-str, 'opacity' ) {
180
+ .u-#{$token}\@desktop-xl {
181
+ opacity: $value;
182
+ }
183
+ }
184
+ }
185
+
186
+ }
187
+
188
+ ```
44
189
 
45
- The *js* directory contains CSS corresponding to interactivity from larva-js. These styles could be kept alongside the JS, but in order to minimize build tool dependencies, there are kept here, in the larva-css package.
190
+ Refer to the larva-css source files in larva-css/src and in the local Larva server, navigate to /css to see available classes.
46
191
 
47
- ## Naming SCSS Files
192
+ ## Things to Know
48
193
 
49
- The SCSS file should be named according to the chunk it will be included in when used in an actual product, and whether it should be loaded asynchronously or inline. The formular for naming a file:
194
+ ### The .lrv namespace
50
195
 
51
- `{a|u|js}-{baseName}.{chunkName}.{inline|async}.scss`
196
+ CSS originating from larva-css .scss files contain a .lrv- namespace. Local project CSS should only contain an `a-`, `u-`, or `js-` namespace.
52
197
 
53
- Example, full file names:
198
+ ### Utility Naming
54
199
 
55
- * u-background.common.async.scss
56
- * u-font-size.single.async.scss
57
- * a-gradient-after.common.async.scss
58
- * a-archive-grid.archive.inline.scss
59
- * js-MobileHeightToggle.common.async.scss
200
+ Utilities that are generated from larva-tokens, are named as follows:
60
201
 
61
- ### Namespace {a|u|js}
202
+ `.lrv-u-{$token-name}`
62
203
 
63
- - a, for algorithm
64
- - u, for utility
65
- - js, styling paired with a JS pattern
66
- - No namespace for generic or reset styles
204
+ For `spacing-XX` tokens, they are named:
67
205
 
68
- ### baseName
206
+ `.lrv-u-margin-{l|r|t|b|lr|tb|a}-{$size}`
69
207
 
70
- The baseName of a pattern is the consistent name that is included before all responsive suffixes and BEM elements or modifiers.
208
+ Where, if the token was `spacing-1`, the utility would be `lrv-u-margin-l-1`.
71
209
 
72
- For example, `a-article-grid` could contain `a-article-grid__sidebar` or `a-article-grid--3col`, but the name of the file only contains a-article-grid.
210
+ ### Algorithms
73
211
 
74
- ### chunkName
212
+ Algorithms are presentationally named CSS patterns that provide functionality difficult or impossible to accomplish with utilities, or where abstractions are useful. Examples are aspect ratio cropping, CSS grid with flex box fallbacks, and SVG icons with `::before` and `::after`.
75
213
 
76
- The name of the chunk where this algorithm should be included. Most algorithms will be common, but there will certainly be cases when algorithms are written for specifc projects that may have their own chunk naming convention. When naming chunks in a WordPress theme, they should map directly 1 to 1 with the queried template where the CSS is equeued or inlined.
214
+ Many of the variations for algorithms are generated with mixins from `larva-scss`, but this is slated to be deprecated in favor of Node scripts in this repository.
77
215
 
78
- ### Async or Inline
216
+ #### `.lrv-a-font` Generation
79
217
 
80
- These terms refer to whether or not the algorithm should be included in inlined, or "critical CSS", or in a file loaded asynchronously.
218
+ The `.lrv-a-font` algorithm handles the styling for typography styles that are included in a style guide. Each property value and selector is generated according to data from `larva-tokens`. The SCSS itself is generated from a Node script in this package that is incoporated into the `larva-css` build.
81
219
 
82
- inline should be used for CSS that is applied to elements that are both "above the fold" and contain properties that come into play at the layout phase in rendering. In other words, they are crucial for the first paint of the page. Examples are any properties part of the box model, positioning, layout APIs like Grid and Flexbox, font sizing, and more.
220
+ ### JS-related CSS
83
221
 
84
- async should be used for CSS that is not critical to the first paint i.e. to making the page content readable, and that apply during the paint and composite phases of rendering. These are properties like color, background, transition, and box-shadow.
222
+ The SCSS files inside 04-js should be imported directly into a local project build, other than js-MobileHeightToggle which is added to the js.common.inline chunk here.
@@ -0,0 +1,29 @@
1
+ module.exports = {
2
+ ruleset: `
3
+ .lrv-a-font-primary-xxl {
4
+ // Define this token locally; it can be defined via larva-tokens, if needed in the future.
5
+ --font-family: var( --font-family-primary );
6
+
7
+ font-family: var( --font-family );
8
+ font-size: var( --primary-xxl-font-size-mobile );
9
+ line-height: var( --primary-xxl-line-height-mobile );
10
+ letter-spacing: var( --primary-xxl-letter-spacing-mobile );
11
+ font-weight: var( --primary-xxl-font-weight-mobile );
12
+ font-style: var( --primary-xxl-font-style-mobile );
13
+
14
+ @media (min-width: $screen-desktop) {
15
+ font-size: var( --primary-xxl-font-size-desktop );
16
+ line-height: var( --primary-xxl-line-height-desktop );
17
+ letter-spacing: var( --primary-xxl-letter-spacing-desktop );
18
+ font-weight: var( --primary-xxl-font-weight-desktop );
19
+ font-style: var( --primary-xxl-font-style-desktop );
20
+ }
21
+ @media (min-width: $screen-desktop-xl) {
22
+ font-size: var( --primary-xxl-font-size-desktop-xl );
23
+ line-height: var( --primary-xxl-line-height-desktop-xl );
24
+ letter-spacing: var( --primary-xxl-letter-spacing-desktop-xl );
25
+ font-weight: var( --primary-xxl-font-weight-desktop-xl );
26
+ font-style: var( --primary-xxl-font-style-desktop-xl );
27
+ }
28
+ }\n`,
29
+ };
@@ -0,0 +1,11 @@
1
+ const { generate } = require( '../../lib/generators' );
2
+
3
+ const expected = require( '../fixtures/expected' );
4
+
5
+ describe( 'A-Font Generator', () => {
6
+ it( 'should output a CSS ruleset containing a-font CSS', () => {
7
+ const output = generate( [ 'lrv-a-font-primary-xxl' ] );
8
+
9
+ expect( output ).toEqual( expected.ruleset );
10
+ } );
11
+ } );
@@ -1,36 +1,4 @@
1
- @media (min-width: 48rem) {
2
- .pmc-a-hover-dropup\@tablet {
3
- position: relative;
4
- min-width: 14rem; }
5
- .pmc-a-hover-dropup-trigger\@tablet {
6
- cursor: pointer; }
7
- .pmc-a-hover-dropup-target\@tablet {
8
- width: 100%;
9
- visibility: hidden;
10
- opacity: 0;
11
- position: absolute;
12
- width: 100%;
13
- z-index: 2;
14
- bottom: 100%;
15
- left: 0;
16
- overflow-y: scroll;
17
- max-height: 8.438rem; }
18
- .pmc-a-hover-dropup\@tablet:hover .pmc-a-hover-dropup-target\@tablet,
19
- .pmc-a-hover-dropup\@tablet:focus .pmc-a-hover-dropup-target\@tablet {
20
- visibility: visible;
21
- opacity: 1; }
22
- .pmc-a-hover-dropup\@tablet:hover .a-icon-arrow-down::after,
23
- .pmc-a-hover-dropup\@tablet:focus .a-icon-arrow-down {
24
- --a-icon-transform: rotate(180deg); } }
25
-
26
- @media (min-width: 48rem) {
27
- .a-icon-after-remove\@tablet::after {
28
- display: none; } }
29
-
30
- .a-icon-invert {
31
- --a-icon-filter: invert(1); }
32
-
33
- .pmc-a-unstyle-link,
34
- .pmc-a-unstyle-link:hover {
35
- color: currentColor;
36
- text-decoration: none; }
1
+ @media(min-width: 48rem){.lrv-a-hover-dropup\@tablet{position:relative;min-width:14rem}.lrv-a-hover-dropup-trigger\@tablet{cursor:pointer}.lrv-a-hover-dropup-target\@tablet{width:100%;visibility:hidden;opacity:0;position:absolute;width:100%;z-index:2;bottom:100%;left:0;overflow-y:scroll;max-height:8.438rem}.lrv-a-hover-dropup\@tablet:hover .lrv-a-hover-dropup-target\@tablet,.lrv-a-hover-dropup\@tablet:focus .lrv-a-hover-dropup-target\@tablet{visibility:visible;opacity:1}.lrv-a-hover-dropup\@tablet:hover .lrv-a-icon-arrow-down::after,.lrv-a-hover-dropup\@tablet:focus .lrv-a-icon-arrow-down{--a-icon-transform: rotate(180deg)}}
2
+ @media(min-width: 48rem){.lrv-a-icon-after-remove\@tablet::after{display:none}}.lrv-a-icon-invert{--a-icon-filter: invert(1)}.lrv-a-icon-arrow-left,.lrv-a-icon-arrow-right,.lrv-a-icon-arrow-down,.lrv-a-icon-arrow-up{--a-icon-url: url( "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 8'%3E%3Cpath d='M13.7 1.7l-6 6c-.2.2-.4.3-.7.3-.3 0-.5-.1-.7-.3l-6-6C-.1 1.3-.1.7.3.3s1-.4 1.4 0L7 5.6 12.3.3c.4-.4 1-.4 1.4 0s.4 1 0 1.4z'/%3E%3C/svg%3E" );--a-icon-height: 0.75rem}.lrv-a-icon-arrow-right{--a-icon-transform: rotate(-90deg)}.lrv-a-icon-arrow-left{--a-icon-transform: rotate(90deg)}.lrv-a-icon-envelope{--a-icon-url: url( "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9'%3E%3Cpath d='M.77.945C.636.875.406.752.356.605.269.357.362.258.731.258h12.723c.37 0 .462.096.376.349-.05.143-.28.27-.416.34-.366.192-5.45 2.964-5.64 3.064-.19.1-.382.146-.681.146-.3 0-.493-.047-.683-.146C6.22 3.91 1.137 1.138.77.945zm12.934.15c.296-.15.276.023.276.163v6.82c0 .307-.39.696-.716.696H.921c-.326 0-.782-.386-.782-.695V1.258c0-.136.016-.313.31-.163.272.14 2.747 1.883 4.368 2.931L2.085 7.104c-.066.066-.096.15-.056.186.04.04.13.02.196-.046l3.28-2.769c.496.32.842.54.905.573.257.13.436.146.683.146.246 0 .425-.017.682-.146.06-.034.409-.253.905-.573l3.28 2.769c.07.063.156.083.196.046.037-.04.007-.12-.06-.186L9.363 4.026c1.62-1.048 4.069-2.791 4.342-2.931z'/%3E%3C/svg%3E" );--a-icon-height: 0.625rem}.lrv-a-icon-search{--a-icon-url: url( "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18'%3E%3Cpath d='M5.228 11.335h.79l.28-.27a6.471 6.471 0 01-1.57-4.23 6.5 6.5 0 116.5 6.5c-1.61 0-3.09-.59-4.23-1.57l-.27.28v.79l-5 4.99-1.49-1.49 4.99-5zm6 0c2.49 0 4.5-2.01 4.5-4.5s-2.01-4.5-4.5-4.5-4.5 2.01-4.5 4.5 2.01 4.5 4.5 4.5z' fill-rule='evenodd'/%3E%3C/svg%3E" )}
3
+ .lrv-a-hover-effect{transition:var(--a-hover-effect-property, 300ms cubic-bezier(0.19, 1, 0.22, 1))}.lrv-a-hover-effect--fade{transform:translate3d(0px, 0px, 0px)}.lrv-a-hover-effect--fade:hover{--a-hover-effect-property: opacity;opacity:.5}.lrv-a-hover-effect--underline{transform:translate3d(0px, 0px, 0px)}.lrv-a-hover-effect--underline:hover{--a-hover-effect-property: border-bottom;border-bottom:1px solid currentColor}
4
+ .lrv-a-truncate-ellipsis{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.lrv-a-truncate-ellipsis-1line{overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:1;-webkit-box-orient:vertical}.lrv-a-truncate-ellipsis-2line{overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}.lrv-a-truncate-ellipsis-3line{overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical}.lrv-a-truncate-ellipsis-5line{overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:5;-webkit-box-orient:vertical}.lrv-a-truncate-ellipsis-6line{overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:6;-webkit-box-orient:vertical}@media(min-width: 78.75rem){.lrv-a-truncate-ellipsis-3line\@desktop-xl{overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical}}@media(max-width: 78.7499rem){.lrv-a-truncate-ellipsis-4line\@mobile-max{overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:4;-webkit-box-orient:vertical}}@media only screen and (max-width: 78.75rem)and (min-width: 48rem){.lrv-a-truncate-ellipsis-5line\@tablet-desktop-only{overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:5;-webkit-box-orient:vertical}}@media(max-width: 78.7499rem){.lrv-a-truncate-ellipsis-5line\@desktop-xl-max{overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:5;-webkit-box-orient:vertical}}@media only screen and (max-width: 78.75rem)and (min-width: 48rem){.lrv-a-truncate-ellipsis-1line\@tablet-desktop-only{overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:1;-webkit-box-orient:vertical}}@media(max-width: 47.999rem){.lrv-a-truncate-ellipsis-2line\@mobile-max{overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}}