@penskemediacorp/larva-css 1.7.0-alpha.0 → 1.7.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.
Files changed (113) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +206 -19
  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 -274
  7. package/build/css/generic.common.inline.css +4 -67
  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 -55
  11. package/build/css/utilities.common.inline.css +29 -473
  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 +10 -0
  17. package/src/01-generic/side-skins.common.inline.scss +10 -0
  18. package/src/01-generic/typography.common.inline.scss +23 -13
  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 +32 -0
  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 +3 -3
  32. package/src/02-algorithms/a-grid/README.md +141 -14
  33. package/src/02-algorithms/a-grid/a-grid.common.inline.scss +53 -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 +30 -0
  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 -3
  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 +36 -8
  54. package/src/03-utilities/u-border-radius.common.async.scss +26 -2
  55. package/src/03-utilities/u-border.common.inline.scss +215 -4
  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 +19 -21
  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 +157 -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 +73 -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/holding/a-truncate-children/README.md +0 -3
  105. package/holding/a-truncate-children/a-truncate-children.browser-test.js +0 -104
  106. package/holding/a-truncate-children/a-truncate-children.css +0 -4
  107. package/holding/a-truncate-children/a-truncate-children.html +0 -15
  108. package/holding/a-truncate-children/a-truncate-children.scss +0 -5
  109. package/src/01-generic/config.common.inline.scss +0 -24
  110. package/src/02-algorithms/a-glue/index.js +0 -1
  111. package/src/02-algorithms/a-icon/a-icon.html +0 -20
  112. package/src/02-algorithms/a-unstyle-link/a-unstyle-link.common.async.scss +0 -5
  113. package/src/03-utilities/u-background.common.async.scss +0 -25
@@ -0,0 +1,127 @@
1
+ /* stylelint-disable */
2
+ /* PrismJS 1.17.1
3
+ https://prismjs.com/download.html#themes=prism-tomorrow&languages=markup+css+clike+javascript+bash+markup-templating+php+json+php-extras+scss+twig */
4
+ /**
5
+ * prism.js tomorrow night eighties for JavaScript, CoffeeScript, CSS and HTML
6
+ * Based on https://github.com/chriskempson/tomorrow-theme
7
+ * @author Rose Pritchard
8
+ */
9
+
10
+ code[class*="language-"],
11
+ pre[class*="language-"] {
12
+ color: #ccc;
13
+ background: none;
14
+ font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
15
+ font-size: 1em;
16
+ text-align: left;
17
+ white-space: pre;
18
+ word-spacing: normal;
19
+ word-break: normal;
20
+ word-wrap: normal;
21
+ line-height: 1.5;
22
+
23
+ -moz-tab-size: 4;
24
+ -o-tab-size: 4;
25
+ tab-size: 4;
26
+
27
+ -webkit-hyphens: none;
28
+ -moz-hyphens: none;
29
+ -ms-hyphens: none;
30
+ hyphens: none;
31
+
32
+ }
33
+
34
+ /* Code blocks */
35
+ pre[class*="language-"] {
36
+ padding: 1em;
37
+ margin: .5em 0;
38
+ overflow: auto;
39
+ }
40
+
41
+ :not(pre) > code[class*="language-"],
42
+ pre[class*="language-"] {
43
+ background: #2d2d2d;
44
+ }
45
+
46
+ /* Inline code */
47
+ :not(pre) > code[class*="language-"] {
48
+ padding: .1em;
49
+ border-radius: .3em;
50
+ white-space: normal;
51
+ }
52
+
53
+ .token.comment,
54
+ .token.block-comment,
55
+ .token.prolog,
56
+ .token.doctype,
57
+ .token.cdata {
58
+ color: #999;
59
+ }
60
+
61
+ .token.punctuation {
62
+ color: #ccc;
63
+ }
64
+
65
+ .token.tag,
66
+ .token.attr-name,
67
+ .token.namespace,
68
+ .token.deleted {
69
+ color: #e2777a;
70
+ }
71
+
72
+ .token.function-name {
73
+ color: #6196cc;
74
+ }
75
+
76
+ .token.boolean,
77
+ .token.number,
78
+ .token.function {
79
+ color: #f08d49;
80
+ }
81
+
82
+ .token.property,
83
+ .token.class-name,
84
+ .token.constant,
85
+ .token.symbol {
86
+ color: #f8c555;
87
+ }
88
+
89
+ .token.selector,
90
+ .token.important,
91
+ .token.atrule,
92
+ .token.keyword,
93
+ .token.builtin {
94
+ color: #cc99cd;
95
+ }
96
+
97
+ .token.string,
98
+ .token.char,
99
+ .token.attr-value,
100
+ .token.regex,
101
+ .token.variable {
102
+ color: #7ec699;
103
+ }
104
+
105
+ .token.operator,
106
+ .token.entity,
107
+ .token.url {
108
+ color: #67cdcc;
109
+ }
110
+
111
+ .token.important,
112
+ .token.bold {
113
+ font-weight: bold;
114
+ }
115
+ .token.italic {
116
+ font-style: italic;
117
+ }
118
+
119
+ .token.entity {
120
+ cursor: help;
121
+ }
122
+
123
+ .token.inserted {
124
+ color: green;
125
+ }
126
+
127
+ // stylelint-enable
package/src/setup.scss ADDED
@@ -0,0 +1,7 @@
1
+ @import '../../larva-scss/dist/generators';
2
+ @import '../../larva-scss/dist/tokens';
3
+ @import '../../larva-tokens/build/default.map.scss';
4
+
5
+ $TOKENS-MAP: $default-map;
6
+
7
+ $ICONS_BUILD_PATH: '../icons';
@@ -1,17 +1,16 @@
1
1
  const path = require( 'path' );
2
- const fs = require( 'fs' );
3
2
 
4
3
  const rules = {
5
- 'extends': path.resolve( __dirname, '../stylelint-config/index.js' ),
6
- 'plugins': path.resolve( __dirname, '../stylelint-css-algorithms/index.js' ),
7
- 'rules': {
4
+ extends: path.resolve( __dirname, '../stylelint-config/index.js' ),
5
+ plugins: path.resolve( __dirname, '../stylelint-css-algorithms/index.js' ),
6
+ rules: {
8
7
  'plugin/css-algorithms': {
9
8
  'pmc-a-space-children': [
10
9
  'margin-top',
11
10
  'margin-left',
12
11
  'display',
13
12
  '--a-space-children-spacer',
14
- 'flex-wrap'
13
+ 'flex-wrap',
15
14
  ],
16
15
  'a-glue': [
17
16
  'top',
@@ -23,7 +22,7 @@ const rules = {
23
22
  '--a-glue-bottom',
24
23
  '--a-glue-top',
25
24
  '--a-glue-right',
26
- '--a-glue-left'
25
+ '--a-glue-left',
27
26
  ],
28
27
  'pmc-a-hover-dropup': [
29
28
  'min-width',
@@ -37,10 +36,10 @@ const rules = {
37
36
  'cursor',
38
37
  '--a-icon-transform',
39
38
  'z-index',
40
- 'max-height'
41
- ]
42
- }
43
- }
39
+ 'max-height',
40
+ ],
41
+ },
42
+ },
44
43
  };
45
44
 
46
- module.exports = rules;
45
+ module.exports = rules;
@@ -1,3 +0,0 @@
1
- # Truncate Children
2
-
3
- The truncate children algorithm truncates direct child elements with an ellipsis when its parent element has an explicit height and width set.
@@ -1,104 +0,0 @@
1
- function describe( testString, tests ) {
2
- console.group( testString );
3
- tests();
4
- console.groupEnd();
5
- }
6
-
7
- function it( testString, test ) {
8
- let testResult = test();
9
- let color = ( false === testResult.result ) ? 'red' : 'green';
10
-
11
- console.log( `%c ${testString} ${testResult.message}`, `color:${color}` );
12
- }
13
-
14
- function assertEquals( value1, value2 ) {
15
- let message = '';
16
- let expression = value1 % value2 < 1;
17
-
18
- if ( false === expression ) {
19
- message = '\n \t Fail: ' + (value1 % value2).toFixed(1);
20
- }
21
-
22
- return {
23
- result: expression,
24
- message: message
25
- };
26
- }
27
-
28
- function tests() {
29
-
30
- describe( 'a-space-children-vertical', () => {
31
-
32
- const parents = document.querySelectorAll( '.a-space-children-vertical' );
33
-
34
- if ( parents.length > 0 ) {
35
-
36
- parents.forEach( parent => {
37
- const children = parent.children;
38
- const parentBox = parent.getBoundingClientRect();
39
-
40
- console.log( 'Node:', parent );
41
-
42
- it( 'does not apply a space above the first item', () => {
43
- let kid = children[0];
44
-
45
- return assertEquals( parentBox.top, kid.getBoundingClientRect().top );
46
- });
47
-
48
- it( 'spaces children', () => {
49
- let kid1Box = children[0].getBoundingClientRect();
50
- let kid2Box = children[1].getBoundingClientRect();
51
- let parentStyles = window.getComputedStyle( parent );
52
- let spaceInPixels = parseInt( parentStyles.getPropertyValue( '--a-space-children-spacer' ) ) * 16;
53
-
54
- return assertEquals( kid1Box.bottom, ( kid2Box.top - spaceInPixels ) );
55
- });
56
-
57
- it( 'does not apply a space below the last item', () => {
58
- let kid = children[ children.length - 1 ];
59
-
60
- return assertEquals( parentBox.bottom, kid.getBoundingClientRect().bottom );
61
- });
62
-
63
- });
64
- }
65
-
66
- });
67
-
68
- describe( 'a-space-children-horizontal', () => {
69
-
70
- const parents = document.querySelectorAll( '.a-space-children-horizontal' );
71
-
72
- if ( parents.length > 0 ) {
73
-
74
- parents.forEach( parent => {
75
- const children = parent.children;
76
- const parentBox = parent.getBoundingClientRect();
77
-
78
- console.log( 'Node:', parent );
79
-
80
- it( 'does not apply a space left of the first item', () => {
81
- let kid = children[0];
82
-
83
- return assertEquals( parentBox.left, kid.getBoundingClientRect().left );
84
- });
85
-
86
- it( 'spaces children', () => {
87
- let kid1 = children[0].getBoundingClientRect();
88
- let kid2 = children[1].getBoundingClientRect();
89
-
90
- const spaceInPixels = parseInt( window.getComputedStyle( parent ).getPropertyValue( '--a-space-children-spacer' ) ) * 16;
91
-
92
- return assertEquals( kid1.right, ( parseInt(kid2.left) - spaceInPixels ) );
93
- });
94
-
95
- });
96
-
97
- }
98
- });
99
-
100
- }
101
-
102
- window.addEventListener( 'load', function() {
103
- tests();
104
- });
@@ -1,4 +0,0 @@
1
- .a-truncate-children > * {
2
- white-space: nowrap;
3
- overflow: hidden;
4
- text-overflow: ellipsis; }
@@ -1,15 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <meta http-equiv="X-UA-Compatible" content="ie=edge">
7
- <title>Document</title>
8
- <link rel="stylesheet" href="a-truncate-children.css">
9
- </head>
10
- <body>
11
- <div class="a-truncate-children">
12
- <p>This text will be truncated when it's parent has a width. Lorem ipsum dolor sit amet consectetur adipisicing elit. Maxime eveniet ad dicta voluptas minus, voluptatem veniam tempore nemo iste cum dolorem modi deserunt. Porro voluptates inventore qui odit, tempora nam.</p>
13
- </div>
14
- </body>
15
- </html>
@@ -1,5 +0,0 @@
1
- .a-truncate-children > * {
2
- white-space: nowrap;
3
- overflow: hidden;
4
- text-overflow: ellipsis;
5
- }
@@ -1,24 +0,0 @@
1
- @import '@penskemediacorp/larva-scss/dist/tokens';
2
-
3
-
4
- // NOTE / TODO: this is a reminder to add generic and element styles on Monday
5
- * {
6
- box-sizing: border-box;
7
- }
8
-
9
- :root {
10
- --font-family-primary: #{map-get( $semantic-font-families, 'helvetica' )};
11
- --font-family-primary-fancy: #{map-get( $semantic-font-families, 'balto' )};
12
- --font-family-secondary: #{map-get( $semantic-font-families, 'georgia' )};
13
- --font-family-secondary-fancy: #{map-get( $semantic-font-families, 'eksell' )};
14
-
15
- --font-family-basic: #{map-get( $semantic-font-families, 'helvetica' )};
16
-
17
- --site-max-width: #{$screen-desktop-xl};
18
-
19
- --color-grey-lightest: #{map-get( $semantic-color-list, grey-lightest )};
20
- --color-grey-light: #{map-get( $semantic-color-list, grey-light )};
21
- --color-grey-light: #{map-get( $semantic-color-list, grey-medium-light )};
22
- --color-grey: #{map-get( $semantic-color-list, grey )};
23
- --color-grey-medium-dark: #{map-get( $semantic-color-list, grey-medium-dark )};
24
- }
@@ -1 +0,0 @@
1
- import './a-glue.scss';
@@ -1,20 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <meta http-equiv="X-UA-Compatible" content="ie=edge">
7
- <title>Document</title>
8
- <link rel="stylesheet" href="../../build/css/common.async.css">
9
- <link rel="stylesheet" href="../../build/css/common.inline.css">
10
- <script src="../../test-setup.js"></script>
11
- <script src="./a-icon.browser-test.js"></script>
12
- </head>
13
- <body>
14
- <p><span class="a-icon-before a-icon-arrow-right">Hello</span></p>
15
- <p><span class="a-icon-before a-icon-arrow-left">Hello</span></p>
16
- <p><span class="a-icon-before a-icon-forward-slash">Hi</span></p>
17
- <p><span class="a-icon-after a-icon-arrow-down">Hi</span></p>
18
- <div style="height:20px;width:30px" class="a-icon a-icon-envelope"></div>
19
- </body>
20
- </html>
@@ -1,5 +0,0 @@
1
- .pmc-a-unstyle-link,
2
- .pmc-a-unstyle-link:hover {
3
- color: currentColor;
4
- text-decoration: none;
5
- }
@@ -1,25 +0,0 @@
1
- @import '@penskemediacorp/larva-scss/dist/generators';
2
- @import '@penskemediacorp/larva-scss/dist/tokens';
3
-
4
- $color_list: (
5
- white: white,
6
- );
7
-
8
- @include pmc-u-background( (
9
- white,
10
- black
11
- ), $semantic-color-list );
12
-
13
- .pmc-u-background-grey-lightest {
14
- background-color: map-get( $semantic-color-list, grey-lightest );
15
- background-color: var( --color-grey-lightest );
16
- }
17
-
18
- .pmc-u-background-grey-light {
19
- background-color: map-get( $semantic-color-list, grey-light );
20
- background-color: var( --color-grey-light );
21
- }
22
-
23
- .pmc-u-background-brand-red\:hover:hover {
24
- background-color: map-get( $semantic-color-list, brand-red );
25
- }