@antv/dumi-theme-antv 0.3.18 → 0.3.19-beta.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 from 'react';
2
- export declare type PlaygroundProps = {
2
+ export type PlaygroundProps = {
3
3
  /**
4
4
  * 代码示例的地址
5
5
  */
package/dist/context.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { ExampleTopic } from './types';
3
- export declare type IThemeAntVContext = {
3
+ export type IThemeAntVContext = {
4
4
  exampleTopics?: ExampleTopic[];
5
5
  };
6
6
  export declare const ThemeAntVContext: import("react").Context<IThemeAntVContext>;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- export declare type APIProps = {
2
+ export type APIProps = {
3
3
  readonly children: any;
4
4
  };
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- export declare type ManualProps = {
2
+ export type ManualProps = {
3
3
  readonly children: any;
4
4
  };
5
5
  /**
@@ -94,5 +94,6 @@
94
94
  "下一篇":"Next",
95
95
  "演示代码报错,请检查": "演示代码报错,请检查",
96
96
  "阅读时间约":"Reading needs",
97
- "分钟":"minutes"
97
+ "分钟":"minutes",
98
+ "没有找到查询结果":"No query result found"
98
99
  }
@@ -94,5 +94,6 @@
94
94
  "下一篇": "下一篇",
95
95
  "演示代码报错,请检查": "演示代码报错,请检查",
96
96
  "阅读时间约":"阅读时间约",
97
- "分钟":"分钟"
97
+ "分钟":"分钟",
98
+ "没有找到查询结果":"没有找到查询结果"
98
99
  }
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { NotificationProps } from './Notification';
3
3
  import 'video-react/dist/video-react.css';
4
- declare type BannerButtonShape = 'round' | 'square';
4
+ type BannerButtonShape = 'round' | 'square';
5
5
  interface BannerButton {
6
6
  text: string;
7
7
  link: string;
@@ -4,7 +4,7 @@ export declare enum EDITOR_TABS {
4
4
  SPEC = "Spec",
5
5
  DATA = "Data"
6
6
  }
7
- declare type ToolbarProps = {
7
+ type ToolbarProps = {
8
8
  /**
9
9
  * 源码文件,用于传入到三方代码平台
10
10
  */
@@ -20,12 +20,12 @@ import { ping } from "../utils";
20
20
  import { extractImportDeps, getCodeSandboxConfig, getRiddleConfig, getStackblitzConfig } from "./utils";
21
21
  import styles from "./Toolbar.module.less";
22
22
  var Paragraph = Typography.Paragraph;
23
- export var EDITOR_TABS;
24
- (function (EDITOR_TABS) {
23
+ export var EDITOR_TABS = /*#__PURE__*/function (EDITOR_TABS) {
25
24
  EDITOR_TABS["JAVASCRIPT"] = "JavaScript";
26
25
  EDITOR_TABS["SPEC"] = "Spec";
27
26
  EDITOR_TABS["DATA"] = "Data";
28
- })(EDITOR_TABS || (EDITOR_TABS = {}));
27
+ return EDITOR_TABS;
28
+ }({});
29
29
  export var Toolbar = function Toolbar(_ref) {
30
30
  var sourceCode = _ref.sourceCode,
31
31
  fileExtension = _ref.fileExtension,
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- export declare type CodeEditorProps = {
2
+ export type CodeEditorProps = {
3
3
  /**
4
4
  * 标题
5
5
  */
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- export declare type CodeHeaderProps = {
2
+ export type CodeHeaderProps = {
3
3
  /**
4
4
  * 代码的标题
5
5
  */
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- export declare type CodePreviewProps = {
2
+ export type CodePreviewProps = {
3
3
  /**
4
4
  * 在文档中预览
5
5
  */
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { ExampleTopic } from '../../types';
3
- declare type CodeRunnerProps = {
3
+ type CodeRunnerProps = {
4
4
  isPlayground?: boolean;
5
5
  topic: string;
6
6
  example: string;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- declare type Company = {
2
+ type Company = {
3
3
  name: string;
4
4
  img: string;
5
5
  };
@@ -3,4 +3,4 @@ import './index.module.less';
3
3
  /**
4
4
  * 文档右侧的指示器(table of content)
5
5
  */
6
- export declare const ContentTable: React.FC<{}>;
6
+ export declare const ContentTable: React.FC;
@@ -1,14 +1,14 @@
1
1
  import React from 'react';
2
2
  import { IC } from '../../types';
3
3
  import { NewsProps } from './News';
4
- declare type DetailButtonProps = {
4
+ type DetailButtonProps = {
5
5
  text: IC;
6
6
  link: string;
7
7
  style?: React.CSSProperties;
8
8
  type?: string;
9
9
  shape?: 'round' | 'square';
10
10
  };
11
- declare type DetailProps = {
11
+ type DetailProps = {
12
12
  className?: string;
13
13
  style?: React.CSSProperties;
14
14
  title: IC;
@@ -1,12 +1,12 @@
1
1
  import React from 'react';
2
- declare type dropdownItem = {
2
+ type dropdownItem = {
3
3
  name: {
4
4
  [key: string]: string;
5
5
  };
6
6
  url: string;
7
7
  target?: '_blank';
8
8
  };
9
- export declare type INav = {
9
+ export type INav = {
10
10
  slug?: string;
11
11
  order: number;
12
12
  title: {
@@ -16,7 +16,7 @@ export declare type INav = {
16
16
  notPage?: boolean;
17
17
  dropdownItems?: dropdownItem[];
18
18
  };
19
- export declare type NavProps = {
19
+ export type NavProps = {
20
20
  navs: INav[];
21
21
  path: string;
22
22
  };
@@ -23,10 +23,12 @@ export var Navs = function Navs(_ref) {
23
23
  var className = '';
24
24
  if (nav.slug) {
25
25
  href = nav.slug.startsWith('http') ? nav.slug : "/".concat(nav.slug);
26
+
27
+ // 去除 docs 防止新页面 404 和 本页重新刷新。
28
+ href = href.replace(/^\/docs(?=\/)/, '');
26
29
  if (locale.id == 'en' && !href.startsWith('http')) {
27
30
  href = "/en".concat(href);
28
31
  }
29
- // 去除 docs 防止二次点击相同 nav 跳转出现04
30
32
  className = cx('header-menu-item-active', _defineProperty({}, styles.activeItem, getNavCategory(path) === getNavCategory(href)));
31
33
  }
32
34
  return size(nav.dropdownItems) ? /*#__PURE__*/React.createElement("li", {
@@ -13,13 +13,13 @@ export interface ProductItem {
13
13
  openExternal?: boolean;
14
14
  }>;
15
15
  }
16
- export declare type ValuesOf<T extends any[]> = T[number];
16
+ export type ValuesOf<T extends any[]> = T[number];
17
17
  declare const CATEGORY_TYPE: ["basic", "extension", "mobile", "ecology"];
18
18
  export declare const CATEGORIES: Array<{
19
19
  type: typeof CATEGORY_TYPE[number];
20
20
  name: string;
21
21
  }>;
22
- export declare type ProductType = {
22
+ export type ProductType = {
23
23
  links: {
24
24
  /** 产品首页 */
25
25
  readonly home?: {
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
- export declare type ITextSegment = {
2
+ export type ITextSegment = {
3
3
  text: string;
4
4
  highlighted?: boolean;
5
5
  };
6
- export declare type ISearchResult = {
6
+ export type ISearchResult = {
7
7
  /**
8
8
  * 搜索结果的主题,显示在最左边,一般是页面的标题。
9
9
  */
@@ -1,4 +1,6 @@
1
1
  import React from 'react';
2
+ import { useIntl } from 'dumi';
3
+ import { InboxOutlined } from '@ant-design/icons';
2
4
  import styles from "./SearchResult.module.less";
3
5
  var getHighlightInfo = function getHighlightInfo(textSegments) {
4
6
  return /*#__PURE__*/React.createElement(React.Fragment, null, textSegments.map(function (segment) {
@@ -14,9 +16,10 @@ var getHighlightInfo = function getHighlightInfo(textSegments) {
14
16
  */
15
17
  export var SearchResult = function SearchResult(_ref) {
16
18
  var results = _ref.results;
19
+ var intl = useIntl();
17
20
  return /*#__PURE__*/React.createElement("div", {
18
21
  className: styles.searchResult
19
- }, results.map(function (r) {
22
+ }, results !== null && results !== void 0 && results.length ? results.map(function (r) {
20
23
  return /*#__PURE__*/React.createElement("div", {
21
24
  className: styles.item
22
25
  }, /*#__PURE__*/React.createElement("div", {
@@ -31,5 +34,13 @@ export var SearchResult = function SearchResult(_ref) {
31
34
  }, getHighlightInfo(r.tilte)), /*#__PURE__*/React.createElement("div", {
32
35
  className: styles.description
33
36
  }, getHighlightInfo(r.description))));
34
- }));
37
+ }) : /*#__PURE__*/React.createElement("div", {
38
+ className: styles.empty
39
+ }, /*#__PURE__*/React.createElement(InboxOutlined, {
40
+ style: {
41
+ fontSize: 20
42
+ }
43
+ }), /*#__PURE__*/React.createElement("div", null, intl.formatMessage({
44
+ id: '没有找到查询结果'
45
+ }))));
35
46
  };
@@ -62,4 +62,14 @@
62
62
  }
63
63
  }
64
64
  }
65
+
66
+ .empty {
67
+ height: 70px;
68
+ display: flex;
69
+ flex-direction: column;
70
+ align-items: center;
71
+ justify-content: space-evenly;
72
+ color: rgb(160, 161, 167);
73
+ font-size: 16px;
74
+ }
65
75
  }
@@ -17,13 +17,18 @@ export var Search = function Search() {
17
17
  _useState2 = _slicedToArray(_useState, 2),
18
18
  open = _useState2[0],
19
19
  setOpen = _useState2[1];
20
+ // useSiteSearch 错误 keywords 为空时 loading 为 true
20
21
  var _useSiteSearch = useSiteSearch(),
21
22
  keywords = _useSiteSearch.keywords,
22
23
  setKeywords = _useSiteSearch.setKeywords,
23
- result = _useSiteSearch.result;
24
+ result = _useSiteSearch.result,
25
+ loading = _useSiteSearch.loading;
24
26
  useEffect(function () {
25
- setOpen(!!(result !== null && result !== void 0 && result.length));
26
- }, [result]);
27
+ // keywords 为空 loading false 查找结束, 进行开关
28
+ if (!keywords || !loading) {
29
+ setOpen(!!keywords);
30
+ }
31
+ }, [keywords, loading]);
27
32
  useEffect(function () {
28
33
  var close = function close(e) {
29
34
  var _e$target;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { INav } from './Navs';
3
- export declare type HeaderProps = {
3
+ export type HeaderProps = {
4
4
  pathPrefix?: string;
5
5
  /** 子标题 */
6
6
  subTitle?: React.ReactNode;
@@ -1,5 +1,5 @@
1
1
  import { FC } from 'react';
2
- export declare type PreviewProps = {
2
+ export type PreviewProps = {
3
3
  source: string;
4
4
  pin: boolean;
5
5
  code: HTMLDivElement;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import 'rc-drawer/assets/index.css';
3
- export declare type ManualContent = {
3
+ export type ManualContent = {
4
4
  readonly children: any;
5
5
  };
6
6
  /**
@@ -79,7 +79,9 @@ export var ManualContent = function ManualContent(_ref) {
79
79
  // 递归
80
80
  rootList.forEach(function (item) {
81
81
  var href = (!baseRoute.startsWith('/en') ? "/".concat(item.slug) : "/en/".concat(item.slug)).toLocaleLowerCase();
82
- var id = href.split('/').slice(0, href.split('/').length - 1).join('/');
82
+ var hasPrefix = hrefId.startsWith('/en') || href.startsWith('/zh');
83
+ var splitCount = hasPrefix ? 3 : 2;
84
+ var id = href.split('/').splice(0, splitCount).join('/');
83
85
  if (href.includes(baseRoute)) {
84
86
  if (id === hrefId) {
85
87
  list.push(_objectSpread(_objectSpread({}, item), {}, {
package/dist/types.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  export interface IThemeConfig {
2
2
  [key: string]: any;
3
3
  }
4
- export declare type Status = 'responded' | 'error' | 'timeout';
4
+ export type Status = 'responded' | 'error' | 'timeout';
5
5
  /**
6
6
  * 配置文件中的国际化配置
7
7
  */
8
- export declare type IC = string | {
8
+ export type IC = string | {
9
9
  zh: string;
10
10
  en: string;
11
11
  };
package/package.json CHANGED
@@ -1,31 +1,35 @@
1
1
  {
2
2
  "name": "@antv/dumi-theme-antv",
3
- "version": "0.3.18",
3
+ "version": "0.3.19-beta.1",
4
4
  "description": "AntV website theme based on dumi2.",
5
- "types": "dist/types.d.ts",
6
- "scripts": {
7
- "dev": "father dev",
8
- "dev:example-site": "cd example && npm run start",
9
- "build": "father build",
10
- "prepare": "father link-dev-theme",
11
- "lint": "npm run lint:es && npm run lint:css",
12
- "lint:css": "stylelint \"{src,test}/**/*.{css,less}\"",
13
- "lint:es": "eslint \"{src,test}/**/*.{js,jsx,ts,tsx}\"",
14
- "prepublishOnly": "npm run build"
15
- },
16
5
  "keywords": [
17
6
  "dumi",
18
7
  "dumi-theme",
19
8
  "dumi-theme-antv"
20
9
  ],
21
- "authors": [
22
- "dumi",
23
- "antv"
24
- ],
10
+ "homepage": "https://github.com/antvis/dumi-theme-antv#readme",
11
+ "bugs": {
12
+ "url": "https://github.com/antvis/dumi-theme-antv/issues"
13
+ },
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "https://github.com/antvis/dumi-theme-antv"
17
+ },
25
18
  "license": "MIT",
19
+ "types": "dist/types.d.ts",
26
20
  "files": [
27
21
  "dist"
28
22
  ],
23
+ "scripts": {
24
+ "build": "father build",
25
+ "dev": "father dev",
26
+ "dev:example-site": "cd example && npm run start",
27
+ "lint": "npm run lint:es && npm run lint:css",
28
+ "lint:css": "stylelint \"{src,test}/**/*.{css,less}\"",
29
+ "lint:es": "eslint \"{src,test}/**/*.{js,jsx,ts,tsx}\"",
30
+ "prepare": "father link-dev-theme",
31
+ "prepublishOnly": "npm run build"
32
+ },
29
33
  "commitlint": {
30
34
  "extends": [
31
35
  "@commitlint/config-conventional"
@@ -48,9 +52,6 @@
48
52
  "prettier --parser=typescript --write"
49
53
  ]
50
54
  },
51
- "publishConfig": {
52
- "access": "public"
53
- },
54
55
  "dependencies": {
55
56
  "@ant-design/icons": "^4.7.0",
56
57
  "@babel/plugin-syntax-unicode-sets-regex": "^7.18.6",
@@ -73,6 +74,7 @@
73
74
  "lodash-es": "^4.17.21",
74
75
  "monaco-editor": "^0.25.0",
75
76
  "parse-github-url": "^1.0.2",
77
+ "prettier": "^2.7.1",
76
78
  "rc-drawer": "^4.0.0",
77
79
  "rc-footer": "^0.6.6",
78
80
  "react": "^18.2.0",
@@ -91,15 +93,10 @@
91
93
  "unified": "^10.1.2",
92
94
  "unist-util-visit": "^4.1.2",
93
95
  "uri-parse": "^1.0.0",
94
- "video-react": "^0.16.0",
95
- "prettier": "^2.7.1"
96
- },
97
- "peerDependencies": {
98
- "dumi": "^2.0.0",
99
- "react": ">=16.9.0",
100
- "react-dom": ">=16.9.0"
96
+ "video-react": "^0.16.0"
101
97
  },
102
98
  "devDependencies": {
99
+ "@antv/g2": "^4.2.10",
103
100
  "@commitlint/cli": "^17.1.2",
104
101
  "@commitlint/config-conventional": "^17.1.0",
105
102
  "@types/classnames": "^2.3.1",
@@ -111,6 +108,7 @@
111
108
  "@types/react-router-dom": "^5.3.3",
112
109
  "@types/react-slick": "^0.23.10",
113
110
  "@umijs/lint": "^4.0.0",
111
+ "d3-regression": "^1.3.10",
114
112
  "dumi": "^2.0.0",
115
113
  "eslint": "^8.23.0",
116
114
  "father": "^4.1.0",
@@ -123,12 +121,16 @@
123
121
  "react-dom": "^18.0.0",
124
122
  "stylelint": "^14.9.1"
125
123
  },
126
- "repository": {
127
- "type": "git",
128
- "url": "https://github.com/antvis/dumi-theme-antv"
124
+ "peerDependencies": {
125
+ "dumi": "^2.0.0",
126
+ "react": ">=16.9.0",
127
+ "react-dom": ">=16.9.0"
129
128
  },
130
- "bugs": {
131
- "url": "https://github.com/antvis/dumi-theme-antv/issues"
129
+ "publishConfig": {
130
+ "access": "public"
132
131
  },
133
- "homepage": "https://github.com/antvis/dumi-theme-antv#readme"
132
+ "authors": [
133
+ "dumi",
134
+ "antv"
135
+ ]
134
136
  }