@antv/dumi-theme-antv 0.3.2 → 0.3.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.
- package/dist/layouts/DocLayout.js +14 -2
- package/dist/pages/Examples/index.module.less +1 -1
- package/dist/plugin/examples.js +21 -16
- package/dist/plugin/index.js +4 -1
- package/dist/plugin/utils.js +4 -1
- package/dist/slots/ExampleSider/index.module.less +1 -1
- package/dist/slots/ManualContent/index.module.less +1 -1
- package/package.json +1 -1
|
@@ -11,7 +11,8 @@ import "../slots/_.less";
|
|
|
11
11
|
|
|
12
12
|
export default (function () {
|
|
13
13
|
var _useSiteData = useSiteData(),
|
|
14
|
-
themeConfig = _useSiteData.themeConfig
|
|
14
|
+
themeConfig = _useSiteData.themeConfig,
|
|
15
|
+
loading = _useSiteData.loading;
|
|
15
16
|
|
|
16
17
|
var navs = themeConfig.navs; // 打印控制台文案
|
|
17
18
|
|
|
@@ -21,8 +22,19 @@ export default (function () {
|
|
|
21
22
|
var outlet = useOutlet();
|
|
22
23
|
|
|
23
24
|
var _useLocation = useLocation(),
|
|
24
|
-
pathname = _useLocation.pathname
|
|
25
|
+
pathname = _useLocation.pathname,
|
|
26
|
+
hash = _useLocation.hash; // 监听 hash 变更,跳转到锚点位置
|
|
27
|
+
// 同时监听页面 loading 状态,因为路由按需加载时需要等待页面渲染完毕才能找到锚点位置
|
|
25
28
|
|
|
29
|
+
|
|
30
|
+
useEffect(function () {
|
|
31
|
+
var id = hash.replace('#', '');
|
|
32
|
+
|
|
33
|
+
if (id) {
|
|
34
|
+
var elm = document.getElementById(decodeURIComponent(id));
|
|
35
|
+
if (elm) document.documentElement.scrollTo(0, elm.offsetTop - 80);
|
|
36
|
+
}
|
|
37
|
+
}, [loading, hash]);
|
|
26
38
|
var path = pathname; // 统一去掉中英文前缀
|
|
27
39
|
|
|
28
40
|
var p = path.replace('/zh/', '/').replace('/en/', '/'); // 首页
|
package/dist/plugin/examples.js
CHANGED
|
@@ -16,7 +16,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
}
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
|
+
mod
|
|
22
|
+
));
|
|
20
23
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
24
|
|
|
22
25
|
// src/plugin/examples.ts
|
|
@@ -72,22 +75,24 @@ var getTopicExamples = (topicPath) => {
|
|
|
72
75
|
}).sort((a, b) => a.order - b.order);
|
|
73
76
|
};
|
|
74
77
|
var getExamplesPageTopics = (exampleTopics) => {
|
|
75
|
-
return exampleTopics.map(
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
78
|
+
return exampleTopics.map(
|
|
79
|
+
({ id, slug, title, icon }) => {
|
|
80
|
+
const nid = id || slug;
|
|
81
|
+
let examples = [];
|
|
82
|
+
try {
|
|
83
|
+
examples = getTopicExamples(path.join(examplesBaseDir, nid));
|
|
84
|
+
} catch (e) {
|
|
85
|
+
console.warn(e);
|
|
86
|
+
}
|
|
87
|
+
return {
|
|
88
|
+
id: nid,
|
|
89
|
+
title,
|
|
90
|
+
icon,
|
|
91
|
+
examples,
|
|
92
|
+
childrenKey: "examples"
|
|
93
|
+
};
|
|
82
94
|
}
|
|
83
|
-
|
|
84
|
-
id: nid,
|
|
85
|
-
title,
|
|
86
|
-
icon,
|
|
87
|
-
examples,
|
|
88
|
-
childrenKey: "examples"
|
|
89
|
-
};
|
|
90
|
-
});
|
|
95
|
+
);
|
|
91
96
|
};
|
|
92
97
|
function getExamplePaths() {
|
|
93
98
|
const exampleTopicPaths = glob.sync(`${examplesBaseDir}/*/*`);
|
package/dist/plugin/index.js
CHANGED
|
@@ -16,7 +16,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
}
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
|
+
mod
|
|
22
|
+
));
|
|
20
23
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
24
|
|
|
22
25
|
// src/plugin/index.ts
|
package/dist/plugin/utils.js
CHANGED
|
@@ -16,7 +16,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
}
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
|
+
mod
|
|
22
|
+
));
|
|
20
23
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
24
|
|
|
22
25
|
// src/plugin/utils.ts
|