@umijs/plugin-docs 4.0.0 → 4.0.3
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.
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
import { useThemeContext } from './context';
|
|
3
|
+
import ExternalLink from './icons/link.svg';
|
|
3
4
|
import useLanguage from './useLanguage';
|
|
4
5
|
|
|
5
6
|
export default () => {
|
|
@@ -17,6 +18,7 @@ interface NavItemProps {
|
|
|
17
18
|
nav: {
|
|
18
19
|
path: string;
|
|
19
20
|
title: string;
|
|
21
|
+
type?: 'nav' | 'link';
|
|
20
22
|
dropdown?: {
|
|
21
23
|
title: string;
|
|
22
24
|
path: string;
|
|
@@ -29,19 +31,35 @@ function NavItem(props: NavItemProps) {
|
|
|
29
31
|
const { nav } = props;
|
|
30
32
|
const lang = useLanguage();
|
|
31
33
|
const [isExpanded, setExpanded] = useState(false);
|
|
34
|
+
|
|
35
|
+
const isExternalLink = (n: NavItemProps['nav']) => {
|
|
36
|
+
return (
|
|
37
|
+
n.type === 'link' && /(https|http):\/\/([\w.]+\/?)\S*/.test(nav.path)
|
|
38
|
+
);
|
|
39
|
+
};
|
|
40
|
+
|
|
32
41
|
return (
|
|
33
42
|
<li
|
|
34
43
|
className="ml-8 dark:text-white relative"
|
|
35
44
|
onMouseEnter={() => nav.dropdown && setExpanded(true)}
|
|
36
45
|
onMouseLeave={() => nav.dropdown && setExpanded(false)}
|
|
37
46
|
>
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
47
|
+
{isExternalLink(nav) ? (
|
|
48
|
+
<a href={nav.path} target="_blank">
|
|
49
|
+
<span className="flex">
|
|
50
|
+
{nav.title}
|
|
51
|
+
<img className="link-icon" src={ExternalLink} alt="ExternalLink" />
|
|
52
|
+
</span>
|
|
53
|
+
</a>
|
|
54
|
+
) : (
|
|
55
|
+
<components.Link
|
|
56
|
+
to={
|
|
57
|
+
lang.isFromPath ? lang.currentLanguage?.locale + nav.path : nav.path
|
|
58
|
+
}
|
|
59
|
+
>
|
|
60
|
+
{lang.render(nav.title)}
|
|
61
|
+
</components.Link>
|
|
62
|
+
)}
|
|
45
63
|
{nav.dropdown && (
|
|
46
64
|
<div
|
|
47
65
|
style={{ maxHeight: isExpanded ? nav.dropdown.length * 48 : 0 }}
|
|
@@ -49,19 +67,41 @@ function NavItem(props: NavItemProps) {
|
|
|
49
67
|
cursor-pointer shadow overflow-hidden top-8"
|
|
50
68
|
>
|
|
51
69
|
{nav.dropdown.map((n) => (
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
70
|
+
<>
|
|
71
|
+
{isExternalLink(n) ? (
|
|
72
|
+
<a href={n.path} target="_blank">
|
|
73
|
+
<span className="flex">
|
|
74
|
+
<span
|
|
75
|
+
className="p-2 bg-white dark:bg-gray-700 dark:text-white
|
|
76
|
+
hover:bg-gray-50 transition duration-300"
|
|
77
|
+
>
|
|
78
|
+
{nav.title}
|
|
79
|
+
</span>
|
|
80
|
+
<img
|
|
81
|
+
className="link-icon"
|
|
82
|
+
src={ExternalLink}
|
|
83
|
+
alt="ExternalLink"
|
|
84
|
+
/>
|
|
85
|
+
</span>
|
|
86
|
+
</a>
|
|
87
|
+
) : (
|
|
88
|
+
<components.Link
|
|
89
|
+
key={n.path}
|
|
90
|
+
to={
|
|
91
|
+
lang.isFromPath
|
|
92
|
+
? lang.currentLanguage?.locale + n.path
|
|
93
|
+
: n.path
|
|
94
|
+
}
|
|
95
|
+
>
|
|
96
|
+
<p
|
|
97
|
+
className="p-2 bg-white dark:bg-gray-700 dark:text-white
|
|
60
98
|
hover:bg-gray-50 transition duration-300"
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
99
|
+
>
|
|
100
|
+
{n.title}
|
|
101
|
+
</p>
|
|
102
|
+
</components.Link>
|
|
103
|
+
)}
|
|
104
|
+
</>
|
|
65
105
|
))}
|
|
66
106
|
</div>
|
|
67
107
|
)}
|
|
@@ -39,6 +39,10 @@ export default () => {
|
|
|
39
39
|
'--color-scheme',
|
|
40
40
|
'light',
|
|
41
41
|
);
|
|
42
|
+
// @ts-ignore
|
|
43
|
+
document.querySelectorAll('.link-icon')?.forEach((el: HTMLElement) => {
|
|
44
|
+
el.style.setProperty('filter', 'invert(0)');
|
|
45
|
+
});
|
|
42
46
|
} else {
|
|
43
47
|
document.body.classList.add('dark');
|
|
44
48
|
localStorage.setItem('theme', 'dark');
|
|
@@ -46,6 +50,10 @@ export default () => {
|
|
|
46
50
|
'--color-scheme',
|
|
47
51
|
'dark',
|
|
48
52
|
);
|
|
53
|
+
// @ts-ignore
|
|
54
|
+
document.querySelectorAll('.link-icon')?.forEach((el: HTMLElement) => {
|
|
55
|
+
el.style.setProperty('filter', 'invert(1)');
|
|
56
|
+
});
|
|
49
57
|
}
|
|
50
58
|
}, [toggle]);
|
|
51
59
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="__dumi-default-external-link-icon"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
! tailwindcss v3.
|
|
2
|
+
! tailwindcss v3.1.3 | MIT License | https://tailwindcss.com
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
/*
|
|
@@ -187,6 +187,8 @@ textarea {
|
|
|
187
187
|
/* 1 */
|
|
188
188
|
font-size: 100%;
|
|
189
189
|
/* 1 */
|
|
190
|
+
font-weight: inherit;
|
|
191
|
+
/* 1 */
|
|
190
192
|
line-height: inherit;
|
|
191
193
|
/* 1 */
|
|
192
194
|
color: inherit;
|
|
@@ -415,15 +417,103 @@ video {
|
|
|
415
417
|
height: auto;
|
|
416
418
|
}
|
|
417
419
|
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
420
|
+
*, ::before, ::after {
|
|
421
|
+
--tw-border-spacing-x: 0;
|
|
422
|
+
--tw-border-spacing-y: 0;
|
|
423
|
+
--tw-translate-x: 0;
|
|
424
|
+
--tw-translate-y: 0;
|
|
425
|
+
--tw-rotate: 0;
|
|
426
|
+
--tw-skew-x: 0;
|
|
427
|
+
--tw-skew-y: 0;
|
|
428
|
+
--tw-scale-x: 1;
|
|
429
|
+
--tw-scale-y: 1;
|
|
430
|
+
--tw-pan-x: ;
|
|
431
|
+
--tw-pan-y: ;
|
|
432
|
+
--tw-pinch-zoom: ;
|
|
433
|
+
--tw-scroll-snap-strictness: proximity;
|
|
434
|
+
--tw-ordinal: ;
|
|
435
|
+
--tw-slashed-zero: ;
|
|
436
|
+
--tw-numeric-figure: ;
|
|
437
|
+
--tw-numeric-spacing: ;
|
|
438
|
+
--tw-numeric-fraction: ;
|
|
439
|
+
--tw-ring-inset: ;
|
|
440
|
+
--tw-ring-offset-width: 0px;
|
|
441
|
+
--tw-ring-offset-color: #fff;
|
|
442
|
+
--tw-ring-color: rgb(59 130 246 / 0.5);
|
|
443
|
+
--tw-ring-offset-shadow: 0 0 #0000;
|
|
444
|
+
--tw-ring-shadow: 0 0 #0000;
|
|
445
|
+
--tw-shadow: 0 0 #0000;
|
|
446
|
+
--tw-shadow-colored: 0 0 #0000;
|
|
447
|
+
--tw-blur: ;
|
|
448
|
+
--tw-brightness: ;
|
|
449
|
+
--tw-contrast: ;
|
|
450
|
+
--tw-grayscale: ;
|
|
451
|
+
--tw-hue-rotate: ;
|
|
452
|
+
--tw-invert: ;
|
|
453
|
+
--tw-saturate: ;
|
|
454
|
+
--tw-sepia: ;
|
|
455
|
+
--tw-drop-shadow: ;
|
|
456
|
+
--tw-backdrop-blur: ;
|
|
457
|
+
--tw-backdrop-brightness: ;
|
|
458
|
+
--tw-backdrop-contrast: ;
|
|
459
|
+
--tw-backdrop-grayscale: ;
|
|
460
|
+
--tw-backdrop-hue-rotate: ;
|
|
461
|
+
--tw-backdrop-invert: ;
|
|
462
|
+
--tw-backdrop-opacity: ;
|
|
463
|
+
--tw-backdrop-saturate: ;
|
|
464
|
+
--tw-backdrop-sepia: ;
|
|
465
|
+
}
|
|
421
466
|
|
|
422
|
-
|
|
423
|
-
|
|
467
|
+
::-webkit-backdrop {
|
|
468
|
+
--tw-border-spacing-x: 0;
|
|
469
|
+
--tw-border-spacing-y: 0;
|
|
470
|
+
--tw-translate-x: 0;
|
|
471
|
+
--tw-translate-y: 0;
|
|
472
|
+
--tw-rotate: 0;
|
|
473
|
+
--tw-skew-x: 0;
|
|
474
|
+
--tw-skew-y: 0;
|
|
475
|
+
--tw-scale-x: 1;
|
|
476
|
+
--tw-scale-y: 1;
|
|
477
|
+
--tw-pan-x: ;
|
|
478
|
+
--tw-pan-y: ;
|
|
479
|
+
--tw-pinch-zoom: ;
|
|
480
|
+
--tw-scroll-snap-strictness: proximity;
|
|
481
|
+
--tw-ordinal: ;
|
|
482
|
+
--tw-slashed-zero: ;
|
|
483
|
+
--tw-numeric-figure: ;
|
|
484
|
+
--tw-numeric-spacing: ;
|
|
485
|
+
--tw-numeric-fraction: ;
|
|
486
|
+
--tw-ring-inset: ;
|
|
487
|
+
--tw-ring-offset-width: 0px;
|
|
488
|
+
--tw-ring-offset-color: #fff;
|
|
489
|
+
--tw-ring-color: rgb(59 130 246 / 0.5);
|
|
490
|
+
--tw-ring-offset-shadow: 0 0 #0000;
|
|
491
|
+
--tw-ring-shadow: 0 0 #0000;
|
|
492
|
+
--tw-shadow: 0 0 #0000;
|
|
493
|
+
--tw-shadow-colored: 0 0 #0000;
|
|
494
|
+
--tw-blur: ;
|
|
495
|
+
--tw-brightness: ;
|
|
496
|
+
--tw-contrast: ;
|
|
497
|
+
--tw-grayscale: ;
|
|
498
|
+
--tw-hue-rotate: ;
|
|
499
|
+
--tw-invert: ;
|
|
500
|
+
--tw-saturate: ;
|
|
501
|
+
--tw-sepia: ;
|
|
502
|
+
--tw-drop-shadow: ;
|
|
503
|
+
--tw-backdrop-blur: ;
|
|
504
|
+
--tw-backdrop-brightness: ;
|
|
505
|
+
--tw-backdrop-contrast: ;
|
|
506
|
+
--tw-backdrop-grayscale: ;
|
|
507
|
+
--tw-backdrop-hue-rotate: ;
|
|
508
|
+
--tw-backdrop-invert: ;
|
|
509
|
+
--tw-backdrop-opacity: ;
|
|
510
|
+
--tw-backdrop-saturate: ;
|
|
511
|
+
--tw-backdrop-sepia: ;
|
|
424
512
|
}
|
|
425
513
|
|
|
426
|
-
|
|
514
|
+
::backdrop {
|
|
515
|
+
--tw-border-spacing-x: 0;
|
|
516
|
+
--tw-border-spacing-y: 0;
|
|
427
517
|
--tw-translate-x: 0;
|
|
428
518
|
--tw-translate-y: 0;
|
|
429
519
|
--tw-rotate: 0;
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/plugin-docs",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.3",
|
|
4
4
|
"description": "@umijs/plugin-docs",
|
|
5
|
-
"homepage": "https://github.com/umijs/umi
|
|
6
|
-
"bugs": "https://github.com/umijs/umi
|
|
5
|
+
"homepage": "https://github.com/umijs/umi/tree/master/packages/plugin-docs#readme",
|
|
6
|
+
"bugs": "https://github.com/umijs/umi/issues",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
|
-
"url": "https://github.com/umijs/umi
|
|
9
|
+
"url": "https://github.com/umijs/umi"
|
|
10
10
|
},
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"main": "dist/index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"build:css": "tailwindcss -i ./client/theme-doc/tailwind.css -o ./client/theme-doc/tailwind.out.css",
|
|
22
22
|
"build:deps": "umi-scripts bundleDeps",
|
|
23
23
|
"build:extra": "pnpm build:css",
|
|
24
|
-
"dev": "pnpm build --
|
|
24
|
+
"dev": "pnpm build --watch",
|
|
25
25
|
"dev:css": "pnpm build:css -- --watch",
|
|
26
26
|
"test": "umi-scripts jest-turbo"
|
|
27
27
|
},
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"rehype-slug": "5.0.1",
|
|
40
40
|
"remark-gfm": "^3.0.1",
|
|
41
41
|
"tailwindcss": "^3.0.24",
|
|
42
|
-
"umi": "4.0.
|
|
42
|
+
"umi": "4.0.3"
|
|
43
43
|
},
|
|
44
44
|
"publishConfig": {
|
|
45
45
|
"access": "public"
|