vuepress-plugin-md-power 1.0.0-rc.143 → 1.0.0-rc.144

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/README.md CHANGED
@@ -95,10 +95,10 @@ pnpm add @iconify/json
95
95
  #### 语法
96
96
 
97
97
  ```md
98
- :[collect:icon]:
99
- :[collect:icon size]:
100
- :[collect:icon /color]:
101
- :[collect:icon size/color]:
98
+ ::collect:icon::
99
+ ::collect:icon =size::
100
+ ::collect:icon /color::
101
+ ::collect:icon =size /color::
102
102
  ```
103
103
 
104
104
  你可以从 [icon-sets.iconify](https://icon-sets.iconify.design/) 获取 图标集。
@@ -106,25 +106,25 @@ pnpm add @iconify/json
106
106
  显示 `logos` 图标集合下的 `vue` 图标
107
107
 
108
108
  ```md
109
- :[logos:vue]:
109
+ ::logos:vue::
110
110
  ```
111
111
 
112
- 图标默认大小为 `1em` ,你可以通过 `size` 设置图标大小
112
+ 图标默认大小为 `1em` ,你可以通过 `=size` 设置图标大小
113
113
 
114
114
  ```md
115
- :[logos:vue 1.2em]:
115
+ ::logos:vue =1.2em::
116
116
  ```
117
117
 
118
118
  图标默认颜色为 `currentColor` 你可以通过 `/color` 设置图标颜色
119
119
 
120
120
  ```md
121
- :[logos:vue /blue]:
121
+ ::logos:vue /blue::
122
122
  ```
123
123
 
124
- 也可以通过 `size/color` 设置图标大小和颜色
124
+ 也可以通过 `=size /color` 设置图标大小和颜色
125
125
 
126
126
  ```md
127
- :[logos:vue 1.2em/blue]:
127
+ ::logos:vue =1.2em /blue::
128
128
  ```
129
129
 
130
130
  ### bilibili
@@ -14,12 +14,12 @@ interface MessageData {
14
14
 
15
15
  const props = withDefaults(defineProps<{
16
16
  feature: string
17
- past?: string
18
- future?: string
17
+ past?: number
18
+ future?: number
19
19
  meta?: string
20
20
  }>(), {
21
- past: '2',
22
- future: '1',
21
+ past: 2,
22
+ future: 1,
23
23
  meta: '',
24
24
  })
25
25
 
@@ -0,0 +1,212 @@
1
+ <script setup lang="ts">
2
+ import type { Ref } from 'vue'
3
+ import { FadeInExpandTransition } from '@vuepress/helper/client'
4
+ import { inject, ref } from 'vue'
5
+
6
+ import '@vuepress/helper/transition/fade-in-height-expand.css'
7
+
8
+ const props = defineProps<{
9
+ type: 'file' | 'folder'
10
+ filename: string
11
+ expanded?: boolean
12
+ focus?: boolean
13
+ }>()
14
+
15
+ const activeFileTreeNode = inject<Ref<string>>('active-file-tree-node', ref(''))
16
+
17
+ const onNodeClick = inject<
18
+ (filename: string, type: 'file' | 'folder') => void
19
+ >('on-file-tree-node-click', () => {})
20
+
21
+ const active = ref(props.expanded)
22
+
23
+ function nodeClick() {
24
+ if (props.filename === '…' || props.filename === '...')
25
+ return
26
+
27
+ onNodeClick(props.filename, props.type)
28
+ }
29
+
30
+ function toggle(ev: MouseEvent) {
31
+ if (props.type === 'folder') {
32
+ const el = ev.target as HTMLElement
33
+ if (!el.matches('.comment, .comment *')) {
34
+ active.value = !active.value
35
+ nodeClick()
36
+ }
37
+ }
38
+ else {
39
+ nodeClick()
40
+ }
41
+ }
42
+ </script>
43
+
44
+ <template>
45
+ <div class="vp-file-tree-node">
46
+ <p
47
+ class="vp-file-tree-info" :class="{
48
+ [type]: true,
49
+ focus,
50
+ expanded: type === 'folder' ? active : false,
51
+ active: type === 'file' ? activeFileTreeNode === filename : false,
52
+ }"
53
+ @click="toggle"
54
+ >
55
+ <slot name="icon" />
56
+ <span class="name" :class="[type]">{{ filename }}</span>
57
+ <span v-if="$slots.comment" class="comment"><slot name="comment" /></span>
58
+ </p>
59
+ <FadeInExpandTransition>
60
+ <div v-if="type === 'folder'" v-show="active" class="group">
61
+ <slot />
62
+ </div>
63
+ </FadeInExpandTransition>
64
+ </div>
65
+ </template>
66
+
67
+ <style>
68
+ .vp-file-tree {
69
+ max-width: 100%;
70
+ padding: 16px;
71
+ overflow: auto hidden;
72
+ font-size: 14px;
73
+ background-color: var(--vp-c-bg-safe);
74
+ border: solid 1px var(--vp-c-divider);
75
+ border-radius: 8px;
76
+ transition: border var(--vp-t-color), background-color var(--vp-t-color);
77
+ }
78
+
79
+ .vp-file-tree .vp-file-tree-title {
80
+ padding: 8px 16px;
81
+ margin: -16px -16px 8px;
82
+ font-weight: bold;
83
+ color: var(--vp-c-text-1);
84
+ border-bottom: solid 1px var(--vp-c-divider);
85
+ transition: color var(--vp-t-color), border-color var(--vp-t-color);
86
+ }
87
+
88
+ .vp-file-tree .vp-file-tree-info {
89
+ position: relative;
90
+ display: flex;
91
+ gap: 8px;
92
+ align-items: center;
93
+ justify-content: flex-start;
94
+ height: 28px;
95
+ padding: 2px 0;
96
+ margin: 0 0 0 16px;
97
+ line-height: 24px;
98
+ text-wrap: nowrap;
99
+ }
100
+
101
+ .vp-file-tree .vp-file-tree-info::after {
102
+ position: absolute;
103
+ top: 1px;
104
+ right: 0;
105
+ bottom: 1px;
106
+ left: -16px;
107
+ z-index: 0;
108
+ display: block;
109
+ pointer-events: none;
110
+ content: "";
111
+ background-color: transparent;
112
+ border-radius: 6px;
113
+ transition: background-color var(--vp-t-color);
114
+ }
115
+
116
+ .vp-file-tree .vp-file-tree-info.active::after,
117
+ .vp-file-tree .vp-file-tree-info:hover::after {
118
+ background-color: var(--vp-c-default-soft);
119
+ }
120
+
121
+ .vp-file-tree .vp-file-tree-info.folder {
122
+ cursor: pointer;
123
+ }
124
+
125
+ .vp-file-tree .vp-file-tree-info.folder::before {
126
+ --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='%23000' d='m5.157 13.069l4.611-4.685a.546.546 0 0 0 0-.768L5.158 2.93a.55.55 0 0 1 0-.771a.53.53 0 0 1 .759 0l4.61 4.684a1.65 1.65 0 0 1 0 2.312l-4.61 4.684a.53.53 0 0 1-.76 0a.55.55 0 0 1 0-.771'/%3E%3C/svg%3E");
127
+
128
+ position: absolute;
129
+ top: 8px;
130
+ left: -16px;
131
+ display: block;
132
+ width: 12px;
133
+ height: 12px;
134
+ color: var(--vp-c-text-2);
135
+ cursor: pointer;
136
+ content: "";
137
+ background-color: currentcolor;
138
+ -webkit-mask: var(--icon) no-repeat;
139
+ mask: var(--icon) no-repeat;
140
+ -webkit-mask-size: 100% 100%;
141
+ mask-size: 100% 100%;
142
+ transition: color var(--vp-t-color), transform var(--vp-t-color);
143
+ transform: rotate(0);
144
+ }
145
+
146
+ .vp-file-tree .vp-file-tree-info.folder.expanded::before {
147
+ transform: rotate(90deg);
148
+ }
149
+
150
+ .vp-file-tree .vp-file-tree-info .name {
151
+ position: relative;
152
+ font-family: var(--vp-font-family-mono);
153
+ }
154
+
155
+ .vp-file-tree .vp-file-tree-info.folder .name {
156
+ color: var(--vp-c-text-1);
157
+ transition: color var(--vp-t-color);
158
+ }
159
+
160
+ .vp-file-tree .vp-file-tree-info.focus .name {
161
+ padding: 0 4px;
162
+ margin: 0 -4px;
163
+ font-weight: bold;
164
+ color: var(--vp-c-bg);
165
+ background-color: var(--vp-c-brand-2);
166
+ border-radius: 4px;
167
+ transition: color var(--vp-t-color), background-color var(--vp-t-color);
168
+ }
169
+
170
+ .vp-file-tree .vp-file-tree-info.active .name {
171
+ color: var(--vp-c-brand-1);
172
+ }
173
+
174
+ .vp-file-tree .vp-file-tree-info:not(.focus).folder .name:hover {
175
+ color: var(--vp-c-brand-1);
176
+ }
177
+
178
+ .vp-file-tree .vp-file-tree-info .comment {
179
+ display: inline-block;
180
+ flex: 1 2;
181
+ height: 28px;
182
+ padding-right: 16px;
183
+ padding-left: 20px;
184
+ margin: -2px 0;
185
+ line-height: 28px;
186
+ color: var(--vp-c-text-3);
187
+ cursor: auto;
188
+ transition: color var(--vp-t-color);
189
+ }
190
+
191
+ .vp-file-tree .vp-file-tree-node .group {
192
+ position: relative;
193
+ margin-left: 28px;
194
+ }
195
+
196
+ .vp-file-tree .vp-file-tree-node .group::before {
197
+ position: absolute;
198
+ top: 0;
199
+ left: -4px;
200
+ width: 1px;
201
+ height: 100%;
202
+ content: "";
203
+ background-color: var(--vp-c-divider);
204
+ transition: background-color var(--vp-t-color);
205
+ }
206
+
207
+ .vp-file-tree [class*="vpi-"] {
208
+ width: 1.2em;
209
+ height: 1.2em;
210
+ margin: 0;
211
+ }
212
+ </style>
@@ -15,9 +15,9 @@ function useResources(el, config) {
15
15
  if (!conf)
16
16
  return [];
17
17
  return [
18
- { name: "JavaScript", items: conf.jsLib.map((url) => ({ name: normalizeName(url), url })) },
19
- { name: "CSS", items: conf.cssLib.map((url) => ({ name: normalizeName(url), url })) }
20
- ].filter((i) => i.items.length);
18
+ { name: "JavaScript", items: conf.jsLib?.map((url) => ({ name: normalizeName(url), url })) },
19
+ { name: "CSS", items: conf.cssLib?.map((url) => ({ name: normalizeName(url), url })) }
20
+ ].filter((i) => i.items?.length);
21
21
  });
22
22
  function normalizeName(url) {
23
23
  return url.slice(url.lastIndexOf("/") + 1);
@@ -205,7 +205,7 @@ interface MarkdownPowerPluginOptions {
205
205
  /**
206
206
  * 是否启用 iconify 图标嵌入语法
207
207
  *
208
- * `:[collect:icon_name]:`
208
+ * `::collect:icon_name::`
209
209
  *
210
210
  * @default false
211
211
  */