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

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 (260) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +32 -33
  3. package/dist/builtins/Playground/index.d.ts +24 -0
  4. package/{es/builtins/Example.js → dist/builtins/Playground/index.js} +40 -33
  5. package/dist/builtins/Playground/index.module.less +15 -0
  6. package/dist/context.d.ts +5 -0
  7. package/dist/context.js +2 -0
  8. package/dist/layouts/DocLayout.d.ts +7 -0
  9. package/dist/layouts/DocLayout.js +38 -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 +71 -0
  14. package/dist/layouts/entry/Manual.d.ts +8 -0
  15. package/dist/layouts/entry/Manual.js +14 -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 +15 -0
  20. package/dist/pages/Example/index.d.ts +6 -0
  21. package/dist/pages/Example/index.js +139 -0
  22. package/dist/pages/Example/index.module.less +40 -0
  23. package/dist/pages/Examples/components/Accouncement/index.d.ts +6 -0
  24. package/dist/pages/Examples/components/Accouncement/index.js +60 -0
  25. package/dist/pages/Examples/components/Accouncement/index.module.less +9 -0
  26. package/dist/pages/Examples/components/Article/index.d.ts +2 -0
  27. package/dist/pages/Examples/components/Article/index.js +8 -0
  28. package/dist/pages/Examples/components/Article/index.module.less +2 -0
  29. package/dist/pages/Examples/components/ExampleTopicMenu/components/LeftMenu/index.d.ts +10 -0
  30. package/dist/pages/Examples/components/ExampleTopicMenu/components/LeftMenu/index.js +74 -0
  31. package/dist/pages/Examples/components/ExampleTopicMenu/index.d.ts +9 -0
  32. package/{es/builtins/Table.js → dist/pages/Examples/components/ExampleTopicMenu/index.js} +47 -41
  33. package/dist/pages/Examples/components/GalleryPageContent/DemoCard/index.d.ts +10 -0
  34. package/dist/pages/Examples/components/GalleryPageContent/DemoCard/index.js +33 -0
  35. package/dist/pages/Examples/components/GalleryPageContent/index.d.ts +10 -0
  36. package/dist/pages/Examples/components/GalleryPageContent/index.js +81 -0
  37. package/dist/pages/Examples/index.d.ts +8 -0
  38. package/dist/pages/Examples/index.js +75 -0
  39. package/dist/pages/Examples/index.module.less +605 -0
  40. package/dist/pages/Examples/types.d.ts +33 -0
  41. package/dist/pages/Examples/types.js +1 -0
  42. package/dist/plugin/examples.d.ts +12 -0
  43. package/dist/plugin/examples.js +91 -0
  44. package/dist/plugin/index.d.ts +3 -0
  45. package/dist/plugin/index.js +100 -0
  46. package/dist/plugin/utils.d.ts +5 -0
  47. package/dist/plugin/utils.js +45 -0
  48. package/dist/slots/404.d.ts +2 -0
  49. package/{es/antv/404/index.js → dist/slots/404.js} +4 -9
  50. package/{es/antv/Cases/Cases.d.ts → dist/slots/Cases/index.d.ts} +4 -4
  51. package/{es/antv/Cases/Cases.js → dist/slots/Cases/index.js} +25 -25
  52. package/{src/antv/Cases/Cases.module.less → dist/slots/Cases/index.module.less} +36 -5
  53. package/dist/slots/CodeEditor/Toolbar.d.ts +67 -0
  54. package/dist/slots/CodeEditor/Toolbar.js +152 -0
  55. package/dist/slots/CodeEditor/Toolbar.module.less +81 -0
  56. package/dist/slots/CodeEditor/index.d.ts +58 -0
  57. package/dist/slots/CodeEditor/index.js +200 -0
  58. package/dist/slots/CodeEditor/index.module.less +11 -0
  59. package/dist/slots/CodeEditor/utils.d.ts +42 -0
  60. package/dist/slots/CodeEditor/utils.js +157 -0
  61. package/dist/slots/CodePreview/CodeHeader.d.ts +19 -0
  62. package/dist/slots/CodePreview/CodeHeader.js +32 -0
  63. package/dist/slots/CodePreview/CodeHeader.module.less +0 -0
  64. package/dist/slots/CodePreview/index.d.ts +17 -0
  65. package/dist/slots/CodePreview/index.js +29 -0
  66. package/dist/slots/CodePreview/index.module.less +42 -0
  67. package/dist/slots/CodeRunner/index.d.ts +14 -0
  68. package/dist/slots/CodeRunner/index.js +76 -0
  69. package/dist/slots/CodeRunner/index.module.less +0 -0
  70. package/dist/slots/CodeRunner/utils.d.ts +10 -0
  71. package/dist/slots/CodeRunner/utils.js +36 -0
  72. package/dist/slots/Companies/index.d.ts +13 -0
  73. package/dist/slots/Companies/index.js +49 -0
  74. package/dist/slots/Companies/index.module.less +82 -0
  75. package/dist/slots/Detail/News.d.ts +9 -0
  76. package/{es/antv/Banner/Notification.js → dist/slots/Detail/News.js} +8 -11
  77. package/{src/antv/Banner/Notification.module.less → dist/slots/Detail/News.module.less} +15 -3
  78. package/dist/slots/Detail/index.d.ts +26 -0
  79. package/dist/slots/Detail/index.js +124 -0
  80. package/{src/antv/Banner/Banner.module.less → dist/slots/Detail/index.module.less} +42 -74
  81. package/dist/slots/ExampleSider/index.d.ts +55 -0
  82. package/dist/slots/ExampleSider/index.js +218 -0
  83. package/dist/slots/ExampleSider/index.module.less +141 -0
  84. package/{es/antv → dist/slots}/Features/FeatureCard.d.ts +1 -1
  85. package/{es/antv → dist/slots}/Features/FeatureCard.js +6 -6
  86. package/{src/antv → dist/slots}/Features/FeatureCard.module.less +8 -1
  87. package/{es/antv → dist/slots}/Features/index.d.ts +2 -2
  88. package/{es/antv → dist/slots}/Features/index.js +17 -25
  89. package/{src/antv/Features/Features.module.less → dist/slots/Features/index.module.less} +34 -3
  90. package/dist/slots/Footer/index.d.ts +18 -0
  91. package/dist/slots/Footer/index.js +187 -0
  92. package/dist/slots/Footer/index.module.less +85 -0
  93. package/dist/slots/Header/Logo.d.ts +7 -0
  94. package/{es/antv → dist/slots}/Header/Logo.js +6 -2
  95. package/dist/slots/Header/LogoWhite.d.ts +7 -0
  96. package/dist/slots/Header/LogoWhite.js +19 -0
  97. package/dist/slots/Header/Navs.d.ts +17 -0
  98. package/dist/slots/Header/Navs.js +46 -0
  99. package/dist/slots/Header/Products/NavigatorBanner.d.ts +10 -0
  100. package/dist/slots/Header/Products/NavigatorBanner.js +34 -0
  101. package/dist/slots/Header/Products/NavigatorBanner.module.less +39 -0
  102. package/{es/antv → dist/slots/Header}/Products/Product.d.ts +3 -3
  103. package/{es/antv → dist/slots/Header}/Products/Product.js +11 -16
  104. package/{src/antv → dist/slots/Header}/Products/Product.module.less +10 -8
  105. package/{es/antv → dist/slots/Header}/Products/getProducts.d.ts +2 -7
  106. package/dist/slots/Header/Products/getProducts.js +67 -0
  107. package/dist/slots/Header/Products/index.d.ts +9 -0
  108. package/{es/antv → dist/slots/Header}/Products/index.js +15 -22
  109. package/dist/slots/Header/Search.d.ts +12 -0
  110. package/dist/slots/Header/Search.js +90 -0
  111. package/dist/slots/Header/Search.module.less +39 -0
  112. package/dist/slots/Header/index.d.ts +66 -0
  113. package/dist/slots/Header/index.js +379 -0
  114. package/dist/slots/Header/index.module.less +382 -0
  115. package/dist/slots/Header/utils.d.ts +1 -0
  116. package/dist/slots/Header/utils.js +26 -0
  117. package/dist/slots/Loading/index.d.ts +2 -0
  118. package/dist/slots/Loading/index.js +65 -0
  119. package/dist/slots/Loading/index.module.less +12 -0
  120. package/dist/slots/Loading.d.ts +5 -0
  121. package/dist/slots/Loading.js +8 -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 +321 -0
  129. package/dist/slots/ManualContent/index.module.less +656 -0
  130. package/dist/slots/TOC.d.ts +5 -0
  131. package/dist/slots/TOC.js +6 -0
  132. package/dist/slots/_.less +83 -0
  133. package/dist/slots/global.d.ts +1 -0
  134. package/dist/slots/global.js +7 -0
  135. package/dist/slots/hooks.d.ts +16 -0
  136. package/{es/antv → dist/slots}/hooks.js +60 -37
  137. package/dist/slots/utils.d.ts +20 -0
  138. package/dist/slots/utils.js +154 -0
  139. package/dist/types.d.ts +3 -0
  140. package/dist/types.js +1 -0
  141. package/dist/typings.d.ts +140 -0
  142. package/package.json +108 -47
  143. package/es/antv/404/index.d.ts +0 -2
  144. package/es/antv/Banner/Banner.module.less +0 -412
  145. package/es/antv/Banner/Notification.d.ts +0 -10
  146. package/es/antv/Banner/Notification.module.less +0 -108
  147. package/es/antv/Banner/index.d.ts +0 -25
  148. package/es/antv/Banner/index.js +0 -104
  149. package/es/antv/Cases/Cases.module.less +0 -203
  150. package/es/antv/Features/FeatureCard.module.less +0 -51
  151. package/es/antv/Features/Features.module.less +0 -169
  152. package/es/antv/Footer/Footer.module.less +0 -36
  153. package/es/antv/Footer/index.d.ts +0 -12
  154. package/es/antv/Footer/index.js +0 -237
  155. package/es/antv/Header/Logo.d.ts +0 -4
  156. package/es/antv/Products/Product.module.less +0 -146
  157. package/es/antv/Products/getNewProducts.d.ts +0 -24
  158. package/es/antv/Products/getNewProducts.js +0 -35
  159. package/es/antv/Products/getProducts.js +0 -460
  160. package/es/antv/Products/index.d.ts +0 -9
  161. package/es/antv/hooks.d.ts +0 -14
  162. package/es/antv/mixins.less +0 -21
  163. package/es/antv/utils.d.ts +0 -5
  164. package/es/antv/utils.js +0 -49
  165. package/es/builtins/API.d.ts +0 -3
  166. package/es/builtins/API.js +0 -37
  167. package/es/builtins/Alert.d.ts +0 -3
  168. package/es/builtins/Alert.js +0 -7
  169. package/es/builtins/Alert.less +0 -62
  170. package/es/builtins/Badge.d.ts +0 -3
  171. package/es/builtins/Badge.js +0 -7
  172. package/es/builtins/Badge.less +0 -31
  173. package/es/builtins/Example.d.ts +0 -5
  174. package/es/builtins/Example.less +0 -47
  175. package/es/builtins/Previewer.d.ts +0 -39
  176. package/es/builtins/Previewer.js +0 -225
  177. package/es/builtins/Previewer.less +0 -406
  178. package/es/builtins/SourceCode.d.ts +0 -10
  179. package/es/builtins/SourceCode.js +0 -70
  180. package/es/builtins/SourceCode.less +0 -103
  181. package/es/builtins/Table.d.ts +0 -4
  182. package/es/builtins/Table.less +0 -43
  183. package/es/builtins/Tree.d.ts +0 -4
  184. package/es/builtins/Tree.js +0 -213
  185. package/es/builtins/Tree.less +0 -159
  186. package/es/components/Dark.d.ts +0 -9
  187. package/es/components/Dark.js +0 -125
  188. package/es/components/Dark.less +0 -121
  189. package/es/components/LocaleSelect.d.ts +0 -6
  190. package/es/components/LocaleSelect.js +0 -53
  191. package/es/components/LocaleSelect.less +0 -59
  192. package/es/components/Navbar.d.ts +0 -10
  193. package/es/components/Navbar.js +0 -155
  194. package/es/components/Navbar.less +0 -180
  195. package/es/components/SearchBar.d.ts +0 -4
  196. package/es/components/SearchBar.js +0 -81
  197. package/es/components/SearchBar.less +0 -165
  198. package/es/components/SideMenu.d.ts +0 -10
  199. package/es/components/SideMenu.js +0 -99
  200. package/es/components/SideMenu.less +0 -379
  201. package/es/components/SlugList.d.ts +0 -7
  202. package/es/components/SlugList.js +0 -38
  203. package/es/components/SlugList.less +0 -18
  204. package/es/declaration.d.ts +0 -1
  205. package/es/layout.d.ts +0 -5
  206. package/es/layout.js +0 -276
  207. package/es/style/layout.less +0 -402
  208. package/es/style/markdown.less +0 -240
  209. package/es/style/variables.less +0 -37
  210. package/src/antv/404/index.tsx +0 -25
  211. package/src/antv/Banner/Notification.tsx +0 -45
  212. package/src/antv/Banner/index.tsx +0 -139
  213. package/src/antv/Cases/Cases.tsx +0 -116
  214. package/src/antv/Features/FeatureCard.tsx +0 -24
  215. package/src/antv/Features/index.tsx +0 -86
  216. package/src/antv/Footer/Footer.module.less +0 -36
  217. package/src/antv/Footer/index.tsx +0 -272
  218. package/src/antv/Header/Logo.tsx +0 -85
  219. package/src/antv/Products/Product.tsx +0 -80
  220. package/src/antv/Products/getNewProducts.tsx +0 -53
  221. package/src/antv/Products/getProducts.tsx +0 -626
  222. package/src/antv/Products/index.tsx +0 -70
  223. package/src/antv/hooks.ts +0 -87
  224. package/src/antv/mixins.less +0 -21
  225. package/src/antv/utils.ts +0 -44
  226. package/src/builtins/API.tsx +0 -57
  227. package/src/builtins/Alert.less +0 -62
  228. package/src/builtins/Alert.tsx +0 -4
  229. package/src/builtins/Badge.less +0 -31
  230. package/src/builtins/Badge.tsx +0 -4
  231. package/src/builtins/Example.less +0 -47
  232. package/src/builtins/Example.tsx +0 -34
  233. package/src/builtins/Previewer.less +0 -406
  234. package/src/builtins/Previewer.tsx +0 -264
  235. package/src/builtins/SourceCode.less +0 -103
  236. package/src/builtins/SourceCode.tsx +0 -55
  237. package/src/builtins/Table.less +0 -43
  238. package/src/builtins/Table.tsx +0 -42
  239. package/src/builtins/Tree.less +0 -159
  240. package/src/builtins/Tree.tsx +0 -130
  241. package/src/components/Dark.less +0 -121
  242. package/src/components/Dark.tsx +0 -78
  243. package/src/components/LocaleSelect.less +0 -59
  244. package/src/components/LocaleSelect.tsx +0 -53
  245. package/src/components/Navbar.less +0 -180
  246. package/src/components/Navbar.tsx +0 -152
  247. package/src/components/SearchBar.less +0 -165
  248. package/src/components/SearchBar.tsx +0 -68
  249. package/src/components/SideMenu.less +0 -379
  250. package/src/components/SideMenu.tsx +0 -148
  251. package/src/components/SlugList.less +0 -18
  252. package/src/components/SlugList.tsx +0 -20
  253. package/src/declaration.d.ts +0 -1
  254. package/src/layout.tsx +0 -225
  255. package/src/style/layout.less +0 -402
  256. package/src/style/markdown.less +0 -240
  257. package/src/style/variables.less +0 -37
  258. package/src/test/SearchBar.test.ts +0 -32
  259. package/src/test/Table.test.tsx +0 -41
  260. package/src/test/index.test.tsx +0 -377
@@ -0,0 +1,91 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
+
22
+ // src/plugin/examples.ts
23
+ var examples_exports = {};
24
+ __export(examples_exports, {
25
+ getExamplesPageTopics: () => getExamplesPageTopics
26
+ });
27
+ module.exports = __toCommonJS(examples_exports);
28
+ var glob = __toESM(require("glob"));
29
+ var path = __toESM(require("path"));
30
+ var fs = __toESM(require("fs-extra"));
31
+ var import_front_matter = __toESM(require("front-matter"));
32
+ var examplesBaseDir = path.resolve(process.cwd(), "examples");
33
+ var getExampleDemos = (exampleDir) => {
34
+ const demoMetaJSON = fs.readFileSync(path.resolve(exampleDir, "demo", "meta.json")).toString();
35
+ const demoMeta = JSON.parse(demoMetaJSON).demos;
36
+ const demos = demoMeta.map((item) => {
37
+ const { title, screenshot, filename, new: isNew } = item;
38
+ const id = filename.replace(/\.tsx?$/, "").replace(/\.ts?$/, "").replace(/\.jsx?$/, "").replace(/\.js?$/, "");
39
+ return {
40
+ id,
41
+ screenshot,
42
+ source: fs.readFileSync(path.resolve(exampleDir, "demo", filename)).toString(),
43
+ title,
44
+ filename,
45
+ isNew: !!isNew
46
+ };
47
+ });
48
+ return demos;
49
+ };
50
+ var getTopicExamples = (topicPath) => {
51
+ const examplePaths = glob.sync(`${topicPath}/*`).filter((item) => {
52
+ return !item.endsWith(".js");
53
+ });
54
+ return examplePaths.map((item) => {
55
+ const exampleMetaZh = fs.readFileSync(path.resolve(item, "index.zh.md")).toString();
56
+ const exampleMetaEn = fs.readFileSync(path.resolve(item, "index.en.md")).toString();
57
+ const exampleMetaZhContent = (0, import_front_matter.default)(exampleMetaZh);
58
+ const exampleMetaEnContent = (0, import_front_matter.default)(exampleMetaEn);
59
+ const example = {
60
+ demos: getExampleDemos(item),
61
+ icon: "",
62
+ id: item.split("/").pop(),
63
+ title: {
64
+ en: exampleMetaEnContent.attributes.title,
65
+ zh: exampleMetaZhContent.attributes.title
66
+ }
67
+ };
68
+ return example;
69
+ });
70
+ };
71
+ var getExamplesPageTopics = (exampleTopics) => {
72
+ return exampleTopics.map(({ id, slug, title, icon }) => {
73
+ const nid = id || slug;
74
+ let examples = [];
75
+ try {
76
+ examples = getTopicExamples(path.join(examplesBaseDir, nid));
77
+ } catch (e) {
78
+ console.warn(e);
79
+ }
80
+ return {
81
+ id: nid,
82
+ title,
83
+ icon,
84
+ examples
85
+ };
86
+ });
87
+ };
88
+ // Annotate the CommonJS export names for ESM import in node:
89
+ 0 && (module.exports = {
90
+ getExamplesPageTopics
91
+ });
@@ -0,0 +1,3 @@
1
+ import type { IApi } from 'dumi';
2
+ declare const _default: (api: IApi) => void;
3
+ export default _default;
@@ -0,0 +1,100 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/plugin/index.ts
20
+ var plugin_exports = {};
21
+ __export(plugin_exports, {
22
+ default: () => plugin_default
23
+ });
24
+ module.exports = __toCommonJS(plugin_exports);
25
+ var import_examples = require("./examples");
26
+ var import_utils = require("./utils");
27
+ var plugin_default = (api) => {
28
+ api.describe({ key: `dumi-theme:${require("../../package.json").name}` });
29
+ const pages = [
30
+ {
31
+ id: "dumi-theme-antv-example-list-zh",
32
+ path: "/examples/",
33
+ file: (0, import_utils.myResolve)("../pages/Examples/index.tsx")
34
+ },
35
+ {
36
+ id: "dumi-theme-antv-example-list-lang",
37
+ path: "/:language/examples/",
38
+ file: (0, import_utils.myResolve)("../pages/Examples/index.tsx")
39
+ },
40
+ {
41
+ id: "dumi-theme-antv-single-example-zh",
42
+ path: "/examples/:topic/:example",
43
+ file: (0, import_utils.myResolve)("../pages/Example/index.tsx")
44
+ },
45
+ {
46
+ id: "dumi-theme-antv-single-example-lang",
47
+ path: "/:language/examples/:topic/:example",
48
+ file: (0, import_utils.myResolve)("../pages/Example/index.tsx")
49
+ }
50
+ ];
51
+ const contextFilePath = (0, import_utils.myResolve)("../context.ts");
52
+ api.onGenerateFiles(() => {
53
+ api.writeTmpFile({
54
+ noPluginDir: true,
55
+ path: "theme-antv/ContextWrapper.tsx",
56
+ content: `
57
+ import React from 'react';
58
+ import { useOutlet, useSiteData } from 'dumi';
59
+ import { ThemeAntVContext } from '${contextFilePath}';
60
+
61
+ export default function ThemeAntVContextWrapper() {
62
+ const outlet = useOutlet();
63
+ // const { themeConfig } = useSiteData();
64
+ // const exampleTopics = themeConfig?.examples || [];
65
+
66
+ return (
67
+ <ThemeAntVContext.Provider
68
+ value={{
69
+ meta: ${JSON.stringify({
70
+ exampleTopics: (0, import_examples.getExamplesPageTopics)(api.config.themeConfig.examples || [])
71
+ })}
72
+ }}
73
+ >
74
+ {outlet}
75
+ </ThemeAntVContext.Provider>
76
+ );
77
+ }
78
+ `
79
+ });
80
+ });
81
+ api.addLayouts(() => ({
82
+ id: "theme-antv-context",
83
+ file: `${api.paths.absTmpPath}/theme-antv/ContextWrapper.tsx`
84
+ }));
85
+ api.modifyRoutes((routes) => {
86
+ pages.forEach((page) => {
87
+ routes[page.id] = {
88
+ id: page.id,
89
+ path: page.path,
90
+ absPath: page.path,
91
+ file: page.file,
92
+ parentId: "DocLayout"
93
+ };
94
+ });
95
+ routes["404"].file = (0, import_utils.myResolve)("../pages/404.tsx");
96
+ return routes;
97
+ });
98
+ };
99
+ // Annotate the CommonJS export names for ESM import in node:
100
+ 0 && (module.exports = {});
@@ -0,0 +1,5 @@
1
+ /**
2
+ * 自定义的 resolve 函数,优先找 tsx,如果找不到则找对应的 js 文件。
3
+ * 因为 dumi-theme-antv 编译之后,全部变成 js 文件
4
+ */
5
+ export declare function myResolve(p: string, alternateExts?: string[]): string;
@@ -0,0 +1,45 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
+
22
+ // src/plugin/utils.ts
23
+ var utils_exports = {};
24
+ __export(utils_exports, {
25
+ myResolve: () => myResolve
26
+ });
27
+ module.exports = __toCommonJS(utils_exports);
28
+ var path = __toESM(require("path"));
29
+ var fs = __toESM(require("fs"));
30
+ function myResolve(p, alternateExts = [".js"]) {
31
+ const extname2 = path.extname(p);
32
+ const pathname = p.slice(0, p.length - extname2.length);
33
+ const exts = [extname2, ...alternateExts];
34
+ for (let i = 0; i < exts.length; i++) {
35
+ const ext = exts[i];
36
+ const fullpath = `${pathname}${ext}`;
37
+ if (fs.existsSync(require.resolve(fullpath)))
38
+ return require.resolve(fullpath);
39
+ }
40
+ return "";
41
+ }
42
+ // Annotate the CommonJS export names for ESM import in node:
43
+ 0 && (module.exports = {
44
+ myResolve
45
+ });
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const NotFound: () => JSX.Element;
@@ -1,12 +1,9 @@
1
1
  import React from 'react';
2
2
  import { HomeOutlined } from '@ant-design/icons';
3
3
  import { Result, Button } from 'antd';
4
- import { Link } from 'dumi/theme';
5
-
6
- var NotFoundPage = function NotFoundPage() {
7
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Result // eslint-disable-next-line @typescript-eslint/no-explicit-any
8
- , {
9
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
4
+ import { Link } from 'dumi';
5
+ export var NotFound = function NotFound() {
6
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Result, {
10
7
  status: '404',
11
8
  title: "404",
12
9
  subTitle: "Sorry, the page you visited does not exist.",
@@ -16,6 +13,4 @@ var NotFoundPage = function NotFoundPage() {
16
13
  type: "primary"
17
14
  }, /*#__PURE__*/React.createElement(HomeOutlined, null), "Back Home"))
18
15
  }));
19
- };
20
-
21
- export default NotFoundPage;
16
+ };
@@ -4,8 +4,8 @@ import 'slick-carousel/slick/slick-theme.css';
4
4
  interface Case {
5
5
  logo?: string;
6
6
  isAppLogo?: boolean;
7
- title: string;
8
- description: string;
7
+ title: IC;
8
+ description: IC;
9
9
  link?: string;
10
10
  image: string;
11
11
  }
@@ -14,5 +14,5 @@ interface CasesProps {
14
14
  style?: React.CSSProperties;
15
15
  className?: string;
16
16
  }
17
- declare const Cases: React.FC<CasesProps>;
18
- export default Cases;
17
+ export declare const Cases: React.FC<CasesProps>;
18
+ export {};
@@ -1,28 +1,32 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
+
2
3
  import React from 'react';
3
4
  import { ArrowLeftOutlined, ArrowRightOutlined } from '@ant-design/icons';
4
- import { Link } from 'react-router-dom';
5
+ import { Link } from 'dumi';
5
6
  import Slider from 'react-slick';
6
- import classNames from 'classnames';
7
+ import cx from 'classnames';
7
8
  import 'slick-carousel/slick/slick.css';
8
- import 'slick-carousel/slick/slick-theme.css'; // @ts-ignore
9
-
10
- import styles from './Cases.module.less';
11
-
12
- var Cases = function Cases(_ref) {
9
+ import 'slick-carousel/slick/slick-theme.css';
10
+ import { useT, ic } from "../hooks";
11
+ import styles from "./index.module.less";
12
+ export var Cases = function Cases(_ref) {
13
13
  var _ref$cases = _ref.cases,
14
14
  cases = _ref$cases === void 0 ? [] : _ref$cases,
15
15
  _ref$style = _ref.style,
16
16
  style = _ref$style === void 0 ? {} : _ref$style,
17
17
  className = _ref.className;
18
- var slider;
18
+ var slider = React.useRef(null);
19
19
 
20
20
  var clickPrevious = function clickPrevious() {
21
- slider.slickPrev();
21
+ var _slider$current;
22
+
23
+ (_slider$current = slider.current) === null || _slider$current === void 0 ? void 0 : _slider$current.slickPrev();
22
24
  };
23
25
 
24
26
  var clickNext = function clickNext() {
25
- slider.slickNext();
27
+ var _slider$current2;
28
+
29
+ (_slider$current2 = slider.current) === null || _slider$current2 === void 0 ? void 0 : _slider$current2.slickNext();
26
30
  };
27
31
 
28
32
  var getCases = function getCases() {
@@ -64,17 +68,17 @@ var Cases = function Cases(_ref) {
64
68
  href: app.link,
65
69
  target: "_blank",
66
70
  rel: "noopener noreferrer"
67
- }, "\u67E5\u770B\u8BE6\u60C5") : /*#__PURE__*/React.createElement(Link, {
71
+ }, useT('查看详情')) : /*#__PURE__*/React.createElement(Link, {
68
72
  className: styles.detail,
69
73
  to: app.link ? app.link : ''
70
- }, "\u67E5\u770B\u8BE6\u60C5"));
74
+ }, useT('查看详情')));
71
75
  return /*#__PURE__*/React.createElement("div", {
72
76
  className: styles.appWrapper,
73
- key: app.title
77
+ key: ic(app.title)
74
78
  }, /*#__PURE__*/React.createElement("img", {
75
79
  className: styles.appTeaser,
76
80
  src: app.image,
77
- alt: app.title
81
+ alt: ic(app.title)
78
82
  }), /*#__PURE__*/React.createElement("div", {
79
83
  className: styles.appLeft
80
84
  }, /*#__PURE__*/React.createElement("div", {
@@ -89,9 +93,9 @@ var Cases = function Cases(_ref) {
89
93
  }
90
94
  }), /*#__PURE__*/React.createElement("p", {
91
95
  className: styles.appTitle
92
- }, app.title), /*#__PURE__*/React.createElement("p", {
96
+ }, ic(app.title)), /*#__PURE__*/React.createElement("p", {
93
97
  className: styles.appDescription
94
- }, app.description), linkDiv), buttons));
98
+ }, ic(app.description)), linkDiv), buttons));
95
99
  });
96
100
  return children;
97
101
  };
@@ -109,14 +113,10 @@ var Cases = function Cases(_ref) {
109
113
  fade: true
110
114
  };
111
115
  return /*#__PURE__*/React.createElement("div", {
112
- className: classNames(styles.wrapper, className),
116
+ className: cx(styles.wrapper, className),
113
117
  style: style
114
- }, /*#__PURE__*/React.createElement(Slider, Object.assign({}, sliderSettings, {
118
+ }, /*#__PURE__*/React.createElement(Slider, _extends({}, sliderSettings, {
115
119
  className: styles.slider,
116
- ref: function ref(c) {
117
- slider = c;
118
- }
120
+ ref: slider
119
121
  }), getCases()));
120
- };
121
-
122
- export default Cases;
122
+ };
@@ -1,4 +1,5 @@
1
- @import '../mixins';
1
+ @import '../_.less';
2
+
2
3
  .wrapper {
3
4
  height: 667px;
4
5
  margin: auto;
@@ -6,9 +7,11 @@
6
7
  padding: 0;
7
8
  overflow: hidden;
8
9
  background: rgba(250, 251, 252, 1);
10
+
9
11
  .slider {
10
12
  .container1440;
11
13
  }
14
+
12
15
  .appWrapper {
13
16
  margin-left: 5%;
14
17
  margin-bottom: 5%;
@@ -16,17 +19,21 @@
16
19
  height: 100%;
17
20
  overflow-y: hidden;
18
21
  display: flex;
22
+
19
23
  .appLeft {
20
24
  margin-left: 3.06%;
21
- width: 35%;
25
+ width: 27%;
22
26
  margin-top: 8%;
23
27
  height: 613px;
28
+
24
29
  .appContent {
25
30
  height: fit-content;
26
31
  position: relative;
32
+
27
33
  .appLogo {
28
- height: 80px;
34
+ width: 80px;
29
35
  }
36
+
30
37
  .appTitle {
31
38
  font-size: 1.2857em;
32
39
  font-weight: 500;
@@ -36,50 +43,60 @@
36
43
  color: rgba(0, 0, 0, 1);
37
44
  user-select: text;
38
45
  }
46
+
39
47
  .appDescription {
40
48
  color: rgba(105, 123, 140, 0.6);
41
49
  font-size: 1em;
42
50
  margin: 16px 0 0 0;
43
51
  user-select: text;
44
52
  }
53
+
45
54
  .detailWrapper {
46
55
  margin: 20px 0 0 0;
56
+
47
57
  .detail {
48
58
  color: @primary-color;
49
59
  font-size: 1em;
50
60
  }
51
61
  }
52
62
  }
63
+
53
64
  .buttons {
54
65
  cursor: pointer;
55
66
  position: absolute;
56
67
  display: flex;
57
68
  bottom: 30%;
58
69
  height: 100px;
70
+
59
71
  .controlButton {
60
72
  width: 47px;
61
73
  height: 47px;
62
74
  line-height: 47px;
63
75
  border: 1px solid #a3b1bf;
64
76
  transition: all 0.3s;
77
+
65
78
  &:hover {
66
79
  border: 1px solid #ced4d9;
67
80
  fill: #000000;
68
81
  }
82
+
69
83
  &:hover :only-child {
70
84
  color: #ced4d9;
71
85
  }
86
+
72
87
  .controlButtonIcon {
73
88
  width: 100%;
74
89
  color: #a3b1bf;
75
90
  transition: all 0.3s;
76
91
  }
77
92
  }
93
+
78
94
  .nextButton {
79
95
  width: 47px;
80
96
  margin-left: -1px;
81
97
  background-image: url('https://gw.alipayobjects.com/zos/basement_prod/27ce6e21-bbb6-4490-8326-43483ac39e0b.svg');
82
98
  background-size: 100% 100%;
99
+
83
100
  &:hover {
84
101
  background-image: url('https://gw.alipayobjects.com/zos/basement_prod/4d1f0d0a-4e56-4f21-a9aa-06b2f8c3e18e.svg');
85
102
  }
@@ -88,15 +105,16 @@
88
105
  }
89
106
  }
90
107
  }
108
+
91
109
  .appTeaser {
92
110
  position: absolute;
93
111
  height: 667px;
94
- left: 50%;
95
112
  right: 0;
96
113
  }
97
114
 
98
115
  .slider {
99
116
  height: 100%;
117
+
100
118
  :global {
101
119
  .slick-dots {
102
120
  display: none;
@@ -118,6 +136,7 @@
118
136
  }
119
137
  }
120
138
  }
139
+
121
140
  .appTeaser {
122
141
  position: absolute;
123
142
  width: 857px;
@@ -129,42 +148,51 @@
129
148
  .wrapper {
130
149
  width: 100%;
131
150
  height: fit-content;
151
+
132
152
  .slider {
133
153
  width: 100%;
134
154
  max-width: 100%;
135
155
  margin-left: 0;
136
156
  margin-right: 0;
137
157
  }
158
+
138
159
  .appWrapper {
139
160
  width: 100%;
140
161
  padding-bottom: 150px;
141
162
  margin-left: 0;
142
163
  flex-direction: column;
143
164
  text-align: center;
165
+
144
166
  .appLeft {
145
167
  height: 286px;
146
168
  margin-left: 4.27%;
147
169
  width: 91.47%;
148
170
  margin-top: 64px;
171
+
149
172
  .appContent {
150
173
  width: 90%;
151
174
  margin-left: 5%;
175
+
152
176
  .appLogo {
153
177
  position: absolute;
154
178
  top: -36px;
155
179
  left: 50%;
156
180
  transform: translateX(-40px);
157
181
  }
182
+
158
183
  .appTitle {
159
184
  padding-top: 76px;
160
185
  }
186
+
161
187
  .detailWrapper {
162
188
  margin-top: 40px;
189
+
163
190
  .detail {
164
191
  font-size: 1em;
165
192
  }
166
193
  }
167
194
  }
195
+
168
196
  .buttons {
169
197
  display: none;
170
198
  position: absolute;
@@ -175,6 +203,7 @@
175
203
  width: 92%;
176
204
  }
177
205
  }
206
+
178
207
  .appTeaser {
179
208
  left: 0;
180
209
  margin-top: 60px;
@@ -189,15 +218,17 @@
189
218
 
190
219
  .slider {
191
220
  height: 100%;
221
+
192
222
  :global {
193
223
  .slick-dots {
194
224
  display: block;
195
225
  bottom: 100px;
196
226
  }
227
+
197
228
  .slick-dots li.slick-active button:before {
198
229
  opacity: 1;
199
230
  color: #1890ff;
200
231
  }
201
232
  }
202
233
  }
203
- }
234
+ }
@@ -0,0 +1,67 @@
1
+ import React from 'react';
2
+ export declare enum EDITOR_TABS {
3
+ JAVASCRIPT = "JavaScript",
4
+ DATA = "Data"
5
+ }
6
+ declare type ToolbarProps = {
7
+ /**
8
+ * 源码文件,用于传入到三方代码平台
9
+ */
10
+ sourceCode: string;
11
+ /**
12
+ * 生成代码文件名后缀,用于传入到三方代码平台
13
+ */
14
+ fileExtension: string;
15
+ /**
16
+ * 项目标题,用于传入到三方代码平台
17
+ */
18
+ title: {
19
+ zh?: string;
20
+ en?: string;
21
+ } | string;
22
+ location?: Location;
23
+ /**
24
+ * playground 的一些配置项
25
+ */
26
+ playground: {
27
+ container?: string;
28
+ playgroundDidMount?: string;
29
+ playgroundWillUnmount?: string;
30
+ dependencies?: {
31
+ [key: string]: string;
32
+ };
33
+ devDependencies?: {
34
+ [key: string]: string;
35
+ };
36
+ htmlCodeTemplate?: string;
37
+ json?: {
38
+ [key: string]: any;
39
+ };
40
+ };
41
+ /**
42
+ * 全屏状态,用于显示不同的 icon
43
+ */
44
+ isFullScreen?: boolean;
45
+ /**
46
+ * Tabs 数据
47
+ */
48
+ editorTabs: EDITOR_TABS[];
49
+ /**
50
+ * 当前编辑哪个 tab
51
+ */
52
+ currentEditorTab: EDITOR_TABS;
53
+ /**
54
+ * 切换 tab
55
+ */
56
+ onEditorTabChange: (tab: EDITOR_TABS) => void;
57
+ /**
58
+ * 进入/退出全屏
59
+ */
60
+ onToggleFullscreen?: null | (() => void);
61
+ /**
62
+ * 执行代码
63
+ */
64
+ onExecuteCode: () => void;
65
+ };
66
+ export declare const Toolbar: React.FC<ToolbarProps>;
67
+ export {};