@rspress-theme-anatole/theme-default 0.6.6 → 0.6.8

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 (2) hide show
  1. package/dist/bundle.js +25 -12
  2. package/package.json +69 -69
package/dist/bundle.js CHANGED
@@ -757,6 +757,9 @@ function Sidebar(props) {
757
757
  const rawSidebarData = useSidebarData();
758
758
  const [sidebarData, setSidebarData] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(() => rawSidebarData.filter(Boolean).flat());
759
759
  const pathname = decodeURIComponent(rawPathname);
760
+ const { siteData } = (0, __WEBPACK_EXTERNAL_MODULE__rspress_runtime_0abd3046__.usePageData)();
761
+ const { base } = siteData;
762
+
760
763
  const activeMatcher = useActiveMatcher();
761
764
  (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(() => {
762
765
  if ((0, __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.inBrowser)()) {
@@ -843,23 +846,34 @@ function Sidebar(props) {
843
846
  if (parts.length && parts[parts.length - 1].includes('.')) {
844
847
  parts.pop();
845
848
  }
846
-
847
- // 取前两级
848
- const first = parts[0] || 'index';
849
+
850
+ // 取前三级
851
+ const first = parts[0] || '';
849
852
  const second = parts[1] || '';
850
-
851
- const langArr = ['en', 'vn', 'zh'];
853
+ const third = parts[2] || '';
854
+ const base_trimmed = base.replace(/^\/|\/$/g, '');;
852
855
 
856
+ const langArr = ['en', 'vn', 'zh'];
853
857
  let fileName = '';
854
- if (!langArr.includes(first)) {
855
- fileName = `/${first}.pdf`;
856
- }
857
- else if (second) {
858
- fileName = `/${first}_${second}.pdf`;
858
+ if (first === base_trimmed) {
859
+ fileName += `/${base_trimmed}`;
860
+
861
+ if (!langArr.includes(second)) {
862
+ fileName += `/${second}.pdf`;
863
+ }
864
+ else if (third) {
865
+ fileName = `/${second}_${third}.pdf`;
866
+ }
859
867
  }
860
868
  else {
861
- fileName = '/index.pdf';
869
+ if (!langArr.includes(first)) {
870
+ fileName = `/${first}.pdf`;
871
+ }
872
+ else if (second) {
873
+ fileName = `/${first}_${second}.pdf`;
874
+ }
862
875
  }
876
+
863
877
  return fileName;
864
878
  })(),
865
879
  target: "_blank", // 新开标签页
@@ -3000,7 +3014,6 @@ function HomeFooter() {
3000
3014
  style: {
3001
3015
  display: "flex",
3002
3016
  fontWeight: "400",
3003
- color: "red"
3004
3017
  }
3005
3018
  }),
3006
3019
  (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("p", {
package/package.json CHANGED
@@ -1,69 +1,69 @@
1
- {
2
- "name": "@rspress-theme-anatole/theme-default",
3
- "author": "Anatole Tong",
4
- "version": "0.6.6",
5
- "license": "MIT",
6
- "sideEffects": [
7
- "*.css",
8
- "*.less",
9
- "*.sass",
10
- "*.scss",
11
- "**/virtual-global-styles.js",
12
- "virtual-global-styles",
13
- "./src/styles/index.ts",
14
- "./dist/index.js"
15
- ],
16
- "type": "module",
17
- "imports": {
18
- "#theme/*": "./src/*"
19
- },
20
- "main": "./dist/index.js",
21
- "types": "./dist/bundle.d.ts",
22
- "dependencies": {
23
- "@mdx-js/react": "2.3.0",
24
- "@rspress-theme-anatole/rspress-plugin-mermaid": "0.6.6",
25
- "@rspress-theme-anatole/shared": "0.6.6",
26
- "@rspress/runtime": "1.43.8",
27
- "body-scroll-lock": "4.0.0-beta.0",
28
- "copy-to-clipboard": "^3.3.3",
29
- "flexsearch": "0.7.43",
30
- "github-slugger": "^2.0.0",
31
- "html2pdf.js": "^0.10.3",
32
- "htmr": "^1.0.2",
33
- "lodash-es": "^4.17.21",
34
- "nprogress": "^0.2.0",
35
- "react": "^18.3.1",
36
- "react-dom": "^18.3.1",
37
- "react-helmet-async": "^1.3.0",
38
- "react-router-dom": "6.29.0",
39
- "react-syntax-highlighter": "^15.6.1"
40
- },
41
- "devDependencies": {
42
- "@microsoft/api-extractor": "^7.49.2",
43
- "@modern-js/tsconfig": "2.64.0",
44
- "@rsbuild/plugin-react": "~1.1.0",
45
- "@rsbuild/plugin-sass": "~1.2.0",
46
- "@rsbuild/plugin-svgr": "^1.0.6",
47
- "@rslib/core": "0.5.2",
48
- "@types/body-scroll-lock": "^3.1.2",
49
- "@types/hast": "^2.3.10",
50
- "@types/jest": "~29.5.14",
51
- "@types/lodash-es": "^4.17.12",
52
- "@types/mdast": "^3.0.15",
53
- "@types/nprogress": "^0.2.3",
54
- "@types/react": "^18.3.18",
55
- "@types/react-dom": "^18.3.5",
56
- "@types/react-syntax-highlighter": "^15.5.13",
57
- "gray-matter": "4.0.3",
58
- "tailwindcss": "^3.4.17",
59
- "typescript": "^5.5.3"
60
- },
61
- "keywords": [
62
- "rspress",
63
- "theme",
64
- "rspress-theme"
65
- ],
66
- "publishConfig": {
67
- "access": "public"
68
- }
69
- }
1
+ {
2
+ "name": "@rspress-theme-anatole/theme-default",
3
+ "author": "Anatole Tong",
4
+ "version": "0.6.8",
5
+ "license": "MIT",
6
+ "sideEffects": [
7
+ "*.css",
8
+ "*.less",
9
+ "*.sass",
10
+ "*.scss",
11
+ "**/virtual-global-styles.js",
12
+ "virtual-global-styles",
13
+ "./src/styles/index.ts",
14
+ "./dist/index.js"
15
+ ],
16
+ "type": "module",
17
+ "imports": {
18
+ "#theme/*": "./src/*"
19
+ },
20
+ "main": "./dist/index.js",
21
+ "types": "./dist/bundle.d.ts",
22
+ "dependencies": {
23
+ "@mdx-js/react": "2.3.0",
24
+ "@rspress-theme-anatole/rspress-plugin-mermaid": "0.6.8",
25
+ "@rspress-theme-anatole/shared": "0.6.8",
26
+ "@rspress/runtime": "1.43.8",
27
+ "body-scroll-lock": "4.0.0-beta.0",
28
+ "copy-to-clipboard": "^3.3.3",
29
+ "flexsearch": "0.7.43",
30
+ "github-slugger": "^2.0.0",
31
+ "html2pdf.js": "^0.10.3",
32
+ "htmr": "^1.0.2",
33
+ "lodash-es": "^4.17.21",
34
+ "nprogress": "^0.2.0",
35
+ "react": "^18.3.1",
36
+ "react-dom": "^18.3.1",
37
+ "react-helmet-async": "^1.3.0",
38
+ "react-router-dom": "6.29.0",
39
+ "react-syntax-highlighter": "^15.6.1"
40
+ },
41
+ "devDependencies": {
42
+ "@microsoft/api-extractor": "^7.49.2",
43
+ "@modern-js/tsconfig": "2.64.0",
44
+ "@rsbuild/plugin-react": "~1.1.0",
45
+ "@rsbuild/plugin-sass": "~1.2.0",
46
+ "@rsbuild/plugin-svgr": "^1.0.6",
47
+ "@rslib/core": "0.5.2",
48
+ "@types/body-scroll-lock": "^3.1.2",
49
+ "@types/hast": "^2.3.10",
50
+ "@types/jest": "~29.5.14",
51
+ "@types/lodash-es": "^4.17.12",
52
+ "@types/mdast": "^3.0.15",
53
+ "@types/nprogress": "^0.2.3",
54
+ "@types/react": "^18.3.18",
55
+ "@types/react-dom": "^18.3.5",
56
+ "@types/react-syntax-highlighter": "^15.5.13",
57
+ "gray-matter": "4.0.3",
58
+ "tailwindcss": "^3.4.17",
59
+ "typescript": "^5.5.3"
60
+ },
61
+ "keywords": [
62
+ "rspress",
63
+ "theme",
64
+ "rspress-theme"
65
+ ],
66
+ "publishConfig": {
67
+ "access": "public"
68
+ }
69
+ }