vuepress-plugin-md-power 1.0.0-rc.100 → 1.0.0-rc.102
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/CanIUse.vue +2 -6
- package/lib/client/components/CodeEditor.vue +3 -3
- package/lib/client/components/CodeRepl.vue +9 -9
- package/lib/client/components/CodeSandbox.vue +5 -7
- package/lib/client/components/FileTreeItem.vue +36 -22
- package/lib/client/components/Loading.vue +1 -1
- package/lib/client/components/PDFViewer.vue +1 -1
- package/lib/client/components/Plot.vue +4 -4
- package/lib/client/components/Replit.vue +1 -1
- package/lib/node/index.js +1202 -1049
- package/package.json +6 -6
|
@@ -68,15 +68,11 @@ function parseData(data: string | MessageData): MessageData {
|
|
|
68
68
|
:data-past="past"
|
|
69
69
|
:data-future="future"
|
|
70
70
|
>
|
|
71
|
-
<iframe
|
|
72
|
-
:src="source"
|
|
73
|
-
:style="{ height }"
|
|
74
|
-
:title="`Can I use ${feature}`"
|
|
75
|
-
/>
|
|
71
|
+
<iframe :src="source" :style="{ height }" :title="`Can I use ${feature}`" />
|
|
76
72
|
</div>
|
|
77
73
|
</template>
|
|
78
74
|
|
|
79
|
-
<style
|
|
75
|
+
<style>
|
|
80
76
|
.ciu_embed {
|
|
81
77
|
margin: 16px -24px;
|
|
82
78
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
import type { HighlighterCore } from 'shiki/core'
|
|
2
3
|
import editorData from '@internal/md-power/replEditorData'
|
|
3
|
-
import {
|
|
4
|
+
import { createHighlighterCore } from 'shiki/core'
|
|
4
5
|
import { onMounted, onUnmounted, ref, shallowRef, watch } from 'vue'
|
|
5
|
-
import type { HighlighterCore } from 'shiki/core'
|
|
6
6
|
import { resolveCodeInfo } from '../composables/codeRepl.js'
|
|
7
7
|
|
|
8
8
|
let highlighter: HighlighterCore | null = null
|
|
@@ -17,7 +17,7 @@ const textAreaEl = shallowRef<HTMLTextAreaElement>()
|
|
|
17
17
|
const input = ref('')
|
|
18
18
|
|
|
19
19
|
async function init() {
|
|
20
|
-
highlighter = await
|
|
20
|
+
highlighter = await createHighlighterCore({
|
|
21
21
|
themes: 'light' in theme && 'dark' in theme ? [theme.light, theme.dark] : [theme],
|
|
22
22
|
langs: Object.keys(grammars).map(key => grammars[key]),
|
|
23
23
|
loadWasm: () => import('shiki/wasm'),
|
|
@@ -101,7 +101,7 @@ function runCode() {
|
|
|
101
101
|
padding-top: 6px;
|
|
102
102
|
margin: 0 -1.5rem;
|
|
103
103
|
background-color: var(--vp-code-block-bg);
|
|
104
|
-
transition: background-color var(--t-color);
|
|
104
|
+
transition: background-color var(--vp-t-color);
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
.code-repl-title {
|
|
@@ -111,7 +111,7 @@ function runCode() {
|
|
|
111
111
|
margin: 0 -1.5rem;
|
|
112
112
|
background-color: var(--vp-code-block-bg);
|
|
113
113
|
border-bottom: solid 1px var(--vp-c-divider);
|
|
114
|
-
transition: var(--t-color);
|
|
114
|
+
transition: var(--vp-t-color);
|
|
115
115
|
transition-property: background, border;
|
|
116
116
|
}
|
|
117
117
|
|
|
@@ -142,7 +142,7 @@ function runCode() {
|
|
|
142
142
|
line-height: 48px;
|
|
143
143
|
color: var(--vp-code-tab-active-text-color);
|
|
144
144
|
white-space: nowrap;
|
|
145
|
-
transition: color var(--t-color);
|
|
145
|
+
transition: color var(--vp-t-color);
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
.icon-run {
|
|
@@ -156,7 +156,7 @@ function runCode() {
|
|
|
156
156
|
cursor: pointer;
|
|
157
157
|
border: solid 1px var(--vp-c-text-3);
|
|
158
158
|
border-radius: 100%;
|
|
159
|
-
transition: var(--t-color);
|
|
159
|
+
transition: var(--vp-t-color);
|
|
160
160
|
transition-property: color, border;
|
|
161
161
|
}
|
|
162
162
|
|
|
@@ -171,7 +171,7 @@ function runCode() {
|
|
|
171
171
|
justify-content: space-between;
|
|
172
172
|
padding: 4px 10px 4px 20px;
|
|
173
173
|
border-top: solid 2px var(--vp-c-divider);
|
|
174
|
-
transition: border-color var(--t-color);
|
|
174
|
+
transition: border-color var(--vp-t-color);
|
|
175
175
|
}
|
|
176
176
|
|
|
177
177
|
.output-head .title {
|
|
@@ -184,7 +184,7 @@ function runCode() {
|
|
|
184
184
|
.output-head .output-version {
|
|
185
185
|
font-size: 12px;
|
|
186
186
|
color: var(--vp-c-text-3);
|
|
187
|
-
transition: color var(--t-color);
|
|
187
|
+
transition: color var(--vp-t-color);
|
|
188
188
|
}
|
|
189
189
|
|
|
190
190
|
.output-head .icon-close {
|
|
@@ -193,7 +193,7 @@ function runCode() {
|
|
|
193
193
|
margin-left: 20px;
|
|
194
194
|
color: var(--vp-c-text-3);
|
|
195
195
|
cursor: pointer;
|
|
196
|
-
transition: color var(--t-color);
|
|
196
|
+
transition: color var(--vp-t-color);
|
|
197
197
|
}
|
|
198
198
|
|
|
199
199
|
.output-head .icon-close:hover {
|
|
@@ -227,7 +227,7 @@ function runCode() {
|
|
|
227
227
|
.output-content .stderr pre,
|
|
228
228
|
.output-content.rust .stderr pre.error {
|
|
229
229
|
color: var(--vp-c-danger-1, #b8272c);
|
|
230
|
-
transition: color var(--t-color);
|
|
230
|
+
transition: color var(--vp-t-color);
|
|
231
231
|
}
|
|
232
232
|
|
|
233
233
|
.output-content.rust .stderr pre {
|
|
@@ -237,6 +237,6 @@ function runCode() {
|
|
|
237
237
|
.output-content .stderr + .stdout {
|
|
238
238
|
margin-top: 12px;
|
|
239
239
|
border-top: 1px solid var(--vp-c-divider);
|
|
240
|
-
transition: border-color var(--t-color);
|
|
240
|
+
transition: border-color var(--vp-t-color);
|
|
241
241
|
}
|
|
242
242
|
</style>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { computed } from 'vue'
|
|
3
2
|
import type { CodeSandboxTokenMeta } from '../../shared/index.js'
|
|
3
|
+
import { computed } from 'vue'
|
|
4
4
|
|
|
5
5
|
const props = defineProps<CodeSandboxTokenMeta>()
|
|
6
6
|
|
|
@@ -11,19 +11,17 @@ const SANDBOX = 'allow-forms allow-modals allow-popups allow-presentation allow-
|
|
|
11
11
|
|
|
12
12
|
const source = computed(() => {
|
|
13
13
|
const params = new URLSearchParams()
|
|
14
|
-
if (props.filepath)
|
|
14
|
+
if (props.filepath)
|
|
15
15
|
params.set(props.type === 'embed' ? 'module' : 'file', encodeURIComponent(props.filepath))
|
|
16
|
-
}
|
|
17
16
|
|
|
18
17
|
if (props.type === 'embed') {
|
|
19
18
|
params.set('view', props.layout ? props.layout.replace(/,/g, '+') : 'Editor+Preview')
|
|
20
19
|
|
|
21
|
-
if (props.console)
|
|
20
|
+
if (props.console)
|
|
22
21
|
params.set('expanddevtools', '1')
|
|
23
|
-
|
|
24
|
-
if (props.navbar === false)
|
|
22
|
+
|
|
23
|
+
if (props.navbar === false)
|
|
25
24
|
params.set('hidenavigation', '1')
|
|
26
|
-
}
|
|
27
25
|
}
|
|
28
26
|
else {
|
|
29
27
|
params.set('from-embed', '')
|
|
@@ -10,7 +10,10 @@ const props = defineProps<{
|
|
|
10
10
|
const active = ref(!!props.expanded)
|
|
11
11
|
const el = ref<HTMLElement>()
|
|
12
12
|
|
|
13
|
-
function toggle() {
|
|
13
|
+
function toggle(e: HTMLElementEventMap['click']) {
|
|
14
|
+
const target = e.target as HTMLElement
|
|
15
|
+
if (target.matches('.comment'))
|
|
16
|
+
return
|
|
14
17
|
active.value = !active.value
|
|
15
18
|
}
|
|
16
19
|
|
|
@@ -18,14 +21,20 @@ onMounted(() => {
|
|
|
18
21
|
if (!el.value || props.type !== 'folder')
|
|
19
22
|
return
|
|
20
23
|
|
|
21
|
-
el.value.querySelector('.tree-node.folder')?.addEventListener(
|
|
24
|
+
el.value.querySelector('.tree-node.folder')?.addEventListener(
|
|
25
|
+
'click',
|
|
26
|
+
toggle as EventListener,
|
|
27
|
+
)
|
|
22
28
|
})
|
|
23
29
|
|
|
24
30
|
onUnmounted(() => {
|
|
25
31
|
if (!el.value || props.type !== 'folder')
|
|
26
32
|
return
|
|
27
33
|
|
|
28
|
-
el.value.querySelector('.tree-node.folder')?.removeEventListener(
|
|
34
|
+
el.value.querySelector('.tree-node.folder')?.removeEventListener(
|
|
35
|
+
'click',
|
|
36
|
+
toggle as EventListener,
|
|
37
|
+
)
|
|
29
38
|
})
|
|
30
39
|
</script>
|
|
31
40
|
|
|
@@ -51,7 +60,7 @@ onUnmounted(() => {
|
|
|
51
60
|
background-color: var(--vp-c-bg-safe);
|
|
52
61
|
border: solid 1px var(--vp-c-divider);
|
|
53
62
|
border-radius: 8px;
|
|
54
|
-
transition: border var(--t-color), background-color var(--t-color);
|
|
63
|
+
transition: border var(--vp-t-color), background-color var(--vp-t-color);
|
|
55
64
|
}
|
|
56
65
|
|
|
57
66
|
.vp-file-tree .vp-file-tree-title {
|
|
@@ -60,7 +69,7 @@ onUnmounted(() => {
|
|
|
60
69
|
font-weight: bold;
|
|
61
70
|
color: var(--vp-c-text-1);
|
|
62
71
|
border-bottom: solid 1px var(--vp-c-divider);
|
|
63
|
-
transition: color var(--t-color), border-color var(--t-color);
|
|
72
|
+
transition: color var(--vp-t-color), border-color var(--vp-t-color);
|
|
64
73
|
}
|
|
65
74
|
|
|
66
75
|
.vp-file-tree ul {
|
|
@@ -97,7 +106,7 @@ onUnmounted(() => {
|
|
|
97
106
|
.file-tree-item .tree-node.folder > .name {
|
|
98
107
|
color: var(--vp-c-text-1);
|
|
99
108
|
cursor: pointer;
|
|
100
|
-
transition: color var(--t-color);
|
|
109
|
+
transition: color var(--vp-t-color);
|
|
101
110
|
}
|
|
102
111
|
|
|
103
112
|
.file-tree-item .tree-node.folder > .name:hover {
|
|
@@ -114,41 +123,46 @@ onUnmounted(() => {
|
|
|
114
123
|
width: 10px;
|
|
115
124
|
height: 10px;
|
|
116
125
|
color: var(--vp-c-text-3);
|
|
126
|
+
cursor: pointer;
|
|
117
127
|
content: "";
|
|
118
128
|
background-color: currentcolor;
|
|
119
129
|
-webkit-mask: var(--icon) no-repeat;
|
|
120
130
|
mask: var(--icon) no-repeat;
|
|
121
131
|
-webkit-mask-size: 100% 100%;
|
|
122
132
|
mask-size: 100% 100%;
|
|
123
|
-
transition: color var(--t-color);
|
|
133
|
+
transition: color var(--vp-t-color);
|
|
124
134
|
}
|
|
125
135
|
|
|
126
136
|
.file-tree-item .tree-node .name.focus {
|
|
137
|
+
position: relative;
|
|
138
|
+
padding: 0 4px;
|
|
139
|
+
margin: 0 -4px;
|
|
127
140
|
font-weight: bold;
|
|
128
|
-
color: var(--vp-c-
|
|
129
|
-
|
|
141
|
+
color: var(--vp-c-bg);
|
|
142
|
+
background-color: var(--vp-c-brand-2);
|
|
143
|
+
border-radius: 4px;
|
|
144
|
+
transition: color var(--vp-t-color), background-color var(--vp-t-color);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.file-tree-item .tree-node .name.focus:hover {
|
|
148
|
+
color: var(--vp-c-bg);
|
|
149
|
+
background-color: var(--vp-c-brand-1);
|
|
130
150
|
}
|
|
131
151
|
|
|
132
152
|
.file-tree-item .tree-node .comment {
|
|
133
153
|
margin-left: 20px;
|
|
134
154
|
overflow: hidden;
|
|
135
155
|
color: var(--vp-c-text-3);
|
|
136
|
-
transition: color var(--t-color);
|
|
156
|
+
transition: color var(--vp-t-color);
|
|
137
157
|
}
|
|
138
158
|
|
|
139
|
-
.file-tree-item .tree-node [class*="
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
color: var(--vp-c-text-2);
|
|
144
|
-
background-color: currentcolor;
|
|
145
|
-
-webkit-mask: var(--icon) no-repeat;
|
|
146
|
-
mask: var(--icon) no-repeat;
|
|
147
|
-
-webkit-mask-size: 100% 100%;
|
|
148
|
-
mask-size: 100% 100%;
|
|
159
|
+
.file-tree-item .tree-node [class*="vpi-"] {
|
|
160
|
+
width: 1.2em;
|
|
161
|
+
height: 1.2em;
|
|
162
|
+
margin: 0;
|
|
149
163
|
}
|
|
150
164
|
|
|
151
|
-
.file-tree-item .tree-node.folder [class*="
|
|
165
|
+
.file-tree-item .tree-node.folder [class*="vpi-"] {
|
|
152
166
|
cursor: pointer;
|
|
153
167
|
}
|
|
154
168
|
|
|
@@ -156,7 +170,7 @@ onUnmounted(() => {
|
|
|
156
170
|
padding-left: 8px !important;
|
|
157
171
|
margin: 0 0 0 6px !important;
|
|
158
172
|
border-left: solid 1px var(--vp-c-divider);
|
|
159
|
-
transition: border-color var(--t-color);
|
|
173
|
+
transition: border-color var(--vp-t-color);
|
|
160
174
|
}
|
|
161
175
|
|
|
162
176
|
.file-tree-item:not(.expanded) > ul {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
import type { PDFTokenMeta } from '../../shared/index.js'
|
|
2
3
|
import { onMounted, toRefs } from 'vue'
|
|
3
4
|
import { usePDF } from '../composables/pdf.js'
|
|
4
5
|
import { useSize } from '../composables/size.js'
|
|
5
|
-
import type { PDFTokenMeta } from '../../shared/index.js'
|
|
6
6
|
|
|
7
7
|
const props = defineProps<PDFTokenMeta>()
|
|
8
8
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
import type { PlotOptions } from '../../shared/index.js'
|
|
2
3
|
import { onClickOutside, useMediaQuery } from '@vueuse/core'
|
|
3
4
|
import { computed, ref, shallowRef } from 'vue'
|
|
4
5
|
import { usePageFrontmatter } from 'vuepress/client'
|
|
5
6
|
import { pluginOptions } from '../options.js'
|
|
6
|
-
import type { PlotOptions } from '../../shared/index.js'
|
|
7
7
|
|
|
8
8
|
const props = defineProps<Omit<PlotOptions, 'tag'>>()
|
|
9
9
|
|
|
@@ -81,7 +81,7 @@ function onClick() {
|
|
|
81
81
|
transition: color ease 0.25s, background-color ease 0.25s;
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
|
|
84
|
+
[data-theme="dark"] .vp-plot {
|
|
85
85
|
background-color: var(--vp-c-bg-plot-dark, #fff);
|
|
86
86
|
}
|
|
87
87
|
|
|
@@ -90,8 +90,8 @@ function onClick() {
|
|
|
90
90
|
color: var(--vp-c-plot-light, #fff);
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
[data-theme="dark"] .vp-plot.hover:hover,
|
|
94
|
+
[data-theme="dark"] .vp-plot.active {
|
|
95
95
|
color: var(--vp-c-plot-dark, #000);
|
|
96
96
|
}
|
|
97
97
|
</style>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
import type { ReplitTokenMeta } from '../../shared/index.js'
|
|
2
3
|
import { computed, getCurrentInstance, ref } from 'vue'
|
|
3
4
|
import Loading from './Loading.vue'
|
|
4
|
-
import type { ReplitTokenMeta } from '../../shared/index.js'
|
|
5
5
|
|
|
6
6
|
const props = defineProps<ReplitTokenMeta>()
|
|
7
7
|
|