@slidev/client 0.32.4 → 0.34.0

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 p-2 gap-1"
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
  >
@@ -3,6 +3,7 @@ import { ignorableWatch, onClickOutside } from '@vueuse/core'
3
3
  import { nextTick, ref, watch } from 'vue'
4
4
  import { currentSlideId } from '../logic/nav'
5
5
  import { useDynamicSlideInfo } from '../logic/note'
6
+ import NoteViewer from './NoteViewer.vue'
6
7
 
7
8
  const props = defineProps({
8
9
  class: {
@@ -59,22 +60,13 @@ onClickOutside(input, () => {
59
60
  </script>
60
61
 
61
62
  <template>
62
- <template v-if="!editing && note">
63
- <div
64
- v-if="info?.notesHTML"
65
- class="prose overflow-auto outline-none"
66
- :class="props.class"
67
- @click="switchNoteEdit"
68
- v-html="info?.notesHTML"
69
- />
70
- <div
71
- v-else
72
- class="prose overflow-auto outline-none"
73
- :class="props.class"
74
- @click="switchNoteEdit"
75
- v-text="note"
76
- />
77
- </template>
63
+ <NoteViewer
64
+ v-if="!editing && note"
65
+ :class="props.class"
66
+ :note="note"
67
+ :note-html="info?.notesHTML"
68
+ @click="switchNoteEdit"
69
+ />
78
70
  <textarea
79
71
  v-else
80
72
  ref="input"
@@ -0,0 +1,20 @@
1
+ <script setup lang="ts">
2
+ import { computed } from 'vue'
3
+ import { currentRoute } from '../logic/nav'
4
+ import NoteViewer from './NoteViewer.vue'
5
+
6
+ const props = defineProps<{
7
+ class?: string
8
+ }>()
9
+
10
+ const note = computed(() => currentRoute.value?.meta?.slide?.note)
11
+ const noteHtml = computed(() => currentRoute.value?.meta?.slide?.notesHTML)
12
+ </script>
13
+
14
+ <template>
15
+ <NoteViewer
16
+ :class="props.class"
17
+ :note="note"
18
+ :note-html="noteHtml"
19
+ />
20
+ </template>
@@ -0,0 +1,26 @@
1
+ <script setup lang="ts">
2
+ const props = defineProps<{
3
+ class?: string
4
+ noteHtml?: string
5
+ note?: string
6
+ }>()
7
+
8
+ defineEmits(['click'])
9
+ </script>
10
+
11
+ <template>
12
+ <div
13
+ v-if="noteHtml"
14
+ class="prose overflow-auto outline-none"
15
+ :class="props.class"
16
+ @click="$emit('click')"
17
+ v-html="noteHtml"
18
+ />
19
+ <div
20
+ v-else
21
+ class="prose overflow-auto outline-none"
22
+ :class="props.class"
23
+ @click="$emit('click')"
24
+ v-text="note"
25
+ />
26
+ </template>
@@ -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)' }"
@@ -14,6 +14,7 @@ import SlideContainer from './SlideContainer.vue'
14
14
  import NavControls from './NavControls.vue'
15
15
  import SlidesOverview from './SlidesOverview.vue'
16
16
  import NoteEditor from './NoteEditor.vue'
17
+ import NoteStatic from './NoteStatic.vue'
17
18
  import Goto from './Goto.vue'
18
19
  import SlidesShow from './SlidesShow.vue'
19
20
  import SlideWrapper from './SlideWrapper'
@@ -83,7 +84,7 @@ onMounted(() => {
83
84
  <div class="bg-main h-full slidev-presenter">
84
85
  <div class="grid-container">
85
86
  <div class="grid-section top flex">
86
- <img src="../assets/logo-title-horizontal.png" class="h-14 ml-2 py-2 my-auto">
87
+ <img src="../assets/logo-title-horizontal.png" class="ml-2 my-auto h-10 py-1 lg:h-14 lg:py-2">
87
88
  <div class="flex-auto" />
88
89
  <div
89
90
  class="timer-btn my-auto relative w-22px h-22px cursor-pointer text-lg"
@@ -97,7 +98,7 @@ onMounted(() => {
97
98
  {{ timer }}
98
99
  </div>
99
100
  </div>
100
- <div ref="main" class="grid-section main flex flex-col p-4" :style="themeVars">
101
+ <div ref="main" class="relative grid-section main flex flex-col p-2 lg:p-4" :style="themeVars">
101
102
  <SlideContainer
102
103
  key="main"
103
104
  class="h-full w-full"
@@ -106,8 +107,11 @@ onMounted(() => {
106
107
  <SlidesShow context="presenter" />
107
108
  </template>
108
109
  </SlideContainer>
110
+ <div class="context">
111
+ current
112
+ </div>
109
113
  </div>
110
- <div class="grid-section next flex flex-col p-4">
114
+ <div class="relative grid-section next flex flex-col p-2 lg:p-4">
111
115
  <SlideContainer
112
116
  v-if="nextSlide"
113
117
  key="next"
@@ -123,9 +127,13 @@ onMounted(() => {
123
127
  context="previewNext"
124
128
  />
125
129
  </SlideContainer>
130
+ <div class="context">
131
+ next
132
+ </div>
126
133
  </div>
127
134
  <div class="grid-section note overflow-auto">
128
- <NoteEditor class="w-full h-full p-4 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" />
129
137
  </div>
130
138
  <div class="grid-section bottom">
131
139
  <NavControls :persist="true" />
@@ -174,7 +182,20 @@ onMounted(() => {
174
182
  "bottom bottom";
175
183
  }
176
184
 
177
- @screen md {
185
+ @media (max-aspect-ratio: 3/5) {
186
+ .grid-container {
187
+ grid-template-columns: 1fr;
188
+ grid-template-rows: min-content 1fr 1fr 1fr min-content;
189
+ grid-template-areas:
190
+ "top"
191
+ "main"
192
+ "note"
193
+ "next"
194
+ "bottom";
195
+ }
196
+ }
197
+
198
+ @media (min-aspect-ratio: 1/1) {
178
199
  .grid-container {
179
200
  grid-template-columns: 1fr 1.1fr 0.9fr;
180
201
  grid-template-rows: min-content 1fr 2fr min-content;
@@ -209,4 +230,8 @@ onMounted(() => {
209
230
  grid-area: bottom;
210
231
  }
211
232
  }
233
+
234
+ .context {
235
+ @apply absolute top-0 left-0 px-1 text-xs bg-gray-400 bg-opacity-50 opacity-75 rounded-br-md;
236
+ }
212
237
  </style>
@@ -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 m-2 opacity-10 bg-current" />
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.32.4",
3
+ "version": "0.34.0",
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.32.4",
20
- "@slidev/types": "0.32.4",
21
- "@vueuse/core": "^8.6.0",
19
+ "@slidev/parser": "0.34.0",
20
+ "@slidev/types": "0.34.0",
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
  }
package/routes.ts CHANGED
@@ -59,6 +59,7 @@ declare module 'vue-router' {
59
59
  start: number
60
60
  end: number
61
61
  note?: string
62
+ notesHTML?: string
62
63
  id: number
63
64
  no: number
64
65
  filepath: string
@@ -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 {
@@ -16,10 +17,16 @@ html {
16
17
 
17
18
  .icon-btn {
18
19
  @apply inline-block cursor-pointer select-none !outline-none;
19
- @apply opacity-75 transition duration-200 ease-in-out align-middle rounded p-2;
20
+ @apply opacity-75 transition duration-200 ease-in-out align-middle rounded p-1;
20
21
  @apply hover:(opacity-100 bg-gray-400 bg-opacity-10);
21
22
  }
22
23
 
24
+ @screen md {
25
+ .icon-btn {
26
+ @apply p-2;
27
+ }
28
+ }
29
+
23
30
  .icon-btn.shallow {
24
31
  @apply opacity-30
25
32
  }
@@ -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: [