@antv/dumi-theme-antv 0.7.10 → 0.8.0-alpha.3

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 (113) hide show
  1. package/dist/builtins/Playground/index.js +1 -1
  2. package/dist/builtins/Playground/index.module.less +0 -1
  3. package/dist/common/styles/Common.js +1 -1
  4. package/dist/common/styles/theme.js +1 -1
  5. package/dist/components/AI/HomeDialog/AntVBanner/index.js +4 -0
  6. package/dist/components/AI/HomeDialog/AntVBanner/index.module.less +35 -0
  7. package/dist/components/AI/HomeDialog/ModeSelector/ModeSelectorDropdown.js +42 -0
  8. package/dist/components/AI/HomeDialog/ModeSelector/index.js +32 -0
  9. package/dist/components/AI/HomeDialog/ModeSelector/index.module.less +289 -0
  10. package/dist/components/AI/HomeDialog/PromptTextarea/ChooseLib/index.js +62 -0
  11. package/dist/components/AI/HomeDialog/PromptTextarea/ChooseLib/index.module.less +4 -0
  12. package/dist/components/AI/HomeDialog/PromptTextarea/DatasourceCard/index.js +25 -0
  13. package/dist/components/AI/HomeDialog/PromptTextarea/DatasourceCard/index.module.less +42 -0
  14. package/dist/components/AI/HomeDialog/PromptTextarea/SendButton.js +23 -0
  15. package/dist/components/AI/HomeDialog/PromptTextarea/SendButton.module.less +9 -0
  16. package/dist/components/AI/HomeDialog/PromptTextarea/Uploader/DataUploader.js +225 -0
  17. package/dist/components/AI/HomeDialog/PromptTextarea/index.js +172 -0
  18. package/dist/components/AI/HomeDialog/PromptTextarea/index.module.less +128 -0
  19. package/dist/components/AI/HomeDialog/RecommendCase/Card.js +80 -0
  20. package/dist/components/AI/HomeDialog/RecommendCase/card.module.less +131 -0
  21. package/dist/components/AI/HomeDialog/RecommendCase/index.js +130 -0
  22. package/dist/components/AI/HomeDialog/RecommendCase/index.module.less +45 -0
  23. package/dist/components/AI/HomeDialog/RecommendCase/recommend.json +66 -0
  24. package/dist/components/AI/HomeDialog/index.js +62 -0
  25. package/dist/components/AI/HomeDialog/index.module.less +3 -0
  26. package/dist/components/AI/constant.js +37 -0
  27. package/dist/components/AI/index.js +1 -0
  28. package/dist/components/AI/types.js +1 -0
  29. package/dist/components/AI/utils.js +38 -0
  30. package/dist/components/Login/Captcha/index.js +185 -0
  31. package/dist/components/Login/Captcha/index.less +91 -0
  32. package/dist/components/Login/CheckCode/index.js +244 -0
  33. package/dist/components/Login/CheckCode/index.less +137 -0
  34. package/dist/components/Login/CountDownButton/index.js +109 -0
  35. package/dist/components/Login/CountDownButton/index.less +8 -0
  36. package/dist/components/Login/LoginForm.js +239 -0
  37. package/dist/components/Login/LoginForm.less +408 -0
  38. package/dist/components/Login/index.js +24 -0
  39. package/dist/components/Login/openAuthWindow.js +54 -0
  40. package/dist/components/Login/types.js +5 -0
  41. package/dist/components/Login/utils.js +47 -0
  42. package/dist/hooks/useProducts.js +39 -0
  43. package/dist/hooks/useStreamingText.js +139 -0
  44. package/dist/hooks/useTypewriter.js +69 -0
  45. package/dist/hooks/useVisionsnapSdk.js +159 -0
  46. package/dist/layouts/DocLayout.js +2 -2
  47. package/dist/layouts/GlobalLayout/index.js +22 -0
  48. package/dist/locales/en.json +132 -1
  49. package/dist/locales/zh.json +132 -1
  50. package/dist/model/AIChat.js +313 -0
  51. package/dist/model/auth.js +147 -0
  52. package/dist/pages/AIPlayground/components/ConversationsMenu/index.js +176 -0
  53. package/dist/pages/AIPlayground/components/ConversationsMenu/index.module.less +46 -0
  54. package/dist/pages/AIPlayground/components/MarkdownComponent/MarkdownCodeBlock.js +97 -0
  55. package/dist/pages/AIPlayground/components/MarkdownComponent/MarkdownCodeBlock.module.less +13 -0
  56. package/dist/pages/AIPlayground/components/MarkdownComponent/index.js +50 -0
  57. package/dist/pages/AIPlayground/components/MsgBox/index.js +407 -0
  58. package/dist/pages/AIPlayground/components/MsgBox/index.module.less +43 -0
  59. package/dist/pages/AIPlayground/components/MsgBox/useAutoScroll.js +46 -0
  60. package/dist/pages/AIPlayground/components/SessionLayout/index.js +62 -0
  61. package/dist/pages/AIPlayground/components/SessionLayout/index.module.less +37 -0
  62. package/dist/pages/AIPlayground/components/TaskBox/generateCode.js +230 -0
  63. package/dist/pages/AIPlayground/components/TaskBox/index.js +101 -0
  64. package/dist/pages/AIPlayground/components/TaskBox/index.module.less +9 -0
  65. package/dist/pages/AIPlayground/demo.js +34 -0
  66. package/dist/pages/AIPlayground/index.js +12 -0
  67. package/dist/pages/AIPlayground/index.module.less +5 -0
  68. package/dist/pages/Examples/components/Accouncement/index.module.less +1 -1
  69. package/dist/pages/Examples/index.module.less +11 -11
  70. package/dist/pages/Index/components/Cases/index.module.less +8 -8
  71. package/dist/pages/Index/components/Companies/index.module.less +4 -3
  72. package/dist/pages/Index/components/Features/FeatureCard.module.less +4 -5
  73. package/dist/pages/Index/components/Features/index.module.less +5 -5
  74. package/dist/pages/Index/components/_.less +9 -9
  75. package/dist/pages/Index/index.js +1 -1
  76. package/dist/plugin/index.js +14 -6
  77. package/dist/slots/Banner/Notification.module.less +8 -8
  78. package/dist/slots/Banner/index.module.less +10 -9
  79. package/dist/slots/CodeEditor/Toolbar.js +23 -27
  80. package/dist/slots/CodeEditor/Toolbar.module.less +7 -0
  81. package/dist/slots/CodeEditor/index.js +67 -5
  82. package/dist/slots/CodeEditor/index.module.less +24 -0
  83. package/dist/slots/CodeEditor/utils.js +2 -1
  84. package/dist/slots/CodePreview/index.module.less +0 -3
  85. package/dist/slots/CodeRunner/index.js +24 -11
  86. package/dist/slots/ContentTable/index.module.less +2 -1
  87. package/dist/{pages/Index/components → slots}/Detail/News.js +1 -1
  88. package/dist/{pages/Index/components → slots}/Detail/News.module.less +9 -9
  89. package/dist/{pages/Index/components → slots}/Detail/index.js +13 -29
  90. package/dist/{pages/Index/components → slots}/Detail/index.module.less +23 -20
  91. package/dist/slots/ExampleSider/index.module.less +3 -4
  92. package/dist/slots/Footer/index.module.less +2 -2
  93. package/dist/slots/Header/Products/Product.module.less +2 -2
  94. package/dist/slots/Header/Products/getProducts.js +20 -26
  95. package/dist/slots/Header/Products/index.js +20 -16
  96. package/dist/slots/Header/Search/SearchResult.js +53 -14
  97. package/dist/slots/Header/Search/SearchResult.module.less +1 -0
  98. package/dist/slots/Header/Search/index.js +2 -1
  99. package/dist/slots/Header/index.js +72 -30
  100. package/dist/slots/Header/index.module.less +14 -6
  101. package/dist/slots/LiveExample/index.js +1 -1
  102. package/dist/slots/LiveExample/index.module.less +1 -1
  103. package/dist/slots/Loading/index.module.less +30 -28
  104. package/dist/slots/ManualContent/index.module.less +14 -17
  105. package/dist/slots/_.less +9 -9
  106. package/dist/static/user.svg +3 -0
  107. package/dist/typings.d.ts +11 -0
  108. package/dist/utils/analytics.js +16 -0
  109. package/dist/utils/code.js +35 -0
  110. package/dist/utils/env.js +63 -0
  111. package/dist/utils/index.js +7 -0
  112. package/dist/utils/request.js +42 -0
  113. package/package.json +31 -15
@@ -1,11 +1,11 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
2
  var _excluded = ["className", "style", "title", "engine", "description", "image", "imageStyle", "githubUrl", "showGithubStars", "buttons", "news"];
3
- 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); }
4
3
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
5
4
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
6
5
  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; }
7
6
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
8
7
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
8
+ 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); }
9
9
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
10
10
  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."); }
11
11
  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); }
@@ -20,8 +20,10 @@ import gh from 'parse-github-url';
20
20
  import React, { useEffect, useState } from 'react';
21
21
  import GitHubButton from 'react-github-button';
22
22
  import { News } from "./News";
23
- import { ic } from "../../../../slots/hooks";
23
+ import { ic } from "../hooks";
24
24
  import styles from "./index.module.less";
25
+ import { HomeDialog } from "../../components/AI/HomeDialog";
26
+ import { getBaseSiteDataUrl } from "../../utils/env";
25
27
  /**
26
28
  * Index.技术栈的描述区域!
27
29
  * 各自配置
@@ -47,7 +49,7 @@ export var Detail = function Detail(_ref) {
47
49
  setRemoteNews = _useState2[1];
48
50
  var lang = useLocale().id;
49
51
  useEffect(function () {
50
- fetch('https://assets.antv.antgroup.com/antv/banner-messages.json' // 生产环境
52
+ fetch("".concat(getBaseSiteDataUrl(), "/antv/banner-messages.json") // 生产环境
51
53
  // 'https://site-data-pre.alipay.com/antv/banner-messages.json', // 预发测试
52
54
  ).then(function (res) {
53
55
  return res.json();
@@ -67,37 +69,15 @@ export var Detail = function Detail(_ref) {
67
69
  className: styles.content
68
70
  }, /*#__PURE__*/React.createElement("div", {
69
71
  className: styles.text
72
+ }, /*#__PURE__*/React.createElement("div", {
73
+ className: styles.titleButtons
70
74
  }, /*#__PURE__*/React.createElement("div", {
71
75
  className: cx(styles.title, 'detail-title')
72
76
  }, /*#__PURE__*/React.createElement("span", {
73
77
  className: cx(styles.engine, 'detail-engine')
74
78
  }, engineText), ic(title).replace(engineText, '')), /*#__PURE__*/React.createElement("div", {
75
- className: cx(styles.description, 'detail-description')
76
- }, ic(description)), /*#__PURE__*/React.createElement("div", {
77
79
  className: cx(styles.buttons, 'detail-buttons')
78
- }, buttons.map(function (_ref2) {
79
- var type = _ref2.type,
80
- style = _ref2.style,
81
- text = _ref2.text,
82
- link = _ref2.link,
83
- shape = _ref2.shape,
84
- icon = _ref2.icon;
85
- return /*#__PURE__*/React.createElement("a", {
86
- key: ic(text),
87
- className: cx(styles.buttonLink, styles[type || ''], type === 'primary' ? 'primary-button' : 'common-button'),
88
- style: _objectSpread({
89
- borderRadius: shape === 'round' ? '1000px' : '12px'
90
- }, style),
91
- href: link[lang] ? link[lang] : link
92
- }, icon !== null && /*#__PURE__*/React.createElement("div", {
93
- className: styles.icon,
94
- style: icon ? {
95
- backgroundImage: "url(".concat(icon, ")")
96
- } : {}
97
- }), /*#__PURE__*/React.createElement("span", {
98
- className: styles.button
99
- }, ic(text)));
100
- }), showGitHubStarsButton && /*#__PURE__*/React.createElement("div", {
80
+ }, showGitHubStarsButton && /*#__PURE__*/React.createElement("div", {
101
81
  key: "github",
102
82
  className: styles.githubWrapper
103
83
  }, /*#__PURE__*/React.createElement(GitHubButton, {
@@ -105,7 +85,11 @@ export var Detail = function Detail(_ref) {
105
85
  size: "large",
106
86
  namespace: githubObj.owner,
107
87
  repo: githubObj.name
108
- })))), /*#__PURE__*/React.createElement("div", {
88
+ }))))), /*#__PURE__*/React.createElement(HomeDialog, {
89
+ style: {
90
+ margin: "140px auto"
91
+ }
92
+ }), /*#__PURE__*/React.createElement("div", {
109
93
  className: cx(styles.news, 'news')
110
94
  }, (news || remoteNews).slice(0, 3).map(function (n, i) {
111
95
  return /*#__PURE__*/React.createElement(News, _extends({
@@ -1,28 +1,35 @@
1
- @import '../../../../common/styles/variables.less';
1
+ @import '../../common/styles/variables.less';
2
2
 
3
3
  .wrapper {
4
- min-height: 650px;
5
- max-height: 803px;
6
- background: linear-gradient(225deg, #ffffff, #f0f5ff);
4
+ min-height: 1000px;
5
+ max-height: 1150px;
6
+ background: linear-gradient(225deg, #fff, #f0f5ff);
7
7
  height: calc(94vh);
8
8
  position: relative;
9
9
  overflow: hidden;
10
10
 
11
11
  .content {
12
12
  .container1440();
13
+
13
14
  height: 100%;
14
15
  position: relative;
15
16
  }
16
17
 
17
18
  .text {
18
19
  position: relative;
19
- top: 26%;
20
+ top: 12%;
20
21
  z-index: 1;
21
22
  margin-left: 4.5%;
22
23
 
24
+ .titleButtons{
25
+ display: flex;
26
+ gap: 50px;
27
+ justify-content: center;
28
+ }
29
+
23
30
  .title {
24
31
  font-size: 3.4em; //2.875em;
25
- color: rgba(0, 0, 0, 1);
32
+ color: rgba(0, 0, 0, 100%);
26
33
  position: relative;
27
34
  font-family: AlibabaPuHuiTiRHeavy;
28
35
 
@@ -33,8 +40,7 @@
33
40
 
34
41
  .description {
35
42
  margin-top: 0.83%; //12px;
36
- margin-bottom: 0px;
37
- color: rgba(106, 123, 140, 1);
43
+ margin-bottom: 0;
38
44
  font-weight: 200;
39
45
  position: relative;
40
46
  width: 40%;
@@ -46,19 +52,18 @@
46
52
  overflow: hidden;
47
53
  text-overflow: ellipsis;
48
54
  -webkit-line-clamp: 4;
49
- display: -webkit-box;
55
+ display: box;
50
56
  -webkit-box-orient: vertical;
51
57
  }
52
58
 
53
59
  .buttons {
54
60
  display: flex;
55
- margin-top: max(3%, 40px);
61
+ margin-top: 10px;
56
62
 
57
63
  .buttonLink {
58
64
  display: flex;
59
65
  align-items: center;
60
66
  justify-content: center;
61
- cursor: pointer;
62
67
  border-radius: 12px;
63
68
  z-index: 10;
64
69
  position: relative;
@@ -67,13 +72,12 @@
67
72
  height: 54px;
68
73
  min-width: 166px;
69
74
  padding: 0 10px;
70
- box-shadow: 0 8px 28px 0 rgba(0, 0, 0, 0.1);
71
75
  background-color: #691eff;
72
76
  font-size: 18px;
73
77
  cursor: pointer;
74
78
  box-shadow: 0 8px 28px 0 #f2f2f2;
75
79
  margin-right: 20px;
76
- color: #ffffff;
80
+ color: #fff;
77
81
  overflow: hidden;
78
82
 
79
83
  .icon {
@@ -88,8 +92,7 @@
88
92
  }
89
93
 
90
94
  &.primary {
91
- color: #fff;
92
- background-color: #ffffff;
95
+ background-color: #fff;
93
96
  color: #000;
94
97
  border: 1px solid #e8e8e8;
95
98
 
@@ -117,8 +120,8 @@
117
120
  display: flex;
118
121
  height: 54px;
119
122
  cursor: pointer;
120
- box-shadow: 0 8px 28px 0 rgba(0, 0, 0, 0.05);
121
- background-color: #ffffff;
123
+ box-shadow: 0 8px 28px 0 rgba(0, 0, 0, 5%);
124
+ background-color: #fff;
122
125
  border: 1px solid #e8e8e8;
123
126
  justify-content: center;
124
127
  align-items: center;
@@ -140,6 +143,7 @@
140
143
 
141
144
  .gh-btn {
142
145
  padding: 16px;
146
+
143
147
  .gh-ico {
144
148
  display: block;
145
149
  width: 20px;
@@ -166,7 +170,7 @@
166
170
  margin-left: -8px;
167
171
  color: #1d2129;
168
172
  letter-spacing: 0;
169
- font-family: AlibabaSans102-Medium;
173
+ font-family: "AlibabaSans102-Medium";
170
174
  }
171
175
  }
172
176
  }
@@ -189,8 +193,7 @@
189
193
  display: flex;
190
194
  position: absolute;
191
195
  right: 0;
192
- margin-top: -300px;
193
- width: 52%;
196
+ width: 32%;
194
197
  max-width: 598px;
195
198
  height: 324px;
196
199
  margin: auto;
@@ -11,7 +11,7 @@
11
11
  z-index: 1;
12
12
  top: 0;
13
13
  height: 100%;
14
- box-shadow: 0 0 6px 2px rgba(0, 0, 0, 0);
14
+ box-shadow: 0 0 6px 2px rgba(0, 0, 0, 0%);
15
15
  width: 1px;
16
16
  transition: all 0.3s;
17
17
  }
@@ -45,7 +45,7 @@
45
45
  user-select: none;
46
46
  background-color: #fff;
47
47
 
48
- &:after {
48
+ &::after {
49
49
  transition: all 0.3s;
50
50
  background-color: transparent;
51
51
  border: 1px solid transparent;
@@ -60,7 +60,7 @@
60
60
  &:hover {
61
61
  border-color: var(--primary-color);
62
62
 
63
- &:before {
63
+ &::before {
64
64
  transition: all 0.3s;
65
65
  content: '';
66
66
  position: absolute;
@@ -127,7 +127,6 @@
127
127
  display: inline-block;
128
128
  width: 100%;
129
129
  vertical-align: bottom;
130
-
131
130
  overflow: hidden;
132
131
  text-overflow: ellipsis;
133
132
  white-space: nowrap;
@@ -36,7 +36,7 @@
36
36
  display: flex;
37
37
  justify-content: center;
38
38
  font-size: 14px;
39
- border-bottom: 1px solid rgba(255, 255, 255, 0.25);
39
+ border-bottom: 1px solid rgba(255, 255, 255, 25%);
40
40
  margin-bottom: 16px;
41
41
  box-sizing: border-box;
42
42
  padding-bottom: 16px;
@@ -72,7 +72,7 @@
72
72
  :global(.anticon),
73
73
  a {
74
74
  margin-right: 8px;
75
- color: rgba(255, 255, 255, 0.6);
75
+ color: rgba(255, 255, 255, 60%);
76
76
  }
77
77
 
78
78
  &.light {
@@ -57,7 +57,7 @@
57
57
  ul {
58
58
  list-style: none;
59
59
  padding: 0;
60
- margin: 0 0 20px 0;
60
+ margin: 0 0 20px;
61
61
 
62
62
  &:last-child {
63
63
  margin-bottom: 32px;
@@ -87,7 +87,7 @@
87
87
  margin-bottom: 4px;
88
88
  font-size: 14px;
89
89
  line-height: 22px;
90
- color: rgba(0, 0, 0, 0.85);
90
+ color: rgba(0, 0, 0, 85%);
91
91
  transition: all 0.3s;
92
92
 
93
93
  &:hover {
@@ -34,34 +34,28 @@ export var CATEGORIES = [{
34
34
  }];
35
35
  export function getNewProducts(_ref) {
36
36
  var language = _ref.language,
37
- isChinaMirrorHost = _ref.isChinaMirrorHost;
38
- // 如需要修改产品信息,请到 https://yuyan.antfin-inc.com/antv/site-data/sprints 修改区块内容
39
- return fetch('https://assets.antv.antgroup.com/antv/products.json' // 生产环境
40
- // 'https://site-data-pre.alipay.com/antv/products.json', // 预发测试
41
- ).then(function (res) {
42
- return res.json();
43
- }).then(function (products) {
44
- return products.filter(function (d) {
45
- return d.lang === language;
46
- }).map(function (d) {
47
- var links = typeof d.links === 'string' ? JSON.parse(d.links) : _objectSpread({}, d.links);
48
- var newLinks = {};
49
- each(links, function (value, k) {
50
- var actualUrl = (value === null || value === void 0 ? void 0 : value.url) || '';
51
- if (isChinaMirrorHost) {
52
- // g2plot.antv.vision => antv-g2plot.gitee.io
53
- var match = actualUrl.match(/([http|https]):\/\/(.*)\.antv\.vision/);
54
- if (match && match[2]) {
55
- actualUrl = actualUrl.replace("".concat(match[2], ".antv.vision"), "antv-".concat(match[2], ".gitee.io"));
56
- }
37
+ isChinaMirrorHost = _ref.isChinaMirrorHost,
38
+ products = _ref.products;
39
+ return products.filter(function (d) {
40
+ return d.lang === language;
41
+ }).map(function (d) {
42
+ var links = typeof d.links === 'string' ? JSON.parse(d.links) : _objectSpread({}, d.links);
43
+ var newLinks = {};
44
+ each(links, function (value, k) {
45
+ var actualUrl = (value === null || value === void 0 ? void 0 : value.url) || '';
46
+ if (isChinaMirrorHost) {
47
+ // g2plot.antv.vision => antv-g2plot.gitee.io
48
+ var match = actualUrl.match(/([http|https]):\/\/(.*)\.antv\.vision/);
49
+ if (match && match[2]) {
50
+ actualUrl = actualUrl.replace("".concat(match[2], ".antv.vision"), "antv-".concat(match[2], ".gitee.io"));
57
51
  }
58
- newLinks[k] = _objectSpread(_objectSpread({}, value), {}, {
59
- url: actualUrl
60
- });
61
- });
62
- return _objectSpread(_objectSpread({}, d), {}, {
63
- links: newLinks
52
+ }
53
+ newLinks[k] = _objectSpread(_objectSpread({}, value), {}, {
54
+ url: actualUrl
64
55
  });
65
56
  });
57
+ return _objectSpread(_objectSpread({}, d), {}, {
58
+ links: newLinks
59
+ });
66
60
  });
67
61
  }
@@ -15,11 +15,15 @@ import { useChinaMirrorHost } from "../../hooks";
15
15
  import Product from "./Product";
16
16
  import styles from "./Product.module.less";
17
17
  import { CATEGORIES, getNewProducts } from "./getProducts";
18
+ import { useProducts } from "../../../hooks/useProducts";
18
19
  export var Products = function Products(_ref) {
19
20
  var show = _ref.show,
20
21
  language = _ref.language,
21
22
  className = _ref.className,
22
23
  bannerVisible = _ref.bannerVisible;
24
+ var _useProducts = useProducts(),
25
+ _useProducts$data = _useProducts.data,
26
+ products = _useProducts$data === void 0 ? [] : _useProducts$data;
23
27
  var locale = useLocale();
24
28
  var _useChinaMirrorHost = useChinaMirrorHost(),
25
29
  _useChinaMirrorHost2 = _slicedToArray(_useChinaMirrorHost, 1),
@@ -30,24 +34,24 @@ export var Products = function Products(_ref) {
30
34
  setProducts = _React$useState2[1];
31
35
  var lang = locale.id === 'zh' ? 'zh' : 'en';
32
36
  React.useEffect(function () {
33
- getNewProducts({
37
+ var data = getNewProducts({
34
38
  language: lang,
35
- isChinaMirrorHost: isChinaMirrorHost
36
- }).then(function (data) {
37
- var newProducts = CATEGORIES.map(function (_ref2) {
38
- var name = _ref2.name,
39
- type = _ref2.type;
40
- return {
41
- name: name,
42
- type: type,
43
- products: data.filter(function (item) {
44
- return item.category === type;
45
- })
46
- };
47
- });
48
- setProducts(newProducts);
39
+ isChinaMirrorHost: isChinaMirrorHost,
40
+ products: products
41
+ });
42
+ var newProducts = CATEGORIES.map(function (_ref2) {
43
+ var name = _ref2.name,
44
+ type = _ref2.type;
45
+ return {
46
+ name: name,
47
+ type: type,
48
+ products: data.filter(function (item) {
49
+ return item.category === type;
50
+ })
51
+ };
49
52
  });
50
- }, [lang, isChinaMirrorHost]);
53
+ setProducts(newProducts);
54
+ }, [lang, isChinaMirrorHost, products.length]);
51
55
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
52
56
  className: cx(styles.products, className, _defineProperty(_defineProperty({}, styles.show, !!show), styles.bannerVisible, !!bannerVisible))
53
57
  }, /*#__PURE__*/React.createElement("div", {
@@ -1,7 +1,10 @@
1
- import { InboxOutlined } from '@ant-design/icons';
2
- import { useIntl } from 'dumi';
1
+ import { useIntl, useSiteData } from 'dumi';
3
2
  import React from 'react';
4
3
  import styles from "./SearchResult.module.less";
4
+ import classnames from "classnames";
5
+ import { AIChatStore, createNewSession } from "../../../model/AIChat";
6
+ import { authStore, showLoginModal } from "../../../model/auth";
7
+ import { useSnapshot } from "valtio";
5
8
  var getHighlightInfo = function getHighlightInfo(textSegments) {
6
9
  return /*#__PURE__*/React.createElement(React.Fragment, null, textSegments.map(function (segment) {
7
10
  return /*#__PURE__*/React.createElement("span", {
@@ -15,13 +18,57 @@ var getHighlightInfo = function getHighlightInfo(textSegments) {
15
18
  * @returns
16
19
  */
17
20
  export var SearchResult = function SearchResult(_ref) {
18
- var results = _ref.results;
21
+ var results = _ref.results,
22
+ keywords = _ref.keywords;
23
+ var _useSiteData = useSiteData(),
24
+ themeConfig = _useSiteData.themeConfig;
19
25
  var intl = useIntl();
26
+ var authSnap = useSnapshot(authStore);
27
+ function pureSearch() {
28
+ AIChatStore.mode = 'solve';
29
+ createNewSession({
30
+ promptText: keywords,
31
+ mode: 'solve',
32
+ lib: !themeConfig.isAntVSite ? themeConfig.title : undefined,
33
+ jump: true,
34
+ lang: intl.locale === 'zh' ? 'zh' : 'en',
35
+ entry_point: 'SearchResult'
36
+ });
37
+ }
20
38
  return /*#__PURE__*/React.createElement("div", {
21
39
  className: styles.searchResult
22
- }, results !== null && results !== void 0 && results.length ? results.map(function (r) {
40
+ }, /*#__PURE__*/React.createElement("div", {
41
+ className: styles.item
42
+ }, /*#__PURE__*/React.createElement("div", {
43
+ className: styles.subject
44
+ }, /*#__PURE__*/React.createElement("img", {
45
+ src: "https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*7svFR6wkPMoAAAAAAAAAAAAADmJ7AQ/original",
46
+ alt: "AntV"
47
+ })), /*#__PURE__*/React.createElement("div", {
48
+ className: styles.br
49
+ }), /*#__PURE__*/React.createElement("a", {
50
+ className: styles.result,
51
+ onClick: function onClick() {
52
+ if (!authSnap.isAuthenticated) {
53
+ showLoginModal(pureSearch);
54
+ return;
55
+ }
56
+ pureSearch();
57
+ }
58
+ }, /*#__PURE__*/React.createElement("div", {
59
+ className: classnames(styles.title, styles.highlighted)
60
+ }, keywords), /*#__PURE__*/React.createElement("div", {
61
+ className: styles.description
62
+ }, intl.formatMessage({
63
+ id: 'ai.search.try'
64
+ }), "\xA0", /*#__PURE__*/React.createElement("span", {
65
+ className: styles.highlighted
66
+ }, "AI"), "\xA0", intl.formatMessage({
67
+ id: 'ai.search.visualization'
68
+ })))), results !== null && results !== void 0 && results.length ? results.map(function (r, index) {
23
69
  return /*#__PURE__*/React.createElement("div", {
24
- className: styles.item
70
+ className: styles.item,
71
+ key: index
25
72
  }, /*#__PURE__*/React.createElement("div", {
26
73
  className: styles.subject
27
74
  }, r.subject), /*#__PURE__*/React.createElement("div", {
@@ -34,13 +81,5 @@ export var SearchResult = function SearchResult(_ref) {
34
81
  }, getHighlightInfo(r.title)), /*#__PURE__*/React.createElement("div", {
35
82
  className: styles.description
36
83
  }, getHighlightInfo(r.description))));
37
- }) : /*#__PURE__*/React.createElement("div", {
38
- className: styles.empty
39
- }, /*#__PURE__*/React.createElement(InboxOutlined, {
40
- style: {
41
- fontSize: 20
42
- }
43
- }), /*#__PURE__*/React.createElement("div", null, intl.formatMessage({
44
- id: '没有找到查询结果'
45
- }))));
84
+ }) : /*#__PURE__*/React.createElement(React.Fragment, null));
46
85
  };
@@ -51,6 +51,7 @@
51
51
  color: rgb(160, 161, 167);
52
52
  max-height: 55px;
53
53
  overflow: hidden;
54
+
54
55
  .segment {
55
56
  padding-left: 1px;
56
57
  padding-right: 1px;
@@ -58,7 +58,8 @@ export var Search = function Search() {
58
58
  placement: "topLeft",
59
59
  destroyTooltipOnHide: false,
60
60
  content: /*#__PURE__*/React.createElement(SearchResult, {
61
- results: searchResults
61
+ results: searchResults,
62
+ keywords: keywords
62
63
  })
63
64
  }, /*#__PURE__*/React.createElement("label", {
64
65
  className: styles.search