vuepress-plugin-md-power 1.0.0-rc.92 → 1.0.0-rc.93
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/lib/client/components/FileTreeItem.vue +151 -0
- package/lib/node/index.d.ts +1 -0
- package/lib/node/index.js +830 -16
- package/lib/shared/index.d.ts +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { onMounted, ref } from 'vue'
|
|
3
|
+
|
|
4
|
+
const props = defineProps<{
|
|
5
|
+
type: 'file' | 'folder'
|
|
6
|
+
expanded: boolean
|
|
7
|
+
empty: boolean
|
|
8
|
+
}>()
|
|
9
|
+
|
|
10
|
+
const active = ref(!!props.expanded)
|
|
11
|
+
const el = ref<HTMLElement>()
|
|
12
|
+
|
|
13
|
+
onMounted(() => {
|
|
14
|
+
if (!el.value || props.type !== 'folder')
|
|
15
|
+
return
|
|
16
|
+
|
|
17
|
+
el.value.querySelector('.tree-node.folder')?.addEventListener('click', () => {
|
|
18
|
+
active.value = !active.value
|
|
19
|
+
})
|
|
20
|
+
})
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<template>
|
|
24
|
+
<li ref="el" class="file-tree-item" :class="{ expanded: active }">
|
|
25
|
+
<slot />
|
|
26
|
+
<ul v-if="props.type === 'folder' && props.empty">
|
|
27
|
+
<li class="file-tree-item">
|
|
28
|
+
<span class="tree-node file">
|
|
29
|
+
<span class="name">…</span>
|
|
30
|
+
</span>
|
|
31
|
+
</li>
|
|
32
|
+
</ul>
|
|
33
|
+
</li>
|
|
34
|
+
</template>
|
|
35
|
+
|
|
36
|
+
<style>
|
|
37
|
+
.vp-file-tree {
|
|
38
|
+
width: fit-content;
|
|
39
|
+
max-width: 100%;
|
|
40
|
+
padding: 16px;
|
|
41
|
+
font-size: 14px;
|
|
42
|
+
background-color: var(--vp-c-bg-safe);
|
|
43
|
+
border: solid 1px var(--vp-c-divider);
|
|
44
|
+
border-radius: 8px;
|
|
45
|
+
transition: border var(--t-color), background-color var(--t-color);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.vp-file-tree ul {
|
|
49
|
+
padding: 0 !important;
|
|
50
|
+
margin: 0 !important;
|
|
51
|
+
list-style: none !important;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.file-tree-item {
|
|
55
|
+
margin-left: 14px;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.vp-file-tree .file-tree-item {
|
|
59
|
+
margin-top: 0;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.file-tree-item .tree-node {
|
|
63
|
+
display: flex;
|
|
64
|
+
flex-wrap: wrap;
|
|
65
|
+
gap: 8px;
|
|
66
|
+
align-items: center;
|
|
67
|
+
justify-content: flex-start;
|
|
68
|
+
margin: 4px 0;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.file-tree-item .tree-node .name {
|
|
72
|
+
font-family: var(--vp-font-family-mono);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.file-tree-item .tree-node.folder {
|
|
76
|
+
position: relative;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.file-tree-item .tree-node.folder > .name {
|
|
80
|
+
color: var(--vp-c-text-1);
|
|
81
|
+
cursor: pointer;
|
|
82
|
+
transition: color var(--t-color);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.file-tree-item .tree-node.folder > .name:hover {
|
|
86
|
+
color: var(--vp-c-brand-1);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.file-tree-item .tree-node.folder::before {
|
|
90
|
+
--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1em' height='1em' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M5.536 21.886a1 1 0 0 0 1.033-.064l13-9a1 1 0 0 0 0-1.644l-13-9A1 1 0 0 0 5 3v18a1 1 0 0 0 .536.886'/%3E%3C/svg%3E");
|
|
91
|
+
|
|
92
|
+
position: absolute;
|
|
93
|
+
top: 7px;
|
|
94
|
+
left: -14px;
|
|
95
|
+
display: block;
|
|
96
|
+
width: 10px;
|
|
97
|
+
height: 10px;
|
|
98
|
+
color: var(--vp-c-text-3);
|
|
99
|
+
content: "";
|
|
100
|
+
background-color: currentcolor;
|
|
101
|
+
-webkit-mask: var(--icon) no-repeat;
|
|
102
|
+
mask: var(--icon) no-repeat;
|
|
103
|
+
-webkit-mask-size: 100% 100%;
|
|
104
|
+
mask-size: 100% 100%;
|
|
105
|
+
transition: color var(--t-color);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.file-tree-item .tree-node.file .name.focus {
|
|
109
|
+
font-weight: bold;
|
|
110
|
+
color: var(--vp-c-brand-1);
|
|
111
|
+
transition: color var(--t-color);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.file-tree-item .tree-node .comment {
|
|
115
|
+
margin-left: 20px;
|
|
116
|
+
overflow: hidden;
|
|
117
|
+
color: var(--vp-c-text-3);
|
|
118
|
+
transition: color var(--t-color);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.file-tree-item .tree-node [class*="vp-fti-"] {
|
|
122
|
+
display: inline-block;
|
|
123
|
+
width: 0.9em;
|
|
124
|
+
height: 0.9em;
|
|
125
|
+
color: var(--vp-c-text-2);
|
|
126
|
+
background-color: currentcolor;
|
|
127
|
+
-webkit-mask: var(--icon) no-repeat;
|
|
128
|
+
mask: var(--icon) no-repeat;
|
|
129
|
+
-webkit-mask-size: 100% 100%;
|
|
130
|
+
mask-size: 100% 100%;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.file-tree-item .tree-node.folder [class*="vp-fti-"] {
|
|
134
|
+
cursor: pointer;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.vp-file-tree .file-tree-item > ul {
|
|
138
|
+
padding-left: 8px !important;
|
|
139
|
+
margin: 0 0 0 6px !important;
|
|
140
|
+
border-left: solid 1px var(--vp-c-divider);
|
|
141
|
+
transition: border-color var(--t-color);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.file-tree-item:not(.expanded) > ul {
|
|
145
|
+
display: none;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.file-tree-item.expanded > .tree-node.folder::before {
|
|
149
|
+
transform: rotate(90deg);
|
|
150
|
+
}
|
|
151
|
+
</style>
|