@antv/dumi-theme-antv 0.5.2 → 0.5.4-beta.0

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.
Files changed (88) hide show
  1. package/dist/common/Link.js +78 -0
  2. package/dist/common/SEO.js +61 -0
  3. package/dist/hooks/useMenu.js +117 -0
  4. package/dist/layouts/DocLayout.js +6 -7
  5. package/dist/layouts/entry/API.js +1 -0
  6. package/dist/layouts/entry/Index.js +9 -22
  7. package/dist/layouts/entry/Manual.js +6 -4
  8. package/dist/locales/en.json +49 -1
  9. package/dist/locales/zh.json +48 -1
  10. package/dist/pages/404.js +1 -2
  11. package/dist/pages/Example/index.js +2 -3
  12. package/dist/pages/Examples/index.js +4 -3
  13. package/dist/slots/ManualContent/Main.js +90 -0
  14. package/dist/slots/ManualContent/Sidebar.js +77 -0
  15. package/dist/slots/ManualContent/index.js +8 -305
  16. package/dist/slots/ManualContent/index.module.less +63 -29
  17. package/dist/slots/ManualContent/utils.js +19 -15
  18. package/dist/slots/utils.js +7 -0
  19. package/dist/utils/menu.js +46 -0
  20. package/package.json +56 -56
  21. package/dist/builtins/Playground/index.d.ts +0 -21
  22. package/dist/context.d.ts +0 -6
  23. package/dist/layouts/DocLayout.d.ts +0 -8
  24. package/dist/layouts/entry/API.d.ts +0 -10
  25. package/dist/layouts/entry/Index.d.ts +0 -7
  26. package/dist/layouts/entry/Manual.d.ts +0 -8
  27. package/dist/model/index.d.ts +0 -5
  28. package/dist/pages/404.d.ts +0 -6
  29. package/dist/pages/Example/components/CollapsedIcon/index.d.ts +0 -8
  30. package/dist/pages/Example/index.d.ts +0 -6
  31. package/dist/pages/Example/utils.d.ts +0 -1
  32. package/dist/pages/Examples/components/Accouncement/index.d.ts +0 -6
  33. package/dist/pages/Examples/components/Article/index.d.ts +0 -2
  34. package/dist/pages/Examples/components/ExampleTopicMenu/components/LeftMenu/index.d.ts +0 -10
  35. package/dist/pages/Examples/components/ExampleTopicMenu/index.d.ts +0 -9
  36. package/dist/pages/Examples/components/GalleryPageContent/DemoCard/index.d.ts +0 -10
  37. package/dist/pages/Examples/components/GalleryPageContent/index.d.ts +0 -10
  38. package/dist/pages/Examples/index.d.ts +0 -8
  39. package/dist/pages/Examples/types.d.ts +0 -34
  40. package/dist/pages/Examples/utils.d.ts +0 -1
  41. package/dist/plugin/api.d.ts +0 -7
  42. package/dist/plugin/examples.d.ts +0 -21
  43. package/dist/plugin/index.d.ts +0 -3
  44. package/dist/plugin/rehypeObservable.d.ts +0 -1
  45. package/dist/slots/404.d.ts +0 -2
  46. package/dist/slots/API/index.d.ts +0 -15
  47. package/dist/slots/Article/index.d.ts +0 -3
  48. package/dist/slots/Banner/Notification.d.ts +0 -10
  49. package/dist/slots/Banner/index.d.ts +0 -26
  50. package/dist/slots/Cases/index.d.ts +0 -19
  51. package/dist/slots/CodeEditor/Toolbar.d.ts +0 -72
  52. package/dist/slots/CodeEditor/index.d.ts +0 -62
  53. package/dist/slots/CodeEditor/utils.d.ts +0 -42
  54. package/dist/slots/CodePreview/CodeHeader.d.ts +0 -19
  55. package/dist/slots/CodePreview/index.d.ts +0 -25
  56. package/dist/slots/CodeRunner/index.d.ts +0 -17
  57. package/dist/slots/CodeRunner/utils.d.ts +0 -11
  58. package/dist/slots/Companies/index.d.ts +0 -13
  59. package/dist/slots/ContentTable/index.d.ts +0 -6
  60. package/dist/slots/Detail/News.d.ts +0 -12
  61. package/dist/slots/Detail/index.d.ts +0 -30
  62. package/dist/slots/ExampleSider/index.d.ts +0 -21
  63. package/dist/slots/Features/FeatureCard.d.ts +0 -9
  64. package/dist/slots/Features/index.d.ts +0 -15
  65. package/dist/slots/Footer/index.d.ts +0 -18
  66. package/dist/slots/Header/Navs.d.ts +0 -27
  67. package/dist/slots/Header/Products/NavigatorBanner.d.ts +0 -10
  68. package/dist/slots/Header/Products/Product.d.ts +0 -14
  69. package/dist/slots/Header/Products/getProducts.d.ts +0 -48
  70. package/dist/slots/Header/Products/index.d.ts +0 -10
  71. package/dist/slots/Header/Search/SearchResult.d.ts +0 -21
  72. package/dist/slots/Header/Search/helper.d.ts +0 -8
  73. package/dist/slots/Header/Search/index.d.ts +0 -2
  74. package/dist/slots/Header/index.d.ts +0 -84
  75. package/dist/slots/Header/utils.d.ts +0 -10
  76. package/dist/slots/Loading/index.d.ts +0 -6
  77. package/dist/slots/ManualContent/NavigatorBanner.d.ts +0 -9
  78. package/dist/slots/ManualContent/Preview.d.ts +0 -7
  79. package/dist/slots/ManualContent/ReadingTime.d.ts +0 -3
  80. package/dist/slots/ManualContent/index.d.ts +0 -9
  81. package/dist/slots/ManualContent/usePreview.d.ts +0 -1
  82. package/dist/slots/ManualContent/utils.d.ts +0 -19
  83. package/dist/slots/SEO.d.ts +0 -10
  84. package/dist/slots/SEO.js +0 -57
  85. package/dist/slots/global.d.ts +0 -1
  86. package/dist/slots/hooks.d.ts +0 -16
  87. package/dist/slots/utils.d.ts +0 -5
  88. package/dist/types.d.ts +0 -86
@@ -1,10 +0,0 @@
1
- import React from 'react';
2
- interface ProductsProps {
3
- show: boolean;
4
- rootDomain: string;
5
- language?: 'zh' | 'en';
6
- className?: string;
7
- bannerVisible?: boolean;
8
- }
9
- export declare const Products: React.FC<ProductsProps>;
10
- export {};
@@ -1,21 +0,0 @@
1
- import React from 'react';
2
- export type ITextSegment = {
3
- text: string;
4
- highlighted?: boolean;
5
- };
6
- export type ISearchResult = {
7
- /**
8
- * 搜索结果的主题,显示在最左边,一般是页面的标题。
9
- */
10
- subject: string;
11
- tilte: ITextSegment[];
12
- description?: ITextSegment[];
13
- link: string;
14
- };
15
- /**
16
- * 展示搜索结果
17
- * @returns
18
- */
19
- export declare const SearchResult: React.FC<{
20
- results: ISearchResult[];
21
- }>;
@@ -1,8 +0,0 @@
1
- import type { ISearchResult } from './SearchResult';
2
- /**
3
- * dumi 搜索结果转页面 UI 的数据结构,默认取 30 条
4
- * @param dumiResult
5
- * @param limit
6
- * @returns
7
- */
8
- export declare function getSearchResults(dumiResults: any[], limit?: number): ISearchResult[];
@@ -1,2 +0,0 @@
1
- import React from 'react';
2
- export declare const Search: () => React.JSX.Element;
@@ -1,84 +0,0 @@
1
- import React from 'react';
2
- import { INav } from './Navs';
3
- import type { IC } from '../../types';
4
- export type HeaderProps = {
5
- pathPrefix?: string;
6
- /** 子标题 */
7
- subTitle?: React.ReactNode;
8
- /** 子标题的链接 */
9
- subTitleHref?: string;
10
- /** 文档和演示的菜单数据 */
11
- navs?: INav[];
12
- /** 是否显示搜索框 */
13
- showSearch?: boolean;
14
- /** 是否显示 Github 图标 */
15
- showGithubCorner?: boolean;
16
- /** 是否显示 Github Star */
17
- showGithubStar?: boolean;
18
- /** 是否显示切换语言选项 */
19
- showLanguageSwitcher?: boolean;
20
- /**
21
- * 国内镜像相关的信息
22
- */
23
- internalSite?: {
24
- url: string;
25
- name: object;
26
- };
27
- /** 切换语言的回调 */
28
- onLanguageChange?: (language: string) => void;
29
- /** 是否二维码 */
30
- showWxQrcode?: boolean;
31
- /** 自定义 logo */
32
- logo?: {
33
- img?: React.ReactNode;
34
- link?: string;
35
- };
36
- siteUrl?: string;
37
- /** github 仓库地址 */
38
- githubUrl?: string;
39
- /** 默认语言 */
40
- defaultLanguage?: 'zh' | 'en';
41
- /** 自定义 Link */
42
- Link?: React.ComponentType<any>;
43
- /** 底色是否透明 */
44
- transparent?: boolean;
45
- /** 是否首页模式 */
46
- isHomePage?: boolean;
47
- /** 是否是AntV官网 */
48
- isAntVSite?: boolean;
49
- /** AntV root 域名,直接用主题的可不传 */
50
- rootDomain?: string;
51
- /** 是否显示 AntV 产品卡片 */
52
- showAntVProductsCard?: boolean;
53
- /**
54
- * 当前版本
55
- */
56
- version?: string;
57
- /** 展示版本切换 */
58
- versions?: {
59
- [key: string]: string;
60
- };
61
- /** 展示周边生态 */
62
- ecosystems?: Array<{
63
- name: Record<string /** zh, en */, string>;
64
- url: string;
65
- }>;
66
- /** 头部搜索框配置 */
67
- searchOptions?: {
68
- docsearchOptions: {
69
- versionV3: boolean;
70
- apiKey: string;
71
- indexName: string;
72
- appId: string;
73
- };
74
- };
75
- announcement?: {
76
- title: IC;
77
- icon: string;
78
- link: {
79
- url: string;
80
- text: IC;
81
- };
82
- };
83
- };
84
- export declare const Header: React.FC<Partial<HeaderProps>>;
@@ -1,10 +0,0 @@
1
- export declare function getLangUrl(url: string, lang: string): string;
2
- /**
3
- * /en/api/xxx -> api
4
- * /api/xxx -> api
5
- * /docs/api/xxx -> api
6
- * api/xxx -> api
7
- * @param url
8
- */
9
- export declare function getNavCategory(url: string): string;
10
- export declare function findVersion(v: string, versions: string[]): string;
@@ -1,6 +0,0 @@
1
- import React from 'react';
2
- /**
3
- * Loading
4
- */
5
- declare const Loading: () => React.JSX.Element;
6
- export default Loading;
@@ -1,9 +0,0 @@
1
- import React from 'react';
2
- export interface NavigatorBannerProps {
3
- post?: {
4
- slug?: string;
5
- title?: string;
6
- } | undefined;
7
- type: 'prev' | 'next';
8
- }
9
- export declare const NavigatorBanner: React.FC<NavigatorBannerProps>;
@@ -1,7 +0,0 @@
1
- import { FC } from 'react';
2
- export type PreviewProps = {
3
- source: string;
4
- pin: boolean;
5
- code: HTMLDivElement;
6
- };
7
- export declare const Preview: FC<any>;
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- declare const ReadingTime: React.FC<any>;
3
- export default ReadingTime;
@@ -1,9 +0,0 @@
1
- import React from 'react';
2
- import 'rc-drawer/assets/index.css';
3
- export type ManualContent = {
4
- readonly children: any;
5
- };
6
- /**
7
- * 文档的结构
8
- */
9
- export declare const ManualContent: React.FC<ManualContent>;
@@ -1 +0,0 @@
1
- export declare function usePreview(options: {}, select: any): void;
@@ -1,19 +0,0 @@
1
- export declare function getOpenKeys(): any[];
2
- export declare function getBaseRoute(): string;
3
- export declare function getIndexRoute(MenuData: any): any;
4
- /**
5
- * 返回需要跳转的 pathname
6
- * /en/api/ ----> /en/api/[first-doc]
7
- * /zh/api/ ----> /api/[first-doc]
8
- * /en/docs/api/ ----> /en/api/[first-doc]
9
- * /zh/docs/api/ ----> /api/[first-doc]
10
- *
11
- * /en/docs/api/xxx ----> /en/api/xxx
12
- * /zh/docs/api/xxx ----> /api/xxx
13
- *
14
- * /docs/api/xxx -----> /api/xxx
15
- *
16
- * @param p
17
- */
18
- export declare function getNavigateUrl(pathname: string, first: string, siderbarMenu: any[]): string;
19
- export declare function safeEval(source: any): any;
@@ -1,10 +0,0 @@
1
- import React from 'react';
2
- interface SEOProps {
3
- description?: string;
4
- lang?: string;
5
- meta?: any[];
6
- title?: string;
7
- titleSuffix?: string;
8
- }
9
- export declare const SEO: React.FC<SEOProps>;
10
- export {};
package/dist/slots/SEO.js DELETED
@@ -1,57 +0,0 @@
1
- import { useSiteData } from 'dumi';
2
- import React from 'react';
3
- import { Helmet } from 'react-helmet';
4
- export var SEO = function SEO(_ref) {
5
- var description = _ref.description,
6
- _ref$lang = _ref.lang,
7
- lang = _ref$lang === void 0 ? '' : _ref$lang,
8
- _ref$meta = _ref.meta,
9
- meta = _ref$meta === void 0 ? [] : _ref$meta,
10
- title = _ref.title,
11
- titleSuffix = _ref.titleSuffix;
12
- var _useSiteData = useSiteData(),
13
- themeConfig = _useSiteData.themeConfig;
14
- var defaultTitle = themeConfig.title,
15
- defaultDescription = themeConfig.defaultDescription;
16
- var metaDescription = description || defaultDescription;
17
- return /*#__PURE__*/React.createElement(Helmet, {
18
- htmlAttributes: {
19
- lang: lang
20
- },
21
- title: title,
22
- titleTemplate: "%s | ".concat(titleSuffix || defaultTitle),
23
- meta: [{
24
- name: "description",
25
- content: metaDescription
26
- }, {
27
- property: "og:title",
28
- content: title
29
- }, {
30
- property: "og:description",
31
- content: metaDescription
32
- }, {
33
- property: "og:image",
34
- content: 'https://gw.alipayobjects.com/zos/antfincdn/FLrTNDvlna/antv.png'
35
- }, {
36
- property: "og:type",
37
- content: "website"
38
- }, {
39
- name: "twitter:card",
40
- content: "summary"
41
- }, {
42
- name: "twitter:title",
43
- content: title
44
- }, {
45
- name: "twitter:description",
46
- content: metaDescription
47
- }, {
48
- property: "twitter:image",
49
- content: 'https://gw.alipayobjects.com/zos/antfincdn/FLrTNDvlna/antv.png'
50
- }].concat(meta)
51
- });
52
- };
53
- SEO.defaultProps = {
54
- lang: "zh",
55
- meta: [],
56
- description: ""
57
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,16 +0,0 @@
1
- import { NavigatorBannerProps } from './ManualContent/NavigatorBanner';
2
- export declare const useChinaMirrorHost: () => [boolean];
3
- export declare const useScrollToTop: () => void;
4
- export declare const useLogoLink: ({ link, siteUrl, lang, }: {
5
- link?: string;
6
- siteUrl?: string;
7
- lang?: string;
8
- }) => [string];
9
- export declare const usePrevAndNext: () => NavigatorBannerProps['post'][];
10
- /**
11
- * i18n .umirc config
12
- * 如果是 object,则取 locale,否则直接用
13
- * @param v
14
- */
15
- export declare function ic(v: string | object): any;
16
- export declare function icWithLocale(v: string | object, locale: any): any;
@@ -1,5 +0,0 @@
1
- import { Status, TreeNode } from '../types';
2
- export declare function ping(): Promise<Status>;
3
- export declare const getChinaMirrorHost: (host?: string) => string;
4
- export declare function getGithubSourceURL(githubUrl: string, relativePath: string, prefix?: string): string;
5
- export declare const filterTreeNode: (treeNode: TreeNode, keyValue: string, locale: string) => TreeNode;
package/dist/types.d.ts DELETED
@@ -1,86 +0,0 @@
1
- export interface IThemeConfig {
2
- [key: string]: any;
3
- }
4
- export type Status = 'responded' | 'error' | 'timeout';
5
- /**
6
- * 配置文件中的国际化配置
7
- */
8
- export type IC = string | {
9
- zh: string;
10
- en: string;
11
- };
12
- export interface TreeNode {
13
- /**
14
- * id
15
- */
16
- id: string;
17
- /**
18
- * 孩子节点 key
19
- */
20
- childrenKey?: string;
21
- /**
22
- * 标题(支持国际化)
23
- */
24
- title: {
25
- zh: string;
26
- en: string;
27
- };
28
- [key: string]: any;
29
- }
30
- /** 案例 DEMO */
31
- export interface Demo extends TreeNode {
32
- /**
33
- * 截图
34
- */
35
- screenshot: string;
36
- /**
37
- * TypeScript 源码文件
38
- */
39
- source: string;
40
- /**
41
- * DEMO 代码文件名称
42
- */
43
- filename: string;
44
- /**
45
- * 衍生属性,通过 topic.id + example.id + demo.id 可以计算获取
46
- */
47
- relativePath?: string;
48
- /**
49
- * 是否为新品
50
- */
51
- isNew?: boolean;
52
- /**
53
- * 目标 example
54
- */
55
- targetExample?: Example;
56
- /**
57
- * 目标主题
58
- */
59
- targetTopic?: ExampleTopic;
60
- }
61
- /** 示例 */
62
- export interface Example extends TreeNode {
63
- /**
64
- * 图标
65
- */
66
- icon: string;
67
- /**
68
- * DEMO
69
- */
70
- demos: Demo[];
71
- }
72
- /** 案例主题 */
73
- export interface ExampleTopic extends TreeNode {
74
- /**
75
- * 图标
76
- */
77
- icon: string;
78
- /**
79
- * slug 和 id 一样,兼容旧配置
80
- */
81
- slug?: string;
82
- /**
83
- * 所有案例
84
- */
85
- examples: Example[];
86
- }