@umijs/plugin-docs 4.0.0-canary.20220428.2 → 4.0.0-canary.20220429.1
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/client/theme-doc/LangSwitch.tsx +3 -1
- package/client/theme-doc/Layout.tsx +2 -1
- package/client/theme-doc/Search.tsx +1 -0
- package/client/theme-doc/components/Announcement.tsx +1 -0
- package/client/theme-doc/firefox-polyfill.css +4 -4
- package/client/theme-doc/useLanguage.ts +7 -1
- package/package.json +2 -2
|
@@ -17,7 +17,7 @@ export default () => {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
function handleClick() {
|
|
20
|
-
if (!currentLanguage) return;
|
|
20
|
+
if (!currentLanguage || languages.length === 1) return;
|
|
21
21
|
if (languages.length === 2) {
|
|
22
22
|
switchLanguage(
|
|
23
23
|
languages[0].locale === currentLanguage.locale
|
|
@@ -29,6 +29,8 @@ export default () => {
|
|
|
29
29
|
setExpanded((e) => !e);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
if (!currentLanguage || languages.length === 1) return null;
|
|
33
|
+
|
|
32
34
|
return (
|
|
33
35
|
<div>
|
|
34
36
|
<div
|
|
@@ -20,7 +20,8 @@ export default (props: any) => {
|
|
|
20
20
|
|
|
21
21
|
function updateBlur() {
|
|
22
22
|
if (!offset || !blur) return;
|
|
23
|
-
blur.backgroundPosition =
|
|
23
|
+
blur.backgroundPosition =
|
|
24
|
+
`0px ` + `calc(var(--anchor-offset) + ${-window.scrollY + 64}px)`;
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
document.addEventListener('scroll', updateBlur, false), updateBlur();
|
|
@@ -102,6 +102,7 @@ export default () => {
|
|
|
102
102
|
<components.Link
|
|
103
103
|
to={(isFromPath ? currentLanguage?.locale : '') + r.href}
|
|
104
104
|
key={i}
|
|
105
|
+
onClick={() => (document.activeElement as HTMLElement)?.blur()}
|
|
105
106
|
className="group outline-none search-result"
|
|
106
107
|
onFocus={() => setIsFocused(true)}
|
|
107
108
|
onBlur={() => setIsFocused(false)}
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
.g-glossy-firefox-cover {
|
|
13
13
|
display: block;
|
|
14
14
|
position: fixed;
|
|
15
|
-
top:
|
|
15
|
+
top: 0;
|
|
16
16
|
width: 100%;
|
|
17
|
-
height: 72px;
|
|
17
|
+
height: calc(var(--anchor-offset) + 72px);
|
|
18
18
|
z-index: 22;
|
|
19
19
|
background-color: white;
|
|
20
20
|
}
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
display: block;
|
|
24
24
|
position: fixed;
|
|
25
25
|
width: 100%;
|
|
26
|
-
top:
|
|
27
|
-
height: 72px;
|
|
26
|
+
top: 0;
|
|
27
|
+
height: calc(var(--anchor-offset) + 72px);
|
|
28
28
|
z-index: 24;
|
|
29
29
|
background: -moz-element(#article-body) no-repeat top;
|
|
30
30
|
filter: blur(10px);
|
|
@@ -57,7 +57,13 @@ function useLanguage(): useLanguageResult {
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
function render(key: string) {
|
|
60
|
-
if (!
|
|
60
|
+
if (!themeConfig.locales || Object.keys(themeConfig.locales).length === 0)
|
|
61
|
+
return key;
|
|
62
|
+
if (!currentLanguage) {
|
|
63
|
+
return (
|
|
64
|
+
themeConfig.locales[Object.keys(themeConfig.locales)[0]].key || key
|
|
65
|
+
);
|
|
66
|
+
}
|
|
61
67
|
if (!themeConfig.locales[currentLanguage.locale]) return key;
|
|
62
68
|
return themeConfig.locales[currentLanguage.locale][key] || key;
|
|
63
69
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/plugin-docs",
|
|
3
|
-
"version": "4.0.0-canary.
|
|
3
|
+
"version": "4.0.0-canary.20220429.1",
|
|
4
4
|
"description": "@umijs/plugin-docs",
|
|
5
5
|
"homepage": "https://github.com/umijs/umi-next/tree/master/packages/plugin-docs#readme",
|
|
6
6
|
"bugs": "https://github.com/umijs/umi-next/issues",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"rehype-slug": "5.0.1",
|
|
40
40
|
"remark-gfm": "^3.0.1",
|
|
41
41
|
"tailwindcss": "^3.0.23",
|
|
42
|
-
"umi": "4.0.0-canary.
|
|
42
|
+
"umi": "4.0.0-canary.20220429.1"
|
|
43
43
|
},
|
|
44
44
|
"publishConfig": {
|
|
45
45
|
"access": "public"
|