vuepress-plugin-md-power 1.0.0-rc.136 → 1.0.0-rc.138

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.
@@ -0,0 +1,330 @@
1
+ <script lang="ts" setup>
2
+ import type { ComputedRef } from 'vue'
3
+ import { useMediaQuery } from '@vueuse/core'
4
+ import { computed, inject } from 'vue'
5
+ import { INJECT_TIMELINE_KEY } from '../options.js'
6
+
7
+ const props = defineProps<{
8
+ time?: string
9
+ type?: 'info' | 'tip' | 'success' | 'warning' | 'danger' | 'caution' | 'important' | (string & {})
10
+ card?: boolean
11
+ line?: 'solid' | 'dashed' | 'dotted'
12
+ icon?: string
13
+ color?: string
14
+ placement?: 'left' | 'right'
15
+ }>()
16
+
17
+ const is639 = useMediaQuery('(max-width: 639px)')
18
+
19
+ const defaultOptions = inject<ComputedRef<{
20
+ line?: 'solid' | 'dashed' | 'dotted'
21
+ card?: boolean
22
+ horizontal?: boolean
23
+ placement?: 'left' | 'right' | 'between'
24
+ }>>(INJECT_TIMELINE_KEY)
25
+
26
+ const timeline = computed(() => {
27
+ const between = defaultOptions?.value.placement === 'between' && !is639.value
28
+ const placement = defaultOptions?.value.placement === 'between' ? 'left' : defaultOptions?.value.placement
29
+ return {
30
+ time: props.time,
31
+ type: props.type || 'info',
32
+ line: props.line || defaultOptions?.value.line || 'solid',
33
+ icon: props.icon,
34
+ color: props.color,
35
+ horizontal: defaultOptions?.value.horizontal ?? false,
36
+ between: between ? props.placement || 'left' : false,
37
+ placement: between ? '' : (placement || 'left'),
38
+ card: props.card ?? defaultOptions?.value.card ?? false,
39
+ }
40
+ })
41
+ </script>
42
+
43
+ <template>
44
+ <div
45
+ class="vp-timeline-item" :class="{
46
+ card: timeline.card,
47
+ horizontal: timeline.horizontal,
48
+ [timeline.type]: true,
49
+ [`line-${timeline.line}`]: true,
50
+ [`placement-${timeline.placement}`]: !timeline.horizontal && timeline.placement,
51
+ between: timeline.between,
52
+ [`between-${timeline.between}`]: timeline.between,
53
+ }"
54
+ :style="timeline.color ? {
55
+ '--vp-timeline-c-line': timeline.color,
56
+ '--vp-timeline-c-point': timeline.color,
57
+ } : null"
58
+ >
59
+ <div class="vp-timeline-line" :class="{ 'has-icon': timeline.icon }">
60
+ <span class="vp-timeline-point">
61
+ <slot name="icon">
62
+ <VPIcon v-if="timeline.icon" :name="timeline.icon" />
63
+ </slot>
64
+ </span>
65
+ </div>
66
+ <div class="vp-timeline-container">
67
+ <div class="vp-timeline-content">
68
+ <p class="vp-timeline-title">
69
+ <slot name="title" />
70
+ </p>
71
+ <slot />
72
+ </div>
73
+ <p v-if="timeline.time" class="vp-timeline-time">
74
+ {{ timeline.time }}
75
+ </p>
76
+ </div>
77
+ </div>
78
+ </template>
79
+
80
+ <style>
81
+ :root,
82
+ .vp-timeline-item.info {
83
+ --vp-timeline-c-line: var(--vp-c-border);
84
+ --vp-timeline-c-point: var(--vp-c-border);
85
+ --vp-timeline-c-title: var(--vp-c-text-1);
86
+ --vp-timeline-c-text: var(--vp-c-text-1);
87
+ --vp-timeline-c-time: var(--vp-c-text-3);
88
+ --vp-timeline-c-icon: var(--vp-c-bg);
89
+ --vp-timeline-bg-card: var(--vp-c-bg-soft);
90
+ }
91
+
92
+ .vp-timeline-item.tip {
93
+ --vp-timeline-c-line: var(--vp-c-tip-1);
94
+ --vp-timeline-c-point: var(--vp-c-tip-1);
95
+ --vp-timeline-bg-card: var(--vp-c-tip-soft);
96
+ }
97
+
98
+ .vp-timeline-item.success {
99
+ --vp-timeline-c-line: var(--vp-c-success-3);
100
+ --vp-timeline-c-point: var(--vp-c-success-3);
101
+ --vp-timeline-bg-card: var(--vp-c-success-soft);
102
+ }
103
+
104
+ .vp-timeline-item.warning {
105
+ --vp-timeline-c-line: var(--vp-c-warning-3);
106
+ --vp-timeline-c-point: var(--vp-c-warning-3);
107
+ --vp-timeline-bg-card: var(--vp-c-warning-soft);
108
+ }
109
+
110
+ .vp-timeline-item.danger {
111
+ --vp-timeline-c-line: var(--vp-c-danger-3);
112
+ --vp-timeline-c-point: var(--vp-c-danger-3);
113
+ --vp-timeline-bg-card: var(--vp-c-danger-soft);
114
+ }
115
+
116
+ .vp-timeline-item.caution {
117
+ --vp-timeline-c-line: var(--vp-c-caution-3);
118
+ --vp-timeline-c-point: var(--vp-c-caution-3);
119
+ --vp-timeline-bg-card: var(--vp-c-caution-soft);
120
+ }
121
+
122
+ .vp-timeline-item.important {
123
+ --vp-timeline-c-line: var(--vp-c-important-3);
124
+ --vp-timeline-c-point: var(--vp-c-important-3);
125
+ --vp-timeline-bg-card: var(--vp-c-important-soft);
126
+ }
127
+
128
+ .vp-timeline-item {
129
+ position: relative;
130
+ display: flex;
131
+ }
132
+
133
+ .vp-timeline-item:not(.horizontal).between {
134
+ width: calc(50% - 18px);
135
+ }
136
+
137
+ .vp-timeline-item.horizontal {
138
+ padding-top: 36px;
139
+ }
140
+
141
+ .vp-timeline-item > .vp-timeline-line {
142
+ position: absolute;
143
+ }
144
+
145
+ .vp-timeline-item:not(.horizontal).placement-left {
146
+ justify-content: flex-start;
147
+ padding-left: 36px;
148
+ }
149
+
150
+ .vp-timeline-item:not(.horizontal).placement-right,
151
+ .vp-timeline-item:not(.horizontal).between {
152
+ justify-content: flex-end;
153
+ padding-right: 36px;
154
+ text-align: right;
155
+ }
156
+
157
+ .vp-timeline-item:not(.horizontal) > .vp-timeline-line {
158
+ top: 0;
159
+ bottom: 0;
160
+ width: 0;
161
+ }
162
+
163
+ .vp-timeline-item.horizontal > .vp-timeline-line {
164
+ top: 12px;
165
+ right: 0;
166
+ left: 0;
167
+ height: 0;
168
+ }
169
+
170
+ .vp-timeline-item:not(.horizontal).card > .vp-timeline-line {
171
+ top: 14px;
172
+ }
173
+
174
+ .vp-timeline-item:not(.horizontal).placement-left > .vp-timeline-line {
175
+ left: 12px;
176
+ }
177
+
178
+ .vp-timeline-item:not(.horizontal).placement-right > .vp-timeline-line,
179
+ .vp-timeline-item:not(.horizontal).between > .vp-timeline-line {
180
+ right: 12px;
181
+ }
182
+
183
+ .vp-timeline-item > .vp-timeline-line::before {
184
+ position: absolute;
185
+ display: block;
186
+ content: "";
187
+ border: none;
188
+ }
189
+
190
+ .vp-timeline-item:not(.horizontal) > .vp-timeline-line::before {
191
+ top: 10px;
192
+ bottom: -48px;
193
+ border-left: 2px solid var(--vp-timeline-c-line);
194
+ }
195
+
196
+ .vp-timeline-item.horizontal > .vp-timeline-line::before {
197
+ right: -46px;
198
+ left: 8px;
199
+ border-top: 2px solid var(--vp-timeline-c-line);
200
+ }
201
+
202
+ .vp-timeline-item:not(.horizontal):last-of-type > .vp-timeline-line::before {
203
+ bottom: 0 !important;
204
+ }
205
+
206
+ .vp-timeline-item.horizontal:last-of-type > .vp-timeline-line::before {
207
+ right: 0 !important;
208
+ }
209
+
210
+ .vp-timeline-item:not(.horizontal).line-dashed > .vp-timeline-line::before {
211
+ border-left-style: dashed;
212
+ }
213
+
214
+ .vp-timeline-item:not(.horizontal).line-dotted > .vp-timeline-line::before {
215
+ border-left-style: dotted;
216
+ }
217
+
218
+ .vp-timeline-item.horizontal.line-dashed > .vp-timeline-line::before {
219
+ border-top-style: dashed;
220
+ }
221
+
222
+ .vp-timeline-item.horizontal.line-dotted > .vp-timeline-line::before {
223
+ border-top-style: dotted;
224
+ }
225
+
226
+ .vp-timeline-item > .vp-timeline-line .vp-timeline-point {
227
+ position: absolute;
228
+ width: 16px;
229
+ height: 16px;
230
+ background-color: var(--vp-timeline-c-point);
231
+ border-radius: 50%;
232
+ transition: background-color var(--vp-t-color);
233
+ }
234
+
235
+ .vp-timeline-item:not(.horizontal) > .vp-timeline-line .vp-timeline-point {
236
+ top: 4px;
237
+ left: -7px;
238
+ }
239
+
240
+ .vp-timeline-item.horizontal > .vp-timeline-line .vp-timeline-point {
241
+ top: -7px;
242
+ left: 0;
243
+ }
244
+
245
+ .vp-timeline-item > .vp-timeline-line.has-icon .vp-timeline-point {
246
+ display: flex;
247
+ align-items: center;
248
+ justify-content: center;
249
+ width: 24px;
250
+ height: 24px;
251
+ }
252
+
253
+ .vp-timeline-item:not(.horizontal) > .vp-timeline-line.has-icon .vp-timeline-point {
254
+ top: -1px;
255
+ left: -11px;
256
+ }
257
+
258
+ .vp-timeline-item.horizontal > .vp-timeline-line.has-icon .vp-timeline-point {
259
+ top: -11px;
260
+ left: 0;
261
+ }
262
+
263
+ .vp-timeline-item > .vp-timeline-line.has-icon .vp-timeline-point .vp-icon {
264
+ width: 16px;
265
+ height: 16px;
266
+ margin: 0;
267
+ color: var(--vp-timeline-c-icon);
268
+ }
269
+
270
+ .vp-timeline-item .vp-timeline-container {
271
+ width: max-content;
272
+ max-width: 100%;
273
+ font-size: 16px;
274
+ line-height: 1.5;
275
+ color: var(--vp-timeline-c-text);
276
+ transition: color var(--vp-t-color);
277
+ }
278
+
279
+ .vp-timeline-item.horizontal .vp-timeline-container {
280
+ max-width: 240px;
281
+ }
282
+
283
+ .vp-timeline-item:not(.horizontal).between-right .vp-timeline-container {
284
+ text-align: left;
285
+ transform: translateX(calc(100% + 48px));
286
+ }
287
+
288
+ .vp-timeline-item.card .vp-timeline-content {
289
+ padding: 16px;
290
+ background-color: var(--vp-timeline-bg-card);
291
+ border-radius: 6px;
292
+ }
293
+
294
+ .vp-timeline-item .vp-timeline-content :where(p, ul, ol) {
295
+ margin: 8px 0;
296
+ line-height: 22px;
297
+ }
298
+
299
+ .vp-doc .vp-timeline-item .vp-timeline-content div[class*="language-"] {
300
+ margin: 16px 0;
301
+ }
302
+
303
+ .vp-timeline-item .vp-timeline-content li + li {
304
+ margin-top: 4px;
305
+ }
306
+
307
+ .vp-timeline-item .vp-timeline-content .vp-timeline-title {
308
+ margin: 0 0 8px;
309
+ font-size: 16px;
310
+ font-weight: 900;
311
+ color: var(--vp-timeline-c-title);
312
+ transition: color var(--vp-t-color);
313
+ }
314
+
315
+ .vp-timeline-item .vp-timeline-content > .vp-timeline-title + * {
316
+ margin-top: 0 !important;
317
+ }
318
+
319
+ .vp-timeline-item .vp-timeline-content > :last-child {
320
+ margin-bottom: 0 !important;
321
+ }
322
+
323
+ .vp-timeline-item .vp-timeline-time {
324
+ margin: 4px 0 0;
325
+ font-size: 14px;
326
+ font-weight: 500;
327
+ color: var(--vp-timeline-c-time);
328
+ transition: color var(--vp-t-color);
329
+ }
330
+ </style>
@@ -7,5 +7,7 @@ declare const installed: {
7
7
  mpegtsjs: boolean;
8
8
  };
9
9
  declare const ART_PLAYER_SUPPORTED_VIDEO_TYPES: string[];
10
+ declare const INJECT_TIMELINE_KEY: unique symbol;
11
+ declare const INJECT_COLLAPSE_KEY: unique symbol;
10
12
 
11
- export { ART_PLAYER_SUPPORTED_VIDEO_TYPES, installed, pluginOptions };
13
+ export { ART_PLAYER_SUPPORTED_VIDEO_TYPES, INJECT_COLLAPSE_KEY, INJECT_TIMELINE_KEY, installed, pluginOptions };
@@ -15,8 +15,16 @@ if (installed.hlsjs) {
15
15
  if (installed.mpegtsjs) {
16
16
  ART_PLAYER_SUPPORTED_VIDEO_TYPES.push("ts", "flv");
17
17
  }
18
+ var INJECT_TIMELINE_KEY = Symbol(
19
+ __VUEPRESS_DEV__ ? "timeline" : ""
20
+ );
21
+ var INJECT_COLLAPSE_KEY = Symbol(
22
+ __VUEPRESS_DEV__ ? "collapse" : ""
23
+ );
18
24
  export {
19
25
  ART_PLAYER_SUPPORTED_VIDEO_TYPES,
26
+ INJECT_COLLAPSE_KEY,
27
+ INJECT_TIMELINE_KEY,
20
28
  installed,
21
29
  pluginOptions
22
30
  };
@@ -1,5 +1,12 @@
1
1
  import type { ReplEditorData } from '../shared/repl.js'
2
2
 
3
+ declare module '*.vue' {
4
+ import type { ComponentOptions } from 'vue'
5
+
6
+ const comp: ComponentOptions
7
+ export default comp
8
+ }
9
+
3
10
  declare module '@internal/md-power/replEditorData' {
4
11
 
5
12
  const res: ReplEditorData
@@ -0,0 +1,129 @@
1
+ :root {
2
+ --vp-chat-c-bg: var(--vp-c-bg-soft);
3
+ --vp-chat-c-bg-header: var(--vp-c-bg-soft);
4
+ --vp-chat-c-bg-content: var(--vp-c-bg-soft);
5
+ --vp-chat-c-bg-user: var(--vp-c-bg);
6
+ --vp-chat-c-bg-self: var(--vp-c-brand-soft);
7
+ --vp-chat-c-title: var(--vp-c-text-1);
8
+ --vp-chat-c-text: var(--vp-c-text-1);
9
+ --vp-chat-c-date: var(--vp-c-text-3);
10
+ --vp-chat-c-username: var(--vp-c-text-2);
11
+ }
12
+
13
+ .vp-chat {
14
+ width: 100%;
15
+ margin: 16px 0;
16
+ overflow: hidden;
17
+ background-color: var(--vp-chat-c-bg);
18
+ border-radius: 6px;
19
+ transition: background-color var(--vp-t-color);
20
+ }
21
+
22
+ @media (min-width: 640px) {
23
+ .vp-chat {
24
+ width: 320px;
25
+ margin: 16px auto;
26
+ }
27
+ }
28
+
29
+ @media (min-width: 768px) {
30
+ .vp-chat {
31
+ width: 360px;
32
+ }
33
+ }
34
+
35
+ @media (min-width: 960px) {
36
+ .vp-chat {
37
+ width: 480px;
38
+ }
39
+ }
40
+
41
+ .vp-chat .vp-chat-header {
42
+ display: flex;
43
+ align-items: center;
44
+ justify-content: center;
45
+ height: 44px;
46
+ background-color: var(--vp-chat-c-bg-header);
47
+ transition: background-color var(--vp-t-color);
48
+ }
49
+
50
+ .vp-chat .vp-chat-title {
51
+ flex: 1 2;
52
+ font-weight: 600;
53
+ color: var(--vp-chat-c-title);
54
+ text-align: center;
55
+ transition: color var(--vp-t-color);
56
+ }
57
+
58
+ .vp-chat .vp-chat-content {
59
+ padding: 0 16px 24px;
60
+ background-color: var(--vp-chat-c-bg-content);
61
+ transition: background-color var(--vp-t-color);
62
+ }
63
+
64
+ .vp-chat .vp-chat-date {
65
+ display: flex;
66
+ align-items: center;
67
+ justify-content: center;
68
+ margin: 16px 0;
69
+ font-size: 12px;
70
+ color: var(--vp-chat-c-date);
71
+ transition: color var(--vp-t-color);
72
+ }
73
+
74
+ .vp-chat .vp-chat-message {
75
+ display: flex;
76
+ margin-bottom: 16px;
77
+ }
78
+
79
+ .vp-chat .vp-chat-message.self {
80
+ justify-content: flex-end;
81
+ }
82
+
83
+ .vp-chat .vp-chat-message:last-child {
84
+ margin-bottom: 0;
85
+ }
86
+
87
+ .vp-chat .vp-chat-message-body {
88
+ flex-shrink: 2;
89
+ padding-right: 32px;
90
+ }
91
+
92
+ .vp-chat .vp-chat-message.self .vp-chat-message-body {
93
+ padding-right: 0;
94
+ padding-left: 32px;
95
+ }
96
+
97
+ .vp-chat .vp-chat-username {
98
+ margin: 0;
99
+ font-size: 14px;
100
+ font-weight: 500;
101
+ color: var(--vp-chat-c-username);
102
+ }
103
+
104
+ .vp-chat .vp-chat-message-body .message-content {
105
+ max-width: 100%;
106
+ padding: 8px 16px;
107
+ font-size: 14px;
108
+ line-height: 22px;
109
+ color: var(--vp-chat-c-text);
110
+ background-color: var(--vp-chat-c-bg-user);
111
+ border-radius: 6px;
112
+ box-shadow: var(--vp-shadow-1);
113
+ }
114
+
115
+ .vp-chat .vp-chat-message.self .vp-chat-message-body .message-content {
116
+ background-color: var(--vp-chat-c-bg-self);
117
+ }
118
+
119
+ .vp-chat .vp-chat-message-body .message-content :where(p, ul, ol) {
120
+ margin: 8px 0;
121
+ }
122
+
123
+ .vp-chat .vp-chat-message-body .message-content :first-child {
124
+ margin-top: 0;
125
+ }
126
+
127
+ .vp-chat .vp-chat-message-body .message-content :last-child {
128
+ margin-bottom: 0;
129
+ }
@@ -147,6 +147,17 @@
147
147
  list-style: none;
148
148
  }
149
149
 
150
+ .demo-draw-vue {
151
+ position: absolute;
152
+ top: -99999px;
153
+ left: -99999px;
154
+ z-index: 1;
155
+ padding: 24px;
156
+ overflow: hidden;
157
+ transform: translate3d(0, 0, 0);
158
+ will-change: top, left, width, height;
159
+ }
160
+
150
161
  .vpi-demo-code {
151
162
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M14.18 4.276a.75.75 0 0 1 .531.918l-3.973 14.83a.75.75 0 0 1-1.45-.389l3.974-14.83a.75.75 0 0 1 .919-.53m2.262 3.053a.75.75 0 0 1 1.059-.056l1.737 1.564c.737.662 1.347 1.212 1.767 1.71c.44.525.754 1.088.754 1.784c0 .695-.313 1.258-.754 1.782c-.42.499-1.03 1.049-1.767 1.711l-1.737 1.564a.75.75 0 0 1-1.004-1.115l1.697-1.527c.788-.709 1.319-1.19 1.663-1.598c.33-.393.402-.622.402-.818s-.072-.424-.402-.817c-.344-.409-.875-.89-1.663-1.598l-1.697-1.527a.75.75 0 0 1-.056-1.06m-8.94 1.06a.75.75 0 1 0-1.004-1.115L4.761 8.836c-.737.662-1.347 1.212-1.767 1.71c-.44.525-.754 1.088-.754 1.784c0 .695.313 1.258.754 1.782c.42.499 1.03 1.049 1.767 1.711l1.737 1.564a.75.75 0 0 0 1.004-1.115l-1.697-1.527c-.788-.709-1.319-1.19-1.663-1.598c-.33-.393-.402-.622-.402-.818s.072-.424.402-.817c.344-.409.875-.89 1.663-1.598z'/%3E%3C/svg%3E");
152
163
  }
@@ -218,6 +218,56 @@ interface MarkdownPowerPluginOptions {
218
218
  * @default false
219
219
  */
220
220
  plot?: boolean | PlotOptions;
221
+ /**
222
+ * 是否启用 timeline 语法
223
+ *
224
+ * ```md
225
+ * ::: timeline
226
+ * - title
227
+ * time="Q1" icon="ri:clockwise-line" line="dashed" type="warning" color="red"
228
+ *
229
+ * xxx
230
+ * :::
231
+ * ```
232
+ *
233
+ * @default false
234
+ */
235
+ timeline?: boolean;
236
+ /**
237
+ * 是否启用 collapse 折叠面板 语法
238
+ *
239
+ * ```md
240
+ * ::: collapse accordion
241
+ * - + title
242
+ *
243
+ * content
244
+ *
245
+ * - - title
246
+ *
247
+ * content
248
+ * :::
249
+ * ```
250
+ *
251
+ * @default false
252
+ */
253
+ collapse?: boolean;
254
+ /**
255
+ * 是否启用 chat 容器 语法
256
+ *
257
+ * ```md
258
+ * ::: chat
259
+ * {:date}
260
+ *
261
+ * {user}
262
+ * message
263
+ *
264
+ * {.}
265
+ * message
266
+ * :::
267
+ * ```
268
+ * @default false
269
+ */
270
+ chat?: boolean;
221
271
  /**
222
272
  * 是否启用 bilibili 视频嵌入
223
273
  *