@slidev/client 0.49.0-beta.1 → 0.49.0-beta.3
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/CodeBlockWrapper.vue +3 -3
- package/builtin/KaTexBlockWrapper.vue +3 -3
- package/builtin/Monaco.vue +27 -4
- package/builtin/ShikiMagicMove.vue +3 -3
- package/builtin/SlidevVideo.vue +3 -7
- package/builtin/VClicks.ts +7 -2
- package/composables/useClicks.ts +80 -32
- package/composables/useDragElements.ts +7 -3
- package/composables/useNav.ts +20 -0
- package/constants.ts +1 -1
- package/env.ts +2 -0
- package/internals/CodeRunner.vue +26 -3
- package/internals/ContextMenu.vue +110 -0
- package/internals/Controls.vue +2 -0
- package/internals/DragControl.vue +1 -0
- package/internals/NavControls.vue +6 -11
- package/internals/QuickOverview.vue +6 -0
- package/logic/contextMenu.ts +34 -0
- package/logic/utils.ts +0 -18
- package/modules/v-click.ts +34 -70
- package/modules/v-mark.ts +3 -3
- package/modules/v-motion.ts +15 -26
- package/package.json +8 -8
- package/pages/play.vue +4 -2
- package/pages/presenter.vue +4 -0
- package/setup/code-runners.ts +7 -4
- package/setup/context-menu.ts +113 -0
- package/setup/main.ts +2 -2
- package/setup/monaco.ts +0 -3
- package/setup/routes.ts +80 -0
- package/routes.ts +0 -68
package/setup/routes.ts
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { RouteLocationNormalized, RouteRecordRaw } from 'vue-router'
|
|
2
|
+
import configs from '#slidev/configs'
|
|
3
|
+
import setups from '#slidev/setups/routes'
|
|
4
|
+
|
|
5
|
+
export default function setupRoutes() {
|
|
6
|
+
const routes: RouteRecordRaw[] = []
|
|
7
|
+
|
|
8
|
+
if (__SLIDEV_FEATURE_PRESENTER__) {
|
|
9
|
+
function passwordGuard(to: RouteLocationNormalized) {
|
|
10
|
+
if (!configs.remote || configs.remote === to.query.password)
|
|
11
|
+
return true
|
|
12
|
+
if (configs.remote && to.query.password === undefined) {
|
|
13
|
+
// eslint-disable-next-line no-alert
|
|
14
|
+
const password = prompt('Enter password')
|
|
15
|
+
if (configs.remote === password)
|
|
16
|
+
return true
|
|
17
|
+
}
|
|
18
|
+
if (to.params.no)
|
|
19
|
+
return { path: `/${to.params.no}` }
|
|
20
|
+
return { path: '' }
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
routes.push(
|
|
24
|
+
{
|
|
25
|
+
name: 'entry',
|
|
26
|
+
path: '/entry',
|
|
27
|
+
component: () => import('../pages/entry.vue'),
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
name: 'overview',
|
|
31
|
+
path: '/overview',
|
|
32
|
+
component: () => import('../pages/overview.vue'),
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: 'notes',
|
|
36
|
+
path: '/notes',
|
|
37
|
+
component: () => import('../pages/notes.vue'),
|
|
38
|
+
beforeEnter: passwordGuard,
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: 'presenter',
|
|
42
|
+
path: '/presenter/:no',
|
|
43
|
+
component: () => import('../pages/presenter.vue'),
|
|
44
|
+
beforeEnter: passwordGuard,
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
path: '/presenter',
|
|
48
|
+
redirect: { path: '/presenter/1' },
|
|
49
|
+
},
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (__SLIDEV_HAS_SERVER__) {
|
|
54
|
+
routes.push(
|
|
55
|
+
{
|
|
56
|
+
name: 'print',
|
|
57
|
+
path: '/print',
|
|
58
|
+
component: () => import('../pages/print.vue'),
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
path: '/presenter/print',
|
|
62
|
+
component: () => import('../pages/presenter/print.vue'),
|
|
63
|
+
},
|
|
64
|
+
)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
routes.push(
|
|
68
|
+
{
|
|
69
|
+
name: 'play',
|
|
70
|
+
path: '/:no',
|
|
71
|
+
component: () => import('../pages/play.vue'),
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
path: '',
|
|
75
|
+
redirect: { path: '/1' },
|
|
76
|
+
},
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
return setups.reduce((routes, setup) => setup(routes), routes)
|
|
80
|
+
}
|
package/routes.ts
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import type { RouteLocationNormalized, RouteRecordRaw } from 'vue-router'
|
|
2
|
-
import configs from '#slidev/configs'
|
|
3
|
-
|
|
4
|
-
export const routes: RouteRecordRaw[] = [
|
|
5
|
-
{
|
|
6
|
-
name: 'print',
|
|
7
|
-
path: '/print',
|
|
8
|
-
component: () => import('./pages/print.vue'),
|
|
9
|
-
},
|
|
10
|
-
|
|
11
|
-
// Redirects
|
|
12
|
-
{ path: '', redirect: { path: '/1' } },
|
|
13
|
-
]
|
|
14
|
-
|
|
15
|
-
if (__SLIDEV_FEATURE_PRESENTER__) {
|
|
16
|
-
function passwordGuard(to: RouteLocationNormalized) {
|
|
17
|
-
if (!configs.remote || configs.remote === to.query.password)
|
|
18
|
-
return true
|
|
19
|
-
if (configs.remote && to.query.password === undefined) {
|
|
20
|
-
// eslint-disable-next-line no-alert
|
|
21
|
-
const password = prompt('Enter password')
|
|
22
|
-
if (configs.remote === password)
|
|
23
|
-
return true
|
|
24
|
-
}
|
|
25
|
-
if (to.params.no)
|
|
26
|
-
return { path: `/${to.params.no}` }
|
|
27
|
-
return { path: '' }
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
routes.push({
|
|
31
|
-
path: '/presenter/print',
|
|
32
|
-
component: () => import('./pages/presenter/print.vue'),
|
|
33
|
-
})
|
|
34
|
-
if (__SLIDEV_HAS_SERVER__) {
|
|
35
|
-
routes.push({
|
|
36
|
-
name: 'entry',
|
|
37
|
-
path: '/entry',
|
|
38
|
-
component: () => import('./pages/entry.vue'),
|
|
39
|
-
})
|
|
40
|
-
routes.push({
|
|
41
|
-
name: 'overview',
|
|
42
|
-
path: '/overview',
|
|
43
|
-
component: () => import('./pages/overview.vue'),
|
|
44
|
-
})
|
|
45
|
-
routes.push({
|
|
46
|
-
name: 'notes',
|
|
47
|
-
path: '/notes',
|
|
48
|
-
component: () => import('./pages/notes.vue'),
|
|
49
|
-
beforeEnter: passwordGuard,
|
|
50
|
-
})
|
|
51
|
-
}
|
|
52
|
-
routes.push({
|
|
53
|
-
name: 'presenter',
|
|
54
|
-
path: '/presenter/:no',
|
|
55
|
-
component: () => import('./pages/presenter.vue'),
|
|
56
|
-
beforeEnter: passwordGuard,
|
|
57
|
-
})
|
|
58
|
-
routes.push({
|
|
59
|
-
path: '/presenter',
|
|
60
|
-
redirect: { path: '/presenter/1' },
|
|
61
|
-
})
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
routes.push({
|
|
65
|
-
name: 'play',
|
|
66
|
-
path: '/:no',
|
|
67
|
-
component: () => import('./pages/play.vue'),
|
|
68
|
-
})
|