@docusaurus/theme-classic 3.8.1-canary-6375 → 3.8.1-canary-6376
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/DocSidebarItem/Category/index.js +33 -28
- package/lib/theme/DocSidebarItem/Category/styles.module.css +26 -0
- package/lib/theme/DocSidebarItem/Link/index.js +8 -1
- package/lib/theme/DocSidebarItem/Link/styles.module.css +8 -0
- package/package.json +15 -15
- package/src/theme/DocSidebarItem/Category/index.tsx +36 -28
- package/src/theme/DocSidebarItem/Category/styles.module.css +26 -0
- package/src/theme/DocSidebarItem/Link/index.tsx +9 -1
- package/src/theme/DocSidebarItem/Link/styles.module.css +8 -0
|
@@ -23,6 +23,7 @@ import Link from '@docusaurus/Link';
|
|
|
23
23
|
import {translate} from '@docusaurus/Translate';
|
|
24
24
|
import useIsBrowser from '@docusaurus/useIsBrowser';
|
|
25
25
|
import DocSidebarItems from '@theme/DocSidebarItems';
|
|
26
|
+
import styles from './styles.module.css';
|
|
26
27
|
// If we navigate to a category and it becomes active, it should automatically
|
|
27
28
|
// expand itself
|
|
28
29
|
function useAutoExpandActiveCategory({
|
|
@@ -100,6 +101,13 @@ function CollapseButton({collapsed, categoryLabel, onClick}) {
|
|
|
100
101
|
/>
|
|
101
102
|
);
|
|
102
103
|
}
|
|
104
|
+
function CategoryLinkLabel({label}) {
|
|
105
|
+
return (
|
|
106
|
+
<span title={label} className={styles.categoryLinkLabel}>
|
|
107
|
+
{label}
|
|
108
|
+
</span>
|
|
109
|
+
);
|
|
110
|
+
}
|
|
103
111
|
export default function DocSidebarItemCategory({
|
|
104
112
|
item,
|
|
105
113
|
onItemClick,
|
|
@@ -149,6 +157,28 @@ export default function DocSidebarItemCategory({
|
|
|
149
157
|
setCollapsed(true);
|
|
150
158
|
}
|
|
151
159
|
}, [collapsible, expandedItem, index, setCollapsed, autoCollapseCategories]);
|
|
160
|
+
const handleItemClick = (e) => {
|
|
161
|
+
onItemClick?.(item);
|
|
162
|
+
if (collapsible) {
|
|
163
|
+
if (href) {
|
|
164
|
+
// When already on the category's page, we collapse it
|
|
165
|
+
// We don't use "isActive" because it would collapse the
|
|
166
|
+
// category even when we browse a children element
|
|
167
|
+
// See https://github.com/facebook/docusaurus/issues/11213
|
|
168
|
+
if (isCurrentPage) {
|
|
169
|
+
e.preventDefault();
|
|
170
|
+
updateCollapsed();
|
|
171
|
+
} else {
|
|
172
|
+
// When navigating to a new category, we always expand
|
|
173
|
+
// see https://github.com/facebook/docusaurus/issues/10854#issuecomment-2609616182
|
|
174
|
+
updateCollapsed(false);
|
|
175
|
+
}
|
|
176
|
+
} else {
|
|
177
|
+
e.preventDefault();
|
|
178
|
+
updateCollapsed();
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
};
|
|
152
182
|
return (
|
|
153
183
|
<li
|
|
154
184
|
className={clsx(
|
|
@@ -165,43 +195,18 @@ export default function DocSidebarItemCategory({
|
|
|
165
195
|
'menu__list-item-collapsible--active': isCurrentPage,
|
|
166
196
|
})}>
|
|
167
197
|
<Link
|
|
168
|
-
className={clsx('menu__link', {
|
|
198
|
+
className={clsx(styles.categoryLink, 'menu__link', {
|
|
169
199
|
'menu__link--sublist': collapsible,
|
|
170
200
|
'menu__link--sublist-caret': !href && collapsible,
|
|
171
201
|
'menu__link--active': isActive,
|
|
172
202
|
})}
|
|
173
|
-
onClick={
|
|
174
|
-
collapsible
|
|
175
|
-
? (e) => {
|
|
176
|
-
onItemClick?.(item);
|
|
177
|
-
if (href) {
|
|
178
|
-
// When already on the category's page, we collapse it
|
|
179
|
-
// We don't use "isActive" because it would collapse the
|
|
180
|
-
// category even when we browse a children element
|
|
181
|
-
// See https://github.com/facebook/docusaurus/issues/11213
|
|
182
|
-
if (isCurrentPage) {
|
|
183
|
-
e.preventDefault();
|
|
184
|
-
updateCollapsed();
|
|
185
|
-
} else {
|
|
186
|
-
// When navigating to a new category, we always expand
|
|
187
|
-
// see https://github.com/facebook/docusaurus/issues/10854#issuecomment-2609616182
|
|
188
|
-
updateCollapsed(false);
|
|
189
|
-
}
|
|
190
|
-
} else {
|
|
191
|
-
e.preventDefault();
|
|
192
|
-
updateCollapsed();
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
: () => {
|
|
196
|
-
onItemClick?.(item);
|
|
197
|
-
}
|
|
198
|
-
}
|
|
203
|
+
onClick={handleItemClick}
|
|
199
204
|
aria-current={isCurrentPage ? 'page' : undefined}
|
|
200
205
|
role={collapsible && !href ? 'button' : undefined}
|
|
201
206
|
aria-expanded={collapsible && !href ? !collapsed : undefined}
|
|
202
207
|
href={collapsible ? hrefWithSSRFallback ?? '#' : hrefWithSSRFallback}
|
|
203
208
|
{...props}>
|
|
204
|
-
{label}
|
|
209
|
+
<CategoryLinkLabel label={label} />
|
|
205
210
|
</Link>
|
|
206
211
|
{href && collapsible && (
|
|
207
212
|
<CollapseButton
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
.categoryLink {
|
|
9
|
+
overflow: hidden;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/*
|
|
13
|
+
TODO merge this logic back in Infima?
|
|
14
|
+
*/
|
|
15
|
+
:global(.menu__link--sublist-caret)::after {
|
|
16
|
+
margin-left: var(--ifm-menu-link-padding-vertical);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.categoryLinkLabel {
|
|
20
|
+
flex: 1;
|
|
21
|
+
overflow: hidden;
|
|
22
|
+
display: -webkit-box;
|
|
23
|
+
line-clamp: 2;
|
|
24
|
+
-webkit-box-orient: vertical;
|
|
25
|
+
-webkit-line-clamp: 2;
|
|
26
|
+
}
|
|
@@ -12,6 +12,13 @@ import Link from '@docusaurus/Link';
|
|
|
12
12
|
import isInternalUrl from '@docusaurus/isInternalUrl';
|
|
13
13
|
import IconExternalLink from '@theme/Icon/ExternalLink';
|
|
14
14
|
import styles from './styles.module.css';
|
|
15
|
+
function LinkLabel({label}) {
|
|
16
|
+
return (
|
|
17
|
+
<span title={label} className={styles.linkLabel}>
|
|
18
|
+
{label}
|
|
19
|
+
</span>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
15
22
|
export default function DocSidebarItemLink({
|
|
16
23
|
item,
|
|
17
24
|
onItemClick,
|
|
@@ -47,7 +54,7 @@ export default function DocSidebarItemLink({
|
|
|
47
54
|
onClick: onItemClick ? () => onItemClick(item) : undefined,
|
|
48
55
|
})}
|
|
49
56
|
{...props}>
|
|
50
|
-
{label}
|
|
57
|
+
<LinkLabel label={label} />
|
|
51
58
|
{!isInternalLink && <IconExternalLink />}
|
|
52
59
|
</Link>
|
|
53
60
|
</li>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/theme-classic",
|
|
3
|
-
"version": "3.8.1-canary-
|
|
3
|
+
"version": "3.8.1-canary-6376",
|
|
4
4
|
"description": "Classic theme for Docusaurus",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "src/theme-classic.d.ts",
|
|
@@ -20,19 +20,19 @@
|
|
|
20
20
|
"copy:watch": "node ../../admin/scripts/copyUntypedFiles.js --watch"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@docusaurus/core": "3.8.1-canary-
|
|
24
|
-
"@docusaurus/logger": "3.8.1-canary-
|
|
25
|
-
"@docusaurus/mdx-loader": "3.8.1-canary-
|
|
26
|
-
"@docusaurus/module-type-aliases": "3.8.1-canary-
|
|
27
|
-
"@docusaurus/plugin-content-blog": "3.8.1-canary-
|
|
28
|
-
"@docusaurus/plugin-content-docs": "3.8.1-canary-
|
|
29
|
-
"@docusaurus/plugin-content-pages": "3.8.1-canary-
|
|
30
|
-
"@docusaurus/theme-common": "3.8.1-canary-
|
|
31
|
-
"@docusaurus/theme-translations": "3.8.1-canary-
|
|
32
|
-
"@docusaurus/types": "3.8.1-canary-
|
|
33
|
-
"@docusaurus/utils": "3.8.1-canary-
|
|
34
|
-
"@docusaurus/utils-common": "3.8.1-canary-
|
|
35
|
-
"@docusaurus/utils-validation": "3.8.1-canary-
|
|
23
|
+
"@docusaurus/core": "3.8.1-canary-6376",
|
|
24
|
+
"@docusaurus/logger": "3.8.1-canary-6376",
|
|
25
|
+
"@docusaurus/mdx-loader": "3.8.1-canary-6376",
|
|
26
|
+
"@docusaurus/module-type-aliases": "3.8.1-canary-6376",
|
|
27
|
+
"@docusaurus/plugin-content-blog": "3.8.1-canary-6376",
|
|
28
|
+
"@docusaurus/plugin-content-docs": "3.8.1-canary-6376",
|
|
29
|
+
"@docusaurus/plugin-content-pages": "3.8.1-canary-6376",
|
|
30
|
+
"@docusaurus/theme-common": "3.8.1-canary-6376",
|
|
31
|
+
"@docusaurus/theme-translations": "3.8.1-canary-6376",
|
|
32
|
+
"@docusaurus/types": "3.8.1-canary-6376",
|
|
33
|
+
"@docusaurus/utils": "3.8.1-canary-6376",
|
|
34
|
+
"@docusaurus/utils-common": "3.8.1-canary-6376",
|
|
35
|
+
"@docusaurus/utils-validation": "3.8.1-canary-6376",
|
|
36
36
|
"@mdx-js/react": "^3.0.0",
|
|
37
37
|
"clsx": "^2.0.0",
|
|
38
38
|
"copy-text-to-clipboard": "^3.2.0",
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
"engines": {
|
|
63
63
|
"node": ">=18.0"
|
|
64
64
|
},
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "d90b4e2d0631dc2538aa404ba1a98adc6599c430"
|
|
66
66
|
}
|
|
@@ -31,6 +31,8 @@ import useIsBrowser from '@docusaurus/useIsBrowser';
|
|
|
31
31
|
import DocSidebarItems from '@theme/DocSidebarItems';
|
|
32
32
|
import type {Props} from '@theme/DocSidebarItem/Category';
|
|
33
33
|
|
|
34
|
+
import styles from './styles.module.css';
|
|
35
|
+
|
|
34
36
|
// If we navigate to a category and it becomes active, it should automatically
|
|
35
37
|
// expand itself
|
|
36
38
|
function useAutoExpandActiveCategory({
|
|
@@ -126,6 +128,14 @@ function CollapseButton({
|
|
|
126
128
|
);
|
|
127
129
|
}
|
|
128
130
|
|
|
131
|
+
function CategoryLinkLabel({label}: {label: string}) {
|
|
132
|
+
return (
|
|
133
|
+
<span title={label} className={styles.categoryLinkLabel}>
|
|
134
|
+
{label}
|
|
135
|
+
</span>
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
|
|
129
139
|
export default function DocSidebarItemCategory({
|
|
130
140
|
item,
|
|
131
141
|
onItemClick,
|
|
@@ -179,6 +189,29 @@ export default function DocSidebarItemCategory({
|
|
|
179
189
|
}
|
|
180
190
|
}, [collapsible, expandedItem, index, setCollapsed, autoCollapseCategories]);
|
|
181
191
|
|
|
192
|
+
const handleItemClick: ComponentProps<'a'>['onClick'] = (e) => {
|
|
193
|
+
onItemClick?.(item);
|
|
194
|
+
if (collapsible) {
|
|
195
|
+
if (href) {
|
|
196
|
+
// When already on the category's page, we collapse it
|
|
197
|
+
// We don't use "isActive" because it would collapse the
|
|
198
|
+
// category even when we browse a children element
|
|
199
|
+
// See https://github.com/facebook/docusaurus/issues/11213
|
|
200
|
+
if (isCurrentPage) {
|
|
201
|
+
e.preventDefault();
|
|
202
|
+
updateCollapsed();
|
|
203
|
+
} else {
|
|
204
|
+
// When navigating to a new category, we always expand
|
|
205
|
+
// see https://github.com/facebook/docusaurus/issues/10854#issuecomment-2609616182
|
|
206
|
+
updateCollapsed(false);
|
|
207
|
+
}
|
|
208
|
+
} else {
|
|
209
|
+
e.preventDefault();
|
|
210
|
+
updateCollapsed();
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
|
|
182
215
|
return (
|
|
183
216
|
<li
|
|
184
217
|
className={clsx(
|
|
@@ -195,43 +228,18 @@ export default function DocSidebarItemCategory({
|
|
|
195
228
|
'menu__list-item-collapsible--active': isCurrentPage,
|
|
196
229
|
})}>
|
|
197
230
|
<Link
|
|
198
|
-
className={clsx('menu__link', {
|
|
231
|
+
className={clsx(styles.categoryLink, 'menu__link', {
|
|
199
232
|
'menu__link--sublist': collapsible,
|
|
200
233
|
'menu__link--sublist-caret': !href && collapsible,
|
|
201
234
|
'menu__link--active': isActive,
|
|
202
235
|
})}
|
|
203
|
-
onClick={
|
|
204
|
-
collapsible
|
|
205
|
-
? (e) => {
|
|
206
|
-
onItemClick?.(item);
|
|
207
|
-
if (href) {
|
|
208
|
-
// When already on the category's page, we collapse it
|
|
209
|
-
// We don't use "isActive" because it would collapse the
|
|
210
|
-
// category even when we browse a children element
|
|
211
|
-
// See https://github.com/facebook/docusaurus/issues/11213
|
|
212
|
-
if (isCurrentPage) {
|
|
213
|
-
e.preventDefault();
|
|
214
|
-
updateCollapsed();
|
|
215
|
-
} else {
|
|
216
|
-
// When navigating to a new category, we always expand
|
|
217
|
-
// see https://github.com/facebook/docusaurus/issues/10854#issuecomment-2609616182
|
|
218
|
-
updateCollapsed(false);
|
|
219
|
-
}
|
|
220
|
-
} else {
|
|
221
|
-
e.preventDefault();
|
|
222
|
-
updateCollapsed();
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
: () => {
|
|
226
|
-
onItemClick?.(item);
|
|
227
|
-
}
|
|
228
|
-
}
|
|
236
|
+
onClick={handleItemClick}
|
|
229
237
|
aria-current={isCurrentPage ? 'page' : undefined}
|
|
230
238
|
role={collapsible && !href ? 'button' : undefined}
|
|
231
239
|
aria-expanded={collapsible && !href ? !collapsed : undefined}
|
|
232
240
|
href={collapsible ? hrefWithSSRFallback ?? '#' : hrefWithSSRFallback}
|
|
233
241
|
{...props}>
|
|
234
|
-
{label}
|
|
242
|
+
<CategoryLinkLabel label={label} />
|
|
235
243
|
</Link>
|
|
236
244
|
{href && collapsible && (
|
|
237
245
|
<CollapseButton
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
.categoryLink {
|
|
9
|
+
overflow: hidden;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/*
|
|
13
|
+
TODO merge this logic back in Infima?
|
|
14
|
+
*/
|
|
15
|
+
:global(.menu__link--sublist-caret)::after {
|
|
16
|
+
margin-left: var(--ifm-menu-link-padding-vertical);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.categoryLinkLabel {
|
|
20
|
+
flex: 1;
|
|
21
|
+
overflow: hidden;
|
|
22
|
+
display: -webkit-box;
|
|
23
|
+
line-clamp: 2;
|
|
24
|
+
-webkit-box-orient: vertical;
|
|
25
|
+
-webkit-line-clamp: 2;
|
|
26
|
+
}
|
|
@@ -16,6 +16,14 @@ import type {Props} from '@theme/DocSidebarItem/Link';
|
|
|
16
16
|
|
|
17
17
|
import styles from './styles.module.css';
|
|
18
18
|
|
|
19
|
+
function LinkLabel({label}: {label: string}) {
|
|
20
|
+
return (
|
|
21
|
+
<span title={label} className={styles.linkLabel}>
|
|
22
|
+
{label}
|
|
23
|
+
</span>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
19
27
|
export default function DocSidebarItemLink({
|
|
20
28
|
item,
|
|
21
29
|
onItemClick,
|
|
@@ -51,7 +59,7 @@ export default function DocSidebarItemLink({
|
|
|
51
59
|
onClick: onItemClick ? () => onItemClick(item) : undefined,
|
|
52
60
|
})}
|
|
53
61
|
{...props}>
|
|
54
|
-
{label}
|
|
62
|
+
<LinkLabel label={label} />
|
|
55
63
|
{!isInternalLink && <IconExternalLink />}
|
|
56
64
|
</Link>
|
|
57
65
|
</li>
|