vuepress-plugin-md-power 1.0.0-rc.181 → 1.0.0-rc.183
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.
|
@@ -157,6 +157,9 @@ function onTabNavClick(index: number): void {
|
|
|
157
157
|
|
|
158
158
|
.vp-code-tab-nav {
|
|
159
159
|
position: relative;
|
|
160
|
+
display: inline-flex;
|
|
161
|
+
gap: 4px;
|
|
162
|
+
align-items: center;
|
|
160
163
|
padding: 0 12px;
|
|
161
164
|
font-size: 14px;
|
|
162
165
|
font-weight: 500;
|
|
@@ -202,7 +205,7 @@ function onTabNavClick(index: number): void {
|
|
|
202
205
|
.vp-code-tab-nav .vp-icon {
|
|
203
206
|
width: 18px;
|
|
204
207
|
height: 18px;
|
|
205
|
-
margin
|
|
208
|
+
margin: 0;
|
|
206
209
|
}
|
|
207
210
|
|
|
208
211
|
.vp-code-tab-nav span {
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { onContentUpdated, useRouter } from "vuepress/client";
|
|
1
|
+
import { onContentUpdated } from "vuepress/client";
|
|
3
2
|
|
|
4
3
|
//#region src/client/composables/mark.ts
|
|
5
4
|
const MARK_MODE_ATTR = "data-mark-mode";
|
|
6
5
|
const MARK_MODE_LAZY = "lazy";
|
|
7
6
|
const MARK_VISIBLE_CLASS = "vp-mark-visible";
|
|
8
7
|
const MARK_BOUND_ATTR = "data-vp-mark-bound";
|
|
9
|
-
const MARK_SELECTOR = "
|
|
10
|
-
const DOC_SELECTOR = ".vp-doc";
|
|
8
|
+
const MARK_SELECTOR = "mark";
|
|
11
9
|
const BOUND_SELECTOR = `${MARK_SELECTOR}[${MARK_BOUND_ATTR}="1"]`;
|
|
12
10
|
function setupMarkHighlight(mode) {
|
|
13
11
|
if (typeof window === "undefined" || __VUEPRESS_SSR__) return;
|
|
@@ -18,9 +16,7 @@ function setupMarkHighlight(mode) {
|
|
|
18
16
|
}
|
|
19
17
|
root.setAttribute(MARK_MODE_ATTR, MARK_MODE_LAZY);
|
|
20
18
|
let intersectionObserver = null;
|
|
21
|
-
let mutationObserver = null;
|
|
22
19
|
let rafId = null;
|
|
23
|
-
let removeAfterEach = null;
|
|
24
20
|
const ensureObserver = () => {
|
|
25
21
|
if (!intersectionObserver) intersectionObserver = new IntersectionObserver((entries, obs) => {
|
|
26
22
|
for (const entry of entries) {
|
|
@@ -57,51 +53,18 @@ function setupMarkHighlight(mode) {
|
|
|
57
53
|
bindMarks();
|
|
58
54
|
});
|
|
59
55
|
};
|
|
60
|
-
const observeDocMutations = () => {
|
|
61
|
-
const doc = document.querySelector(DOC_SELECTOR);
|
|
62
|
-
if (!doc) return;
|
|
63
|
-
if (mutationObserver) mutationObserver.disconnect();
|
|
64
|
-
mutationObserver = new MutationObserver((mutations) => {
|
|
65
|
-
if (mutations.some((mutation) => mutation.addedNodes.length > 0)) scheduleBind();
|
|
66
|
-
});
|
|
67
|
-
mutationObserver.observe(doc, {
|
|
68
|
-
childList: true,
|
|
69
|
-
subtree: true
|
|
70
|
-
});
|
|
71
|
-
};
|
|
72
56
|
const resetObserver = () => {
|
|
73
|
-
|
|
57
|
+
if (!intersectionObserver) return;
|
|
58
|
+
intersectionObserver.disconnect();
|
|
59
|
+
intersectionObserver = null;
|
|
60
|
+
Array.from(document.querySelectorAll(BOUND_SELECTOR) || []).forEach((mark) => {
|
|
74
61
|
if (!mark.classList.contains(MARK_VISIBLE_CLASS)) mark.removeAttribute(MARK_BOUND_ATTR);
|
|
75
62
|
});
|
|
76
|
-
if (intersectionObserver) {
|
|
77
|
-
intersectionObserver.disconnect();
|
|
78
|
-
intersectionObserver = null;
|
|
79
|
-
}
|
|
80
63
|
};
|
|
81
|
-
const router = useRouter();
|
|
82
|
-
onMounted(() => {
|
|
83
|
-
observeDocMutations();
|
|
84
|
-
scheduleBind();
|
|
85
|
-
});
|
|
86
64
|
onContentUpdated(() => {
|
|
87
65
|
resetObserver();
|
|
88
|
-
observeDocMutations();
|
|
89
66
|
scheduleBind();
|
|
90
67
|
});
|
|
91
|
-
if (router?.afterEach) removeAfterEach = router.afterEach(() => {
|
|
92
|
-
resetObserver();
|
|
93
|
-
observeDocMutations();
|
|
94
|
-
scheduleBind();
|
|
95
|
-
});
|
|
96
|
-
if (router?.isReady) router.isReady().then(() => scheduleBind()).catch(() => {});
|
|
97
|
-
onBeforeUnmount(() => {
|
|
98
|
-
if (rafId !== null) cancelAnimationFrame(rafId);
|
|
99
|
-
resetObserver();
|
|
100
|
-
mutationObserver?.disconnect();
|
|
101
|
-
mutationObserver = null;
|
|
102
|
-
removeAfterEach?.();
|
|
103
|
-
removeAfterEach = null;
|
|
104
|
-
});
|
|
105
68
|
}
|
|
106
69
|
|
|
107
70
|
//#endregion
|
package/lib/node/index.d.ts
CHANGED
|
@@ -146,6 +146,20 @@ interface IconifyProvider extends IconProviderBase {
|
|
|
146
146
|
* @default ''
|
|
147
147
|
*/
|
|
148
148
|
prefix?: LiteralUnion<IconifyPrefix>;
|
|
149
|
+
/**
|
|
150
|
+
* preload iconify icons
|
|
151
|
+
*
|
|
152
|
+
* 预加载 iconify 图标,
|
|
153
|
+
*
|
|
154
|
+
*
|
|
155
|
+
* - `string[]` 需要预加载的图标名称,`collect:name` 格式
|
|
156
|
+
* - `Record<collect, name[]>` 以 collect 为 key, value 为需要预加载的图标 `name`
|
|
157
|
+
* 其中,如果 key 为 `preflight` 时,value 为预加载图标的 `collect:name` 格式
|
|
158
|
+
*
|
|
159
|
+
* 此配置主要用于开发组件时,在组件中直接使用 `<VPIcon name="xx" />` 时无法触发
|
|
160
|
+
* 主题的图标本地资源分析功能,通过预加载的方式直接预设为本地资源图标。
|
|
161
|
+
*/
|
|
162
|
+
preload?: string[] | Record<LiteralUnion<IconifyPrefix | 'preflight'>, string[]>;
|
|
149
163
|
}
|
|
150
164
|
type FontAwesomeAssetBuiltIn = 'fontawesome' | 'fontawesome-with-brands';
|
|
151
165
|
type IconAssetLink = `//${string}` | `//${string}` | `https://${string}` | `http://${string}`;
|
package/lib/node/index.js
CHANGED
|
@@ -1777,11 +1777,12 @@ function parseFileTreeRawContent(content) {
|
|
|
1777
1777
|
children: []
|
|
1778
1778
|
};
|
|
1779
1779
|
const stack = [root];
|
|
1780
|
-
const lines = content.
|
|
1780
|
+
const lines = content.trimEnd().split("\n");
|
|
1781
|
+
const spaceLength = lines[0].match(/^\s*/)?.[0].length ?? 0;
|
|
1781
1782
|
for (const line of lines) {
|
|
1782
1783
|
const match = line.match(/^(\s*)-(.*)$/);
|
|
1783
1784
|
if (!match) continue;
|
|
1784
|
-
const level = Math.floor(match[1].length / 2);
|
|
1785
|
+
const level = Math.floor((match[1].length - spaceLength) / 2);
|
|
1785
1786
|
const info = match[2].trim();
|
|
1786
1787
|
while (stack.length > 0 && stack[stack.length - 1].level >= level) stack.pop();
|
|
1787
1788
|
const parent = stack[stack.length - 1];
|
package/lib/shared/index.d.ts
CHANGED
|
@@ -144,6 +144,20 @@ interface IconifyProvider extends IconProviderBase {
|
|
|
144
144
|
* @default ''
|
|
145
145
|
*/
|
|
146
146
|
prefix?: LiteralUnion<IconifyPrefix>;
|
|
147
|
+
/**
|
|
148
|
+
* preload iconify icons
|
|
149
|
+
*
|
|
150
|
+
* 预加载 iconify 图标,
|
|
151
|
+
*
|
|
152
|
+
*
|
|
153
|
+
* - `string[]` 需要预加载的图标名称,`collect:name` 格式
|
|
154
|
+
* - `Record<collect, name[]>` 以 collect 为 key, value 为需要预加载的图标 `name`
|
|
155
|
+
* 其中,如果 key 为 `preflight` 时,value 为预加载图标的 `collect:name` 格式
|
|
156
|
+
*
|
|
157
|
+
* 此配置主要用于开发组件时,在组件中直接使用 `<VPIcon name="xx" />` 时无法触发
|
|
158
|
+
* 主题的图标本地资源分析功能,通过预加载的方式直接预设为本地资源图标。
|
|
159
|
+
*/
|
|
160
|
+
preload?: string[] | Record<LiteralUnion<IconifyPrefix | 'preflight'>, string[]>;
|
|
147
161
|
}
|
|
148
162
|
type FontAwesomeAssetBuiltIn = 'fontawesome' | 'fontawesome-with-brands';
|
|
149
163
|
type IconAssetLink = `//${string}` | `//${string}` | `https://${string}` | `http://${string}`;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vuepress-plugin-md-power",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.0-rc.
|
|
4
|
+
"version": "1.0.0-rc.183",
|
|
5
5
|
"description": "The Plugin for VuePress 2 - markdown power",
|
|
6
6
|
"author": "pengzhanbo <volodymyr@foxmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"markdown-it": "^14.1.0",
|
|
40
40
|
"mpegts.js": "^1.7.3",
|
|
41
41
|
"pyodide": "^0.29.0",
|
|
42
|
-
"sass": "^1.
|
|
43
|
-
"sass-embedded": "^1.
|
|
42
|
+
"sass": "^1.96.0",
|
|
43
|
+
"sass-embedded": "^1.96.0",
|
|
44
44
|
"stylus": "^0.64.0",
|
|
45
45
|
"vuepress": "2.0.0-rc.26"
|
|
46
46
|
},
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"@mdit/plugin-tab": "^0.23.0",
|
|
86
86
|
"@mdit/plugin-tasklist": "^0.22.2",
|
|
87
87
|
"@pengzhanbo/utils": "^2.1.2",
|
|
88
|
-
"@vuepress/helper": "2.0.0-rc.
|
|
88
|
+
"@vuepress/helper": "2.0.0-rc.121",
|
|
89
89
|
"@vueuse/core": "^14.1.0",
|
|
90
90
|
"chokidar": "5.0.0",
|
|
91
91
|
"image-size": "^2.0.2",
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
"markdown-it-container": "^4.0.0",
|
|
96
96
|
"nanoid": "^5.1.6",
|
|
97
97
|
"qrcode": "^1.5.4",
|
|
98
|
-
"shiki": "^3.
|
|
98
|
+
"shiki": "^3.20.0",
|
|
99
99
|
"tm-grammars": "^1.26.0",
|
|
100
100
|
"tm-themes": "^1.10.13",
|
|
101
101
|
"vue": "^3.5.25"
|