@slidev/client 0.47.2 → 0.47.4
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/RenderWhen.vue +25 -6
- package/builtin/Tweet.vue +2 -0
- package/iframes/monaco/index.css +1 -1
- package/package.json +8 -6
- package/uno.config.ts +4 -1
package/builtin/RenderWhen.vue
CHANGED
|
@@ -1,29 +1,48 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { computed, inject } from 'vue'
|
|
3
2
|
import type { RenderContext } from '@slidev/types'
|
|
4
|
-
|
|
3
|
+
import { computed, inject, ref } from 'vue'
|
|
4
|
+
import { useElementVisibility } from '@vueuse/core'
|
|
5
5
|
import { injectionRenderContext } from '../constants'
|
|
6
6
|
|
|
7
|
-
type Context = 'main' | RenderContext
|
|
7
|
+
type Context = 'main' | 'visible' | RenderContext
|
|
8
8
|
|
|
9
9
|
const props = defineProps<{
|
|
10
10
|
context: Context | Context[]
|
|
11
11
|
}>()
|
|
12
12
|
const { context } = props
|
|
13
|
+
const target = ref(null)
|
|
14
|
+
const targetVisible = useElementVisibility(target)
|
|
13
15
|
|
|
14
|
-
|
|
16
|
+
// When context has `visible`, we need to wrap the content with a div to track the visibility
|
|
17
|
+
const needsDomWrapper = Array.isArray(context) ? context.includes('visible') : context === 'visible'
|
|
15
18
|
|
|
16
|
-
const
|
|
19
|
+
const currentContext = inject(injectionRenderContext)
|
|
20
|
+
const shouldRender = computed(() => {
|
|
21
|
+
const anyContext = Array.isArray(context) ? context.some(contextMatch) : contextMatch(context)
|
|
22
|
+
const allConditions = Array.isArray(context) ? context.every(conditionsMatch) : conditionsMatch(context)
|
|
23
|
+
return anyContext && allConditions
|
|
24
|
+
})
|
|
17
25
|
|
|
18
26
|
function contextMatch(context: Context) {
|
|
19
27
|
if (context === currentContext?.value)
|
|
20
28
|
return true
|
|
21
29
|
if (context === 'main' && (currentContext?.value === 'slide' || currentContext?.value === 'presenter'))
|
|
22
30
|
return true
|
|
31
|
+
if (context === 'visible')
|
|
32
|
+
return true
|
|
23
33
|
return false
|
|
24
34
|
}
|
|
35
|
+
|
|
36
|
+
function conditionsMatch(context: Context) {
|
|
37
|
+
if (context === 'visible')
|
|
38
|
+
return targetVisible.value
|
|
39
|
+
return true
|
|
40
|
+
}
|
|
25
41
|
</script>
|
|
26
42
|
|
|
27
43
|
<template>
|
|
28
|
-
<
|
|
44
|
+
<div v-if="needsDomWrapper" ref="target">
|
|
45
|
+
<slot v-if="shouldRender" />
|
|
46
|
+
</div>
|
|
47
|
+
<slot v-else-if="shouldRender" />
|
|
29
48
|
</template>
|
package/builtin/Tweet.vue
CHANGED
|
@@ -15,6 +15,7 @@ const props = defineProps<{
|
|
|
15
15
|
id: string | number
|
|
16
16
|
scale?: string | number
|
|
17
17
|
conversation?: string
|
|
18
|
+
cards?: 'hidden' | 'visible'
|
|
18
19
|
}>()
|
|
19
20
|
|
|
20
21
|
const tweet = ref<HTMLElement | null>()
|
|
@@ -31,6 +32,7 @@ async function create() {
|
|
|
31
32
|
{
|
|
32
33
|
theme: isDark.value ? 'dark' : 'light',
|
|
33
34
|
conversation: props.conversation || 'none',
|
|
35
|
+
cards: props.cards,
|
|
34
36
|
},
|
|
35
37
|
)
|
|
36
38
|
loaded.value = true
|
package/iframes/monaco/index.css
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slidev/client",
|
|
3
|
-
"version": "0.47.
|
|
3
|
+
"version": "0.47.4",
|
|
4
4
|
"description": "Presentation slides for developers",
|
|
5
5
|
"author": "antfu <anthonyfu117@hotmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -20,9 +20,11 @@
|
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@antfu/utils": "^0.7.7",
|
|
23
|
+
"@iconify-json/carbon": "^1.1.28",
|
|
24
|
+
"@iconify-json/ph": "^1.1.11",
|
|
23
25
|
"@shikijs/vitepress-twoslash": "^1.0.0-beta.5",
|
|
24
26
|
"@unhead/vue": "^1.8.10",
|
|
25
|
-
"@unocss/reset": "^0.58.
|
|
27
|
+
"@unocss/reset": "^0.58.5",
|
|
26
28
|
"@vueuse/core": "^10.7.2",
|
|
27
29
|
"@vueuse/math": "^10.7.2",
|
|
28
30
|
"@vueuse/motion": "^2.0.0",
|
|
@@ -38,14 +40,14 @@
|
|
|
38
40
|
"mermaid": "^10.8.0",
|
|
39
41
|
"monaco-editor": "^0.37.1",
|
|
40
42
|
"nanoid": "^5.0.5",
|
|
41
|
-
"prettier": "^3.2.
|
|
43
|
+
"prettier": "^3.2.5",
|
|
42
44
|
"recordrtc": "^5.6.2",
|
|
43
45
|
"resolve": "^1.22.8",
|
|
44
|
-
"unocss": "^0.58.
|
|
46
|
+
"unocss": "^0.58.5",
|
|
45
47
|
"vue": "^3.4.15",
|
|
46
48
|
"vue-router": "^4.2.5",
|
|
47
|
-
"@slidev/parser": "0.47.
|
|
48
|
-
"@slidev/types": "0.47.
|
|
49
|
+
"@slidev/parser": "0.47.4",
|
|
50
|
+
"@slidev/types": "0.47.4"
|
|
49
51
|
},
|
|
50
52
|
"devDependencies": {
|
|
51
53
|
"vite": "^5.0.12"
|
package/uno.config.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { fileURLToPath } from 'node:url'
|
|
1
2
|
import {
|
|
2
3
|
defineConfig,
|
|
3
4
|
presetAttributify,
|
|
@@ -26,7 +27,9 @@ export default defineConfig({
|
|
|
26
27
|
presets: [
|
|
27
28
|
presetUno(),
|
|
28
29
|
presetAttributify(),
|
|
29
|
-
presetIcons(
|
|
30
|
+
presetIcons({
|
|
31
|
+
collectionsNodeResolvePath: fileURLToPath(import.meta.url),
|
|
32
|
+
}),
|
|
30
33
|
presetTypography(),
|
|
31
34
|
],
|
|
32
35
|
transformers: [
|