@alauda/doom 1.20.3 → 1.20.4
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.
|
@@ -2,20 +2,22 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { IconDown, SvgWrapper } from '@rspress/core/theme';
|
|
3
3
|
import { clsx } from 'clsx';
|
|
4
4
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
5
|
+
import { useIsPrint } from '../runtime/index.js';
|
|
5
6
|
import classes from '@alauda/doom/styles/auto-expandable.module.scss';
|
|
6
7
|
export const AutoExpandable = ({ threshold = 240, children, }) => {
|
|
7
8
|
const ref = useRef(null);
|
|
9
|
+
const isPrint = useIsPrint();
|
|
8
10
|
const [expandable, setExpandable] = useState(false);
|
|
9
11
|
const [expanded, setExpanded] = useState(false);
|
|
10
12
|
useEffect(() => {
|
|
11
|
-
if (!ref.current) {
|
|
13
|
+
if (!ref.current || isPrint) {
|
|
12
14
|
return;
|
|
13
15
|
}
|
|
14
16
|
if (ref.current.scrollHeight > threshold) {
|
|
15
17
|
// eslint-disable-next-line react-hooks/set-state-in-effect, @eslint-react/hooks-extra/no-direct-set-state-in-use-effect
|
|
16
18
|
setExpandable(true);
|
|
17
19
|
}
|
|
18
|
-
}, [threshold]);
|
|
20
|
+
}, [threshold, isPrint]);
|
|
19
21
|
const onExpandChange = useCallback(() => {
|
|
20
22
|
setExpanded((expanded) => !expanded);
|
|
21
23
|
}, []);
|
package/package.json
CHANGED
package/styles/global.scss
CHANGED
|
@@ -94,15 +94,22 @@ td {
|
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
.
|
|
98
|
-
|
|
99
|
-
margin: 24px 0;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
.language-mdx {
|
|
97
|
+
.rp-tabs {
|
|
98
|
+
.rp-codeblock {
|
|
103
99
|
// https://github.com/web-infra-dev/rspress/blob/bbe6476c8394f9c95a98fd791f0614481f89d878/packages/theme-default/src/styles/code.css#L6
|
|
104
100
|
--rp-code-block-bg: #{color.adjust($color: #f6f8fa, $lightness: -5%)};
|
|
105
101
|
}
|
|
102
|
+
|
|
103
|
+
&__content {
|
|
104
|
+
&__item {
|
|
105
|
+
padding: 0 1rem;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
> :first-child,
|
|
109
|
+
> :last-child {
|
|
110
|
+
margin: 1rem 0;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
106
113
|
}
|
|
107
114
|
|
|
108
115
|
.doom-auto-toc {
|
|
@@ -178,12 +185,17 @@ td {
|
|
|
178
185
|
&-nav,
|
|
179
186
|
&-doc-layout__menu,
|
|
180
187
|
&-doc-footer,
|
|
188
|
+
&-doc-layout__outline,
|
|
181
189
|
&-doc-layout__sidebar {
|
|
182
190
|
display: none;
|
|
183
191
|
}
|
|
184
192
|
|
|
185
|
-
&-doc-layout__doc
|
|
186
|
-
|
|
193
|
+
&-doc-layout__doc {
|
|
194
|
+
max-width: unset;
|
|
195
|
+
|
|
196
|
+
&-container {
|
|
197
|
+
padding: 0;
|
|
198
|
+
}
|
|
187
199
|
}
|
|
188
200
|
|
|
189
201
|
&-toc-item--active .rp-toc-item__text {
|