@slidev/client 0.49.6 → 0.49.8
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/builtin/Monaco.vue +3 -2
- package/internals/SlideWrapper.vue +2 -6
- package/package.json +3 -3
- package/setup/monaco.ts +3 -3
package/builtin/Monaco.vue
CHANGED
|
@@ -15,13 +15,12 @@ Learn more: https://sli.dev/guide/syntax.html#monaco-editor
|
|
|
15
15
|
import { debounce } from '@antfu/utils'
|
|
16
16
|
import lz from 'lz-string'
|
|
17
17
|
import type * as monaco from 'monaco-editor'
|
|
18
|
-
import { computed, nextTick, onMounted, ref } from 'vue'
|
|
18
|
+
import { computed, defineAsyncComponent, nextTick, onMounted, ref } from 'vue'
|
|
19
19
|
import type { RawAtValue } from '@slidev/types'
|
|
20
20
|
import { whenever } from '@vueuse/core'
|
|
21
21
|
import { makeId } from '../logic/utils'
|
|
22
22
|
import { useSlideContext } from '../context'
|
|
23
23
|
import { useNav } from '../composables/useNav'
|
|
24
|
-
import CodeRunner from '../internals/CodeRunner.vue'
|
|
25
24
|
|
|
26
25
|
const props = withDefaults(defineProps<{
|
|
27
26
|
codeLz: string
|
|
@@ -51,6 +50,8 @@ const props = withDefaults(defineProps<{
|
|
|
51
50
|
highlightOutput: true,
|
|
52
51
|
})
|
|
53
52
|
|
|
53
|
+
const CodeRunner = defineAsyncComponent(() => import('../internals/CodeRunner.vue').then(r => r.default))
|
|
54
|
+
|
|
54
55
|
const code = ref(lz.decompressFromBase64(props.codeLz).trimEnd())
|
|
55
56
|
const diff = props.diffLz && ref(lz.decompressFromBase64(props.diffLz).trimEnd())
|
|
56
57
|
const isWritable = computed(() => props.writable && !props.readonly && __DEV__)
|
|
@@ -68,13 +68,9 @@ const SlideComponent = computed(() => props.route && defineAsyncComponent({
|
|
|
68
68
|
:class="getSlideClass(route, ['slide', 'presenter'].includes(props.renderContext) ? '' : 'disable-view-transition')"
|
|
69
69
|
:style="style"
|
|
70
70
|
>
|
|
71
|
-
<
|
|
72
|
-
<SlideBottom />
|
|
73
|
-
</div>
|
|
71
|
+
<SlideBottom />
|
|
74
72
|
<SlideComponent />
|
|
75
|
-
<
|
|
76
|
-
<SlideTop />
|
|
77
|
-
</div>
|
|
73
|
+
<SlideTop />
|
|
78
74
|
</div>
|
|
79
75
|
</template>
|
|
80
76
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slidev/client",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.49.
|
|
4
|
+
"version": "0.49.8",
|
|
5
5
|
"description": "Presentation slides for developers",
|
|
6
6
|
"author": "antfu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -59,8 +59,8 @@
|
|
|
59
59
|
"vue": "^3.4.27",
|
|
60
60
|
"vue-router": "^4.3.2",
|
|
61
61
|
"yaml": "^2.4.2",
|
|
62
|
-
"@slidev/parser": "0.49.
|
|
63
|
-
"@slidev/types": "0.49.
|
|
62
|
+
"@slidev/parser": "0.49.8",
|
|
63
|
+
"@slidev/types": "0.49.8"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"vite": "^5.2.12"
|
package/setup/monaco.ts
CHANGED
|
@@ -121,16 +121,16 @@ const setup = createSingletonPromise(async () => {
|
|
|
121
121
|
}
|
|
122
122
|
})
|
|
123
123
|
|
|
124
|
-
async function _addFile(raw: Promise<{ default: string }>, path: string) {
|
|
124
|
+
async function _addFile(raw: () => Promise<{ default: string }>, path: string) {
|
|
125
125
|
const uri = monaco.Uri.file(path)
|
|
126
|
-
const code = (await raw).default
|
|
126
|
+
const code = (await raw()).default
|
|
127
127
|
monaco.languages.typescript.typescriptDefaults.addExtraLib(code, `file:///${path}`)
|
|
128
128
|
monaco.editor.createModel(code, 'javascript', uri)
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
const addFileCache = new Map<string, Promise<void>>()
|
|
132
132
|
|
|
133
|
-
export async function addFile(raw: Promise<{ default: string }>, path: string) {
|
|
133
|
+
export async function addFile(raw: () => Promise<{ default: string }>, path: string) {
|
|
134
134
|
if (addFileCache.has(path))
|
|
135
135
|
return addFileCache.get(path)
|
|
136
136
|
const promise = _addFile(raw, path)
|