@antv/dumi-theme-antv 0.3.5 → 0.3.6
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.
- package/dist/builtins/Playground/index.js +14 -26
- package/dist/layouts/DocLayout.js +17 -20
- package/dist/layouts/entry/API.js +0 -1
- package/dist/layouts/entry/Index.js +27 -31
- package/dist/layouts/entry/Manual.js +0 -1
- package/dist/pages/404.js +1 -2
- package/dist/pages/Example/index.js +19 -37
- package/dist/pages/Examples/components/Accouncement/index.js +9 -13
- package/dist/pages/Examples/components/ExampleTopicMenu/components/LeftMenu/index.js +9 -20
- package/dist/pages/Examples/components/ExampleTopicMenu/index.js +6 -14
- package/dist/pages/Examples/components/GalleryPageContent/DemoCard/index.js +3 -5
- package/dist/pages/Examples/components/GalleryPageContent/index.js +8 -6
- package/dist/pages/Examples/index.js +8 -19
- package/dist/plugin/examples.js +5 -0
- package/dist/plugin/index.js +6 -0
- package/dist/plugin/utils.js +4 -0
- package/dist/slots/Article/index.js +0 -2
- package/dist/slots/Banner/Notification.js +6 -10
- package/dist/slots/Banner/index.js +24 -46
- package/dist/slots/Cases/index.js +4 -13
- package/dist/slots/CodeEditor/Toolbar.js +26 -36
- package/dist/slots/CodeEditor/index.js +66 -76
- package/dist/slots/CodeEditor/utils.js +28 -43
- package/dist/slots/CodePreview/CodeHeader.js +4 -4
- package/dist/slots/CodePreview/index.js +4 -6
- package/dist/slots/CodeRunner/index.js +22 -33
- package/dist/slots/CodeRunner/utils.js +5 -6
- package/dist/slots/Companies/index.js +4 -4
- package/dist/slots/ContentTable/index.js +1 -1
- package/dist/slots/Detail/News.js +6 -8
- package/dist/slots/Detail/index.js +25 -34
- package/dist/slots/ExampleSider/index.js +36 -43
- package/dist/slots/Features/FeatureCard.js +2 -4
- package/dist/slots/Features/index.js +7 -11
- package/dist/slots/Footer/index.js +13 -19
- package/dist/slots/Header/Logo.js +1 -1
- package/dist/slots/Header/LogoWhite.js +1 -1
- package/dist/slots/Header/Navs.js +8 -11
- package/dist/slots/Header/Products/NavigatorBanner.js +2 -8
- package/dist/slots/Header/Products/Product.js +9 -13
- package/dist/slots/Header/Products/getProducts.js +5 -11
- package/dist/slots/Header/Products/index.js +14 -22
- package/dist/slots/Header/Search.js +15 -20
- package/dist/slots/Header/index.js +93 -130
- package/dist/slots/Header/utils.js +2 -3
- package/dist/slots/Loading/index.js +1 -3
- package/dist/slots/ManualContent/NavigatorBanner.js +2 -7
- package/dist/slots/ManualContent/ReadingTime.js +0 -2
- package/dist/slots/ManualContent/index.js +51 -86
- package/dist/slots/ManualContent/utils.js +7 -13
- package/dist/slots/SEO.js +8 -10
- package/dist/slots/global.js +2 -1
- package/dist/slots/hooks.js +17 -29
- package/dist/slots/utils.js +32 -57
- package/package.json +1 -1
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
-
|
|
3
2
|
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."); }
|
|
4
|
-
|
|
5
3
|
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); }
|
|
6
|
-
|
|
7
|
-
function
|
|
8
|
-
|
|
9
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
10
|
-
|
|
4
|
+
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; }
|
|
5
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
11
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
-
|
|
13
7
|
import React from 'react';
|
|
14
8
|
import { useContext, useEffect } from 'react';
|
|
15
9
|
import { useNavigate } from 'react-router-dom';
|
|
@@ -26,33 +20,29 @@ import { GalleryPageContent } from "./components/GalleryPageContent";
|
|
|
26
20
|
import { usePrevAndNext } from "../../slots/hooks";
|
|
27
21
|
import { ThemeAntVContext } from "../../context";
|
|
28
22
|
import styles from "./index.module.less";
|
|
23
|
+
|
|
29
24
|
/**
|
|
30
25
|
* Examples 页面
|
|
31
26
|
*
|
|
32
27
|
* @author YuZhanglong <loveyzl1123@gmail.com>
|
|
33
28
|
*/
|
|
34
|
-
|
|
35
29
|
var Example = function Example() {
|
|
36
30
|
var nav = useNavigate();
|
|
37
31
|
var locale = useLocale();
|
|
38
32
|
/** 示例页面的元数据信息 */
|
|
39
|
-
|
|
40
33
|
var metaData = useContext(ThemeAntVContext);
|
|
41
34
|
var exampleTopics = metaData.meta.exampleTopics;
|
|
42
|
-
|
|
43
35
|
var _usePrevAndNext = usePrevAndNext(),
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
36
|
+
_usePrevAndNext2 = _slicedToArray(_usePrevAndNext, 2),
|
|
37
|
+
prev = _usePrevAndNext2[0],
|
|
38
|
+
next = _usePrevAndNext2[1];
|
|
48
39
|
var title = {
|
|
49
40
|
zh: '所有图表',
|
|
50
41
|
en: "Gallery"
|
|
51
|
-
};
|
|
52
|
-
|
|
42
|
+
};
|
|
43
|
+
// 为 zh 做兜底
|
|
53
44
|
useEffect(function () {
|
|
54
45
|
var p = window.location.pathname;
|
|
55
|
-
|
|
56
46
|
if (p.includes('/zh/')) {
|
|
57
47
|
nav(p.replace('/zh/', '/'));
|
|
58
48
|
}
|
|
@@ -91,5 +81,4 @@ var Example = function Example() {
|
|
|
91
81
|
isDynamicFooter: true
|
|
92
82
|
}));
|
|
93
83
|
};
|
|
94
|
-
|
|
95
84
|
export default Example;
|
package/dist/plugin/examples.js
CHANGED
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -62,6 +66,7 @@ var getTopicExamples = (topicPath) => {
|
|
|
62
66
|
const exampleMetaEnContent = (0, import_front_matter.default)(exampleMetaEn);
|
|
63
67
|
const example = {
|
|
64
68
|
demos: getExampleDemos(item),
|
|
69
|
+
// 二级暂时无须 ICON,保留
|
|
65
70
|
icon: "",
|
|
66
71
|
id: item.split("/").pop(),
|
|
67
72
|
title: {
|
package/dist/plugin/index.js
CHANGED
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -54,6 +58,7 @@ var plugin_default = (api) => {
|
|
|
54
58
|
id: "dumi-theme-antv-zh-homepage",
|
|
55
59
|
absPath: "/zh/"
|
|
56
60
|
},
|
|
61
|
+
// Examples gallery page.
|
|
57
62
|
{
|
|
58
63
|
id: "dumi-theme-antv-example-list-zh",
|
|
59
64
|
absPath: "/examples",
|
|
@@ -64,6 +69,7 @@ var plugin_default = (api) => {
|
|
|
64
69
|
absPath: "/:language/examples",
|
|
65
70
|
file: (0, import_utils.myResolve)("../pages/Examples/index.tsx")
|
|
66
71
|
},
|
|
72
|
+
// single example preview page.
|
|
67
73
|
{
|
|
68
74
|
id: "dumi-theme-antv-single-example-zh",
|
|
69
75
|
absPath: "/examples/:topic/:example",
|
package/dist/plugin/utils.js
CHANGED
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Layout } from 'antd';
|
|
3
3
|
import styles from "./index.module.less";
|
|
4
|
-
|
|
5
4
|
var Article = function Article(props) {
|
|
6
5
|
return /*#__PURE__*/React.createElement(Layout.Content, {
|
|
7
6
|
className: styles.article
|
|
8
7
|
}, /*#__PURE__*/React.createElement("article", props));
|
|
9
8
|
};
|
|
10
|
-
|
|
11
9
|
export default Article;
|
|
@@ -2,15 +2,14 @@ import React from 'react';
|
|
|
2
2
|
import { Link } from 'dumi';
|
|
3
3
|
import styles from "./Notification.module.less";
|
|
4
4
|
var numberImages = ['https://gw.alipayobjects.com/zos/antfincdn/IqREAm36K7/1.png', 'https://gw.alipayobjects.com/zos/antfincdn/3fG1Iqjfnz/2.png'];
|
|
5
|
-
|
|
6
5
|
var Notification = function Notification(_ref) {
|
|
7
6
|
var _ref$index = _ref.index,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
index = _ref$index === void 0 ? 0 : _ref$index,
|
|
8
|
+
type = _ref.type,
|
|
9
|
+
title = _ref.title,
|
|
10
|
+
date = _ref.date,
|
|
11
|
+
_ref$link = _ref.link,
|
|
12
|
+
link = _ref$link === void 0 ? '' : _ref$link;
|
|
14
13
|
var children = /*#__PURE__*/React.createElement("div", {
|
|
15
14
|
className: styles.container
|
|
16
15
|
}, /*#__PURE__*/React.createElement("img", {
|
|
@@ -24,7 +23,6 @@ var Notification = function Notification(_ref) {
|
|
|
24
23
|
}, type, " \u2027 ", title), /*#__PURE__*/React.createElement("p", {
|
|
25
24
|
className: styles.date
|
|
26
25
|
}, date)));
|
|
27
|
-
|
|
28
26
|
if (link.startsWith('http')) {
|
|
29
27
|
return /*#__PURE__*/React.createElement("a", {
|
|
30
28
|
href: link,
|
|
@@ -33,11 +31,9 @@ var Notification = function Notification(_ref) {
|
|
|
33
31
|
className: styles.notification
|
|
34
32
|
}, children);
|
|
35
33
|
}
|
|
36
|
-
|
|
37
34
|
return /*#__PURE__*/React.createElement(Link, {
|
|
38
35
|
to: link,
|
|
39
36
|
className: styles.notification
|
|
40
37
|
}, children);
|
|
41
38
|
};
|
|
42
|
-
|
|
43
39
|
export default Notification;
|
|
@@ -1,23 +1,16 @@
|
|
|
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); }
|
|
1
2
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
|
-
|
|
3
3
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
-
|
|
5
|
-
function
|
|
6
|
-
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
7
|
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); }
|
|
8
|
-
|
|
9
8
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
10
|
-
|
|
11
9
|
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."); }
|
|
12
|
-
|
|
13
10
|
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); }
|
|
14
|
-
|
|
15
|
-
function
|
|
16
|
-
|
|
17
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
18
|
-
|
|
11
|
+
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; }
|
|
12
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
19
13
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
20
|
-
|
|
21
14
|
import React, { useEffect, useState } from 'react';
|
|
22
15
|
import { Modal } from 'antd';
|
|
23
16
|
import { CaretRightOutlined } from '@ant-design/icons';
|
|
@@ -30,34 +23,30 @@ import Notification from "./Notification";
|
|
|
30
23
|
import 'video-react/dist/video-react.css';
|
|
31
24
|
import styles from "./index.module.less";
|
|
32
25
|
var backLeftBottom = 'https://gw.alipayobjects.com/zos/basement_prod/441d5eaf-e623-47cd-b9b9-2a581d9ce1e3.svg';
|
|
33
|
-
|
|
34
26
|
var Banner = function Banner(_ref) {
|
|
35
27
|
var coverImage = _ref.coverImage,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
28
|
+
title = _ref.title,
|
|
29
|
+
description = _ref.description,
|
|
30
|
+
notifications = _ref.notifications,
|
|
31
|
+
_ref$style = _ref.style,
|
|
32
|
+
style = _ref$style === void 0 ? {} : _ref$style,
|
|
33
|
+
className = _ref.className,
|
|
34
|
+
video = _ref.video,
|
|
35
|
+
_ref$showGithubStars = _ref.showGithubStars,
|
|
36
|
+
showGithubStars = _ref$showGithubStars === void 0 ? true : _ref$showGithubStars,
|
|
37
|
+
_ref$buttons = _ref.buttons,
|
|
38
|
+
buttons = _ref$buttons === void 0 ? [] : _ref$buttons,
|
|
39
|
+
onCloseVideo = _ref.onCloseVideo,
|
|
40
|
+
onPlayVideo = _ref.onPlayVideo;
|
|
49
41
|
var locale = useLocale();
|
|
50
42
|
var lang = locale.id.includes('zh') ? 'zh' : 'en';
|
|
51
43
|
var notificationsUrl = "https://my-json-server.typicode.com/antvis/antvis-sites-data/notifications?lang=".concat(lang);
|
|
52
|
-
|
|
53
44
|
var _useState = useState([]),
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
45
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
46
|
+
remoteNews = _useState2[0],
|
|
47
|
+
setRemoteNews = _useState2[1];
|
|
58
48
|
var _useSiteData = useSiteData(),
|
|
59
|
-
|
|
60
|
-
|
|
49
|
+
themeConfig = _useSiteData.themeConfig;
|
|
61
50
|
var githubUrl = themeConfig.githubUrl;
|
|
62
51
|
useEffect(function () {
|
|
63
52
|
fetch(notificationsUrl).then(function (res) {
|
|
@@ -72,12 +61,10 @@ var Banner = function Banner(_ref) {
|
|
|
72
61
|
key: i
|
|
73
62
|
}, notification));
|
|
74
63
|
});
|
|
75
|
-
|
|
76
64
|
var showVideo = function showVideo() {
|
|
77
65
|
if (onPlayVideo) {
|
|
78
66
|
onPlayVideo();
|
|
79
67
|
}
|
|
80
|
-
|
|
81
68
|
Modal.info({
|
|
82
69
|
title: 'This is a notification message',
|
|
83
70
|
className: styles.videoModal,
|
|
@@ -90,24 +77,20 @@ var Banner = function Banner(_ref) {
|
|
|
90
77
|
width: '70%'
|
|
91
78
|
});
|
|
92
79
|
};
|
|
93
|
-
|
|
94
80
|
var renderButtons = buttons.map(function (button, i) {
|
|
95
81
|
var ButtonLink = button.link.startsWith('http') || button.link.startsWith('#') ? 'a' : Link;
|
|
96
82
|
var buttonProps = {};
|
|
97
|
-
|
|
98
83
|
if (button.link.startsWith('http')) {
|
|
99
84
|
buttonProps.target = '_blank';
|
|
100
85
|
buttonProps.rel = 'noopener noreferrer';
|
|
101
86
|
}
|
|
102
|
-
|
|
103
87
|
if (ButtonLink === 'a') {
|
|
104
88
|
buttonProps.href = button.link;
|
|
105
89
|
} else {
|
|
106
90
|
buttonProps.to = button.link;
|
|
107
91
|
}
|
|
108
|
-
|
|
109
92
|
var _button$shape = button.shape,
|
|
110
|
-
|
|
93
|
+
shape = _button$shape === void 0 ? 'round' : _button$shape;
|
|
111
94
|
return /*#__PURE__*/React.createElement(ButtonLink, _extends({}, buttonProps, {
|
|
112
95
|
className: classNames(styles.buttonLink, styles[button.type || ''], button.type === 'primary' ? 'primary-button' : 'common-button'),
|
|
113
96
|
key: i,
|
|
@@ -118,7 +101,6 @@ var Banner = function Banner(_ref) {
|
|
|
118
101
|
className: styles.button
|
|
119
102
|
}, button.text));
|
|
120
103
|
});
|
|
121
|
-
|
|
122
104
|
if (video) {
|
|
123
105
|
renderButtons.push( /*#__PURE__*/React.createElement("div", {
|
|
124
106
|
key: "video",
|
|
@@ -138,10 +120,8 @@ var Banner = function Banner(_ref) {
|
|
|
138
120
|
id: "\u77E5\u6E90\u30FB\u81F4\u8FDC"
|
|
139
121
|
})))));
|
|
140
122
|
}
|
|
141
|
-
|
|
142
123
|
if (showGithubStars) {
|
|
143
124
|
var githubObj = gh(githubUrl);
|
|
144
|
-
|
|
145
125
|
if (githubObj && githubObj.owner && githubObj.name) {
|
|
146
126
|
renderButtons.push( /*#__PURE__*/React.createElement("div", {
|
|
147
127
|
key: "github",
|
|
@@ -154,7 +134,6 @@ var Banner = function Banner(_ref) {
|
|
|
154
134
|
})));
|
|
155
135
|
}
|
|
156
136
|
}
|
|
157
|
-
|
|
158
137
|
return /*#__PURE__*/React.createElement("section", {
|
|
159
138
|
className: classNames(styles.wrapper, className),
|
|
160
139
|
style: style
|
|
@@ -180,5 +159,4 @@ var Banner = function Banner(_ref) {
|
|
|
180
159
|
alt: "back"
|
|
181
160
|
})));
|
|
182
161
|
};
|
|
183
|
-
|
|
184
162
|
export default Banner;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
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
|
-
|
|
3
2
|
import React from 'react';
|
|
4
3
|
import { ArrowLeftOutlined, ArrowRightOutlined } from '@ant-design/icons';
|
|
5
4
|
import { Link, FormattedMessage } from 'dumi';
|
|
@@ -12,28 +11,22 @@ import 'slick-carousel/slick/slick-theme.css';
|
|
|
12
11
|
import styles from "./index.module.less";
|
|
13
12
|
export var Cases = function Cases(_ref) {
|
|
14
13
|
var _ref$cases = _ref.cases,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
cases = _ref$cases === void 0 ? [] : _ref$cases,
|
|
15
|
+
_ref$style = _ref.style,
|
|
16
|
+
style = _ref$style === void 0 ? {} : _ref$style,
|
|
17
|
+
className = _ref.className;
|
|
19
18
|
var lang = useLocale().id;
|
|
20
19
|
var slider = React.useRef(null);
|
|
21
|
-
|
|
22
20
|
var clickPrevious = function clickPrevious() {
|
|
23
21
|
var _slider$current;
|
|
24
|
-
|
|
25
22
|
(_slider$current = slider.current) === null || _slider$current === void 0 ? void 0 : _slider$current.slickPrev();
|
|
26
23
|
};
|
|
27
|
-
|
|
28
24
|
var clickNext = function clickNext() {
|
|
29
25
|
var _slider$current2;
|
|
30
|
-
|
|
31
26
|
(_slider$current2 = slider.current) === null || _slider$current2 === void 0 ? void 0 : _slider$current2.slickNext();
|
|
32
27
|
};
|
|
33
|
-
|
|
34
28
|
var getCases = function getCases() {
|
|
35
29
|
var buttons;
|
|
36
|
-
|
|
37
30
|
if (cases.length > 1) {
|
|
38
31
|
buttons = /*#__PURE__*/React.createElement("div", {
|
|
39
32
|
className: styles.buttons
|
|
@@ -58,7 +51,6 @@ export var Cases = function Cases(_ref) {
|
|
|
58
51
|
}
|
|
59
52
|
})));
|
|
60
53
|
}
|
|
61
|
-
|
|
62
54
|
var children = cases.map(function (app) {
|
|
63
55
|
var linkDiv = /*#__PURE__*/React.createElement("div", {
|
|
64
56
|
className: styles.detailWrapper,
|
|
@@ -105,7 +97,6 @@ export var Cases = function Cases(_ref) {
|
|
|
105
97
|
});
|
|
106
98
|
return children;
|
|
107
99
|
};
|
|
108
|
-
|
|
109
100
|
var sliderSettings = {
|
|
110
101
|
dots: cases.length > 1,
|
|
111
102
|
infinite: true,
|
|
@@ -1,23 +1,15 @@
|
|
|
1
1
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
-
|
|
3
2
|
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."); }
|
|
4
|
-
|
|
5
3
|
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); }
|
|
6
|
-
|
|
7
|
-
function
|
|
8
|
-
|
|
9
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
10
|
-
|
|
4
|
+
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; }
|
|
5
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
11
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
-
|
|
13
7
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
14
|
-
|
|
15
8
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
16
|
-
|
|
17
|
-
function
|
|
18
|
-
|
|
9
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
10
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
11
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
19
12
|
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); }
|
|
20
|
-
|
|
21
13
|
import React, { useEffect, useState } from 'react';
|
|
22
14
|
import { CodeSandboxOutlined, PlayCircleOutlined, ThunderboltOutlined } from '@ant-design/icons';
|
|
23
15
|
import { Typography, Tooltip } from 'antd';
|
|
@@ -29,43 +21,41 @@ import { extractImportDeps, getCodeSandboxConfig, getStackblitzConfig, getRiddle
|
|
|
29
21
|
import styles from "./Toolbar.module.less";
|
|
30
22
|
var Paragraph = Typography.Paragraph;
|
|
31
23
|
export var EDITOR_TABS;
|
|
32
|
-
|
|
33
24
|
(function (EDITOR_TABS) {
|
|
34
25
|
EDITOR_TABS["JAVASCRIPT"] = "JavaScript";
|
|
35
26
|
EDITOR_TABS["DATA"] = "Data";
|
|
36
27
|
})(EDITOR_TABS || (EDITOR_TABS = {}));
|
|
37
|
-
|
|
38
28
|
export var Toolbar = function Toolbar(_ref) {
|
|
39
29
|
var sourceCode = _ref.sourceCode,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
30
|
+
fileExtension = _ref.fileExtension,
|
|
31
|
+
_ref$playground = _ref.playground,
|
|
32
|
+
playground = _ref$playground === void 0 ? {} : _ref$playground,
|
|
33
|
+
location = _ref.location,
|
|
34
|
+
_ref$title = _ref.title,
|
|
35
|
+
title = _ref$title === void 0 ? '' : _ref$title,
|
|
36
|
+
_ref$isFullScreen = _ref.isFullScreen,
|
|
37
|
+
isFullScreen = _ref$isFullScreen === void 0 ? false : _ref$isFullScreen,
|
|
38
|
+
editorTabs = _ref.editorTabs,
|
|
39
|
+
currentEditorTab = _ref.currentEditorTab,
|
|
40
|
+
onEditorTabChange = _ref.onEditorTabChange,
|
|
41
|
+
_ref$onToggleFullscre = _ref.onToggleFullscreen,
|
|
42
|
+
onToggleFullscreen = _ref$onToggleFullscre === void 0 ? null : _ref$onToggleFullscre,
|
|
43
|
+
onExecuteCode = _ref.onExecuteCode;
|
|
54
44
|
var locale = useLocale();
|
|
55
|
-
var exampleTitle = _typeof(title) === 'object' ? title[locale.id] : title;
|
|
45
|
+
var exampleTitle = _typeof(title) === 'object' ? title[locale.id] : title;
|
|
56
46
|
|
|
47
|
+
// 使用 playground.dependencies 定义的版本号
|
|
57
48
|
var dependencies = _objectSpread(_objectSpread({}, extractImportDeps(sourceCode)), playground.dependencies);
|
|
58
|
-
|
|
59
49
|
var devDependencies = playground.devDependencies || {};
|
|
60
50
|
var codeSandboxConfig = getCodeSandboxConfig(exampleTitle, sourceCode, fileExtension, dependencies, devDependencies, playground);
|
|
61
51
|
var riddlePrefillConfig = getRiddleConfig(exampleTitle, sourceCode, fileExtension, dependencies, devDependencies, playground);
|
|
62
|
-
var stackblitzPrefillConfig = getStackblitzConfig(exampleTitle, sourceCode, fileExtension, dependencies, devDependencies, playground);
|
|
52
|
+
var stackblitzPrefillConfig = getStackblitzConfig(exampleTitle, sourceCode, fileExtension, dependencies, devDependencies, playground);
|
|
53
|
+
// const htmlCode = getHtmlCodeTemplate(exampleTitle, sourceCode, fileExtension, dependencies, devDependencies, playground);
|
|
63
54
|
|
|
64
55
|
var _useState = useState(false),
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
56
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
57
|
+
riddleVisible = _useState2[0],
|
|
58
|
+
updateRiddleVisible = _useState2[1];
|
|
69
59
|
useEffect(function () {
|
|
70
60
|
ping().then(function (status) {
|
|
71
61
|
return updateRiddleVisible(status === 'responded');
|