umberto 1.17.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.
package/README.md CHANGED
@@ -258,6 +258,7 @@ title: Overview [optional]
258
258
  slug: overview [optional]
259
259
  order: 10 [optional]
260
260
  toc: false [optional]
261
+ toc-limit: 5 [optional]
261
262
  badges: [ premium, ... ] [optional]
262
263
  sitenav: false [optional]
263
264
  feedback-widget: false [optional]
@@ -307,6 +308,10 @@ Can be set to sort the guides within the same category. If skipped, guides are s
307
308
 
308
309
  If defined and set to `false`, table of contents will not be rendered.
309
310
 
311
+ #### toc-limit [optional]
312
+
313
+ If defined and set to `0` or greater integer, the table of contents will be limited to the defined depth (e.g. for value `2`, only `<h2>` and `<h3>` headings will be shown in the table of contents). Value `0` is an equivalent of using `toc: false`.
314
+
310
315
  #### sitenav [optional]
311
316
 
312
317
  If defined and set to `false`, there will be no left-side navigation and main content will be centered.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "umberto",
3
- "version": "1.17.0",
3
+ "version": "1.18.0",
4
4
  "description": "CKSource Documentation builder",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -42,15 +42,15 @@
42
42
  "medium-zoom": "^1.0.5",
43
43
  "mkdirp": "^1.0.4",
44
44
  "moment": "^2.27.0",
45
- "node-sass": "^4.14.1",
46
45
  "nyc": "15.1.0",
47
46
  "pug": "^3.0.0",
47
+ "sass": "^1.43.4",
48
48
  "sitemap": "^6.1.6",
49
49
  "tippy.js": "^6.3.2",
50
50
  "tree-model": "^1.0.7",
51
51
  "upath": "^2.0.0",
52
52
  "vnu-jar": "^20.5.29",
53
- "webpack": "^4.43.0"
53
+ "webpack": "^5.58.1"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@ckeditor/ckeditor5-dev-env": "^21.0.0",
@@ -9,7 +9,16 @@ const cheerio = require( 'cheerio' );
9
9
 
10
10
  hexo.extend.helper.register( 'uToc', ( data, options = {} ) => {
11
11
  const $ = cheerio.load( data );
12
- const headings = $( 'h2,h3,h4,h5,h6' )
12
+
13
+ let usedHeadings = [ 'h2', 'h3', 'h4', 'h5', 'h6' ];
14
+
15
+ if ( options.tocLimit >= 0 ) {
16
+ usedHeadings = usedHeadings.slice( 0, options.tocLimit );
17
+ }
18
+
19
+ usedHeadings = usedHeadings.join( ',' );
20
+
21
+ const headings = $( usedHeadings )
13
22
  .filter( function() {
14
23
  return !$( this ).parents( '.live-snippet, .collapsing-list__item' ).length;
15
24
  } );
@@ -5,7 +5,7 @@
5
5
 
6
6
  'use strict';
7
7
 
8
- const sass = require( 'node-sass' );
8
+ const sass = require( 'sass' );
9
9
  const fs = require( 'fs-extra' );
10
10
  const upath = require( 'upath' );
11
11
 
@@ -22,7 +22,7 @@ module.exports = ( src, dst ) => {
22
22
 
23
23
  return fs.readFile( absolutePath, 'utf-8', ( err, data ) => {
24
24
  if ( err ) {
25
- return reject( err );
25
+ return done( err );
26
26
  }
27
27
 
28
28
  return done( {
@@ -7,7 +7,7 @@ block content
7
7
  != split.title || page.title
8
8
 
9
9
  if page.toc !== false
10
- != uToc( page.content )
10
+ != uToc( page.content, { tocLimit: page[ 'toc-limit' ] } )
11
11
 
12
12
  != split.content
13
13
 
@@ -8,7 +8,7 @@ block content
8
8
  != split.title || page.title
9
9
 
10
10
  if page.toc !== false
11
- != uToc( page.content, { groupId: page.groupId } )
11
+ != uToc( page.content, { groupId: page.groupId, tocLimit: page[ 'toc-limit' ] } )
12
12
 
13
13
  != split.content
14
14
 
@@ -8,7 +8,7 @@ block content
8
8
  != split.title || page.title
9
9
 
10
10
  if page.toc !== false
11
- != uToc( page.content, { groupId: page.groupId } )
11
+ != uToc( page.content, { groupId: page.groupId, tocLimit: page[ 'toc-limit' ] } )
12
12
 
13
13
  != split.content
14
14
 
@@ -21,7 +21,7 @@ div.api-props-filter {
21
21
  border-color: u-color( 'selected' );
22
22
 
23
23
  &:hover {
24
- background: u-color( 'selected', 5 );
24
+ background: u-color( 'selected', 5% );
25
25
  }
26
26
  }
27
27
 
@@ -16,7 +16,7 @@
16
16
  text-decoration: none;
17
17
 
18
18
  &:hover {
19
- color: u-color('badge-#{ $color }', -50 );
19
+ color: u-color('badge-#{ $color }', -50% );
20
20
  text-decoration: none;
21
21
  }
22
22
  }
@@ -185,7 +185,7 @@ ul.collapsing-list {
185
185
  overflow: hidden;
186
186
  height: $u-line-height-base + em;
187
187
  white-space: nowrap;
188
- margin-bottom: u-spacing( 0 )/2;
188
+ margin-bottom: math.div( u-spacing( 0 ), 2 );
189
189
  }
190
190
  }
191
191
 
@@ -233,7 +233,7 @@ ul.collapsing-list {
233
233
  &__dev-names {
234
234
  code#{&}--active {
235
235
  display: block;
236
- color: u-color( 'text', 40 );
236
+ color: u-color( 'text', 40% );
237
237
  font-size: u-font-size( -1 );
238
238
  cursor: default;
239
239
  }
@@ -80,7 +80,7 @@
80
80
 
81
81
  h1 {
82
82
  &:first-of-type {
83
- margin-bottom: u-spacing( 0 ) / 2;
83
+ margin-bottom: math.div( u-spacing( 0 ), 2 );
84
84
  }
85
85
  }
86
86
 
@@ -124,7 +124,7 @@
124
124
  font-size: 0.9em;
125
125
  padding: 0;
126
126
  margin: -0.4em 0 0 0;
127
- color: u-color( 'text', 50 );
127
+ color: u-color( 'text', 50% );
128
128
 
129
129
  &--hidden {
130
130
  display: none;
@@ -27,7 +27,7 @@
27
27
  }
28
28
 
29
29
  p {
30
- color: u-color( 'text', 20 );
30
+ color: u-color( 'text', 20% );
31
31
  position: absolute;
32
32
  bottom: u-spacing( 2 );
33
33
  right: u-spacing( 3 );
@@ -146,9 +146,9 @@
146
146
  kbd {
147
147
  display: inline-block;
148
148
  background: u-color( 'background-dark' );
149
- border: solid 1px u-border-color( 'background-hue', 5 );
150
- border-bottom-color: u-border-color( 'background-hue', -5 );
151
- box-shadow: inset 0 -1px 0 u-border-color( 'background-hue', -5 );
149
+ border: solid 1px u-border-color( 'background-hue', 5% );
150
+ border-bottom-color: u-border-color( 'background-hue', -5% );
151
+ box-shadow: inset 0 -1px 0 u-border-color( 'background-hue', -5% );
152
152
  font-family: $u-font-face-mono;
153
153
  font-size: .8em; // 12px;
154
154
  padding: u-spacing( -3 ) u-spacing( -2 );
@@ -173,7 +173,7 @@
173
173
  margin-bottom: 0;
174
174
 
175
175
  &:last-of-type {
176
- margin-bottom: u-spacing( 0 )/3;
176
+ margin-bottom: math.div( u-spacing( 0 ), 3 );
177
177
  }
178
178
  }
179
179
 
@@ -211,7 +211,7 @@
211
211
  }
212
212
 
213
213
  td, th {
214
- border: 1px solid u-border-color( 'background-dark', 20 );
214
+ border: 1px solid u-border-color( 'background-dark', 20% );
215
215
  padding: 6px 12px;
216
216
  }
217
217
 
@@ -14,7 +14,7 @@
14
14
  position: absolute;
15
15
  padding: 0 1em;
16
16
  left: -2em;
17
- color: u-color( 'link', 20 );
17
+ color: u-color( 'link', 20% );
18
18
  }
19
19
 
20
20
  &:hover {
@@ -28,8 +28,8 @@ p.tip {
28
28
  width: $u-top-icon-width;
29
29
  height: $u-top-icon-width;
30
30
  position: absolute;
31
- left: ($u-top-icon-width*2 - $u-top-icon-width/2 ) * -1;
32
- top: $u-top-icon-width/2;
31
+ left: ( $u-top-icon-width * 2 - math.div( $u-top-icon-width, 2 ) ) * -1;
32
+ top: math.div( $u-top-icon-width, 2 );
33
33
  }
34
34
 
35
35
  @include u-responsive-narrow {
@@ -41,8 +41,8 @@ p.tip {
41
41
  width: $u-top-icon-width;
42
42
  height: $u-top-icon-width;
43
43
  position: absolute;
44
- left: $u-top-icon-width - $u-top-icon-width/2;
45
- top: $u-top-icon-width/2;
44
+ left: $u-top-icon-width - math.div( $u-top-icon-width, 2 );
45
+ top: math.div( $u-top-icon-width, 2 );
46
46
  }
47
47
  }
48
48
 
@@ -140,7 +140,7 @@ nav.api-secondary-navigation {
140
140
  }
141
141
 
142
142
  h3 {
143
- margin-bottom: u-spacing( 0 ) / 3;
143
+ margin-bottom: math.div( u-spacing( 0 ), 3 );
144
144
  padding-top: 0;
145
145
  }
146
146
  }
@@ -23,7 +23,7 @@
23
23
 
24
24
  &:hover {
25
25
  &::before {
26
- border-color: transparent transparent transparent u-color( 'toggler', -8 );
26
+ border-color: transparent transparent transparent u-color( 'toggler', -8% );
27
27
  }
28
28
  }
29
29
  }
@@ -37,7 +37,7 @@
37
37
 
38
38
  &:hover {
39
39
  &::before {
40
- border-color: u-color( 'toggler', -8 ) transparent transparent transparent;
40
+ border-color: u-color( 'toggler', -8% ) transparent transparent transparent;
41
41
  }
42
42
  }
43
43
  }
@@ -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,
@@ -95,7 +95,7 @@ See: `_api-tree.scss` and `_guide-sdk-tree.scss`. */
95
95
  background-color: u-color( 'background-hue' );
96
96
 
97
97
  &:hover {
98
- background-color: u-color( 'background-hue', -3 );
98
+ background-color: u-color( 'background-hue', -3% );
99
99
  }
100
100
  }
101
101
  }
@@ -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,9 +1,13 @@
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
- @import '~tippy.js/dist/tippy.css';
5
- @import '~tippy.js/themes/light-border.css';
6
- @import '~tippy.js/animations/scale.css';
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';
7
11
 
8
12
  @import 'helpers/globals';
9
13
  @import 'helpers/font';
@@ -29,7 +33,7 @@ body, html {
29
33
 
30
34
  body {
31
35
  padding: $u-top-height 0 0;
32
- color: u-color( text, 10 );
36
+ color: u-color( text, 10% );
33
37
 
34
38
  @include u-responsive-tablet {
35
39
  padding: $u-top-main 0 0;