@antv/dumi-theme-antv 0.2.2 → 0.3.0-beta.10

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 (265) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +32 -33
  3. package/dist/builtins/Playground/index.d.ts +21 -0
  4. package/dist/builtins/Playground/index.js +69 -0
  5. package/dist/builtins/Playground/index.module.less +15 -0
  6. package/dist/context.d.ts +6 -0
  7. package/dist/context.js +2 -0
  8. package/dist/layouts/DocLayout.d.ts +7 -0
  9. package/dist/layouts/DocLayout.js +48 -0
  10. package/dist/layouts/entry/API.d.ts +10 -0
  11. package/dist/layouts/entry/API.js +12 -0
  12. package/dist/layouts/entry/Index.d.ts +7 -0
  13. package/dist/layouts/entry/Index.js +79 -0
  14. package/dist/layouts/entry/Manual.d.ts +8 -0
  15. package/dist/layouts/entry/Manual.js +13 -0
  16. package/dist/locales/en.json +98 -0
  17. package/dist/locales/zh.json +98 -0
  18. package/dist/pages/404.d.ts +6 -0
  19. package/dist/pages/404.js +18 -0
  20. package/dist/pages/Example/index.d.ts +6 -0
  21. package/dist/pages/Example/index.js +115 -0
  22. package/dist/pages/Example/index.module.less +82 -0
  23. package/dist/pages/Example/utils.d.ts +1 -0
  24. package/dist/pages/Example/utils.js +9 -0
  25. package/dist/pages/Examples/components/Accouncement/index.d.ts +6 -0
  26. package/dist/pages/Examples/components/Accouncement/index.js +60 -0
  27. package/dist/pages/Examples/components/Accouncement/index.module.less +9 -0
  28. package/dist/pages/Examples/components/Article/index.d.ts +2 -0
  29. package/dist/pages/Examples/components/Article/index.js +8 -0
  30. package/dist/pages/Examples/components/Article/index.module.less +2 -0
  31. package/dist/pages/Examples/components/ExampleTopicMenu/components/LeftMenu/index.d.ts +10 -0
  32. package/dist/pages/Examples/components/ExampleTopicMenu/components/LeftMenu/index.js +74 -0
  33. package/dist/pages/Examples/components/ExampleTopicMenu/index.d.ts +9 -0
  34. package/{es/builtins/Example.js → dist/pages/Examples/components/ExampleTopicMenu/index.js} +47 -33
  35. package/dist/pages/Examples/components/GalleryPageContent/DemoCard/index.d.ts +10 -0
  36. package/dist/pages/Examples/components/GalleryPageContent/DemoCard/index.js +33 -0
  37. package/dist/pages/Examples/components/GalleryPageContent/index.d.ts +10 -0
  38. package/dist/pages/Examples/components/GalleryPageContent/index.js +81 -0
  39. package/dist/pages/Examples/index.d.ts +8 -0
  40. package/dist/pages/Examples/index.js +95 -0
  41. package/dist/pages/Examples/index.module.less +607 -0
  42. package/dist/pages/Examples/types.d.ts +34 -0
  43. package/dist/pages/Examples/types.js +1 -0
  44. package/dist/plugin/examples.d.ts +21 -0
  45. package/dist/plugin/examples.js +105 -0
  46. package/dist/plugin/index.d.ts +3 -0
  47. package/dist/plugin/index.js +113 -0
  48. package/dist/plugin/utils.d.ts +5 -0
  49. package/dist/plugin/utils.js +46 -0
  50. package/dist/slots/404.d.ts +2 -0
  51. package/{es/antv/404/index.js → dist/slots/404.js} +4 -9
  52. package/{es/antv/Cases/Cases.d.ts → dist/slots/Cases/index.d.ts} +5 -4
  53. package/{es/antv/Cases/Cases.js → dist/slots/Cases/index.js} +25 -25
  54. package/{src/antv/Cases/Cases.module.less → dist/slots/Cases/index.module.less} +36 -5
  55. package/dist/slots/CodeEditor/Toolbar.d.ts +67 -0
  56. package/dist/slots/CodeEditor/Toolbar.js +140 -0
  57. package/dist/slots/CodeEditor/Toolbar.module.less +81 -0
  58. package/dist/slots/CodeEditor/index.d.ts +58 -0
  59. package/dist/slots/CodeEditor/index.js +226 -0
  60. package/dist/slots/CodeEditor/index.module.less +11 -0
  61. package/dist/slots/CodeEditor/utils.d.ts +42 -0
  62. package/dist/slots/CodeEditor/utils.js +157 -0
  63. package/dist/slots/CodePreview/CodeHeader.d.ts +19 -0
  64. package/dist/slots/CodePreview/CodeHeader.js +32 -0
  65. package/dist/slots/CodePreview/CodeHeader.module.less +0 -0
  66. package/dist/slots/CodePreview/index.d.ts +17 -0
  67. package/dist/slots/CodePreview/index.js +29 -0
  68. package/dist/slots/CodePreview/index.module.less +43 -0
  69. package/dist/slots/CodeRunner/index.d.ts +15 -0
  70. package/dist/slots/CodeRunner/index.js +79 -0
  71. package/dist/slots/CodeRunner/index.module.less +0 -0
  72. package/dist/slots/CodeRunner/utils.d.ts +11 -0
  73. package/dist/slots/CodeRunner/utils.js +36 -0
  74. package/dist/slots/Companies/index.d.ts +13 -0
  75. package/dist/slots/Companies/index.js +49 -0
  76. package/dist/slots/Companies/index.module.less +82 -0
  77. package/dist/slots/Detail/News.d.ts +10 -0
  78. package/{es/antv/Banner/Notification.js → dist/slots/Detail/News.js} +8 -11
  79. package/{src/antv/Banner/Notification.module.less → dist/slots/Detail/News.module.less} +15 -3
  80. package/dist/slots/Detail/index.d.ts +27 -0
  81. package/dist/slots/Detail/index.js +124 -0
  82. package/{src/antv/Banner/Banner.module.less → dist/slots/Detail/index.module.less} +42 -74
  83. package/dist/slots/ExampleSider/index.d.ts +21 -0
  84. package/dist/slots/ExampleSider/index.js +196 -0
  85. package/dist/slots/ExampleSider/index.module.less +141 -0
  86. package/{es/antv → dist/slots}/Features/FeatureCard.d.ts +2 -1
  87. package/{es/antv → dist/slots}/Features/FeatureCard.js +6 -6
  88. package/{src/antv → dist/slots}/Features/FeatureCard.module.less +8 -1
  89. package/{es/antv → dist/slots}/Features/index.d.ts +2 -2
  90. package/{es/antv → dist/slots}/Features/index.js +19 -26
  91. package/{src/antv/Features/Features.module.less → dist/slots/Features/index.module.less} +34 -3
  92. package/dist/slots/Footer/index.d.ts +18 -0
  93. package/dist/slots/Footer/index.js +188 -0
  94. package/dist/slots/Footer/index.module.less +86 -0
  95. package/dist/slots/Header/Logo.d.ts +7 -0
  96. package/{es/antv → dist/slots}/Header/Logo.js +6 -2
  97. package/dist/slots/Header/LogoWhite.d.ts +7 -0
  98. package/dist/slots/Header/LogoWhite.js +19 -0
  99. package/dist/slots/Header/Navs.d.ts +26 -0
  100. package/dist/slots/Header/Navs.js +63 -0
  101. package/dist/slots/Header/Products/NavigatorBanner.d.ts +10 -0
  102. package/dist/slots/Header/Products/NavigatorBanner.js +34 -0
  103. package/dist/slots/Header/Products/NavigatorBanner.module.less +39 -0
  104. package/{es/antv → dist/slots/Header}/Products/Product.d.ts +3 -3
  105. package/{es/antv → dist/slots/Header}/Products/Product.js +11 -16
  106. package/{src/antv → dist/slots/Header}/Products/Product.module.less +10 -8
  107. package/{es/antv → dist/slots/Header}/Products/getProducts.d.ts +2 -7
  108. package/dist/slots/Header/Products/getProducts.js +67 -0
  109. package/dist/slots/Header/Products/index.d.ts +9 -0
  110. package/{es/antv → dist/slots/Header}/Products/index.js +15 -22
  111. package/dist/slots/Header/Search.d.ts +12 -0
  112. package/dist/slots/Header/Search.js +90 -0
  113. package/dist/slots/Header/Search.module.less +39 -0
  114. package/dist/slots/Header/index.d.ts +66 -0
  115. package/dist/slots/Header/index.js +380 -0
  116. package/dist/slots/Header/index.module.less +382 -0
  117. package/dist/slots/Header/utils.d.ts +1 -0
  118. package/dist/slots/Header/utils.js +26 -0
  119. package/dist/slots/Loading/index.d.ts +7 -0
  120. package/dist/slots/Loading/index.js +79 -0
  121. package/dist/slots/Loading/index.module.less +279 -0
  122. package/dist/slots/ManualContent/NavigatorBanner.d.ts +9 -0
  123. package/dist/slots/ManualContent/NavigatorBanner.js +36 -0
  124. package/dist/slots/ManualContent/NavigatorBanner.module.less +39 -0
  125. package/dist/slots/ManualContent/ReadingTime.d.ts +3 -0
  126. package/dist/slots/ManualContent/ReadingTime.js +10 -0
  127. package/dist/slots/ManualContent/index.d.ts +9 -0
  128. package/dist/slots/ManualContent/index.js +344 -0
  129. package/dist/slots/ManualContent/index.module.less +668 -0
  130. package/dist/slots/ManualContent/utils.d.ts +3 -0
  131. package/dist/slots/ManualContent/utils.js +35 -0
  132. package/dist/slots/SEO.d.ts +10 -0
  133. package/dist/slots/SEO.js +59 -0
  134. package/dist/slots/TOC.d.ts +5 -0
  135. package/dist/slots/TOC.js +6 -0
  136. package/dist/slots/_.less +83 -0
  137. package/dist/slots/global.d.ts +1 -0
  138. package/dist/slots/global.js +7 -0
  139. package/dist/slots/hooks.d.ts +16 -0
  140. package/{es/antv → dist/slots}/hooks.js +60 -37
  141. package/dist/slots/utils.d.ts +5 -0
  142. package/dist/slots/utils.js +112 -0
  143. package/dist/types.d.ts +86 -0
  144. package/dist/types.js +1 -0
  145. package/dist/typings.d.ts +24 -0
  146. package/package.json +110 -47
  147. package/es/antv/404/index.d.ts +0 -2
  148. package/es/antv/Banner/Banner.module.less +0 -412
  149. package/es/antv/Banner/Notification.d.ts +0 -10
  150. package/es/antv/Banner/Notification.module.less +0 -108
  151. package/es/antv/Banner/index.d.ts +0 -25
  152. package/es/antv/Banner/index.js +0 -104
  153. package/es/antv/Cases/Cases.module.less +0 -203
  154. package/es/antv/Features/FeatureCard.module.less +0 -51
  155. package/es/antv/Features/Features.module.less +0 -169
  156. package/es/antv/Footer/Footer.module.less +0 -36
  157. package/es/antv/Footer/index.d.ts +0 -12
  158. package/es/antv/Footer/index.js +0 -237
  159. package/es/antv/Header/Logo.d.ts +0 -4
  160. package/es/antv/Products/Product.module.less +0 -146
  161. package/es/antv/Products/getNewProducts.d.ts +0 -24
  162. package/es/antv/Products/getNewProducts.js +0 -35
  163. package/es/antv/Products/getProducts.js +0 -460
  164. package/es/antv/Products/index.d.ts +0 -9
  165. package/es/antv/hooks.d.ts +0 -14
  166. package/es/antv/mixins.less +0 -21
  167. package/es/antv/utils.d.ts +0 -5
  168. package/es/antv/utils.js +0 -49
  169. package/es/builtins/API.d.ts +0 -3
  170. package/es/builtins/API.js +0 -37
  171. package/es/builtins/Alert.d.ts +0 -3
  172. package/es/builtins/Alert.js +0 -7
  173. package/es/builtins/Alert.less +0 -62
  174. package/es/builtins/Badge.d.ts +0 -3
  175. package/es/builtins/Badge.js +0 -7
  176. package/es/builtins/Badge.less +0 -31
  177. package/es/builtins/Example.d.ts +0 -5
  178. package/es/builtins/Example.less +0 -47
  179. package/es/builtins/Previewer.d.ts +0 -39
  180. package/es/builtins/Previewer.js +0 -225
  181. package/es/builtins/Previewer.less +0 -406
  182. package/es/builtins/SourceCode.d.ts +0 -10
  183. package/es/builtins/SourceCode.js +0 -70
  184. package/es/builtins/SourceCode.less +0 -103
  185. package/es/builtins/Table.d.ts +0 -4
  186. package/es/builtins/Table.js +0 -56
  187. package/es/builtins/Table.less +0 -43
  188. package/es/builtins/Tree.d.ts +0 -4
  189. package/es/builtins/Tree.js +0 -213
  190. package/es/builtins/Tree.less +0 -159
  191. package/es/components/Dark.d.ts +0 -9
  192. package/es/components/Dark.js +0 -125
  193. package/es/components/Dark.less +0 -121
  194. package/es/components/LocaleSelect.d.ts +0 -6
  195. package/es/components/LocaleSelect.js +0 -53
  196. package/es/components/LocaleSelect.less +0 -59
  197. package/es/components/Navbar.d.ts +0 -10
  198. package/es/components/Navbar.js +0 -155
  199. package/es/components/Navbar.less +0 -180
  200. package/es/components/SearchBar.d.ts +0 -4
  201. package/es/components/SearchBar.js +0 -81
  202. package/es/components/SearchBar.less +0 -165
  203. package/es/components/SideMenu.d.ts +0 -10
  204. package/es/components/SideMenu.js +0 -99
  205. package/es/components/SideMenu.less +0 -379
  206. package/es/components/SlugList.d.ts +0 -7
  207. package/es/components/SlugList.js +0 -38
  208. package/es/components/SlugList.less +0 -18
  209. package/es/declaration.d.ts +0 -1
  210. package/es/layout.d.ts +0 -5
  211. package/es/layout.js +0 -276
  212. package/es/style/layout.less +0 -402
  213. package/es/style/markdown.less +0 -240
  214. package/es/style/variables.less +0 -37
  215. package/src/antv/404/index.tsx +0 -25
  216. package/src/antv/Banner/Notification.tsx +0 -45
  217. package/src/antv/Banner/index.tsx +0 -139
  218. package/src/antv/Cases/Cases.tsx +0 -116
  219. package/src/antv/Features/FeatureCard.tsx +0 -24
  220. package/src/antv/Features/index.tsx +0 -86
  221. package/src/antv/Footer/Footer.module.less +0 -36
  222. package/src/antv/Footer/index.tsx +0 -272
  223. package/src/antv/Header/Logo.tsx +0 -85
  224. package/src/antv/Products/Product.tsx +0 -80
  225. package/src/antv/Products/getNewProducts.tsx +0 -53
  226. package/src/antv/Products/getProducts.tsx +0 -626
  227. package/src/antv/Products/index.tsx +0 -70
  228. package/src/antv/hooks.ts +0 -87
  229. package/src/antv/mixins.less +0 -21
  230. package/src/antv/utils.ts +0 -44
  231. package/src/builtins/API.tsx +0 -57
  232. package/src/builtins/Alert.less +0 -62
  233. package/src/builtins/Alert.tsx +0 -4
  234. package/src/builtins/Badge.less +0 -31
  235. package/src/builtins/Badge.tsx +0 -4
  236. package/src/builtins/Example.less +0 -47
  237. package/src/builtins/Example.tsx +0 -34
  238. package/src/builtins/Previewer.less +0 -406
  239. package/src/builtins/Previewer.tsx +0 -264
  240. package/src/builtins/SourceCode.less +0 -103
  241. package/src/builtins/SourceCode.tsx +0 -55
  242. package/src/builtins/Table.less +0 -43
  243. package/src/builtins/Table.tsx +0 -42
  244. package/src/builtins/Tree.less +0 -159
  245. package/src/builtins/Tree.tsx +0 -130
  246. package/src/components/Dark.less +0 -121
  247. package/src/components/Dark.tsx +0 -78
  248. package/src/components/LocaleSelect.less +0 -59
  249. package/src/components/LocaleSelect.tsx +0 -53
  250. package/src/components/Navbar.less +0 -180
  251. package/src/components/Navbar.tsx +0 -152
  252. package/src/components/SearchBar.less +0 -165
  253. package/src/components/SearchBar.tsx +0 -68
  254. package/src/components/SideMenu.less +0 -379
  255. package/src/components/SideMenu.tsx +0 -148
  256. package/src/components/SlugList.less +0 -18
  257. package/src/components/SlugList.tsx +0 -20
  258. package/src/declaration.d.ts +0 -1
  259. package/src/layout.tsx +0 -225
  260. package/src/style/layout.less +0 -402
  261. package/src/style/markdown.less +0 -240
  262. package/src/style/variables.less +0 -37
  263. package/src/test/SearchBar.test.ts +0 -32
  264. package/src/test/Table.test.tsx +0 -41
  265. package/src/test/index.test.tsx +0 -377
@@ -0,0 +1,59 @@
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
+
13
+ var _useSiteData = useSiteData(),
14
+ themeConfig = _useSiteData.themeConfig;
15
+
16
+ var defaultTitle = themeConfig.title,
17
+ defaultDescription = themeConfig.defaultDescription;
18
+ var metaDescription = description || defaultDescription;
19
+ return /*#__PURE__*/React.createElement(Helmet, {
20
+ htmlAttributes: {
21
+ lang: lang
22
+ },
23
+ title: title,
24
+ titleTemplate: "%s | ".concat(titleSuffix || defaultTitle),
25
+ meta: [{
26
+ name: "description",
27
+ content: metaDescription
28
+ }, {
29
+ property: "og:title",
30
+ content: title
31
+ }, {
32
+ property: "og:description",
33
+ content: metaDescription
34
+ }, {
35
+ property: "og:image",
36
+ content: 'https://gw.alipayobjects.com/zos/antfincdn/FLrTNDvlna/antv.png'
37
+ }, {
38
+ property: "og:type",
39
+ content: "website"
40
+ }, {
41
+ name: "twitter:card",
42
+ content: "summary"
43
+ }, {
44
+ name: "twitter:title",
45
+ content: title
46
+ }, {
47
+ name: "twitter:description",
48
+ content: metaDescription
49
+ }, {
50
+ property: "twitter:image",
51
+ content: 'https://gw.alipayobjects.com/zos/antfincdn/FLrTNDvlna/antv.png'
52
+ }].concat(meta)
53
+ });
54
+ };
55
+ SEO.defaultProps = {
56
+ lang: "zh",
57
+ meta: [],
58
+ description: ""
59
+ };
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ /**
3
+ * 文档右侧的指示器(table of content)
4
+ */
5
+ export declare const TOC: React.FC<{}>;
@@ -0,0 +1,6 @@
1
+ import Toc from 'dumi/theme-default/slots/Toc';
2
+ /**
3
+ * 文档右侧的指示器(table of content)
4
+ */
5
+
6
+ export var TOC = Toc;
@@ -0,0 +1,83 @@
1
+ @import "~antd/dist/antd.less";
2
+
3
+ @primary-color: #873bf4;
4
+
5
+ .container1440() {
6
+ width: 1440px;
7
+ max-width: calc(100% - 80px);
8
+ margin-left: auto;
9
+ margin-right: auto;
10
+
11
+ @media only screen and (max-width: 931.99px) {
12
+ & {
13
+ max-width: calc(100% - 60px);
14
+ }
15
+ }
16
+
17
+ @media only screen and (max-width: 767.99px) {
18
+ & {
19
+ max-width: calc(100% - 32px);
20
+ }
21
+ }
22
+ }
23
+
24
+ // 非常关键,用于 react-split-pane 的样式,如果没有,会没有办法鼠标拖拽
25
+ // 参考:https://codesandbox.io/s/mow7x4zyqx
26
+ :global {
27
+
28
+ .Pane1,
29
+ .Pane2 {
30
+ overflow: auto;
31
+ }
32
+
33
+ .Resizer {
34
+ background: #000;
35
+ opacity: 0.1;
36
+ z-index: 1;
37
+ box-sizing: border-box;
38
+ background-clip: padding-box;
39
+
40
+ &:hover {
41
+ transition: all 2s ease;
42
+ }
43
+
44
+ &.horizontal {
45
+ height: 11px;
46
+ margin: -5px 0;
47
+ border-top: 5px solid rgba(255, 255, 255, 0);
48
+ border-bottom: 5px solid rgba(255, 255, 255, 0);
49
+ cursor: row-resize;
50
+ width: 100%;
51
+
52
+ &:hover {
53
+ border-top: 5px solid rgba(0, 0, 0, 0.5);
54
+ border-bottom: 5px solid rgba(0, 0, 0, 0.5);
55
+ }
56
+ }
57
+
58
+ &.vertical {
59
+ width: 11px;
60
+ margin: 0 -5px;
61
+ border-left: 5px solid rgba(255, 255, 255, 0);
62
+ border-right: 5px solid rgba(255, 255, 255, 0);
63
+ cursor: col-resize;
64
+
65
+ Pane2 {
66
+ border-left: 1px solid #e6e6e6;
67
+ }
68
+
69
+ &:hover {
70
+ border-left: 5px solid rgba(0, 0, 0, 0.5);
71
+ border-right: 5px solid rgba(0, 0, 0, 0.5);
72
+ }
73
+ }
74
+
75
+ &.disabled {
76
+ cursor: not-allowed;
77
+
78
+ &:hover {
79
+ border-color: transparent;
80
+ }
81
+ }
82
+ }
83
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ import * as _ from 'lodash-es';
2
+ import insertCss from 'insert-css'; // 挂载一些全局变量
3
+
4
+ if (window) {
5
+ window.lodash = _;
6
+ window.insertCss = insertCss;
7
+ }
@@ -0,0 +1,16 @@
1
+ import { NavigatorBannerProps } from './ManualContent/NavigatorBanner';
2
+ export declare const useChinaMirrorHost: () => [boolean];
3
+ export declare const useScrollToTop: () => void;
4
+ export declare const useT: (transformedMessage: string) => string;
5
+ export declare const useLogoLink: ({ link, siteUrl, lang, }: {
6
+ link?: string;
7
+ siteUrl?: string;
8
+ lang?: string;
9
+ }) => [string];
10
+ export declare const usePrevAndNext: () => NavigatorBannerProps['post'][];
11
+ /**
12
+ * i18n .umirc config
13
+ * 如果是 object,则取 locale,否则直接用
14
+ * @param v
15
+ */
16
+ export declare function ic(v: string | object): any;
@@ -1,3 +1,5 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+
1
3
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
4
 
3
5
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -10,7 +12,9 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
10
12
 
11
13
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
14
 
13
- import { useEffect, useState } from "react";
15
+ import { useEffect, useState } from 'react';
16
+ import { get } from 'lodash-es';
17
+ import { useIntl, useLocale } from 'dumi';
14
18
  export var useChinaMirrorHost = function useChinaMirrorHost() {
15
19
  var _useState = useState(false),
16
20
  _useState2 = _slicedToArray(_useState, 2),
@@ -18,64 +22,83 @@ export var useChinaMirrorHost = function useChinaMirrorHost() {
18
22
  setIsChinaMirrorHost = _useState2[1];
19
23
 
20
24
  useEffect(function () {
21
- if (window.location.host.includes("gitee.io") && window.location.host.includes("antv")) {
25
+ if (window.location.host.includes('gitee.io') && window.location.host.includes('antv')) {
22
26
  setIsChinaMirrorHost(true);
23
27
  }
24
28
  }, []);
25
29
  return [isChinaMirrorHost];
26
30
  };
27
- export var usePrevAndNext = function usePrevAndNext() {
28
- var _useState3 = useState([]),
29
- _useState4 = _slicedToArray(_useState3, 2),
30
- prevAndNext = _useState4[0],
31
- setPrevAndNext = _useState4[1];
32
-
33
- useEffect(function () {
34
- var menuNodes = document.querySelectorAll("aside .ant-menu-item a");
35
- var currentMenuNode = document.querySelector("aside .ant-menu-item-selected a");
36
- var currentIndex = Array.from(menuNodes).findIndex(function (node) {
37
- return node === currentMenuNode;
38
- });
39
- var prevNode = currentIndex - 1 >= 0 ? menuNodes[currentIndex - 1] : undefined;
40
- var nextNode = currentIndex + 1 < menuNodes.length ? menuNodes[currentIndex + 1] : undefined;
41
- var prev = prevNode ? {
42
- slug: prevNode.getAttribute("href") || undefined,
43
- title: prevNode.textContent || undefined
44
- } : undefined;
45
- var next = nextNode ? {
46
- slug: nextNode.getAttribute("href") || undefined,
47
- title: nextNode.textContent || undefined
48
- } : undefined;
49
- setPrevAndNext([prev, next]);
50
- }, []);
51
- return prevAndNext;
31
+ export var useScrollToTop = function useScrollToTop() {
32
+ document.body.scrollTop = document.documentElement.scrollTop = 0;
33
+ };
34
+ export var useT = function useT(transformedMessage) {
35
+ var intl = useIntl();
36
+ return intl.formatMessage({
37
+ id: transformedMessage
38
+ });
52
39
  };
53
40
  export var useLogoLink = function useLogoLink(_ref) {
54
41
  var _ref$link = _ref.link,
55
- link = _ref$link === void 0 ? "" : _ref$link,
42
+ link = _ref$link === void 0 ? '' : _ref$link,
56
43
  _ref$siteUrl = _ref.siteUrl,
57
- siteUrl = _ref$siteUrl === void 0 ? "" : _ref$siteUrl,
44
+ siteUrl = _ref$siteUrl === void 0 ? '' : _ref$siteUrl,
58
45
  _ref$lang = _ref.lang,
59
- lang = _ref$lang === void 0 ? "" : _ref$lang;
46
+ lang = _ref$lang === void 0 ? '' : _ref$lang;
60
47
  var defaultLogoLink;
61
48
 
62
49
  if (link) {
63
50
  defaultLogoLink = link;
64
- } else if (siteUrl === "https://antv.vision") {
51
+ } else if (siteUrl === 'https://antv.vision') {
65
52
  defaultLogoLink = "/".concat(lang);
66
53
  } else {
67
54
  defaultLogoLink = "https://antv.vision/".concat(lang);
68
55
  }
69
56
 
70
- var _useState5 = useState(""),
71
- _useState6 = _slicedToArray(_useState5, 2),
72
- giteeLogoLink = _useState6[0],
73
- setGiteeLogoLink = _useState6[1];
57
+ var _useState3 = useState(''),
58
+ _useState4 = _slicedToArray(_useState3, 2),
59
+ giteeLogoLink = _useState4[0],
60
+ setGiteeLogoLink = _useState4[1];
74
61
 
75
62
  useEffect(function () {
76
- if (window.location.host.includes("gitee.io") && window.location.host.includes("antv")) {
63
+ if (window.location.host.includes('gitee.io') && window.location.host.includes('antv')) {
77
64
  setGiteeLogoLink("https://antv.gitee.io/".concat(lang));
78
65
  }
79
66
  }, []);
80
67
  return [giteeLogoLink || defaultLogoLink];
81
- };
68
+ };
69
+ export var usePrevAndNext = function usePrevAndNext() {
70
+ var _useState5 = useState([]),
71
+ _useState6 = _slicedToArray(_useState5, 2),
72
+ prevAndNext = _useState6[0],
73
+ setPrevAndNext = _useState6[1];
74
+
75
+ useEffect(function () {
76
+ var menuNodes = document.querySelectorAll('aside .ant-menu-item a');
77
+ var currentMenuNode = document.querySelector('aside .ant-menu-item-selected a');
78
+ var currentIndex = Array.from(menuNodes).findIndex(function (node) {
79
+ return node === currentMenuNode;
80
+ });
81
+ var prevNode = currentIndex - 1 >= 0 ? menuNodes[currentIndex - 1] : undefined;
82
+ var nextNode = currentIndex + 1 < menuNodes.length ? menuNodes[currentIndex + 1] : undefined;
83
+ var prev = prevNode ? {
84
+ slug: prevNode.getAttribute('href') || undefined,
85
+ title: prevNode.textContent || undefined
86
+ } : undefined;
87
+ var next = nextNode ? {
88
+ slug: nextNode.getAttribute('href') || undefined,
89
+ title: nextNode.textContent || undefined
90
+ } : undefined;
91
+ setPrevAndNext([prev, next]);
92
+ }, []);
93
+ return prevAndNext;
94
+ };
95
+ /**
96
+ * i18n .umirc config
97
+ * 如果是 object,则取 locale,否则直接用
98
+ * @param v
99
+ */
100
+
101
+ export function ic(v) {
102
+ var locale = useLocale();
103
+ return _typeof(v) === 'object' ? get(v, [locale.id]) : v;
104
+ }
@@ -0,0 +1,5 @@
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;
@@ -0,0 +1,112 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+
3
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
4
+
5
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
6
+
7
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
8
+
9
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
10
+
11
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
12
+
13
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
14
+
15
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
16
+
17
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
18
+
19
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
20
+
21
+ export function ping() {
22
+ return _ping.apply(this, arguments);
23
+ }
24
+
25
+ function _ping() {
26
+ _ping = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
27
+ var timeout, network;
28
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
29
+ while (1) {
30
+ switch (_context.prev = _context.next) {
31
+ case 0:
32
+ timeout = new Promise(function (resolve) {
33
+ setTimeout(function () {
34
+ resolve('timeout');
35
+ }, 1500);
36
+ });
37
+ network = new Promise(function (resolve) {
38
+ var url = 'https://private-a' + 'lipay' + 'objects.alip' + 'ay.com/alip' + 'ay-rmsdeploy-image/rmsportal/RKuAiriJqrUhyqW.png';
39
+ var img = new Image();
40
+
41
+ img.onload = function () {
42
+ img.src = '';
43
+ resolve('responded');
44
+ };
45
+
46
+ img.onerror = function () {
47
+ img.src = '';
48
+ resolve('error');
49
+ };
50
+
51
+ img.src = url;
52
+ });
53
+ return _context.abrupt("return", Promise.race([timeout, network]));
54
+
55
+ case 3:
56
+ case "end":
57
+ return _context.stop();
58
+ }
59
+ }
60
+ }, _callee);
61
+ }));
62
+ return _ping.apply(this, arguments);
63
+ }
64
+
65
+ export var getChinaMirrorHost = function getChinaMirrorHost(host) {
66
+ var hostString = typeof host === 'undefined' ? window.location.host : host; // antv.vision => antv.gitee.io
67
+
68
+ if (hostString === 'antv.vision') {
69
+ return 'antv.gitee.io';
70
+ } // g2plot.antv.vision => antv-g2plot.gitee.io
71
+
72
+
73
+ var match = hostString.match(/(.*)\.antv\.vision/);
74
+
75
+ if (match && match[1]) {
76
+ return "antv-".concat(match[1], ".gitee.io");
77
+ }
78
+
79
+ return hostString;
80
+ };
81
+ export function getGithubSourceURL(githubUrl, relativePath) {
82
+ var prefix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'examples';
83
+
84
+ // https://github.com/antvis/x6/tree/master/packages/x6-sites
85
+ if (githubUrl.includes('/tree/master/')) {
86
+ return "".concat(githubUrl.replace('/tree/master/', '/edit/master/'), "/").concat(prefix, "/").concat(relativePath);
87
+ }
88
+
89
+ return "".concat(githubUrl, "/edit/master/").concat(prefix, "/").concat(relativePath);
90
+ }
91
+ export var filterTreeNode = function filterTreeNode(treeNode, keyValue, locale) {
92
+ if (treeNode.childrenKey && Array.isArray(treeNode[treeNode.childrenKey])) {
93
+ var children = treeNode[treeNode.childrenKey];
94
+ var filteredChildren = children.filter(function (child) {
95
+ var c = filterTreeNode(child, keyValue, locale);
96
+ return c !== null;
97
+ });
98
+
99
+ if (filteredChildren.length > 0) {
100
+ treeNode[treeNode.childrenKey] = _toConsumableArray(filteredChildren);
101
+ return treeNode;
102
+ }
103
+ }
104
+
105
+ var isCurrentTreeNodeMatched = treeNode.title[locale].toLowerCase().includes(keyValue.toLowerCase()); // 当前节点自身匹配,那么其孩子直接匹配,可以直接返回当前节点
106
+
107
+ if (isCurrentTreeNodeMatched) {
108
+ return treeNode;
109
+ }
110
+
111
+ return null;
112
+ };
@@ -0,0 +1,86 @@
1
+ export interface IThemeConfig {
2
+ [key: string]: any;
3
+ }
4
+ export declare type Status = 'responded' | 'error' | 'timeout';
5
+ /**
6
+ * 配置文件中的国际化配置
7
+ */
8
+ export declare 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
+ }
package/dist/types.js ADDED
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,24 @@
1
+ declare module '\*.jpg' {
2
+ const content: string;
3
+ export default content;
4
+ }
5
+
6
+ declare module '\*.png' {
7
+ const content: string;
8
+ export default content;
9
+ }
10
+
11
+ declare module '\*.json' {
12
+ const content: string;
13
+ export default content;
14
+ }
15
+
16
+ declare module '\*.less' {
17
+ const content: any;
18
+ export default content;
19
+ }
20
+
21
+ declare module '\*.svg' {
22
+ const content: any;
23
+ export default content;
24
+ }