@docusaurus/theme-classic 0.0.0-4923 → 0.0.0-4924

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/lib/index.js CHANGED
@@ -156,7 +156,7 @@ function docusaurusThemeClassic(context, options) {
156
156
  },
157
157
 
158
158
  getClientModules() {
159
- const modules = [require.resolve(getInfimaCSSFile(direction)), './prism-include-languages', './admonitions.css'];
159
+ const modules = [require.resolve(getInfimaCSSFile(direction)), './prism-include-languages', './admonitions.css', './nprogress'];
160
160
 
161
161
  if (customCss) {
162
162
  if (Array.isArray(customCss)) {
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Copyright (c) Facebook, Inc. and its affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ /**
9
+ * Styles for NProgress
10
+ * Copied over to remove unused styles for the spinner.
11
+ * https://github.com/rstacruz/nprogress/blob/master/nprogress.css
12
+ */
13
+
14
+ :root {
15
+ --docusaurus-progress-bar-color: var(--ifm-color-primary);
16
+ }
17
+
18
+ #nprogress {
19
+ pointer-events: none;
20
+ }
21
+
22
+ #nprogress .bar {
23
+ background: var(--docusaurus-progress-bar-color);
24
+ position: fixed;
25
+ z-index: 1031;
26
+ top: 0;
27
+ left: 0;
28
+ width: 100%;
29
+ height: 2px;
30
+ }
31
+
32
+ #nprogress .peg {
33
+ position: absolute;
34
+ right: 0;
35
+ width: 100px;
36
+ height: 100%;
37
+ box-shadow: 0 0 10px var(--docusaurus-progress-bar-color),
38
+ 0 0 5px var(--docusaurus-progress-bar-color);
39
+ opacity: 1;
40
+ transform: rotate(3deg) translate(0, -4px);
41
+ }
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _nprogress = _interopRequireDefault(require("nprogress"));
9
+
10
+ require("./nprogress.css");
11
+
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+
14
+ /**
15
+ * Copyright (c) Facebook, Inc. and its affiliates.
16
+ *
17
+ * This source code is licensed under the MIT license found in the
18
+ * LICENSE file in the root directory of this source tree.
19
+ */
20
+ _nprogress.default.configure({
21
+ showSpinner: false
22
+ });
23
+
24
+ const delay = 200;
25
+ const clientModule = {
26
+ onRouteUpdate({
27
+ location,
28
+ previousLocation
29
+ }) {
30
+ if (previousLocation && location.pathname !== previousLocation.pathname) {
31
+ const progressBarTimeout = window.setTimeout(() => {
32
+ _nprogress.default.start();
33
+ }, delay);
34
+ return () => window.clearTimeout(progressBarTimeout);
35
+ }
36
+
37
+ return undefined;
38
+ },
39
+
40
+ onRouteDidUpdate() {
41
+ _nprogress.default.done();
42
+ }
43
+
44
+ };
45
+ var _default = clientModule;
46
+ exports.default = _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/theme-classic",
3
- "version": "0.0.0-4923",
3
+ "version": "0.0.0-4924",
4
4
  "description": "Classic theme for Docusaurus",
5
5
  "main": "lib/index.js",
6
6
  "types": "src/theme-classic.d.ts",
@@ -21,20 +21,21 @@
21
21
  "format:lib-next": "prettier --config ../../.prettierrc --write \"lib-next/**/*.{js,ts,jsx,tsc}\""
22
22
  },
23
23
  "dependencies": {
24
- "@docusaurus/core": "0.0.0-4923",
25
- "@docusaurus/plugin-content-blog": "0.0.0-4923",
26
- "@docusaurus/plugin-content-docs": "0.0.0-4923",
27
- "@docusaurus/plugin-content-pages": "0.0.0-4923",
28
- "@docusaurus/theme-common": "0.0.0-4923",
29
- "@docusaurus/theme-translations": "0.0.0-4923",
30
- "@docusaurus/utils": "0.0.0-4923",
31
- "@docusaurus/utils-common": "0.0.0-4923",
32
- "@docusaurus/utils-validation": "0.0.0-4923",
24
+ "@docusaurus/core": "0.0.0-4924",
25
+ "@docusaurus/plugin-content-blog": "0.0.0-4924",
26
+ "@docusaurus/plugin-content-docs": "0.0.0-4924",
27
+ "@docusaurus/plugin-content-pages": "0.0.0-4924",
28
+ "@docusaurus/theme-common": "0.0.0-4924",
29
+ "@docusaurus/theme-translations": "0.0.0-4924",
30
+ "@docusaurus/utils": "0.0.0-4924",
31
+ "@docusaurus/utils-common": "0.0.0-4924",
32
+ "@docusaurus/utils-validation": "0.0.0-4924",
33
33
  "@mdx-js/react": "^1.6.22",
34
34
  "clsx": "^1.1.1",
35
35
  "copy-text-to-clipboard": "^3.0.1",
36
36
  "infima": "0.2.0-alpha.38",
37
37
  "lodash": "^4.17.21",
38
+ "nprogress": "^0.2.0",
38
39
  "postcss": "^8.4.12",
39
40
  "prism-react-renderer": "^1.3.1",
40
41
  "prismjs": "^1.28.0",
@@ -45,9 +46,10 @@
45
46
  "@babel/cli": "^7.17.6",
46
47
  "@babel/core": "^7.17.9",
47
48
  "@babel/preset-typescript": "^7.16.7",
48
- "@docusaurus/module-type-aliases": "0.0.0-4923",
49
- "@docusaurus/types": "0.0.0-4923",
49
+ "@docusaurus/module-type-aliases": "0.0.0-4924",
50
+ "@docusaurus/types": "0.0.0-4924",
50
51
  "@types/mdx-js__react": "^1.5.5",
52
+ "@types/nprogress": "^0.2.0",
51
53
  "@types/prismjs": "^1.26.0",
52
54
  "@types/rtlcss": "^3.1.4",
53
55
  "cross-env": "^7.0.3",
@@ -62,5 +64,5 @@
62
64
  "engines": {
63
65
  "node": ">=14"
64
66
  },
65
- "gitHead": "0d7f61e267384e2c272cc3c0df059bdfe16609fd"
67
+ "gitHead": "9a5e4f9e3588967ccfb235a808f4bfc1447e403c"
66
68
  }
package/src/index.ts CHANGED
@@ -138,6 +138,7 @@ export default function docusaurusThemeClassic(
138
138
  require.resolve(getInfimaCSSFile(direction)),
139
139
  './prism-include-languages',
140
140
  './admonitions.css',
141
+ './nprogress',
141
142
  ];
142
143
 
143
144
  if (customCss) {
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Copyright (c) Facebook, Inc. and its affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ /**
9
+ * Styles for NProgress
10
+ * Copied over to remove unused styles for the spinner.
11
+ * https://github.com/rstacruz/nprogress/blob/master/nprogress.css
12
+ */
13
+
14
+ :root {
15
+ --docusaurus-progress-bar-color: var(--ifm-color-primary);
16
+ }
17
+
18
+ #nprogress {
19
+ pointer-events: none;
20
+ }
21
+
22
+ #nprogress .bar {
23
+ background: var(--docusaurus-progress-bar-color);
24
+ position: fixed;
25
+ z-index: 1031;
26
+ top: 0;
27
+ left: 0;
28
+ width: 100%;
29
+ height: 2px;
30
+ }
31
+
32
+ #nprogress .peg {
33
+ position: absolute;
34
+ right: 0;
35
+ width: 100px;
36
+ height: 100%;
37
+ box-shadow: 0 0 10px var(--docusaurus-progress-bar-color),
38
+ 0 0 5px var(--docusaurus-progress-bar-color);
39
+ opacity: 1;
40
+ transform: rotate(3deg) translate(0, -4px);
41
+ }
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Copyright (c) Facebook, Inc. and its affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ import nprogress from 'nprogress';
9
+ import './nprogress.css';
10
+ import type {ClientModule} from '@docusaurus/types';
11
+
12
+ nprogress.configure({showSpinner: false});
13
+
14
+ const delay = 200;
15
+
16
+ const clientModule: ClientModule = {
17
+ onRouteUpdate({location, previousLocation}) {
18
+ if (previousLocation && location.pathname !== previousLocation.pathname) {
19
+ const progressBarTimeout = window.setTimeout(() => {
20
+ nprogress.start();
21
+ }, delay);
22
+ return () => window.clearTimeout(progressBarTimeout);
23
+ }
24
+ return undefined;
25
+ },
26
+ onRouteDidUpdate() {
27
+ nprogress.done();
28
+ },
29
+ };
30
+
31
+ export default clientModule;