umberto 1.14.0 → 1.18.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 (33) hide show
  1. package/README.md +6 -0
  2. package/package.json +4 -3
  3. package/scripts/helper/normalize-badges.js +26 -0
  4. package/scripts/helper/u-toc.js +10 -1
  5. package/scripts/utils/normalizebadges.js +50 -0
  6. package/scripts/utils/parselinks.js +81 -33
  7. package/src/tasks/compile-sass.js +35 -4
  8. package/themes/umberto/layout/_mixin/nav-tree-item.pug +5 -1
  9. package/themes/umberto/layout/_mixin/nav-tree-level.pug +4 -0
  10. package/themes/umberto/layout/_partial/head.pug +2 -0
  11. package/themes/umberto/layout/index.pug +1 -1
  12. package/themes/umberto/layout/page.pug +1 -1
  13. package/themes/umberto/layout/sdk.pug +1 -1
  14. package/themes/umberto/source/assets/_img/star-in-circle.svg +1 -0
  15. package/themes/umberto/src/css/_api-props-filter.scss +1 -1
  16. package/themes/umberto/src/css/_badge.scss +1 -1
  17. package/themes/umberto/src/css/_collapsinglist.scss +2 -2
  18. package/themes/umberto/src/css/_content.scss +2 -2
  19. package/themes/umberto/src/css/_footer.scss +1 -1
  20. package/themes/umberto/src/css/_formatted.scss +5 -5
  21. package/themes/umberto/src/css/_guide-content.scss +1 -1
  22. package/themes/umberto/src/css/_notice.scss +4 -4
  23. package/themes/umberto/src/css/_secondary-navigation.scss +1 -1
  24. package/themes/umberto/src/css/_toggler.scss +2 -2
  25. package/themes/umberto/src/css/_top.scss +5 -5
  26. package/themes/umberto/src/css/_tree.scss +21 -3
  27. package/themes/umberto/src/css/helpers/_color.scss +3 -3
  28. package/themes/umberto/src/css/helpers/_font.scss +1 -1
  29. package/themes/umberto/src/css/helpers/_globals.scss +2 -2
  30. package/themes/umberto/src/css/styles.scss +9 -1
  31. package/themes/umberto/src/js/_tooltips.js +39 -0
  32. package/themes/umberto/src/js/app.js +4 -1
  33. package/CHANGELOG.md +0 -1322
@@ -96,8 +96,8 @@ $u-rwd-button-size: 24px;
96
96
  border-radius: 5px;
97
97
  transition: 250ms all ease;
98
98
 
99
- &:nth-child( 2 ) { top: ( $u-rwd-button-size / 3 ) * 1; }
100
- &:nth-child( 3 ) { top: ( $u-rwd-button-size / 3 ) * 2; }
99
+ &:nth-child( 2 ) { top: math.div( $u-rwd-button-size, 3 ) * 1; }
100
+ &:nth-child( 3 ) { top: math.div( $u-rwd-button-size, 3 ) * 2; }
101
101
  }
102
102
  }
103
103
  }
@@ -258,7 +258,7 @@ $u-rwd-button-size: 24px;
258
258
  transition: 150ms ease all;
259
259
 
260
260
  &:hover {
261
- background-color: u-color( 'background-dark', -3 );
261
+ background-color: u-color( 'background-dark', -3% );
262
262
  }
263
263
 
264
264
  &:hover,
@@ -275,7 +275,7 @@ $u-rwd-button-size: 24px;
275
275
  svg {
276
276
  fill: currentColor;
277
277
  width: 30px;
278
- margin-top: ($u-top-sub - 30px) / 2;
278
+ margin-top: math.div( $u-top-sub - 30px, 2 );
279
279
  }
280
280
  }
281
281
  }
@@ -308,7 +308,7 @@ $u-rwd-button-size: 24px;
308
308
  }
309
309
 
310
310
  &::-webkit-input-placeholder {
311
- color: u-color( 'text', 70 );
311
+ color: u-color( 'text', 70% );
312
312
  }
313
313
 
314
314
  &:focus,
@@ -54,6 +54,7 @@ See: `_api-tree.scss` and `_guide-sdk-tree.scss`. */
54
54
  display: inline-block;
55
55
  padding: u-spacing( -3 ) 0;
56
56
  position: relative;
57
+ margin-right: auto;
57
58
 
58
59
  // The icon.
59
60
  &::before {
@@ -70,7 +71,11 @@ See: `_api-tree.scss` and `_guide-sdk-tree.scss`. */
70
71
  }
71
72
 
72
73
  .tree__item__badge {
73
- margin: 0 u-spacing( 2 ) 0 u-spacing( -2 );
74
+ margin: 0 u-spacing( -2 );
75
+ }
76
+
77
+ .tree__item__badge:last-of-type {
78
+ margin-right: u-spacing( 2 );
74
79
  }
75
80
 
76
81
  .tree__item__wrapper {
@@ -79,7 +84,7 @@ See: `_api-tree.scss` and `_guide-sdk-tree.scss`. */
79
84
  align-items: center;
80
85
  flex-wrap: nowrap;
81
86
  align-content: center;
82
- justify-content: space-between;
87
+ justify-content: flex-end;
83
88
 
84
89
  &:hover {
85
90
  background-color: u-color( 'background-dark' );
@@ -90,7 +95,7 @@ See: `_api-tree.scss` and `_guide-sdk-tree.scss`. */
90
95
  background-color: u-color( 'background-hue' );
91
96
 
92
97
  &:hover {
93
- background-color: u-color( 'background-hue', -3 );
98
+ background-color: u-color( 'background-hue', -3% );
94
99
  }
95
100
  }
96
101
  }
@@ -178,9 +183,22 @@ See: `_api-tree.scss` and `_guide-sdk-tree.scss`. */
178
183
  border-radius: 20px;
179
184
  /* u-spacing() lacks granularity here :( */
180
185
  padding: u-spacing( -4 ) .6em;
186
+ vertical-align: middle;
187
+ }
188
+
189
+ .tree__item__badge .tree__item__badge__text {
190
+ display: none;
181
191
  }
182
192
 
183
193
  .tree__item__badge_new {
184
194
  background: u-color( 'badge-green' );
185
195
  color: u-color( 'text-invert' );
186
196
  }
197
+
198
+ .tree__item__badge_premium {
199
+ background-image: url( ../img/star-in-circle.svg );
200
+ width: 16px;
201
+ height: 16px;
202
+ flex-shrink: 0;
203
+ display: inline-block;
204
+ }
@@ -33,10 +33,10 @@ $u-colors: (
33
33
  'hint-warning': #FF1D00
34
34
  );
35
35
 
36
- @function u-color( $name, $offset: 0 ) {
36
+ @function u-color( $name, $offset: 0% ) {
37
37
  @return scale-color( map-get( $u-colors, $name ), $lightness: $offset );
38
38
  }
39
39
 
40
- @function u-border-color( $name, $offset: 0 ) {
41
- @return u-color( $name, $offset - 25 );
40
+ @function u-border-color( $name, $offset: 0% ) {
41
+ @return u-color( $name, $offset - 25% );
42
42
  }
@@ -25,7 +25,7 @@ $u-font-sizes: (
25
25
  @mixin u-font-mono {
26
26
  font-family: $u-font-face-mono;
27
27
  font-size: .9em;
28
- color: u-color( text, 20 );
28
+ color: u-color( text, 20% );
29
29
  }
30
30
 
31
31
  $u-baseline-levels: (
@@ -95,7 +95,7 @@ $u-top-icon-width: 30px;
95
95
  margin-bottom: 0;
96
96
  padding: u-spacing( 0 ) u-spacing( 2 );
97
97
  border-top: 1px solid u-color( 'background-hue' );
98
- // background: u-color( 'background-hue', 40 );
98
+ // background: u-color( 'background-hue', 40% );
99
99
  background: u-color( 'background-bright' );
100
100
  height: 50px;
101
101
  border-top: 1px solid #eee;
@@ -108,7 +108,7 @@ $u-top-icon-width: 30px;
108
108
  font-size: .85em;
109
109
  text-transform: uppercase;
110
110
  font-weight: 600;
111
- color: u-color( 'text', 20 );
111
+ color: u-color( 'text', 20% );
112
112
  }
113
113
 
114
114
  @mixin levels( $depth, $spacing ) {
@@ -1,6 +1,14 @@
1
1
  // Copyright (c) 2017-2021, CKSource - Frederico Knabben. All rights reserved.
2
2
  // For licensing, see LICENSE.md or http://ckeditor.com/license
3
3
 
4
+ // Division using / is deprecated, math.div() has to be used instead.
5
+ // See: https://sass-lang.com/documentation/breaking-changes/slash-div
6
+ @use 'sass:math';
7
+
8
+ @use '~tippy.js/dist/tippy.css';
9
+ @use '~tippy.js/themes/light-border.css';
10
+ @use '~tippy.js/animations/scale.css';
11
+
4
12
  @import 'helpers/globals';
5
13
  @import 'helpers/font';
6
14
  @import 'helpers/reset';
@@ -25,7 +33,7 @@ body, html {
25
33
 
26
34
  body {
27
35
  padding: $u-top-height 0 0;
28
- color: u-color( text, 10 );
36
+ color: u-color( text, 10% );
29
37
 
30
38
  @include u-responsive-tablet {
31
39
  padding: $u-top-main 0 0;
@@ -0,0 +1,39 @@
1
+ /**
2
+ * @license Copyright (c) 2017-2021, CKSource - Frederico Knabben. All rights reserved.
3
+ * For licensing, see LICENSE.md.
4
+ */
5
+
6
+ import $ from 'jquery';
7
+ import tippy from 'tippy.js';
8
+
9
+ export function enableBadgeTooltips() {
10
+ $( '[data-badge-tooltip]' ).each( ( index, element ) => {
11
+ tippy( element, {
12
+ content: element.dataset.badgeTooltip,
13
+ placement: 'right',
14
+ duration: 150,
15
+ animation: 'scale',
16
+ theme: 'light-border',
17
+ zIndex: 1
18
+ } );
19
+ } );
20
+ }
21
+
22
+ export function createTooltip( target, content, options ) {
23
+ const tooltip = tippy( target, {
24
+ content,
25
+ ...options
26
+ } );
27
+
28
+ const closeButton = tooltip.popper.querySelector( '.tippy-content__close-button' );
29
+
30
+ closeButton.addEventListener( 'click', () => {
31
+ tooltip.hide();
32
+ } );
33
+
34
+ target.addEventListener( 'click', () => {
35
+ tooltip.hide();
36
+ } );
37
+
38
+ return tooltip;
39
+ }
@@ -25,6 +25,7 @@ import copyMobileApiNavigation from './_copymobileapinavigation';
25
25
  import { rwdButton } from './_rwdmenu';
26
26
  import imageModal from './_imageModal';
27
27
  import showWarningBanner from './_warningbanner';
28
+ import { enableBadgeTooltips, createTooltip } from './_tooltips';
28
29
 
29
30
  // Changing documentation theme. To enable, type in the console: `localStorage.setItem( 'theme', 'theme-dark' )`.
30
31
  if ( localStorage.getItem( 'theme' ) === 'theme-dark' ) {
@@ -35,7 +36,8 @@ if ( localStorage.getItem( 'theme' ) === 'theme-dark' ) {
35
36
  window.umberto = {
36
37
  // The `VERSION` value will be replaced by the `DefinePlugin` webpack plugin.
37
38
  version: VERSION, // eslint-disable-line no-undef
38
- showWarningBanner
39
+ showWarningBanner,
40
+ createTooltip
39
41
  };
40
42
 
41
43
  $( document ).ready( () => {
@@ -57,4 +59,5 @@ $( document ).ready( () => {
57
59
  imageModal(); // lightbox for { @img } elements
58
60
  // `sampleCode()` must be called after the `setupPrism()` function.
59
61
  sampleCode(); // control accordion of sample code and buttons(copy/download)
62
+ enableBadgeTooltips(); // attaches tippy.js tooltip for all elements with data-badge-tooltip
60
63
  } );