@slidev/client 0.48.0-beta.1 → 0.48.0-beta.11

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.
Files changed (61) hide show
  1. package/builtin/CodeBlockWrapper.vue +4 -3
  2. package/builtin/KaTexBlockWrapper.vue +4 -3
  3. package/builtin/RenderWhen.vue +3 -3
  4. package/builtin/SlideCurrentNo.vue +2 -3
  5. package/builtin/SlidesTotal.vue +3 -4
  6. package/builtin/SlidevVideo.vue +8 -6
  7. package/builtin/Toc.vue +3 -3
  8. package/builtin/TocList.vue +3 -2
  9. package/builtin/Tweet.vue +4 -15
  10. package/builtin/VClickGap.vue +3 -5
  11. package/builtin/VClicks.ts +1 -1
  12. package/composables/useClicks.ts +19 -13
  13. package/composables/useTweetScript.ts +17 -0
  14. package/constants.ts +56 -8
  15. package/context.ts +70 -0
  16. package/env.ts +3 -12
  17. package/internals/DrawingControls.vue +39 -9
  18. package/internals/DrawingLayer.vue +3 -2
  19. package/internals/Editor.vue +7 -3
  20. package/internals/Goto.vue +5 -4
  21. package/internals/IconButton.vue +4 -3
  22. package/internals/InfoDialog.vue +1 -1
  23. package/internals/Modal.vue +1 -1
  24. package/internals/NavControls.vue +2 -3
  25. package/internals/NoteDisplay.vue +1 -1
  26. package/internals/NoteEditor.vue +36 -8
  27. package/internals/NoteStatic.vue +5 -6
  28. package/internals/PrintContainer.vue +3 -2
  29. package/internals/PrintSlideClick.vue +5 -7
  30. package/internals/RecordingDialog.vue +5 -6
  31. package/internals/SlideContainer.vue +12 -9
  32. package/internals/SlideWrapper.ts +28 -12
  33. package/internals/SlidesOverview.vue +18 -7
  34. package/internals/SlidesShow.vue +7 -8
  35. package/layouts/two-cols-header.vue +9 -3
  36. package/logic/drawings.ts +6 -3
  37. package/logic/nav.ts +6 -1
  38. package/logic/note.ts +7 -7
  39. package/main.ts +8 -4
  40. package/modules/context.ts +4 -3
  41. package/modules/{directives.ts → v-click.ts} +15 -15
  42. package/modules/v-mark.ts +159 -0
  43. package/package.json +21 -13
  44. package/{internals/EntrySelect.vue → pages/entry.vue} +7 -0
  45. package/{internals/NotesView.vue → pages/notes.vue} +3 -3
  46. package/pages/overview.vue +201 -0
  47. package/{internals/Play.vue → pages/play.vue} +7 -7
  48. package/{internals/PresenterPrint.vue → pages/presenter/print.vue} +7 -5
  49. package/{internals/Presenter.vue → pages/presenter.vue} +64 -58
  50. package/{internals/Print.vue → pages/print.vue} +2 -2
  51. package/routes.ts +27 -51
  52. package/setup/codemirror.ts +7 -0
  53. package/shim-vue.d.ts +35 -0
  54. package/shim.d.ts +0 -12
  55. package/state/index.ts +10 -10
  56. package/styles/code.css +7 -3
  57. package/styles/index.css +18 -6
  58. package/styles/katex.css +1 -1
  59. package/styles/layouts-base.css +17 -12
  60. package/styles/vars.css +1 -0
  61. package/uno.config.ts +14 -2
@@ -1,12 +1,12 @@
1
1
  import type { App } from 'vue'
2
- import { computed, reactive } from 'vue'
2
+ import { computed, reactive, ref } from 'vue'
3
3
  import type { RouteLocationNormalizedLoaded, RouteRecordRaw } from 'vue-router'
4
4
  import type { ComputedRef } from '@vue/reactivity'
5
5
  import type { configs } from '../env'
6
6
  import * as nav from '../logic/nav'
7
7
  import { route } from '../logic/nav'
8
8
  import { isDark } from '../logic/dark'
9
- import { injectionCurrentPage, injectionSlidevContext } from '../constants'
9
+ import { injectionCurrentPage, injectionRenderContext, injectionSlidevContext } from '../constants'
10
10
  import { useContext } from '../composables/useContext'
11
11
 
12
12
  export type SlidevContextNavKey = 'path' | 'total' | 'clicksContext' | 'clicks' | 'clicksTotal' | 'currentPage' | 'currentPath' | 'currentRoute' | 'currentSlideId' | 'currentLayout' | 'nextRoute' | 'rawTree' | 'treeWithActiveStatuses' | 'tree' | 'downloadPDF' | 'next' | 'nextSlide' | 'openInEditor' | 'prev' | 'prevSlide' | 'rawRoutes' | 'go'
@@ -21,10 +21,11 @@ export interface SlidevContext {
21
21
  themeConfigs: ComputedRef<typeof configs['themeConfig']>
22
22
  }
23
23
 
24
- export default function createSlidevContext() {
24
+ export function createSlidevContext() {
25
25
  return {
26
26
  install(app: App) {
27
27
  const context = reactive(useContext(route))
28
+ app.provide(injectionRenderContext, ref('none'))
28
29
  app.provide(injectionSlidevContext, context)
29
30
  app.provide(injectionCurrentPage, computed(() => context.nav.currentPage))
30
31
 
@@ -11,19 +11,21 @@ import {
11
11
  injectionClicksContext,
12
12
  } from '../constants'
13
13
 
14
- function dirInject<T = unknown>(dir: DirectiveBinding<any>, key: InjectionKey<T> | string, defaultValue?: T): T | undefined {
14
+ export type VClickValue = string | [string | number, string | number] | boolean
15
+
16
+ export function dirInject<T = unknown>(dir: DirectiveBinding<any>, key: InjectionKey<T> | string, defaultValue?: T): T | undefined {
15
17
  return (dir.instance?.$ as any).provides[key as any] ?? defaultValue
16
18
  }
17
19
 
18
- export default function createDirectives() {
20
+ export function createVClickDirectives() {
19
21
  return {
20
22
  install(app: App) {
21
- app.directive('click', {
23
+ app.directive<HTMLElement, VClickValue>('click', {
22
24
  // @ts-expect-error extra prop
23
25
  name: 'v-click',
24
26
 
25
- mounted(el: HTMLElement, dir) {
26
- const resolved = resolveClick(el, dir)
27
+ mounted(el, dir) {
28
+ const resolved = resolveClick(el, dir, dir.value)
27
29
  if (resolved == null)
28
30
  return
29
31
 
@@ -55,12 +57,12 @@ export default function createDirectives() {
55
57
  unmounted,
56
58
  })
57
59
 
58
- app.directive('after', {
60
+ app.directive<HTMLElement, VClickValue>('after', {
59
61
  // @ts-expect-error extra prop
60
62
  name: 'v-after',
61
63
 
62
- mounted(el: HTMLElement, dir) {
63
- const resolved = resolveClick(el, dir, true)
64
+ mounted(el, dir) {
65
+ const resolved = resolveClick(el, dir, dir.value, true)
64
66
  if (resolved == null)
65
67
  return
66
68
 
@@ -86,12 +88,12 @@ export default function createDirectives() {
86
88
  unmounted,
87
89
  })
88
90
 
89
- app.directive('click-hide', {
91
+ app.directive<HTMLElement, VClickValue>('click-hide', {
90
92
  // @ts-expect-error extra prop
91
93
  name: 'v-click-hide',
92
94
 
93
- mounted(el: HTMLElement, dir) {
94
- const resolved = resolveClick(el, dir, false, true)
95
+ mounted(el, dir) {
96
+ const resolved = resolveClick(el, dir, dir.value, false, true)
95
97
  if (resolved == null)
96
98
  return
97
99
 
@@ -127,14 +129,12 @@ function isCurrent(thisClick: number | [number, number], clicks: number) {
127
129
  : thisClick === clicks
128
130
  }
129
131
 
130
- function resolveClick(el: Element, dir: DirectiveBinding<any>, clickAfter = false, flagHide = false): ResolvedClicksInfo | null {
132
+ export function resolveClick(el: Element, dir: DirectiveBinding<any>, value: VClickValue, clickAfter = false, flagHide = false): ResolvedClicksInfo | null {
131
133
  const ctx = dirInject(dir, injectionClicksContext)?.value
132
134
 
133
135
  if (!el || !ctx || ctx.disabled)
134
136
  return null
135
137
 
136
- let value = dir.value
137
-
138
138
  if (value === false || value === 'false')
139
139
  return null
140
140
 
@@ -153,7 +153,7 @@ function resolveClick(el: Element, dir: DirectiveBinding<any>, clickAfter = fals
153
153
  // range (absolute)
154
154
  delta = 0
155
155
  thisClick = value as [number, number]
156
- maxClick = value[1]
156
+ maxClick = +value[1]
157
157
  }
158
158
  else {
159
159
  ({ start: thisClick, end: maxClick, delta } = ctx.resolve(value))
@@ -0,0 +1,159 @@
1
+ import type { RoughAnnotationConfig } from '@slidev/rough-notation'
2
+ import { annotate } from '@slidev/rough-notation'
3
+ import type { App } from 'vue'
4
+ import { computed, watchEffect } from 'vue'
5
+ import type { VClickValue } from './v-click'
6
+ import { resolveClick } from './v-click'
7
+
8
+ export interface RoughDirectiveOptions extends Partial<RoughAnnotationConfig> {
9
+ at: VClickValue
10
+ }
11
+
12
+ export type RoughDirectiveValue = VClickValue | RoughDirectiveOptions
13
+
14
+ function addClass(options: RoughDirectiveOptions, cls: string) {
15
+ options.class = [options.class, cls].filter(Boolean).join(' ')
16
+ return options
17
+ }
18
+
19
+ // Definitions of supported modifiers
20
+ const vMarkModifiers: Record<string, (options: RoughDirectiveOptions, value?: any) => RoughDirectiveOptions> = {
21
+ // Types
22
+ 'box': options => Object.assign(options, { type: 'box' }),
23
+ 'circle': options => Object.assign(options, { type: 'circle' }),
24
+ 'underline': options => Object.assign(options, { type: 'underline' }),
25
+ 'highlight': options => Object.assign(options, { type: 'highlight' }),
26
+ 'strike-through': options => Object.assign(options, { type: 'strike-through' }),
27
+ 'crossed-off': options => Object.assign(options, { type: 'crossed-off' }),
28
+ 'bracket': options => Object.assign(options, { type: 'bracket' }),
29
+
30
+ // Type Aliases
31
+ 'strike': options => Object.assign(options, { type: 'strike-through' }),
32
+ 'cross': options => Object.assign(options, { type: 'crossed-off' }),
33
+ 'crossed': options => Object.assign(options, { type: 'crossed-off' }),
34
+ 'linethrough': options => Object.assign(options, { type: 'strike-through' }),
35
+ 'line-through': options => Object.assign(options, { type: 'strike-through' }),
36
+
37
+ // Colors
38
+ // @unocss-include
39
+ 'black': options => addClass(options, 'text-black'),
40
+ 'blue': options => addClass(options, 'text-blue'),
41
+ 'cyan': options => addClass(options, 'text-cyan'),
42
+ 'gray': options => addClass(options, 'text-gray'),
43
+ 'green': options => addClass(options, 'text-green'),
44
+ 'indigo': options => addClass(options, 'text-indigo'),
45
+ 'lime': options => addClass(options, 'text-lime'),
46
+ 'orange': options => addClass(options, 'text-orange'),
47
+ 'pink': options => addClass(options, 'text-pink'),
48
+ 'purple': options => addClass(options, 'text-purple'),
49
+ 'red': options => addClass(options, 'text-red'),
50
+ 'teal': options => addClass(options, 'text-teal'),
51
+ 'white': options => addClass(options, 'text-white'),
52
+ 'yellow': options => addClass(options, 'text-yellow'),
53
+ }
54
+
55
+ const vMarkModifiersDynamic: [RegExp, (match: RegExpMatchArray, options: RoughDirectiveOptions, value?: any) => RoughDirectiveOptions][] = [
56
+ // Support setting delay like `v-mark.delay300="1"`
57
+ [/^delay-?(\d+)?$/, (match, options, value) => {
58
+ const ms = (match[1] ? Number.parseInt(match[1]) : value) || 300
59
+ options.delay = ms
60
+ return options
61
+ }],
62
+ // Support setting opacity like `v-mark.op50="1"`
63
+ [/^(?:op|opacity)-?(\d+)?$/, (match, options, value) => {
64
+ const opacity = (match[1] ? Number.parseInt(match[1]) : value) || 100
65
+ options.opacity = opacity / 100
66
+ return options
67
+ }],
68
+ ]
69
+
70
+ /**
71
+ * This supports v-mark directive to add notations to elements, powered by `rough-notation`.
72
+ */
73
+ export function createVMarkDirective() {
74
+ return {
75
+ install(app: App) {
76
+ app.directive<HTMLElement, RoughDirectiveValue>('mark', {
77
+ // @ts-expect-error extra prop
78
+ name: 'v-mark',
79
+
80
+ mounted: (el, binding) => {
81
+ const options = computed(() => {
82
+ const bindingOptions = (typeof binding.value === 'object' && !Array.isArray(binding.value))
83
+ ? { ...binding.value }
84
+ : { at: binding.value }
85
+
86
+ let modifierOptions: RoughDirectiveOptions = { at: bindingOptions.at }
87
+ const unknownModifiers = Object.entries(binding.modifiers)
88
+ .filter(([k, v]) => {
89
+ if (vMarkModifiers[k]) {
90
+ modifierOptions = vMarkModifiers[k](modifierOptions, v)
91
+ return false
92
+ }
93
+ for (const [re, fn] of vMarkModifiersDynamic) {
94
+ const match = k.match(re)
95
+ if (match) {
96
+ modifierOptions = fn(match, modifierOptions, v)
97
+ return false
98
+ }
99
+ }
100
+ return true
101
+ })
102
+
103
+ if (unknownModifiers.length)
104
+ console.warn('[Slidev] Invalid modifiers for v-mark:', unknownModifiers)
105
+
106
+ const options = {
107
+ ...modifierOptions,
108
+ ...bindingOptions,
109
+ }
110
+ options.type ||= 'underline'
111
+
112
+ return options
113
+ })
114
+
115
+ const annotation = annotate(el, options.value as RoughAnnotationConfig)
116
+
117
+ const resolvedClick = resolveClick(el, binding, options.value.at)
118
+ if (!resolvedClick) {
119
+ console.error('[Slidev] Invalid value for v-mark:', options.value.at)
120
+ return
121
+ }
122
+
123
+ watchEffect(() => {
124
+ let shouldShow: boolean | undefined
125
+
126
+ if (options.value.class)
127
+ annotation.class = options.value.class
128
+ if (options.value.color)
129
+ annotation.color = options.value.color
130
+
131
+ const at = options.value.at
132
+
133
+ if (at === true) {
134
+ shouldShow = true
135
+ }
136
+ else if (at === false) {
137
+ shouldShow = false
138
+ }
139
+ else if (resolvedClick) {
140
+ shouldShow = resolvedClick.isActive.value
141
+ }
142
+ else {
143
+ console.error('[Slidev] Invalid value for v-mark:', at)
144
+ return
145
+ }
146
+
147
+ if (shouldShow == null)
148
+ return
149
+
150
+ if (shouldShow)
151
+ annotation.show()
152
+ else
153
+ annotation.hide()
154
+ })
155
+ },
156
+ })
157
+ },
158
+ }
159
+ }
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@slidev/client",
3
- "version": "0.48.0-beta.1",
3
+ "type": "module",
4
+ "version": "0.48.0-beta.11",
4
5
  "description": "Presentation slides for developers",
5
6
  "author": "antfu <anthonyfu117@hotmail.com>",
6
7
  "license": "MIT",
@@ -13,6 +14,12 @@
13
14
  "bugs": "https://github.com/slidevjs/slidev/issues",
14
15
  "exports": {
15
16
  "./package.json": "./package.json",
17
+ "./constants": "./constants.ts",
18
+ "./context": "./context.ts",
19
+ "./env": "./env.ts",
20
+ "./layoutHelper": "./layoutHelper.ts",
21
+ "./routes": "./routes.ts",
22
+ "./utils": "./utils.ts",
16
23
  "./*": "./*"
17
24
  },
18
25
  "engines": {
@@ -22,34 +29,35 @@
22
29
  "@antfu/utils": "^0.7.7",
23
30
  "@iconify-json/carbon": "^1.1.30",
24
31
  "@iconify-json/ph": "^1.1.11",
25
- "@shikijs/vitepress-twoslash": "^1.1.2",
32
+ "@shikijs/vitepress-twoslash": "^1.1.7",
33
+ "@slidev/rough-notation": "^0.1.0",
26
34
  "@unhead/vue": "^1.8.10",
27
35
  "@unocss/reset": "^0.58.5",
28
- "@vueuse/core": "^10.7.2",
29
- "@vueuse/math": "^10.7.2",
30
- "@vueuse/motion": "^2.0.0",
31
- "codemirror": "^5.65.5",
36
+ "@vueuse/core": "^10.8.0",
37
+ "@vueuse/math": "^10.8.0",
38
+ "@vueuse/motion": "^2.1.0",
39
+ "codemirror": "^5.65.16",
32
40
  "defu": "^6.1.4",
33
- "drauu": "^0.3.7",
41
+ "drauu": "^0.4.0",
34
42
  "file-saver": "^2.0.5",
35
43
  "floating-vue": "^5.2.2",
36
44
  "fuse.js": "^7.0.0",
37
- "js-base64": "^3.7.6",
45
+ "js-base64": "^3.7.7",
38
46
  "js-yaml": "^4.1.0",
39
47
  "katex": "^0.16.9",
40
48
  "mermaid": "^10.8.0",
41
49
  "monaco-editor": "^0.37.1",
42
- "nanoid": "^5.0.5",
50
+ "nanoid": "^5.0.6",
43
51
  "prettier": "^3.2.5",
44
52
  "recordrtc": "^5.6.2",
45
53
  "resolve": "^1.22.8",
46
54
  "unocss": "^0.58.5",
47
55
  "vue": "^3.4.19",
48
- "vue-router": "^4.2.5",
49
- "@slidev/types": "0.48.0-beta.1",
50
- "@slidev/parser": "0.48.0-beta.1"
56
+ "vue-router": "^4.3.0",
57
+ "@slidev/parser": "0.48.0-beta.11",
58
+ "@slidev/types": "0.48.0-beta.11"
51
59
  },
52
60
  "devDependencies": {
53
- "vite": "^5.1.1"
61
+ "vite": "^5.1.4"
54
62
  }
55
63
  }
@@ -21,5 +21,12 @@
21
21
  <carbon:catalog class="text-3em op50" />
22
22
  Notes
23
23
  </RouterLink>
24
+ <RouterLink
25
+ to="/overview"
26
+ class="flex flex-col gap-2 items-center justify-center h-40 min-w-40 rounded bg-gray:10 p4 hover:bg-gray/20"
27
+ >
28
+ <carbon:list-boxes class="text-3em op50" />
29
+ Overview
30
+ </RouterLink>
24
31
  </div>
25
32
  </template>
@@ -7,8 +7,8 @@ import { sharedState } from '../state/shared'
7
7
  import { fullscreen } from '../state'
8
8
  import { total } from '../logic/nav'
9
9
  import { rawRoutes } from '../routes'
10
- import NoteDisplay from './NoteDisplay.vue'
11
- import IconButton from './IconButton.vue'
10
+ import NoteDisplay from '../internals/NoteDisplay.vue'
11
+ import IconButton from '../internals/IconButton.vue'
12
12
 
13
13
  const slideTitle = configs.titleTemplate.replace('%s', configs.title || 'Slidev')
14
14
  useHead({
@@ -53,7 +53,7 @@ function decreaseFontSize() {
53
53
  :placeholder="`No notes for Slide ${pageNo}.`"
54
54
  />
55
55
  </div>
56
- <div class="flex-none border-t border-gray-400 border-opacity-20">
56
+ <div class="flex-none border-t border-main">
57
57
  <div class="flex gap-1 items-center px-6 py-3">
58
58
  <IconButton :title="isFullscreen ? 'Close fullscreen' : 'Enter fullscreen'" @click="toggleFullscreen">
59
59
  <carbon:minimize v-if="isFullscreen" />
@@ -0,0 +1,201 @@
1
+ <script setup lang="ts">
2
+ import { computed, nextTick, onMounted, reactive, ref } from 'vue'
3
+ import { useHead } from '@unhead/vue'
4
+ import type { RouteRecordRaw } from 'vue-router'
5
+ import type { ClicksContext } from 'packages/types'
6
+ import { themeVars } from '../env'
7
+ import { rawRoutes } from '../logic/nav'
8
+ import { useClicksContextBase } from '../composables/useClicks'
9
+ import { isColorSchemaConfigured, isDark, toggleDark } from '../logic/dark'
10
+ import { getSlideClass } from '../utils'
11
+ import SlideContainer from '../internals/SlideContainer.vue'
12
+ import SlideWrapper from '../internals/SlideWrapper'
13
+ import DrawingPreview from '../internals/DrawingPreview.vue'
14
+ import IconButton from '../internals/IconButton.vue'
15
+ import NoteEditor from '../internals/NoteEditor.vue'
16
+
17
+ const cardWidth = 450
18
+
19
+ useHead({
20
+ title: 'List Overview',
21
+ })
22
+
23
+ const blocks: Map<number, HTMLElement> = reactive(new Map())
24
+ const activeBlocks = ref<number[]>([])
25
+ const edittingNote = ref<number | null>(null)
26
+ const wordCounts = computed(() => rawRoutes.map(route => wordCount(route.meta?.slide?.note || '')))
27
+ const totalWords = computed(() => wordCounts.value.reduce((a, b) => a + b, 0))
28
+ const totalClicks = computed(() => rawRoutes.map(route => getSlideClicks(route)).reduce((a, b) => a + b, 0))
29
+
30
+ const clicksContextMap = new WeakMap<RouteRecordRaw, ClicksContext>()
31
+ function getClickContext(route: RouteRecordRaw) {
32
+ // We create a local clicks context to calculate the total clicks of the slide
33
+ if (!clicksContextMap.has(route))
34
+ clicksContextMap.set(route, useClicksContextBase(() => 999999, route?.meta?.clicks))
35
+ return clicksContextMap.get(route)!
36
+ }
37
+
38
+ function getSlideClicks(route: RouteRecordRaw) {
39
+ return route.meta?.clicks || getClickContext(route)?.total
40
+ }
41
+
42
+ function wordCount(str: string) {
43
+ return str.match(/[\w\d\’\'-]+/gi)?.length || 0
44
+ }
45
+
46
+ function isElementInViewport(el: HTMLElement) {
47
+ const rect = el.getBoundingClientRect()
48
+ const delta = 20
49
+ return (
50
+ rect.top >= 0 - delta
51
+ && rect.left >= 0 - delta
52
+ && rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) + delta
53
+ && rect.right <= (window.innerWidth || document.documentElement.clientWidth) + delta
54
+ )
55
+ }
56
+
57
+ function checkActiveBlocks() {
58
+ const active: number[] = []
59
+ Array.from(blocks.entries())
60
+ .forEach(([idx, el]) => {
61
+ if (isElementInViewport(el))
62
+ active.push(idx)
63
+ })
64
+ activeBlocks.value = active
65
+ }
66
+
67
+ function openSlideInNewTab(path: string) {
68
+ const a = document.createElement('a')
69
+ a.target = '_blank'
70
+ a.href = path
71
+ a.click()
72
+ }
73
+
74
+ function scrollToSlide(idx: number) {
75
+ const el = blocks.get(idx)
76
+ if (el)
77
+ el.scrollIntoView({ behavior: 'smooth', block: 'start' })
78
+ }
79
+
80
+ onMounted(() => {
81
+ nextTick(() => {
82
+ checkActiveBlocks()
83
+ })
84
+ })
85
+ </script>
86
+
87
+ <template>
88
+ <div class="h-screen w-screen of-hidden flex">
89
+ <nav class="h-full flex flex-col border-r border-main p2 select-none">
90
+ <div class="flex flex-col flex-auto items-center justify-center group gap-1">
91
+ <div
92
+ v-for="(route, idx) of rawRoutes"
93
+ :key="route.path"
94
+ class="relative"
95
+ >
96
+ <button
97
+ class="relative transition duration-300 w-8 h-8 rounded hover:bg-active hover:op100"
98
+ :class="activeBlocks.includes(idx) ? 'op100 text-primary bg-gray:5' : 'op20'"
99
+ @click="scrollToSlide(idx)"
100
+ >
101
+ <div>{{ idx + 1 }}</div>
102
+ </button>
103
+ <div
104
+ v-if="route.meta?.slide?.title"
105
+ class="pointer-events-none select-none absolute left-110% bg-main top-50% translate-y--50% ws-nowrap z-10 px2 shadow-xl rounded border border-main transition duration-400 op0 group-hover:op100"
106
+ :class="activeBlocks.includes(idx) ? 'text-primary' : 'text-main important-text-op-50'"
107
+ >
108
+ {{ route.meta?.slide?.title }}
109
+ </div>
110
+ </div>
111
+ </div>
112
+ <IconButton
113
+ v-if="!isColorSchemaConfigured"
114
+ :title="isDark ? 'Switch to light mode theme' : 'Switch to dark mode theme'"
115
+ @click="toggleDark()"
116
+ >
117
+ <carbon-moon v-if="isDark" />
118
+ <carbon-sun v-else />
119
+ </IconButton>
120
+ </nav>
121
+ <main
122
+ class="flex-1 h-full of-auto"
123
+ :style="`grid-template-columns: repeat(auto-fit,minmax(${cardWidth}px,1fr))`"
124
+ @scroll="checkActiveBlocks"
125
+ >
126
+ <div
127
+ v-for="(route, idx) of rawRoutes"
128
+ :key="route.path"
129
+ :ref="el => blocks.set(idx, el as any)"
130
+ class="relative border-t border-main of-hidden flex gap-4 min-h-50 group"
131
+ >
132
+ <div class="select-none w-13 text-right my4">
133
+ <div class="text-3xl op20 mb2">
134
+ {{ idx + 1 }}
135
+ </div>
136
+ <div
137
+ v-if="getSlideClicks(route)"
138
+ class="flex gap-0.5 op50 items-center justify-end"
139
+ :title="`Clicks in this slide: ${getSlideClicks(route)}`"
140
+ >
141
+ <carbon:cursor-1 text-sm />
142
+ {{ getSlideClicks(route) }}
143
+ </div>
144
+ </div>
145
+ <div
146
+ class="border rounded border-main overflow-hidden bg-main my5 select-none h-max"
147
+ :style="themeVars"
148
+ @dblclick="openSlideInNewTab(route.path)"
149
+ >
150
+ <SlideContainer
151
+ :key="route.path"
152
+ :width="cardWidth"
153
+ :clicks-disabled="true"
154
+ class="pointer-events-none important:[&_*]:select-none"
155
+ >
156
+ <SlideWrapper
157
+ :is="route.component"
158
+ v-if="route?.component"
159
+ :clicks-context="getClickContext(route)"
160
+ :class="getSlideClass(route)"
161
+ :route="route"
162
+ render-context="overview"
163
+ />
164
+ <DrawingPreview :page="+route.path" />
165
+ </SlideContainer>
166
+ </div>
167
+ <div class="py3 mt-0.5 mr--8 ml--4 op0 transition group-hover:op100">
168
+ <IconButton
169
+ title="Edit Note"
170
+ class="rounded-full w-9 h-9 text-sm"
171
+ :class="edittingNote === idx ? 'important:op0' : ''"
172
+ @click="edittingNote = idx"
173
+ >
174
+ <carbon:pen />
175
+ </IconButton>
176
+ </div>
177
+ <NoteEditor
178
+ :no="idx"
179
+ class="max-w-250 w-250 text-lg rounded p3"
180
+ :auto-height="true"
181
+ :editing="edittingNote === idx"
182
+ @dblclick="edittingNote !== idx ? edittingNote = idx : null"
183
+ @update:editing="edittingNote = null"
184
+ />
185
+ <div
186
+ v-if="wordCounts[idx] > 0"
187
+ class="select-none absolute bottom-0 right-0 bg-main rounded-tl p2 op35 text-xs"
188
+ >
189
+ {{ wordCounts[idx] }} words
190
+ </div>
191
+ </div>
192
+ </main>
193
+ <div class="absolute top-0 right-0 px3 py1.5 border-b border-l rounded-lb bg-main border-main select-none">
194
+ <div class="text-xs op50">
195
+ {{ rawRoutes.length }} slides ·
196
+ {{ totalClicks + rawRoutes.length - 1 }} clicks ·
197
+ {{ totalWords }} words
198
+ </div>
199
+ </div>
200
+ </div>
201
+ </template>
@@ -5,11 +5,11 @@ import { isEmbedded, isPrintMode, next, prev, useSwipeControls } from '../logic/
5
5
  import { isDrawing } from '../logic/drawings'
6
6
  import { registerShortcuts } from '../logic/shortcuts'
7
7
  import { configs, themeVars } from '../env'
8
- import Controls from './Controls.vue'
9
- import SlideContainer from './SlideContainer.vue'
10
- import NavControls from './NavControls.vue'
11
- import SlidesShow from './SlidesShow.vue'
12
- import PrintStyle from './PrintStyle.vue'
8
+ import Controls from '../internals/Controls.vue'
9
+ import SlideContainer from '../internals/SlideContainer.vue'
10
+ import NavControls from '../internals/NavControls.vue'
11
+ import SlidesShow from '../internals/SlidesShow.vue'
12
+ import PrintStyle from '../internals/PrintStyle.vue'
13
13
 
14
14
  registerShortcuts()
15
15
 
@@ -33,11 +33,11 @@ const persistNav = computed(() => isScreenVertical.value || showEditor.value)
33
33
 
34
34
  const Editor = shallowRef<any>()
35
35
  if (__DEV__ && __SLIDEV_FEATURE_EDITOR__)
36
- import('./Editor.vue').then(v => Editor.value = v.default)
36
+ import('../internals/Editor.vue').then(v => Editor.value = v.default)
37
37
 
38
38
  const DrawingControls = shallowRef<any>()
39
39
  if (__SLIDEV_FEATURE_DRAWINGS__)
40
- import('./DrawingControls.vue').then(v => DrawingControls.value = v.default)
40
+ import('../internals/DrawingControls.vue').then(v => DrawingControls.value = v.default)
41
41
  </script>
42
42
 
43
43
  <template>
@@ -2,9 +2,9 @@
2
2
  import { computed } from 'vue'
3
3
  import { useStyleTag } from '@vueuse/core'
4
4
  import { useHead } from '@unhead/vue'
5
- import { configs, themeVars } from '../env'
6
- import { rawRoutes, total } from '../logic/nav'
7
- import NoteDisplay from './NoteDisplay.vue'
5
+ import { configs, themeVars } from '../../env'
6
+ import { rawRoutes, total } from '../../logic/nav'
7
+ import NoteDisplay from '../../internals/NoteDisplay.vue'
8
8
 
9
9
  useStyleTag(`
10
10
  @page {
@@ -24,7 +24,9 @@ html #page-root {
24
24
  }
25
25
  `)
26
26
 
27
- useHead({ title: `Notes - ${configs.title}` })
27
+ useHead({
28
+ title: `Notes - ${configs.title}`,
29
+ })
28
30
 
29
31
  const slidesWithNote = computed(() => rawRoutes
30
32
  .map(route => route.meta?.slide)
@@ -56,7 +58,7 @@ const slidesWithNote = computed(() => rawRoutes
56
58
  </h2>
57
59
  <NoteDisplay :note-html="slide!.noteHTML" class="max-w-full" />
58
60
  </div>
59
- <hr v-if="index < slidesWithNote.length - 1" class="border-gray-400/50 mb-8">
61
+ <hr v-if="index < slidesWithNote.length - 1" class="border-main mb-8">
60
62
  </div>
61
63
  </div>
62
64
  </div>