@docusaurus/theme-classic 0.0.0-4831 → 0.0.0-4836
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/theme-classic.d.ts
CHANGED
|
@@ -51,8 +51,9 @@ const NavbarItemPosition = _utilsValidation.Joi.string().equal('left', 'right').
|
|
|
51
51
|
|
|
52
52
|
const NavbarItemBaseSchema = _utilsValidation.Joi.object({
|
|
53
53
|
label: _utilsValidation.Joi.string(),
|
|
54
|
+
html: _utilsValidation.Joi.string(),
|
|
54
55
|
className: _utilsValidation.Joi.string()
|
|
55
|
-
}) // We allow any unknown attributes on the links (users may need additional
|
|
56
|
+
}).nand('html', 'label') // We allow any unknown attributes on the links (users may need additional
|
|
56
57
|
// attributes like target, aria-role, data-customAttribute...)
|
|
57
58
|
.unknown();
|
|
58
59
|
|
|
@@ -17,6 +17,7 @@ export default function NavbarNavLink({
|
|
|
17
17
|
to,
|
|
18
18
|
href,
|
|
19
19
|
label,
|
|
20
|
+
html,
|
|
20
21
|
activeClassName = '',
|
|
21
22
|
prependBaseUrlToHref,
|
|
22
23
|
...props
|
|
@@ -29,38 +30,55 @@ export default function NavbarNavLink({
|
|
|
29
30
|
forcePrependBaseUrl: true,
|
|
30
31
|
});
|
|
31
32
|
const isExternalLink = label && href && !isInternalUrl(href);
|
|
32
|
-
const isDropdownLink = activeClassName === dropdownLinkActiveClass;
|
|
33
|
+
const isDropdownLink = activeClassName === dropdownLinkActiveClass; // Link content is set through html XOR label
|
|
34
|
+
|
|
35
|
+
const linkContentProps = html
|
|
36
|
+
? {
|
|
37
|
+
dangerouslySetInnerHTML: {
|
|
38
|
+
__html: html,
|
|
39
|
+
},
|
|
40
|
+
}
|
|
41
|
+
: {
|
|
42
|
+
children: (
|
|
43
|
+
<>
|
|
44
|
+
{label}
|
|
45
|
+
{isExternalLink && (
|
|
46
|
+
<IconExternalLink
|
|
47
|
+
{...(isDropdownLink && {
|
|
48
|
+
width: 12,
|
|
49
|
+
height: 12,
|
|
50
|
+
})}
|
|
51
|
+
/>
|
|
52
|
+
)}
|
|
53
|
+
</>
|
|
54
|
+
),
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
if (href) {
|
|
58
|
+
return (
|
|
59
|
+
<Link
|
|
60
|
+
href={prependBaseUrlToHref ? normalizedHref : href}
|
|
61
|
+
{...props}
|
|
62
|
+
{...linkContentProps}
|
|
63
|
+
/>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
33
67
|
return (
|
|
34
68
|
<Link
|
|
35
|
-
{
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
? isRegexpStringMatch(activeBaseRegex, location.pathname)
|
|
50
|
-
: location.pathname.startsWith(activeBaseUrl),
|
|
51
|
-
}
|
|
52
|
-
: null),
|
|
53
|
-
})}
|
|
54
|
-
{...props}>
|
|
55
|
-
{label}
|
|
56
|
-
{isExternalLink && (
|
|
57
|
-
<IconExternalLink
|
|
58
|
-
{...(isDropdownLink && {
|
|
59
|
-
width: 12,
|
|
60
|
-
height: 12,
|
|
61
|
-
})}
|
|
62
|
-
/>
|
|
63
|
-
)}
|
|
64
|
-
</Link>
|
|
69
|
+
to={toUrl}
|
|
70
|
+
isNavLink
|
|
71
|
+
activeClassName={
|
|
72
|
+
!props.className?.includes(activeClassName) ? activeClassName : ''
|
|
73
|
+
}
|
|
74
|
+
{...((activeBasePath || activeBaseRegex) && {
|
|
75
|
+
isActive: (_match, location) =>
|
|
76
|
+
activeBaseRegex
|
|
77
|
+
? isRegexpStringMatch(activeBaseRegex, location.pathname)
|
|
78
|
+
: location.pathname.startsWith(activeBaseUrl),
|
|
79
|
+
})}
|
|
80
|
+
{...props}
|
|
81
|
+
{...linkContentProps}
|
|
82
|
+
/>
|
|
65
83
|
);
|
|
66
84
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/theme-classic",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-4836",
|
|
4
4
|
"description": "Classic theme for Docusaurus",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "src/theme-classic.d.ts",
|
|
@@ -21,15 +21,15 @@
|
|
|
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-
|
|
25
|
-
"@docusaurus/plugin-content-blog": "0.0.0-
|
|
26
|
-
"@docusaurus/plugin-content-docs": "0.0.0-
|
|
27
|
-
"@docusaurus/plugin-content-pages": "0.0.0-
|
|
28
|
-
"@docusaurus/theme-common": "0.0.0-
|
|
29
|
-
"@docusaurus/theme-translations": "0.0.0-
|
|
30
|
-
"@docusaurus/utils": "0.0.0-
|
|
31
|
-
"@docusaurus/utils-common": "0.0.0-
|
|
32
|
-
"@docusaurus/utils-validation": "0.0.0-
|
|
24
|
+
"@docusaurus/core": "0.0.0-4836",
|
|
25
|
+
"@docusaurus/plugin-content-blog": "0.0.0-4836",
|
|
26
|
+
"@docusaurus/plugin-content-docs": "0.0.0-4836",
|
|
27
|
+
"@docusaurus/plugin-content-pages": "0.0.0-4836",
|
|
28
|
+
"@docusaurus/theme-common": "0.0.0-4836",
|
|
29
|
+
"@docusaurus/theme-translations": "0.0.0-4836",
|
|
30
|
+
"@docusaurus/utils": "0.0.0-4836",
|
|
31
|
+
"@docusaurus/utils-common": "0.0.0-4836",
|
|
32
|
+
"@docusaurus/utils-validation": "0.0.0-4836",
|
|
33
33
|
"@mdx-js/react": "^1.6.22",
|
|
34
34
|
"clsx": "^1.1.1",
|
|
35
35
|
"copy-text-to-clipboard": "^3.0.1",
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"rtlcss": "^3.5.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@docusaurus/module-type-aliases": "0.0.0-
|
|
46
|
-
"@docusaurus/types": "0.0.0-
|
|
45
|
+
"@docusaurus/module-type-aliases": "0.0.0-4836",
|
|
46
|
+
"@docusaurus/types": "0.0.0-4836",
|
|
47
47
|
"@types/mdx-js__react": "^1.5.5",
|
|
48
48
|
"@types/prismjs": "^1.26.0",
|
|
49
49
|
"@types/rtlcss": "^3.1.3",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"engines": {
|
|
60
60
|
"node": ">=14"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "9f5e74fd2fa4695a5c69ee02ad12d59f2fc4c621"
|
|
63
63
|
}
|
|
@@ -21,6 +21,7 @@ export default function NavbarNavLink({
|
|
|
21
21
|
to,
|
|
22
22
|
href,
|
|
23
23
|
label,
|
|
24
|
+
html,
|
|
24
25
|
activeClassName = '',
|
|
25
26
|
prependBaseUrlToHref,
|
|
26
27
|
...props
|
|
@@ -33,32 +34,47 @@ export default function NavbarNavLink({
|
|
|
33
34
|
const isExternalLink = label && href && !isInternalUrl(href);
|
|
34
35
|
const isDropdownLink = activeClassName === dropdownLinkActiveClass;
|
|
35
36
|
|
|
37
|
+
// Link content is set through html XOR label
|
|
38
|
+
const linkContentProps = html
|
|
39
|
+
? {dangerouslySetInnerHTML: {__html: html}}
|
|
40
|
+
: {
|
|
41
|
+
children: (
|
|
42
|
+
<>
|
|
43
|
+
{label}
|
|
44
|
+
{isExternalLink && (
|
|
45
|
+
<IconExternalLink
|
|
46
|
+
{...(isDropdownLink && {width: 12, height: 12})}
|
|
47
|
+
/>
|
|
48
|
+
)}
|
|
49
|
+
</>
|
|
50
|
+
),
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
if (href) {
|
|
54
|
+
return (
|
|
55
|
+
<Link
|
|
56
|
+
href={prependBaseUrlToHref ? normalizedHref : href}
|
|
57
|
+
{...props}
|
|
58
|
+
{...linkContentProps}
|
|
59
|
+
/>
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
36
63
|
return (
|
|
37
64
|
<Link
|
|
38
|
-
{
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
? isRegexpStringMatch(activeBaseRegex, location.pathname)
|
|
53
|
-
: location.pathname.startsWith(activeBaseUrl),
|
|
54
|
-
}
|
|
55
|
-
: null),
|
|
56
|
-
})}
|
|
57
|
-
{...props}>
|
|
58
|
-
{label}
|
|
59
|
-
{isExternalLink && (
|
|
60
|
-
<IconExternalLink {...(isDropdownLink && {width: 12, height: 12})} />
|
|
61
|
-
)}
|
|
62
|
-
</Link>
|
|
65
|
+
to={toUrl}
|
|
66
|
+
isNavLink
|
|
67
|
+
activeClassName={
|
|
68
|
+
!props.className?.includes(activeClassName) ? activeClassName : ''
|
|
69
|
+
}
|
|
70
|
+
{...((activeBasePath || activeBaseRegex) && {
|
|
71
|
+
isActive: (_match, location) =>
|
|
72
|
+
activeBaseRegex
|
|
73
|
+
? isRegexpStringMatch(activeBaseRegex, location.pathname)
|
|
74
|
+
: location.pathname.startsWith(activeBaseUrl),
|
|
75
|
+
})}
|
|
76
|
+
{...props}
|
|
77
|
+
{...linkContentProps}
|
|
78
|
+
/>
|
|
63
79
|
);
|
|
64
80
|
}
|
package/src/theme-classic.d.ts
CHANGED
|
@@ -49,8 +49,10 @@ const NavbarItemPosition = Joi.string().equal('left', 'right').default('left');
|
|
|
49
49
|
|
|
50
50
|
const NavbarItemBaseSchema = Joi.object({
|
|
51
51
|
label: Joi.string(),
|
|
52
|
+
html: Joi.string(),
|
|
52
53
|
className: Joi.string(),
|
|
53
54
|
})
|
|
55
|
+
.nand('html', 'label')
|
|
54
56
|
// We allow any unknown attributes on the links (users may need additional
|
|
55
57
|
// attributes like target, aria-role, data-customAttribute...)
|
|
56
58
|
.unknown();
|