hexo-theme-gnix 4.2.4 → 4.2.6
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 +1 -1
- package/source/css/default.css +11 -11
- package/source/js/pjax.js +1 -2
- package/source/js/shiki/shiki.js +9 -38
package/package.json
CHANGED
package/source/css/default.css
CHANGED
|
@@ -210,14 +210,6 @@ a.header-anchor:hover::after {
|
|
|
210
210
|
color: var(--surface0);
|
|
211
211
|
}
|
|
212
212
|
|
|
213
|
-
h2 a.header-anchor {
|
|
214
|
-
color: var(--peach);
|
|
215
|
-
|
|
216
|
-
&:hover::after {
|
|
217
|
-
content: "##";
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
|
|
221
213
|
h3 a.header-anchor {
|
|
222
214
|
color: var(--yellow);
|
|
223
215
|
|
|
@@ -889,7 +881,16 @@ body {
|
|
|
889
881
|
font-weight: 700;
|
|
890
882
|
line-height: 1.25;
|
|
891
883
|
letter-spacing: -0.02em;
|
|
892
|
-
margin:
|
|
884
|
+
margin: 1rem 0 1rem;
|
|
885
|
+
border-bottom: 0.8px solid var(--surface0);
|
|
886
|
+
|
|
887
|
+
a.header-anchor {
|
|
888
|
+
color: var(--text);
|
|
889
|
+
|
|
890
|
+
&:hover::after {
|
|
891
|
+
content: "##";
|
|
892
|
+
}
|
|
893
|
+
}
|
|
893
894
|
}
|
|
894
895
|
|
|
895
896
|
h3 {
|
|
@@ -1145,10 +1146,9 @@ ul.contains-task-list {
|
|
|
1145
1146
|
}
|
|
1146
1147
|
|
|
1147
1148
|
li.task-list-item {
|
|
1148
|
-
display: flex;
|
|
1149
|
-
align-items: center;
|
|
1150
1149
|
gap: 0.75rem;
|
|
1151
1150
|
font-size: 1rem;
|
|
1151
|
+
list-style: none;
|
|
1152
1152
|
}
|
|
1153
1153
|
|
|
1154
1154
|
input.task-list-item-checkbox {
|
package/source/js/pjax.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
(() => {
|
|
2
|
-
// biome-ignore lint/correctness/noUnusedVariables: will be used
|
|
3
2
|
let pjax;
|
|
4
3
|
|
|
5
4
|
function initPjax() {
|
|
@@ -11,7 +10,7 @@
|
|
|
11
10
|
});
|
|
12
11
|
|
|
13
12
|
window.addEventListener("popstate", () => {
|
|
14
|
-
if (pjax
|
|
13
|
+
if (pjax?.loadUrl) {
|
|
15
14
|
pjax.loadUrl(window.location.href);
|
|
16
15
|
}
|
|
17
16
|
});
|
package/source/js/shiki/shiki.js
CHANGED
|
@@ -56,58 +56,29 @@ const FeatureHandlers = {
|
|
|
56
56
|
expandCode(figure) {
|
|
57
57
|
const expandBtn = figure.querySelector(SELECTORS.expandBtn);
|
|
58
58
|
const pre = figure.querySelector(SELECTORS.preShiki);
|
|
59
|
-
|
|
60
59
|
const isExpanded = figure.classList.contains("expanded");
|
|
61
60
|
const showLines = parseInt(figure.dataset.showLines || "10", 10);
|
|
62
61
|
|
|
63
62
|
if (isExpanded) {
|
|
64
|
-
// 记录折叠前的状态
|
|
65
|
-
const beforeCollapseHeight = pre.scrollHeight;
|
|
66
|
-
|
|
67
|
-
// 计算折叠后的目标高度
|
|
68
63
|
const computedStyle = getComputedStyle(pre);
|
|
69
64
|
const lineHeight = parseFloat(computedStyle.lineHeight) || 20;
|
|
70
65
|
const paddingTop = parseFloat(computedStyle.paddingTop) || 0;
|
|
71
66
|
const paddingBottom = parseFloat(computedStyle.paddingBottom) || 0;
|
|
72
67
|
const targetHeight = showLines * lineHeight + paddingTop + paddingBottom;
|
|
73
68
|
|
|
74
|
-
|
|
75
|
-
pre.style.maxHeight = `${
|
|
76
|
-
|
|
77
|
-
// 应用折叠状态
|
|
78
|
-
requestAnimationFrame(() => {
|
|
79
|
-
figure.classList.remove("expanded");
|
|
80
|
-
pre.style.maxHeight = `${targetHeight}px`;
|
|
81
|
-
|
|
82
|
-
// 延迟箭头旋转,等待折叠动画完成
|
|
83
|
-
setTimeout(() => {
|
|
84
|
-
expandBtn.classList.remove(CLASSES.expandDone);
|
|
85
|
-
}, 300); // 与CSS transition时间同步
|
|
86
|
-
});
|
|
69
|
+
figure.classList.remove("expanded");
|
|
70
|
+
pre.style.maxHeight = `${targetHeight}px`;
|
|
71
|
+
expandBtn.classList.remove(CLASSES.expandDone);
|
|
87
72
|
} else {
|
|
88
|
-
// 展开代码
|
|
89
|
-
const currentHeight = pre.offsetHeight;
|
|
90
73
|
const fullHeight = pre.scrollHeight;
|
|
91
74
|
|
|
92
|
-
// 先设置当前高度作为起点
|
|
93
|
-
pre.style.maxHeight = `${currentHeight}px`;
|
|
94
|
-
|
|
95
|
-
// 应用展开状态
|
|
96
75
|
figure.classList.add("expanded");
|
|
76
|
+
pre.style.maxHeight = `${fullHeight}px`;
|
|
77
|
+
expandBtn.classList.add(CLASSES.expandDone);
|
|
97
78
|
|
|
98
|
-
|
|
99
|
-
pre.style.maxHeight =
|
|
100
|
-
|
|
101
|
-
// 立即开始箭头旋转动画
|
|
102
|
-
expandBtn.classList.add(CLASSES.expandDone);
|
|
103
|
-
|
|
104
|
-
// 动画结束后清除max-height限制,允许内容自然增长
|
|
105
|
-
setTimeout(() => {
|
|
106
|
-
if (figure.classList.contains("expanded")) {
|
|
107
|
-
pre.style.maxHeight = "none";
|
|
108
|
-
}
|
|
109
|
-
}, 300);
|
|
110
|
-
});
|
|
79
|
+
setTimeout(() => {
|
|
80
|
+
pre.style.maxHeight = "none";
|
|
81
|
+
}, 300);
|
|
111
82
|
}
|
|
112
83
|
},
|
|
113
84
|
};
|
|
@@ -117,7 +88,7 @@ function handleToolbarClick(event) {
|
|
|
117
88
|
const classList = target.classList;
|
|
118
89
|
|
|
119
90
|
const handlers = {
|
|
120
|
-
expand: () => FeatureHandlers.
|
|
91
|
+
"expand": () => FeatureHandlers.expandCode(this),
|
|
121
92
|
"copy-button": () => FeatureHandlers.copy(this, target),
|
|
122
93
|
"toggle-wrap": () => FeatureHandlers.toggleWrap(this),
|
|
123
94
|
};
|