@umijs/plugin-docs 4.0.0-canary.20230109.1 → 4.0.0-canary.20230201.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.
@@ -1,5 +1,5 @@
1
1
  import React, { useState } from 'react';
2
- import { useThemeContext } from './context';
2
+ import { useThemeContext, type INav, type INavDropdown } from './context';
3
3
  import ExternalLink from './icons/link.svg';
4
4
  import useLanguage from './useLanguage';
5
5
 
@@ -14,25 +14,17 @@ export default () => {
14
14
  );
15
15
  };
16
16
 
17
- interface NavItemProps {
18
- nav: {
19
- path: string;
20
- title: string;
21
- type?: 'nav' | 'link';
22
- dropdown?: {
23
- title: string;
24
- path: string;
25
- }[];
26
- };
17
+ interface INavItemProps {
18
+ nav: INav;
27
19
  }
28
20
 
29
- function NavItem(props: NavItemProps) {
21
+ function NavItem(props: INavItemProps) {
30
22
  const { components } = useThemeContext()!;
31
23
  const { nav } = props;
32
24
  const lang = useLanguage();
33
25
  const [isExpanded, setExpanded] = useState(false);
34
26
 
35
- const isExternalLink = (n: NavItemProps['nav']) => {
27
+ const isExternalLink = (n: INavDropdown) => {
36
28
  return (
37
29
  n.type === 'link' && /(https|http):\/\/([\w.]+\/?)\S*/.test(nav.path)
38
30
  );
@@ -54,7 +46,11 @@ function NavItem(props: NavItemProps) {
54
46
  ) : (
55
47
  <components.Link
56
48
  to={
57
- lang.isFromPath ? lang.currentLanguage?.locale + nav.path : nav.path
49
+ nav.link
50
+ ? nav.link
51
+ : lang.isFromPath
52
+ ? lang.currentLanguage?.locale + nav.path
53
+ : nav.path
58
54
  }
59
55
  >
60
56
  {lang.render(nav.title)}
@@ -1,37 +1,51 @@
1
1
  import React from 'react';
2
2
 
3
- interface IContext {
4
- appData: any;
5
- components: any;
6
- themeConfig: {
3
+ export interface INavBaseProps {
4
+ path: string;
5
+ title: string;
6
+ type?: 'nav' | 'link';
7
+ }
8
+
9
+ export interface INavDropdown extends INavBaseProps {}
10
+
11
+ export interface INav extends INavBaseProps {
12
+ /**
13
+ * 不使用 navigate 重定向,而是直接用 link 指定最终地址,否则会破坏 history 历史,导致无法返回
14
+ * https://github.com/umijs/umi/issues/10325
15
+ */
16
+ link: string;
17
+ dropdown?: INavDropdown[];
18
+ children: any[];
19
+ }
20
+
21
+ export interface IThemeConfig {
22
+ title: string;
23
+ description?: string;
24
+ github: string;
25
+ // 键盘搜索的快捷键,参考 https://github.com/madrobby/keymaster
26
+ searchHotKey?: string | { macos: string; windows: string };
27
+ logo: string | React.ComponentType;
28
+ // 在设置文件中声明该项目的国际化功能支持的语言
29
+ i18n?: { locale: string; text: string }[];
30
+ // 插件会从 docs/locales 内将所有 json 文件注入到 themeConfig 中
31
+ // 供 useLanguage 使用
32
+ locales: { [locale: string]: { [key: string]: string } };
33
+ // 顶部导航栏右侧自定义组件
34
+ extraNavRight?: React.ComponentType;
35
+ // 底部导航栏左侧自定义组件
36
+ extraNavLeft?: React.ComponentType;
37
+ navs: INav[];
38
+ announcement?: {
7
39
  title: string;
8
- description?: string;
9
- github: string;
10
- // 键盘搜索的快捷键,参考 https://github.com/madrobby/keymaster
11
- searchHotKey?: string | { macos: string; windows: string };
12
- logo: string | React.ComponentType;
13
- // 在设置文件中声明该项目的国际化功能支持的语言
14
- i18n?: { locale: string; text: string }[];
15
- // 插件会从 docs/locales 内将所有 json 文件注入到 themeConfig 中
16
- // 供 useLanguage 使用
17
- locales: { [locale: string]: { [key: string]: string } };
18
- // 顶部导航栏右侧自定义组件
19
- extraNavRight?: React.ComponentType;
20
- // 底部导航栏左侧自定义组件
21
- extraNavLeft?: React.ComponentType;
22
- navs: {
23
- path: string;
24
- title: string;
25
- type: 'nav' | 'link';
26
- dropdown?: { title: string; path: string }[];
27
- children: any[];
28
- }[];
29
- announcement?: {
30
- title: string;
31
- link?: string;
32
- };
33
- themeSwitch?: {};
40
+ link?: string;
34
41
  };
42
+ themeSwitch?: {};
43
+ }
44
+
45
+ export interface IContext {
46
+ appData: any;
47
+ components: any;
48
+ themeConfig: IThemeConfig;
35
49
  location: {
36
50
  pathname: string;
37
51
  search: string;
@@ -1,5 +1,5 @@
1
1
  /*
2
- ! tailwindcss v3.1.8 | MIT License | https://tailwindcss.com
2
+ ! tailwindcss v3.2.4 | MIT License | https://tailwindcss.com
3
3
  */
4
4
 
5
5
  /*
@@ -30,6 +30,7 @@
30
30
  2. Prevent adjustments of font size after orientation changes in iOS.
31
31
  3. Use a more readable tab size.
32
32
  4. Use the user's configured `sans` font-family by default.
33
+ 5. Use the user's configured `sans` font-feature-settings by default.
33
34
  */
34
35
 
35
36
  html {
@@ -44,6 +45,8 @@ html {
44
45
  /* 3 */
45
46
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
46
47
  /* 4 */
48
+ font-feature-settings: normal;
49
+ /* 5 */
47
50
  }
48
51
 
49
52
  /*
@@ -410,6 +413,12 @@ video {
410
413
  height: auto;
411
414
  }
412
415
 
416
+ /* Make elements with the HTML hidden attribute stay hidden by default */
417
+
418
+ [hidden] {
419
+ display: none;
420
+ }
421
+
413
422
  *, ::before, ::after {
414
423
  --tw-border-spacing-x: 0;
415
424
  --tw-border-spacing-y: 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umijs/plugin-docs",
3
- "version": "4.0.0-canary.20230109.1",
3
+ "version": "4.0.0-canary.20230201.1",
4
4
  "description": "@umijs/plugin-docs",
5
5
  "homepage": "https://github.com/umijs/umi/tree/master/packages/plugin-docs#readme",
6
6
  "bugs": "https://github.com/umijs/umi/issues",
@@ -38,12 +38,12 @@
38
38
  "@mdx-js/mdx": "2.1.1",
39
39
  "@types/github-slugger": "^1.3.0",
40
40
  "@types/keymaster": "^1.6.30",
41
- "@types/react-helmet": "^6.1.5",
41
+ "@types/react-helmet": "^6.1.6",
42
42
  "rehype-autolink-headings": "^6.1.1",
43
43
  "rehype-slug": "5.0.1",
44
44
  "remark-gfm": "^3.0.1",
45
- "tailwindcss": "^3.0.24",
46
- "umi": "4.0.0-canary.20230109.1"
45
+ "tailwindcss": "^3.2.4",
46
+ "umi": "4.0.0-canary.20230201.1"
47
47
  },
48
48
  "publishConfig": {
49
49
  "access": "public"