jeawin-astro 3.0.41 → 3.0.42

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jeawin-astro",
3
- "version": "3.0.41",
3
+ "version": "3.0.42",
4
4
  "author": "chaegumi <chaegumi@qq.com>",
5
5
  "description": "",
6
6
  "license": "MIT",
@@ -41,7 +41,7 @@
41
41
  "chai": "^5.2.0",
42
42
  "mocha": "^10.8.2",
43
43
  "postcss": "^8.5.3",
44
- "rollup": "^4.35.0",
44
+ "rollup": "^4.37.0",
45
45
  "rollup-plugin-node-externals": "^7.1.3",
46
46
  "rollup-plugin-postcss": "^4.0.2",
47
47
  "typescript": "^5.8.2"
@@ -49,23 +49,23 @@
49
49
  "dependencies": {
50
50
  "@astrojs/alpinejs": "^0.4.3",
51
51
  "@astrojs/check": "^0.9.4",
52
- "@astrojs/cloudflare": "^12.2.4",
52
+ "@astrojs/cloudflare": "^12.3.0",
53
53
  "@astrojs/rss": "^4.0.11",
54
54
  "@astrojs/sitemap": "3.2.1",
55
55
  "@astrojs/ts-plugin": "^1.10.4",
56
56
  "@astrojs/vue": "^5.0.7",
57
57
  "@iconify-json/fa6-brands": "^1.2.5",
58
58
  "@iconify-json/fa6-solid": "^1.2.3",
59
- "@iconify/tools": "^4.1.1",
59
+ "@iconify/tools": "^4.1.2",
60
60
  "@keyv/compress-brotli": "^2.0.3",
61
61
  "@pagefind/default-ui": "^1.3.0",
62
62
  "@tailwindcss/forms": "^0.5.10",
63
63
  "@tailwindcss/typography": "^0.5.16",
64
- "@tailwindcss/vite": "^4.0.14",
64
+ "@tailwindcss/vite": "^4.0.15",
65
65
  "@types/alpinejs": "^3.13.11",
66
66
  "alpinejs": "^3.14.9",
67
67
  "aos": "3.0.0-beta.6",
68
- "astro": "^5.5.2",
68
+ "astro": "^5.5.4",
69
69
  "astro-color-scheme": "^1.1.5",
70
70
  "astro-embed": "^0.9.0",
71
71
  "astro-icon": "^1.1.5",
@@ -75,7 +75,7 @@
75
75
  "dayjs": "^1.11.13",
76
76
  "fetch-jsonp": "^1.3.0",
77
77
  "glob": "^11.0.1",
78
- "keyv": "^5.3.1",
78
+ "keyv": "^5.3.2",
79
79
  "keyv-lru": "^3.0.4",
80
80
  "lodash": "^4.17.21",
81
81
  "pagefind": "^1.3.0",
@@ -84,9 +84,9 @@
84
84
  "smartmenus": "2.0.0-alpha.1",
85
85
  "sprintf-js": "^1.1.3",
86
86
  "string-strip-html": "^13.4.12",
87
- "swiper": "^11.2.5",
87
+ "swiper": "^11.2.6",
88
88
  "tailwind-scrollbar": "^4.0.1",
89
- "tailwindcss": "^4.0.14",
89
+ "tailwindcss": "^4.0.15",
90
90
  "tslib": "^2.8.1",
91
91
  "zod": "^3.24.2"
92
92
  }
@@ -8,4 +8,5 @@ export * from "./magnify.js";
8
8
  export * from "./search-result-list.js";
9
9
  export * from "./smartmenus.js";
10
10
  export * from "./swiper.js";
11
- export * from "./util.js";
11
+ export * from "./util.js";
12
+ export * from "./tree.js";
@@ -0,0 +1,3 @@
1
+ export function array_depth(array: any): number;
2
+ export function array_breadth(array: any): any;
3
+ export function countLeafNodes(tree: any): number;
@@ -0,0 +1,44 @@
1
+ // 数组深度
2
+ export function array_depth(array) {
3
+ let max_depth = 1;
4
+
5
+ for (const value of array) {
6
+ // console.log(value);
7
+ if (value.children && Array.isArray(value.children)) {
8
+ let depth = array_depth(value.children) + 1;
9
+ if (depth > max_depth) {
10
+ max_depth = depth;
11
+ }
12
+ }
13
+ }
14
+
15
+ return max_depth;
16
+ }
17
+ // 数组广度
18
+ export function array_breadth(array) {
19
+ let max_breadth = array.length; // 当前层级的广度
20
+
21
+ for (const value of array) {
22
+ if (value.children && Array.isArray(value.children)) {
23
+ // 递归计算子数组的广度
24
+ let breadth = array_breadth(value.children);
25
+ if (breadth > max_breadth) {
26
+ max_breadth = breadth;
27
+ }
28
+ }
29
+ }
30
+
31
+ return max_breadth;
32
+ }
33
+ // 叶子节点数
34
+ export function countLeafNodes(tree) {
35
+ let count = 0;
36
+ for (const value of tree) {
37
+ if (value.children && Array.isArray(value.children)) {
38
+ count += countLeafNodes(value.children);
39
+ } else {
40
+ count += 1;
41
+ }
42
+ }
43
+ return count;
44
+ }