@antv/dumi-theme-antv 0.7.9 → 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 +13 -13
  70. package/dist/pages/Index/components/Cases/index.module.less +9 -9
  71. package/dist/pages/Index/components/Companies/index.module.less +5 -4
  72. package/dist/pages/Index/components/Features/FeatureCard.module.less +4 -5
  73. package/dist/pages/Index/components/Features/index.module.less +6 -6
  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 +11 -10
  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 +24 -21
  91. package/dist/slots/ExampleSider/index.module.less +3 -4
  92. package/dist/slots/Footer/index.module.less +3 -3
  93. package/dist/slots/Header/Products/Product.module.less +3 -3
  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 +15 -7
  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 +33 -17
@@ -0,0 +1,16 @@
1
+ /**
2
+ * 统一的事件跟踪函数
3
+ * @param {string} eventName - 事件名称,如 'button_click'
4
+ * @param {object} params - 事件相关的参数
5
+ */
6
+ export var trackEvent = function trackEvent(eventName) {
7
+ var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
8
+ if (typeof window === 'undefined') {
9
+ return false;
10
+ }
11
+ if (window.gtag) {
12
+ window.gtag('event', eventName, params);
13
+ } else {
14
+ console.warn('[Analytics] gtag is not available.');
15
+ }
16
+ };
@@ -0,0 +1,35 @@
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
+ function _wrapRegExp() { _wrapRegExp = function _wrapRegExp(e, r) { return new BabelRegExp(e, void 0, r); }; var e = RegExp.prototype, r = new WeakMap(); function BabelRegExp(e, t, p) { var o = new RegExp(e, t); return r.set(o, p || r.get(e)), _setPrototypeOf(o, BabelRegExp.prototype); } function buildGroups(e, t) { var p = r.get(t); return Object.keys(p).reduce(function (r, t) { var o = p[t]; if ("number" == typeof o) r[t] = e[o];else { for (var i = 0; void 0 === e[o[i]] && i + 1 < o.length;) i++; r[t] = e[o[i]]; } return r; }, Object.create(null)); } return _inherits(BabelRegExp, RegExp), BabelRegExp.prototype.exec = function (r) { var t = e.exec.call(this, r); if (t) { t.groups = buildGroups(t, this); var p = t.indices; p && (p.groups = buildGroups(p, this)); } return t; }, BabelRegExp.prototype[Symbol.replace] = function (t, p) { if ("string" == typeof p) { var o = r.get(this); return e[Symbol.replace].call(this, t, p.replace(/\$<([^>]+)>/g, function (e, r) { var t = o[r]; return "$" + (Array.isArray(t) ? t.join("$") : t); })); } if ("function" == typeof p) { var i = this; return e[Symbol.replace].call(this, t, function () { var e = arguments; return "object" != _typeof(e[e.length - 1]) && (e = [].slice.call(e)).push(buildGroups(e, i)), p.apply(this, e); }); } return e[Symbol.replace].call(this, t, p); }, _wrapRegExp.apply(this, arguments); }
3
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
4
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
5
+ export function isPreviewable(str) {
6
+ if (typeof str !== 'string') {
7
+ return false;
8
+ }
9
+ var trimmedStr = str.trim();
10
+
11
+ // \b 是一个“单词边界”,确保我们匹配的是完整的 "import" 单词
12
+ // 而不是 "important" 的一部分
13
+ var hasImportStatement = /\bimport\b/.test(trimmedStr);
14
+ if (trimmedStr.startsWith('```') && trimmedStr.endsWith('```') && hasImportStatement) {
15
+ return true;
16
+ }
17
+ return false;
18
+ }
19
+ export function getCodeFromMarkdown() {
20
+ var md = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
21
+ var regex = /*#__PURE__*/_wrapRegExp(/```(\w*)\n?([\s\S]*?)```/, {
22
+ lang: 1,
23
+ code: 2
24
+ });
25
+ var match = md.match(regex);
26
+ if (match) {
27
+ return {
28
+ lang: match.groups.lang || 'plaintext',
29
+ code: match.groups.code.trim()
30
+ };
31
+ }
32
+ return {
33
+ code: ''
34
+ };
35
+ }
package/dist/utils/env.js CHANGED
@@ -8,4 +8,67 @@ export var isBrowser = function isBrowser() {
8
8
  export var safeWindow = function safeWindow(fn) {
9
9
  if (isBrowser()) return fn(window);
10
10
  return undefined;
11
+ };
12
+
13
+ /**
14
+ * 环境类型枚举
15
+ */
16
+
17
+ /**
18
+ * 获取当前环境类型
19
+ * @returns {EnvType} 当前环境类型
20
+ */
21
+ export var getEnv = function getEnv() {
22
+ // 服务端环境默认返回生产环境
23
+ if (typeof window === 'undefined') {
24
+ return 'prod';
25
+ }
26
+ var hostname = window.location.hostname;
27
+
28
+ // 生产环境
29
+ if (hostname.endsWith('antv.antgroup.com')) {
30
+ return 'prod';
31
+ }
32
+
33
+ // 预发环境
34
+ if (hostname.endsWith('-pre.alipay.com')) {
35
+ return 'pre';
36
+ }
37
+
38
+ // 本地环境
39
+ if (hostname.endsWith('.alipay.net')) {
40
+ return 'dev';
41
+ }
42
+
43
+ // 默认返回生产环境
44
+ return 'prod';
45
+ };
46
+
47
+ /**
48
+ * 根据当前环境动态获取 API 的 baseURL。
49
+ * 在浏览器中,它会根据域名判断;在服务端,它会返回一个固定的生产环境地址。
50
+ * @returns {string} API 的 baseURL
51
+ */
52
+ export var getBaseURL = function getBaseURL() {
53
+ var env = getEnv();
54
+ switch (env) {
55
+ case 'dev':
56
+ return 'https://weavefox.alipay.net:8443';
57
+ case 'pre':
58
+ return 'https://prepub.weavefox.cn';
59
+ case 'prod':
60
+ default:
61
+ return 'https://www.weavefox.cn';
62
+ }
63
+ };
64
+ export var getBaseSiteDataUrl = function getBaseSiteDataUrl() {
65
+ var env = getEnv();
66
+ switch (env) {
67
+ case 'dev':
68
+ case 'pre':
69
+ return 'https://site-data-pre.alipay.com';
70
+ case 'prod':
71
+ default:
72
+ return 'https://assets.antv.antgroup.com';
73
+ }
11
74
  };
@@ -0,0 +1,7 @@
1
+ export function isUUID(str) {
2
+ if (typeof str !== 'string') {
3
+ return false;
4
+ }
5
+ var regex = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
6
+ return regex.test(str);
7
+ }
@@ -0,0 +1,42 @@
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
+ 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; }
3
+ 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; }
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(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
+ 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); }
7
+ import axios from 'axios';
8
+ import { getBaseURL } from "./env";
9
+ var req = axios.create({
10
+ baseURL: getBaseURL(),
11
+ timeout: 60000,
12
+ withCredentials: true
13
+ });
14
+
15
+ // 响应拦截器
16
+ req.interceptors.response.use(
17
+ // @ts-ignore - Temporarily ignore type mismatch if it occurs with custom ApiResponse
18
+ function (response) {
19
+ return response.data;
20
+ });
21
+
22
+ /**
23
+ * 封装通用请求方法
24
+ * @template T - 期望的响应数据类型 (后端返回的 data 字段)
25
+ */
26
+ var request = {
27
+ get: function get(url, params, config) {
28
+ return req.get(url, _objectSpread({
29
+ params: params
30
+ }, config));
31
+ },
32
+ post: function post(url, data, config) {
33
+ return req.post(url, data, config);
34
+ },
35
+ put: function put(url, data, config) {
36
+ return req.put(url, data, config);
37
+ },
38
+ delete: function _delete(url, config) {
39
+ return req.delete(url, config);
40
+ }
41
+ };
42
+ export default request;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antv/dumi-theme-antv",
3
- "version": "0.7.9",
3
+ "version": "0.8.0-alpha.3",
4
4
  "description": "AntV website theme based on dumi2.",
5
5
  "keywords": [
6
6
  "dumi",
@@ -20,17 +20,6 @@
20
20
  "files": [
21
21
  "dist"
22
22
  ],
23
- "scripts": {
24
- "build": "npm run prepare && father build",
25
- "dev": "father dev",
26
- "fix": "prettier ./src --write",
27
- "lint": "npm run lint:es && npm run lint:css",
28
- "lint:css": "stylelint \"{src,test}/**/*.{css,less}\"",
29
- "lint:es": "eslint \"{src,test}/**/*.{js,jsx,ts,tsx}\"",
30
- "prepare": "father link-dev-theme",
31
- "prepublishOnly": "npm run build",
32
- "start": "cd example && npm run dev"
33
- },
34
23
  "commitlint": {
35
24
  "extends": [
36
25
  "@commitlint/config-conventional"
@@ -54,19 +43,27 @@
54
43
  ]
55
44
  },
56
45
  "dependencies": {
46
+ "@ai-sdk/openai": "^2.0.59",
47
+ "@ai-sdk/react": "^2.0.86",
57
48
  "@ant-design/cssinjs": "^1.23.0",
58
49
  "@ant-design/icons": "^4.8.3",
59
50
  "@ant-design/pro-components": "^2.8.7",
51
+ "@ant-design/x": "^1.6.1",
60
52
  "@babel/plugin-syntax-unicode-sets-regex": "^7.18.6",
61
53
  "@babel/standalone": "^7.26.2",
62
54
  "@docsearch/css": "^3.8.0",
63
55
  "@docsearch/react": "^3.8.0",
64
56
  "@emotion/server": "^11.11.0",
65
- "@monaco-editor/react": "^4.6.0",
57
+ "@fingerprintjs/fingerprintjs": "^4.6.2",
58
+ "@monaco-editor/react": "4.7.0",
66
59
  "@petercatai/assistant": "^2.0.24",
67
60
  "@stackblitz/sdk": "^1.11.0",
61
+ "@tanstack/react-query": "^5.90.2",
62
+ "ahooks": "^3.9.5",
63
+ "ai": "^5.0.86",
68
64
  "antd": "^5.24.5",
69
65
  "antd-style": "^3.7.1",
66
+ "axios": "^1.13.2",
70
67
  "babel-loader": "^10.0.0",
71
68
  "babel-plugin-import": "^1.13.8",
72
69
  "chalk": "^4.1.2",
@@ -83,11 +80,12 @@
83
80
  "indent-string": "^5.0.0",
84
81
  "insert-css": "^2.0.0",
85
82
  "leancloud-storage": "^4.15.2",
83
+ "localforage": "^1.10.0",
86
84
  "lodash-es": "^4.17.21",
87
85
  "lodash.merge": "^4.6.2",
88
86
  "mini-css-extract-plugin": "^2.9.2",
89
87
  "moment": "^2.30.1",
90
- "monaco-editor": "^0.25.2",
88
+ "monaco-editor": "0.51.0",
91
89
  "nprogress": "^0.2.0",
92
90
  "p-limit": "^3.1.0",
93
91
  "parse-github-url": "^1.0.3",
@@ -102,6 +100,7 @@
102
100
  "react-router-dom": "^6.28.0",
103
101
  "react-slick": "^0.29.0",
104
102
  "react-split-pane": "^0.1.92",
103
+ "react-syntax-highlighter": "^15.6.6",
105
104
  "react-use": "^17.5.1",
106
105
  "reading-time": "^1.5.0",
107
106
  "rehype-raw": "^7.0.0",
@@ -117,7 +116,8 @@
117
116
  "uri-parse": "^1.0.0",
118
117
  "valtio": "^1.13.2",
119
118
  "video-react": "^0.16.0",
120
- "xmlbuilder": "^15.1.1"
119
+ "xmlbuilder": "^15.1.1",
120
+ "zod": "^3.25.76"
121
121
  },
122
122
  "devDependencies": {
123
123
  "@commitlint/cli": "^17.8.1",
@@ -133,6 +133,7 @@
133
133
  "@types/react": "^18.3.12",
134
134
  "@types/react-router-dom": "^5.3.3",
135
135
  "@types/react-slick": "^0.23.13",
136
+ "@types/react-syntax-highlighter": "^15.5.13",
136
137
  "@types/styled-components": "^5.1.34",
137
138
  "@umijs/lint": "^4.3.34",
138
139
  "css-loader": "^7.1.2",
@@ -161,5 +162,20 @@
161
162
  "authors": [
162
163
  "dumi",
163
164
  "antv"
164
- ]
165
- }
165
+ ],
166
+ "resolutions": {
167
+ "@monaco-editor/loader": "1.5.0"
168
+ },
169
+ "overrides": {
170
+ "@monaco-editor/loader": "1.5.0"
171
+ },
172
+ "scripts": {
173
+ "build": "npm run prepare && father build",
174
+ "dev": "father dev",
175
+ "fix": "prettier ./src --write",
176
+ "lint": "npm run lint:es && npm run lint:css",
177
+ "lint:css": "stylelint \"{src,test}/**/*.{css,less}\"",
178
+ "lint:es": "eslint \"{src,test}/**/*.{js,jsx,ts,tsx}\"",
179
+ "start": "cd example && npm run dev"
180
+ }
181
+ }