@docusaurus/theme-classic 0.0.0-4135 → 0.0.0-4143

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.
@@ -18,6 +18,8 @@ var _IconExternalLink = _interopRequireDefault(require("@theme/IconExternalLink"
18
18
 
19
19
  var _isInternalUrl = _interopRequireDefault(require("@docusaurus/isInternalUrl"));
20
20
 
21
+ var _themeCommon = require("@docusaurus/theme-common");
22
+
21
23
  var _index = require("./index");
22
24
 
23
25
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -58,7 +60,7 @@ function NavLink({
58
60
  activeClassName: !((_props$className = props.className) !== null && _props$className !== void 0 && _props$className.includes(activeClassName)) ? activeClassName : '',
59
61
  to: toUrl,
60
62
  ...(activeBasePath || activeBaseRegex ? {
61
- isActive: (_match, location) => activeBaseRegex ? new RegExp(activeBaseRegex).test(location.pathname) : location.pathname.startsWith(activeBaseUrl)
63
+ isActive: (_match, location) => activeBaseRegex ? (0, _themeCommon.isRegexpStringMatch)(activeBaseRegex, location.pathname) : location.pathname.startsWith(activeBaseUrl)
62
64
  } : null)
63
65
  }} {...props}>
64
66
  {isExternalLink ? <span>
@@ -34,7 +34,7 @@ function isItemActive(item, localPathname) {
34
34
  return true;
35
35
  }
36
36
 
37
- if (item.activeBaseRegex && new RegExp(item.activeBaseRegex).test(localPathname)) {
37
+ if ((0, _themeCommon.isRegexpStringMatch)(item.activeBaseRegex, localPathname)) {
38
38
  return true;
39
39
  }
40
40
 
@@ -10,6 +10,7 @@ import Link from '@docusaurus/Link';
10
10
  import useBaseUrl from '@docusaurus/useBaseUrl';
11
11
  import IconExternalLink from '@theme/IconExternalLink';
12
12
  import isInternalUrl from '@docusaurus/isInternalUrl';
13
+ import {isRegexpStringMatch} from '@docusaurus/theme-common';
13
14
  import {getInfimaActiveClassName} from './index';
14
15
  const dropdownLinkActiveClass = 'dropdown__link--active';
15
16
  export function NavLink({
@@ -47,7 +48,7 @@ export function NavLink({
47
48
  ? {
48
49
  isActive: (_match, location) =>
49
50
  activeBaseRegex
50
- ? new RegExp(activeBaseRegex).test(location.pathname)
51
+ ? isRegexpStringMatch(activeBaseRegex, location.pathname)
51
52
  : location.pathname.startsWith(activeBaseUrl),
52
53
  }
53
54
  : null),
@@ -10,6 +10,7 @@ import {
10
10
  isSamePath,
11
11
  useCollapsible,
12
12
  Collapsible,
13
+ isRegexpStringMatch,
13
14
  useLocalPathname,
14
15
  } from '@docusaurus/theme-common';
15
16
  import {NavLink} from '@theme/NavbarItem/DefaultNavbarItem';
@@ -21,10 +22,7 @@ function isItemActive(item, localPathname) {
21
22
  return true;
22
23
  }
23
24
 
24
- if (
25
- item.activeBaseRegex &&
26
- new RegExp(item.activeBaseRegex).test(localPathname)
27
- ) {
25
+ if (isRegexpStringMatch(item.activeBaseRegex, localPathname)) {
28
26
  return true;
29
27
  }
30
28
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/theme-classic",
3
- "version": "0.0.0-4135",
3
+ "version": "0.0.0-4143",
4
4
  "description": "Classic theme for Docusaurus",
5
5
  "main": "lib/index.js",
6
6
  "types": "src/types.d.ts",
@@ -23,15 +23,15 @@
23
23
  "update-code-translations": "node -e 'require(\"./update-code-translations.js\").run()'"
24
24
  },
25
25
  "dependencies": {
26
- "@docusaurus/core": "0.0.0-4135",
27
- "@docusaurus/plugin-content-blog": "0.0.0-4135",
28
- "@docusaurus/plugin-content-docs": "0.0.0-4135",
29
- "@docusaurus/plugin-content-pages": "0.0.0-4135",
30
- "@docusaurus/theme-common": "0.0.0-4135",
31
- "@docusaurus/types": "0.0.0-4135",
32
- "@docusaurus/utils": "0.0.0-4135",
33
- "@docusaurus/utils-common": "0.0.0-4135",
34
- "@docusaurus/utils-validation": "0.0.0-4135",
26
+ "@docusaurus/core": "0.0.0-4143",
27
+ "@docusaurus/plugin-content-blog": "0.0.0-4143",
28
+ "@docusaurus/plugin-content-docs": "0.0.0-4143",
29
+ "@docusaurus/plugin-content-pages": "0.0.0-4143",
30
+ "@docusaurus/theme-common": "0.0.0-4143",
31
+ "@docusaurus/types": "0.0.0-4143",
32
+ "@docusaurus/utils": "0.0.0-4143",
33
+ "@docusaurus/utils-common": "0.0.0-4143",
34
+ "@docusaurus/utils-validation": "0.0.0-4143",
35
35
  "@mdx-js/mdx": "^1.6.21",
36
36
  "@mdx-js/react": "^1.6.21",
37
37
  "chalk": "^4.1.2",
@@ -50,7 +50,7 @@
50
50
  "rtlcss": "^3.3.0"
51
51
  },
52
52
  "devDependencies": {
53
- "@docusaurus/module-type-aliases": "0.0.0-4135",
53
+ "@docusaurus/module-type-aliases": "0.0.0-4143",
54
54
  "@types/mdx-js__react": "^1.5.4",
55
55
  "@types/parse-numeric-range": "^0.0.1",
56
56
  "@types/rtlcss": "^3.1.1",
@@ -64,5 +64,5 @@
64
64
  "engines": {
65
65
  "node": ">=14"
66
66
  },
67
- "gitHead": "d5dab23c92e0ca1e60f6dc06c784dc6588379be4"
67
+ "gitHead": "2fe01a54c76f8ac4259b076c43b31d2ccb0ea4f2"
68
68
  }
@@ -16,6 +16,7 @@ import type {
16
16
  } from '@theme/NavbarItem/DefaultNavbarItem';
17
17
  import IconExternalLink from '@theme/IconExternalLink';
18
18
  import isInternalUrl from '@docusaurus/isInternalUrl';
19
+ import {isRegexpStringMatch} from '@docusaurus/theme-common';
19
20
  import {getInfimaActiveClassName} from './index';
20
21
 
21
22
  const dropdownLinkActiveClass = 'dropdown__link--active';
@@ -54,7 +55,7 @@ export function NavLink({
54
55
  ? {
55
56
  isActive: (_match, location) =>
56
57
  activeBaseRegex
57
- ? new RegExp(activeBaseRegex).test(location.pathname)
58
+ ? isRegexpStringMatch(activeBaseRegex, location.pathname)
58
59
  : location.pathname.startsWith(activeBaseUrl),
59
60
  }
60
61
  : null),
@@ -11,6 +11,7 @@ import {
11
11
  isSamePath,
12
12
  useCollapsible,
13
13
  Collapsible,
14
+ isRegexpStringMatch,
14
15
  useLocalPathname,
15
16
  } from '@docusaurus/theme-common';
16
17
  import type {
@@ -31,10 +32,7 @@ function isItemActive(
31
32
  if (isSamePath(item.to, localPathname)) {
32
33
  return true;
33
34
  }
34
- if (
35
- item.activeBaseRegex &&
36
- new RegExp(item.activeBaseRegex).test(localPathname)
37
- ) {
35
+ if (isRegexpStringMatch(item.activeBaseRegex, localPathname)) {
38
36
  return true;
39
37
  }
40
38
  if (item.activeBasePath && localPathname.startsWith(item.activeBasePath)) {