@slidev/client 0.33.0 → 0.34.1

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.
@@ -59,5 +59,5 @@ watchEffect(() => {
59
59
  </script>
60
60
 
61
61
  <template>
62
- <ShadowRoot class="mermaid" :inner-html="html" />
62
+ <ShadowRoot ref="el" class="mermaid" :inner-html="html" @shadow="el = $event" />
63
63
  </template>
@@ -25,7 +25,8 @@ function setBrushColor(color: typeof brush.color) {
25
25
 
26
26
  <template>
27
27
  <Draggable
28
- class="flex flex-wrap text-xl p-2 gap-1 rounded-md bg-main shadow transition-opacity duration-200 dark:(border border-gray-400 border-opacity-10)"
28
+ class="flex flex-wrap text-xl p-2 gap-1 rounded-md bg-main shadow transition-opacity duration-200"
29
+ dark="border border-gray-400 border-opacity-10"
29
30
  :class="drawingEnabled ? '' : drawingPinned ? 'opacity-40 hover:opacity-90' : 'opacity-0 pointer-events-none'"
30
31
  storage-key="slidev-drawing-pos"
31
32
  :initial-x="10"
@@ -132,7 +132,7 @@ throttledWatch(
132
132
  @pointerdown="onHandlerDown"
133
133
  />
134
134
  <div
135
- class="shadow bg-main p-4 grid grid-rows-[max-content,1fr] h-full overflow-hidden border-l border-gray-400 border-opacity-20"
135
+ class="shadow bg-main p-4 grid grid-rows-[max-content_1fr] h-full overflow-hidden border-l border-gray-400 border-opacity-20"
136
136
  :style="{ width: `${editorWidth}px` }"
137
137
  >
138
138
  <div class="flex pb-2 text-xl -mt-1">
@@ -56,7 +56,7 @@ watch(text, (t) => {
56
56
  :class="showGotoDialog ? 'top-5' : '-top-20'"
57
57
  shadow="~"
58
58
  p="x-4 y-2"
59
- border="~ transparent rounded dark:(gray-400 opacity-25)"
59
+ border="~ transparent rounded dark:gray-400 dark:opacity-25"
60
60
  >
61
61
  <input
62
62
  ref="input"
@@ -32,7 +32,7 @@ const onMouseLeave = () => {
32
32
 
33
33
  const barStyle = computed(() => props.persist
34
34
  ? 'text-$slidev-controls-foreground bg-transparent'
35
- : 'rounded-md bg-main shadow dark:(border border-gray-400 border-opacity-10)',
35
+ : 'rounded-md bg-main shadow dark:border dark:border-gray-400 dark:border-opacity-10',
36
36
  )
37
37
 
38
38
  const RecordingControls = shallowRef<any>()
@@ -47,7 +47,7 @@ if (__SLIDEV_FEATURE_DRAWINGS__)
47
47
  <template>
48
48
  <nav ref="root" class="flex flex-col">
49
49
  <div
50
- class="flex flex-wrap-reverse text-xl gap-0.5 p-1 lg:(gap-1 p-2)"
50
+ class="flex flex-wrap-reverse text-xl gap-0.5 p-1 lg:gap-1 lg:p-2"
51
51
  :class="barStyle"
52
52
  @mouseleave="onMouseLeave"
53
53
  >
@@ -40,7 +40,7 @@ if (__SLIDEV_FEATURE_DRAWINGS__)
40
40
  </script>
41
41
 
42
42
  <template>
43
- <div id="page-root" ref="root" class="grid grid-cols-[1fr,max-content]" :style="themeVars">
43
+ <div id="page-root" ref="root" class="grid grid-cols-[1fr_max-content]" :style="themeVars">
44
44
  <SlideContainer
45
45
  class="w-full h-full"
46
46
  :style="{ background: 'var(--slidev-slide-container-background, black)' }"
@@ -84,7 +84,7 @@ onMounted(() => {
84
84
  <div class="bg-main h-full slidev-presenter">
85
85
  <div class="grid-container">
86
86
  <div class="grid-section top flex">
87
- <img src="../assets/logo-title-horizontal.png" class="ml-2 my-auto h-10 py-1 lg:(h-14 py-2)">
87
+ <img src="../assets/logo-title-horizontal.png" class="ml-2 my-auto h-10 py-1 lg:h-14 lg:py-2">
88
88
  <div class="flex-auto" />
89
89
  <div
90
90
  class="timer-btn my-auto relative w-22px h-22px cursor-pointer text-lg"
@@ -98,7 +98,7 @@ onMounted(() => {
98
98
  {{ timer }}
99
99
  </div>
100
100
  </div>
101
- <div ref="main" class="relative grid-section main flex flex-col p-2 lg:(p-4)" :style="themeVars">
101
+ <div ref="main" class="relative grid-section main flex flex-col p-2 lg:p-4" :style="themeVars">
102
102
  <SlideContainer
103
103
  key="main"
104
104
  class="h-full w-full"
@@ -111,7 +111,7 @@ onMounted(() => {
111
111
  current
112
112
  </div>
113
113
  </div>
114
- <div class="relative grid-section next flex flex-col p-2 lg:(p-4)">
114
+ <div class="relative grid-section next flex flex-col p-2 lg:p-4">
115
115
  <SlideContainer
116
116
  v-if="nextSlide"
117
117
  key="next"
@@ -132,8 +132,8 @@ onMounted(() => {
132
132
  </div>
133
133
  </div>
134
134
  <div class="grid-section note overflow-auto">
135
- <NoteEditor v-if="__DEV__" class="w-full h-full overflow-auto p-2 lg:(p-4)" />
136
- <NoteStatic v-else class="w-full h-full overflow-auto p-2 lg:(p-4)" />
135
+ <NoteEditor v-if="__DEV__" class="w-full h-full overflow-auto p-2 lg:p-4" />
136
+ <NoteStatic v-else class="w-full h-full overflow-auto p-2 lg:p-4" />
137
137
  </div>
138
138
  <div class="grid-section bottom">
139
139
  <NavControls :persist="true" />
@@ -1,8 +1,8 @@
1
1
  <script setup lang="ts">
2
- import type { ComponentCustomProps, Slots } from 'vue'
2
+ import type { Slots } from 'vue'
3
3
  import { h, watchEffect } from 'vue'
4
4
  import _configs from '/@slidev/configs'
5
- import { slideScale, windowSize } from '../state'
5
+ import { windowSize } from '../state'
6
6
  import { isPrintMode } from '../logic/nav'
7
7
  import { themeVars } from '../env'
8
8
  import PrintContainer from './PrintContainer.vue'
@@ -17,9 +17,9 @@ function vStyle<Props>(props: Props, { slots }: { slots: Slots }) {
17
17
 
18
18
  watchEffect(() => {
19
19
  if (isPrintMode)
20
- document.body.parentNode.classList.add('print')
20
+ (document.body.parentNode as HTMLElement).classList.add('print')
21
21
  else
22
- document.body.parentNode.classList.remove('print')
22
+ (document.body.parentNode as HTMLElement).classList.remove('print')
23
23
  })
24
24
  </script>
25
25
 
@@ -27,7 +27,7 @@ watchEffect(() => {
27
27
  <vStyle>
28
28
  @page { size: {{ width }}px {{ height }}px; margin: 0px; }
29
29
  </vStyle>
30
- <div id="page-root" class="grid grid-cols-[1fr,max-content]" :style="themeVars">
30
+ <div id="page-root" class="grid grid-cols-[1fr_max-content]" :style="themeVars">
31
31
  <PrintContainer
32
32
  class="w-full h-full"
33
33
  :style="{ background: 'var(--slidev-slide-container-background, black)' }"
@@ -88,7 +88,6 @@ async function start() {
88
88
 
89
89
  <style lang="postcss">
90
90
  .recording-dialog {
91
-
92
91
  .form-text {
93
92
  @apply flex flex-col;
94
93
 
@@ -47,7 +47,7 @@ const value = useVModel(props, 'modelValue', emit, { passive: true })
47
47
  }
48
48
 
49
49
  .item {
50
- @apply flex rounded whitespace-nowrap py-1 px-4 cursor-default hover:(bg-gray-400 bg-opacity-10);
50
+ @apply flex rounded whitespace-nowrap py-1 px-4 cursor-default hover:bg-gray-400 hover:bg-opacity-10;
51
51
 
52
52
  svg {
53
53
  @apply mr-1 -ml-2 my-auto;
@@ -5,11 +5,17 @@ const props = defineProps<{
5
5
  innerHtml: string
6
6
  }>()
7
7
 
8
+ const emit = defineEmits<{
9
+ (event: 'shadow', div: ShadowRoot): void
10
+ }>()
11
+
8
12
  const el = ref<HTMLDivElement>()
9
13
  const shadow = computed(() => el.value ? (el.value.shadowRoot || el.value.attachShadow({ mode: 'open' })) : null)
10
14
  watchEffect(() => {
11
- if (shadow.value)
15
+ if (shadow.value) {
16
+ emit('shadow', shadow.value)
12
17
  shadow.value.innerHTML = props.innerHtml
18
+ }
13
19
  })
14
20
  </script>
15
21
 
@@ -70,7 +70,7 @@ watchEffect(() => {
70
70
  class="relative"
71
71
  >
72
72
  <div
73
- class="inline-block border border-gray-400 rounded border-opacity-50 overflow-hidden bg-main hover:(border-$slidev-theme-primary)"
73
+ class="inline-block border border-gray-400 rounded border-opacity-50 overflow-hidden bg-main hover:border-$slidev-theme-primary"
74
74
  :class="{ 'border-$slidev-theme-primary': focus(idx + 1) }"
75
75
  @click="go(+route.path)"
76
76
  >
@@ -1,3 +1,3 @@
1
1
  <template>
2
- <div class="w-1px opacity-10 bg-current m-1 lg:(m-2)" />
2
+ <div class="w-1px opacity-10 bg-current m-1 lg:m-2" />
3
3
  </template>
@@ -77,7 +77,7 @@ onMounted(fixPosition)
77
77
 
78
78
  <div
79
79
  ref="handler"
80
- class="absolute bottom-0 right-0 rounded-full bg-main shadow opacity-0 shadow z-30 hover:opacity-100 dark:(border border-true-gray-700)"
80
+ class="absolute bottom-0 right-0 rounded-full bg-main shadow opacity-0 shadow z-30 hover:opacity-100 dark:border dark:border-true-gray-700"
81
81
  :style="handleStyle"
82
82
  :class="handlerDown ? '!opacity-100' : ''"
83
83
  />
package/main.ts CHANGED
@@ -6,11 +6,7 @@ import { router } from './routes'
6
6
  import createDirectives from './modules/directives'
7
7
  import createSlidevContext from './modules/context'
8
8
 
9
- import 'virtual:windi-base.css'
10
- import 'virtual:windi-components.css'
11
9
  import '/@slidev/styles'
12
- import 'virtual:windi-utilities.css'
13
- import 'virtual:windi-devtools'
14
10
 
15
11
  const app = createApp(App)
16
12
  app.use(router)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slidev/client",
3
- "version": "0.33.0",
3
+ "version": "0.34.1",
4
4
  "description": "Presentation slides for developers",
5
5
  "author": "antfu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",
@@ -16,9 +16,10 @@
16
16
  },
17
17
  "dependencies": {
18
18
  "@antfu/utils": "^0.5.2",
19
- "@slidev/parser": "0.33.0",
20
- "@slidev/types": "0.33.0",
21
- "@vueuse/core": "^8.6.0",
19
+ "@slidev/parser": "0.34.1",
20
+ "@slidev/types": "0.34.1",
21
+ "@unocss/reset": "^0.42.0",
22
+ "@vueuse/core": "^8.7.5",
22
23
  "@vueuse/head": "^0.7.6",
23
24
  "@vueuse/motion": "^2.0.0-beta.18",
24
25
  "codemirror": "^5.65.5",
@@ -27,17 +28,18 @@
27
28
  "file-saver": "^2.0.5",
28
29
  "js-base64": "^3.7.2",
29
30
  "js-yaml": "^4.1.0",
30
- "katex": "^0.15.6",
31
- "mermaid": "^9.1.1",
31
+ "katex": "^0.16.0",
32
+ "mermaid": "^9.1.3",
32
33
  "monaco-editor": "^0.33.0",
33
- "nanoid": "^3.3.4",
34
- "prettier": "^2.6.2",
34
+ "nanoid": "^4.0.0",
35
+ "prettier": "^2.7.1",
35
36
  "recordrtc": "^5.6.2",
36
- "resolve": "^1.22.0",
37
- "vite-plugin-windicss": "^1.8.4",
38
- "vue": "^3.2.36",
39
- "vue-router": "^4.0.15",
40
- "vue-starport": "^0.2.11",
41
- "windicss": "^3.5.4"
37
+ "resolve": "^1.22.1",
38
+ "unocss": "^0.42.0",
39
+ "vite-plugin-windicss": "^1.8.6",
40
+ "vue": "^3.2.37",
41
+ "vue-router": "^4.0.16",
42
+ "vue-starport": "^0.3.0",
43
+ "windicss": "^3.5.5"
42
44
  }
43
45
  }
@@ -1,7 +1,7 @@
1
1
  /* __imports__ */
2
2
 
3
3
  import type { NavOperations, ShortcutOptions } from '@slidev/types'
4
- import { downloadPDF, next, nextSlide, prev, prevSlide } from '../logic/nav'
4
+ import { downloadPDF, go, next, nextSlide, prev, prevSlide } from '../logic/nav'
5
5
  import { toggleDark } from '../logic/dark'
6
6
  import { showGotoDialog, showOverview, toggleOverview } from '../state'
7
7
  import { drawingEnabled } from '../logic/drawings'
@@ -14,6 +14,7 @@ export default function setupShortcuts() {
14
14
  prev,
15
15
  nextSlide,
16
16
  prevSlide,
17
+ go,
17
18
  downloadPDF,
18
19
  toggleDark,
19
20
  toggleOverview,
package/shim.d.ts CHANGED
@@ -2,7 +2,7 @@ declare interface Window {
2
2
  // extend the window
3
3
  }
4
4
 
5
- // with vite-plugin-md, markdowns can be treat as Vue components
5
+ // with vite-plugin-vue-markdown, markdowns can be treat as Vue components
6
6
  declare module '*.md' {
7
7
  import type { ComponentOptions } from 'vue'
8
8
  const component: ComponentOptions
package/styles/code.css CHANGED
@@ -41,12 +41,12 @@ html:not(.dark) .shiki-dark {
41
41
  @apply w-4 mr-6 inline-block text-right text-gray-400 dark:text-gray-600
42
42
  }
43
43
 
44
- // revert windicss preflight for katex
44
+ /* revert windicss preflight for katex */
45
45
  .katex,
46
46
  .katex :after,
47
47
  .katex :before {
48
48
  border-color: currentColor;
49
49
  }
50
50
 
51
- // codemirror
51
+ /* codemirror */
52
52
  .CodeMirror pre.CodeMirror-placeholder { opacity: 0.4; }
package/styles/index.css CHANGED
@@ -8,6 +8,7 @@ body,
8
8
  height: 100vh;
9
9
  height: calc(var(--vh, 1vh) * 100);
10
10
  overflow: hidden;
11
+ @apply font-sans;
11
12
  }
12
13
 
13
14
  html {
@@ -70,7 +70,7 @@
70
70
  }
71
71
 
72
72
  a {
73
- @apply border-current border-b border-dashed hover:(text-$slidev-theme-primary border-solid);
73
+ @apply border-current border-b border-dashed hover:text-$slidev-theme-primary hover:border-solid;
74
74
  }
75
75
 
76
76
  td, th {
package/uno.config.ts ADDED
@@ -0,0 +1,34 @@
1
+ import {
2
+ defineConfig,
3
+ presetAttributify,
4
+ presetIcons,
5
+ presetTypography,
6
+ presetUno,
7
+ transformerDirectives,
8
+ transformerVariantGroup,
9
+ } from 'unocss'
10
+
11
+ export default defineConfig({
12
+ safelist: [
13
+ '!opacity-0',
14
+ 'prose',
15
+ ],
16
+ shortcuts: {
17
+ 'bg-main': 'bg-white text-[#181818] dark:(bg-[#121212] text-[#ddd])',
18
+ 'abs-tl': 'absolute top-0 left-0',
19
+ 'abs-tr': 'absolute top-0 right-0',
20
+ 'abs-b': 'absolute bottom-0 left-0 right-0',
21
+ 'abs-bl': 'absolute bottom-0 left-0',
22
+ 'abs-br': 'absolute bottom-0 right-0',
23
+ },
24
+ presets: [
25
+ presetUno(),
26
+ presetAttributify(),
27
+ presetIcons(),
28
+ presetTypography(),
29
+ ],
30
+ transformers: [
31
+ transformerDirectives({ enforce: 'pre' }),
32
+ transformerVariantGroup(),
33
+ ],
34
+ })
package/windi.config.ts CHANGED
@@ -40,6 +40,7 @@ export default defineConfig({
40
40
  ],
41
41
  },
42
42
  plugins: [
43
+ // @ts-expect-error casing
43
44
  typography,
44
45
  ],
45
46
  safelist: [