@antv/dumi-theme-antv 0.7.3-beta.3 → 0.7.3-beta.4

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.
@@ -0,0 +1,12 @@
1
+ export var defaultToken = {
2
+ borderColorSplit: '#f0f0f0',
3
+ borderRadius: 8,
4
+ colorLink: '#873bf4',
5
+ colorPrimary: '#873bf4',
6
+ colorText: 'rgba(0, 0, 0, 0.85)',
7
+ fontFamily: 'AlibabaPuHuiTiRHeavy, sans-serif',
8
+ fontSize: 14,
9
+ primaryColor: '#873bf4',
10
+ textColor: 'rgba(0, 0, 0, 0.85)',
11
+ textColorSecondary: 'rgba(0, 0, 0, 0.45)'
12
+ };
@@ -1,10 +1,18 @@
1
- import { Helmet, useLocation, useOutlet, useSiteData } from 'dumi';
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
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."); }
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); }
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(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
+ import { createCache, extractStyle, StyleProvider } from '@ant-design/cssinjs';
8
+ import { ConfigProvider } from 'antd';
9
+ import { Helmet, useLocation, useOutlet, useServerInsertedHTML, useSiteData } from 'dumi';
2
10
  import React, { useEffect } from 'react';
3
11
  import { getPurePathname } from "../utils/location";
4
12
  import IndexLayout from "./IndexLayout";
5
13
  import ManualLayout from "./ManualLayout";
6
- import { ConfigProvider } from 'antd';
7
14
  import GlobalStyles from "../common/GlobalStyles";
15
+ import { defaultToken } from "../common/styles/theme";
8
16
  import "../static/style";
9
17
 
10
18
  /**
@@ -18,13 +26,18 @@ export default (function () {
18
26
 
19
27
  // 打印控制台文案
20
28
  useEffect(function () {
21
- console.log('%cAntV 让数据栩栩如生', 'color:#5B7102; font-size: 20px;'), console.log('%c新一代数据可视化解决方案', 'color:#5B7102;'), console.log('--------------------------'), console.log('%c关注我们的微信公众号 %c“数据可视化 AntV”%c,获取我们团队最新的进展、动态、分享,也欢迎加入我们!', 'color: red', 'color: pink', 'color: red');
29
+ console.log('%cAntV 让数据栩栩如生', 'color:#5B7102; font-size: 20px;'), console.log('%c新一代数据可视化解决方案', 'color:#5B7102;'), console.log('--------------------------'), console.log('%c关注我们的微信公众号 %c"数据可视化 AntV"%c,获取我们团队最新的进展、动态、分享,也欢迎加入我们!', 'color: red', 'color: pink', 'color: red');
22
30
  }, []);
23
31
  var outlet = useOutlet();
24
32
  var location = useLocation();
25
33
  var pathname = location.pathname,
26
34
  hash = location.hash;
27
35
  var purePathname = getPurePathname(pathname);
36
+ var _React$useState = React.useState(function () {
37
+ return createCache();
38
+ }),
39
+ _React$useState2 = _slicedToArray(_React$useState, 1),
40
+ styleCache = _React$useState2[0];
28
41
 
29
42
  // 监听 hash 变更,跳转到锚点位置
30
43
  // 同时监听页面 loading 状态,因为路由按需加载时需要等待页面渲染完毕才能找到锚点位置
@@ -56,18 +69,44 @@ export default (function () {
56
69
  }
57
70
  return outlet;
58
71
  }, [purePathname]);
72
+ useServerInsertedHTML(function () {
73
+ var styleText = extractStyle(styleCache, {
74
+ plain: true,
75
+ types: 'style'
76
+ });
77
+ // biome-ignore lint/security/noDangerouslySetInnerHtml: only used in .dumi
78
+ return /*#__PURE__*/React.createElement("style", {
79
+ "data-type": "antd-cssinjs",
80
+ dangerouslySetInnerHTML: {
81
+ __html: styleText
82
+ }
83
+ });
84
+ });
85
+ useServerInsertedHTML(function () {
86
+ var styleText = extractStyle(styleCache, {
87
+ plain: true,
88
+ types: ['cssVar', 'token']
89
+ });
90
+ return /*#__PURE__*/React.createElement("style", {
91
+ "data-type": "antd-css-var",
92
+ "data-rc-order": "prepend",
93
+ "data-rc-priority": "-9999"
94
+ // biome-ignore lint/security/noDangerouslySetInnerHtml: only used in .dumi
95
+ ,
96
+ dangerouslySetInnerHTML: {
97
+ __html: styleText
98
+ }
99
+ });
100
+ });
59
101
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Helmet, null, /*#__PURE__*/React.createElement("link", {
60
102
  rel: "shortcut icon",
61
103
  href: "https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*7svFR6wkPMoAAAAAAAAAAAAADmJ7AQ/original"
62
- })), /*#__PURE__*/React.createElement(ConfigProvider, {
104
+ })), /*#__PURE__*/React.createElement(StyleProvider, {
105
+ cache: styleCache
106
+ }, /*#__PURE__*/React.createElement(ConfigProvider, {
63
107
  theme: {
64
- token: {
65
- colorPrimary: '#873bf4',
66
- borderRadius: 8,
67
- colorLink: '#873bf4',
68
- fontSize: 14,
69
- colorText: 'rgba(0, 0, 0, 0.85)'
70
- }
108
+ token: defaultToken,
109
+ hashed: false
71
110
  }
72
- }, /*#__PURE__*/React.createElement(GlobalStyles, null), content));
111
+ }, /*#__PURE__*/React.createElement(GlobalStyles, null), content)));
73
112
  });
@@ -9,7 +9,6 @@ import { FloatButton, Layout as AntLayout } from 'antd';
9
9
  import React, { lazy, useContext, useEffect } from 'react';
10
10
  import { useNavigate } from 'react-router-dom';
11
11
  import CommonHelmet from "../../common/CommonHelmet";
12
- import InViewSuspense from "../../common/InViewSuspense";
13
12
  import { ThemeAntVContext } from "../../context";
14
13
  import useLocale from "../../hooks/useLocale";
15
14
  import Footer from "dumi/theme/slots/Footer";
@@ -56,9 +55,9 @@ var Examples = function Examples() {
56
55
  }), /*#__PURE__*/React.createElement(AntLayout, {
57
56
  hasSider: true,
58
57
  className: styles.layout
59
- }, /*#__PURE__*/React.createElement(InViewSuspense, null, /*#__PURE__*/React.createElement(ExampleTopicMenu, {
58
+ }, /*#__PURE__*/React.createElement(ExampleTopicMenu, {
60
59
  exampleTopics: exampleTopics
61
- })), /*#__PURE__*/React.createElement(Article, {
60
+ }), /*#__PURE__*/React.createElement(Article, {
62
61
  className: styles.markdown
63
62
  }, /*#__PURE__*/React.createElement("div", {
64
63
  className: styles.main,
@@ -184,12 +184,12 @@ async function runCheck(config) {
184
184
  };
185
185
  }
186
186
  function generateReport(result) {
187
- console.log();
188
187
  if (result.deadLinks.length === 0) {
189
188
  console.log(import_chalk.default.green(`✓ Check completed: All ${result.totalLinks} links are valid`));
190
189
  console.log();
191
190
  return;
192
191
  }
192
+ const reportFile = path.join(process.cwd(), "dead-links-report.log");
193
193
  const linksByFile = result.deadLinks.reduce((acc, link) => {
194
194
  if (!acc[link.sourceFile]) {
195
195
  acc[link.sourceFile] = [];
@@ -197,24 +197,44 @@ function generateReport(result) {
197
197
  acc[link.sourceFile].push(link);
198
198
  return acc;
199
199
  }, {});
200
- console.log(
201
- import_chalk.default.yellow(
202
- `📊 Found ${result.deadLinks.length}/${result.totalLinks} dead links in ${Object.keys(linksByFile).length} files`
203
- )
204
- );
200
+ const reportLines = [
201
+ `Dead Links Report (${(/* @__PURE__ */ new Date()).toISOString()})`,
202
+ `Found ${result.deadLinks.length}/${result.totalLinks} dead links in ${Object.keys(linksByFile).length} files`,
203
+ ""
204
+ ];
205
205
  Object.entries(linksByFile).forEach(([file, links]) => {
206
- console.log();
207
- console.log(import_chalk.default.yellow(`📄 ${file}:`));
206
+ reportLines.push(`File: ${file}`);
208
207
  links.forEach((link) => {
209
- console.log(import_chalk.default.red(` ✗ ${link.url}`));
210
- console.log(import_chalk.default.gray(` • Text: ${link.text}`));
211
- console.log(import_chalk.default.gray(` • Reason: ${link.reason}`));
208
+ reportLines.push(` ✗ ${link.url}`);
209
+ reportLines.push(` • Text: ${link.text}`);
210
+ reportLines.push(` • Reason: ${link.reason}`);
212
211
  });
212
+ reportLines.push("");
213
213
  });
214
- console.log();
215
- console.log(import_chalk.default.cyan(`💡 Tip: Please fix these links and run \`npx dumi check-links\` to verify`));
216
- console.log(import_chalk.default.cyan(`💡 Tip: Don't forget to run \`npm run build\` after fixing the links`));
217
- console.log();
214
+ try {
215
+ fs.writeFileSync(reportFile, reportLines.join("\n"), "utf-8");
216
+ const gitignorePath = path.join(process.cwd(), ".gitignore");
217
+ const gitignoreContent = fs.existsSync(gitignorePath) ? fs.readFileSync(gitignorePath, "utf-8") : "";
218
+ if (!gitignoreContent.includes("dead-links-report.log")) {
219
+ fs.appendFileSync(gitignorePath, "\n# Dead links report\ndead-links-report.log\n");
220
+ }
221
+ console.log();
222
+ console.log(import_chalk.default.yellow("📊 Dead Links Summary:"));
223
+ console.log(import_chalk.default.yellow(`Found ${result.deadLinks.length} dead links in ${Object.keys(linksByFile).length} files`));
224
+ console.log();
225
+ Object.entries(linksByFile).forEach(([file, links]) => {
226
+ console.log(
227
+ import_chalk.default.red(`✗ ${file}`),
228
+ import_chalk.default.gray(`(${links.length} dead ${links.length === 1 ? "link" : "links"})`)
229
+ );
230
+ });
231
+ console.log();
232
+ console.log(import_chalk.default.cyan(`💡 Detailed report: ${reportFile}`));
233
+ console.log();
234
+ } catch (error) {
235
+ console.error(import_chalk.default.red("Failed to write report file:"), error);
236
+ console.log(reportLines.join("\n"));
237
+ }
218
238
  }
219
239
  var deadLinkChecker_default = (api) => {
220
240
  const getConfig = () => {
@@ -33,6 +33,7 @@ __export(plugin_exports, {
33
33
  });
34
34
  module.exports = __toCommonJS(plugin_exports);
35
35
  var import_chalk = __toESM(require("chalk"));
36
+ var import_critters_webpack_plugin = __toESM(require("critters-webpack-plugin"));
36
37
  var import_plugin_utils = require("dumi/plugin-utils");
37
38
  var path = __toESM(require("path"));
38
39
  var import_antVReactTechStack = require("./antVReactTechStack");
@@ -45,6 +46,14 @@ var PAGES_DIR = (0, import_plugin_utils.winPath)(path.join(__dirname, "../pages"
45
46
  var MOCK_META = { frontmatter: { title: "mock-meta" }, texts: [], toc: [] };
46
47
  var plugin_default = (api) => {
47
48
  api.describe({ key: `dumi-theme:${require("../../package.json").name}` });
49
+ api.chainWebpack((config) => {
50
+ config.plugin("critters").use(import_critters_webpack_plugin.default, [
51
+ {
52
+ preload: "js-lazy",
53
+ inlineThreshold: 10240
54
+ }
55
+ ]);
56
+ });
48
57
  api.modifyDefaultConfig((memo) => {
49
58
  memo.resolve.codeBlockMode = "passive";
50
59
  memo.exportStatic = {};
@@ -1,6 +1,5 @@
1
1
  import { useSiteData } from 'dumi';
2
2
  import React, { lazy } from 'react';
3
- import InViewSuspense from "../../common/InViewSuspense";
4
3
  var EditButton = /*#__PURE__*/lazy(function () {
5
4
  return import("./EditButton");
6
5
  });
@@ -17,5 +16,5 @@ export var Feedback = function Feedback() {
17
16
  if (!feedback) {
18
17
  return null;
19
18
  }
20
- return /*#__PURE__*/React.createElement(InViewSuspense, null, /*#__PURE__*/React.createElement(EditButton, null), /*#__PURE__*/React.createElement(Contributors, null), /*#__PURE__*/React.createElement(SectionFeedback, null));
19
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(EditButton, null), /*#__PURE__*/React.createElement(Contributors, null), /*#__PURE__*/React.createElement(SectionFeedback, null));
21
20
  };
@@ -8,7 +8,8 @@
8
8
  padding: 0;
9
9
  position: relative;
10
10
  z-index: 200;
11
- font-family: var(--font-family);
11
+ font-family: Avenir, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans',
12
+ sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
12
13
  transition: box-shadow 0.3s, background 0.3s;
13
14
 
14
15
  &.transparent {
@@ -15,8 +15,9 @@ var Loading = function Loading(_ref) {
15
15
  return /*#__PURE__*/React.createElement("div", {
16
16
  style: _objectSpread({
17
17
  position: 'relative',
18
- height: '100vh',
19
- width: '100%'
18
+ height: '100%',
19
+ width: '100%',
20
+ minHeight: '200px'
20
21
  }, style)
21
22
  }, /*#__PURE__*/React.createElement("div", {
22
23
  className: styles.loading
@@ -6,7 +6,6 @@
6
6
  width: 100%;
7
7
  height: 100%;
8
8
  background-color: #fff;
9
- border: 1px solid #f0f0f0;
10
9
 
11
10
  :global {
12
11
  .container {
@@ -3,14 +3,12 @@ import { FloatButton, Layout } from 'antd';
3
3
  import { useRouteMeta } from 'dumi';
4
4
  import React, { lazy } from 'react';
5
5
  import { useMedia } from 'react-use';
6
- import readingTime from 'reading-time';
7
6
  import ClientOnly from "../../common/ClientOnly";
8
7
  import InViewSuspense from "../../common/InViewSuspense";
9
8
  import { ContentTable } from "dumi/theme/slots/ContentTable";
10
9
  import { Feedback } from "dumi/theme/slots/Feedback";
11
10
  import styles from "./index.module.less";
12
11
  import { PrevAndNext } from "./PrevAndNext";
13
- import ReadingTime from "./ReadingTime";
14
12
  var PageFeedback = /*#__PURE__*/lazy(function () {
15
13
  return import("../Feedback/PageFeedback");
16
14
  });
@@ -20,11 +18,6 @@ var ObPreview = /*#__PURE__*/lazy(function () {
20
18
  export var Main = function Main(_ref) {
21
19
  var children = _ref.children;
22
20
  var meta = useRouteMeta();
23
- var text = meta.texts.reduce(function (prev, next) {
24
- return prev + next.value;
25
- }, '');
26
- var _readingTime = readingTime(text),
27
- time = _readingTime.time;
28
21
  var is991Wide = useMedia('(min-width: 991.99px)', true);
29
22
  var showToc = is991Wide && meta.frontmatter.showToc !== false;
30
23
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ClientOnly, null, /*#__PURE__*/React.createElement(ObPreview, null)), /*#__PURE__*/React.createElement(Layout.Content, {
@@ -34,17 +27,12 @@ export var Main = function Main(_ref) {
34
27
  }, /*#__PURE__*/React.createElement("h1", {
35
28
  className: styles.contentTitle
36
29
  }, meta.frontmatter.title), /*#__PURE__*/React.createElement("div", {
37
- className: styles.readtimeContainer
38
- }, /*#__PURE__*/React.createElement(ReadingTime, {
39
- readingTime: time,
40
- className: styles.readtime
41
- })), /*#__PURE__*/React.createElement("div", {
42
30
  className: styles.markdown
43
- }, children), /*#__PURE__*/React.createElement("div", {
31
+ }, children), /*#__PURE__*/React.createElement(ClientOnly, null, /*#__PURE__*/React.createElement("div", {
44
32
  style: {
45
33
  marginTop: '40px'
46
34
  }
47
- }, /*#__PURE__*/React.createElement(Feedback, null)), /*#__PURE__*/React.createElement(PrevAndNext, null)), /*#__PURE__*/React.createElement(FloatButton.BackTop, {
35
+ }, /*#__PURE__*/React.createElement(Feedback, null))), /*#__PURE__*/React.createElement(PrevAndNext, null)), /*#__PURE__*/React.createElement(FloatButton.BackTop, {
48
36
  style: {
49
37
  right: 24
50
38
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antv/dumi-theme-antv",
3
- "version": "0.7.3-beta.3",
3
+ "version": "0.7.3-beta.4",
4
4
  "description": "AntV website theme based on dumi2.",
5
5
  "keywords": [
6
6
  "dumi",
@@ -43,21 +43,26 @@
43
43
  ]
44
44
  },
45
45
  "dependencies": {
46
+ "@ant-design/cssinjs": "^1.23.0",
46
47
  "@ant-design/icons": "^4.8.3",
47
48
  "@ant-design/pro-components": "^2.8.7",
48
49
  "@babel/plugin-syntax-unicode-sets-regex": "^7.18.6",
49
50
  "@babel/standalone": "^7.26.2",
50
51
  "@docsearch/css": "^3.8.0",
51
52
  "@docsearch/react": "^3.8.0",
53
+ "@emotion/server": "^11.11.0",
52
54
  "@monaco-editor/react": "^4.6.0",
53
55
  "@petercatai/assistant": "^2.0.24",
54
56
  "@stackblitz/sdk": "^1.11.0",
55
57
  "antd": "^5.24.5",
56
58
  "antd-style": "^3.7.1",
59
+ "babel-loader": "^10.0.0",
60
+ "babel-plugin-import": "^1.13.8",
57
61
  "chalk": "^4.1.2",
58
62
  "cheerio": "^1.0.0-rc.12",
59
63
  "classnames": "^2.5.1",
60
64
  "codesandbox": "^2.2.3",
65
+ "critters-webpack-plugin": "^3.0.2",
61
66
  "d3-dsv": "^3.0.1",
62
67
  "docsearch.js": "^2.6.3",
63
68
  "front-matter": "^4.0.2",
@@ -69,14 +74,16 @@
69
74
  "leancloud-storage": "^4.15.2",
70
75
  "lodash-es": "^4.17.21",
71
76
  "lodash.merge": "^4.6.2",
77
+ "mini-css-extract-plugin": "^2.9.2",
78
+ "moment": "^2.30.1",
72
79
  "monaco-editor": "^0.25.2",
73
80
  "nprogress": "^0.2.0",
74
81
  "p-limit": "^3.1.0",
75
82
  "parse-github-url": "^1.0.3",
76
83
  "rc-drawer": "^4.4.3",
77
84
  "rc-footer": "^0.6.8",
78
- "react": "18.3.0-canary-c3048aab4-20240326",
79
- "react-dom": "18.3.0-canary-c3048aab4-20240326",
85
+ "react": "^19.1.0",
86
+ "react-dom": "^19.1.0",
80
87
  "react-error-boundary": "^3.1.4",
81
88
  "react-github-button": "^0.1.11",
82
89
  "react-intersection-observer": "^9.16.0",