@slidev/client 0.35.6 → 0.36.2

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.
@@ -42,10 +42,10 @@ export function strokeShortcut(key: KeyFilter, fn: Fn) {
42
42
  }
43
43
 
44
44
  export function registerShortcuts() {
45
- const { customShortcuts, defaultShortcuts } = setupShortcuts()
45
+ const allShortcuts = setupShortcuts()
46
46
 
47
47
  const shortcuts = new Map<string | Ref<Boolean>, ShortcutOptions>(
48
- [...defaultShortcuts, ...customShortcuts].map((options: ShortcutOptions) => [options.key, options]),
48
+ allShortcuts.map((options: ShortcutOptions) => [options.key, options]),
49
49
  )
50
50
 
51
51
  shortcuts.forEach((options) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slidev/client",
3
- "version": "0.35.6",
3
+ "version": "0.36.2",
4
4
  "description": "Presentation slides for developers",
5
5
  "author": "antfu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",
@@ -16,13 +16,13 @@
16
16
  },
17
17
  "dependencies": {
18
18
  "@antfu/utils": "^0.5.2",
19
- "@slidev/parser": "0.35.6",
20
- "@slidev/types": "0.35.6",
21
- "@unocss/reset": "^0.45.14",
22
- "@vueuse/core": "^9.1.1",
23
- "@vueuse/head": "^0.7.9",
24
- "@vueuse/math": "^9.1.1",
25
- "@vueuse/motion": "^2.0.0-beta.18",
19
+ "@slidev/parser": "0.36.2",
20
+ "@slidev/types": "0.36.2",
21
+ "@unocss/reset": "^0.45.20",
22
+ "@vueuse/core": "^9.2.0",
23
+ "@vueuse/head": "^0.7.10",
24
+ "@vueuse/math": "^9.2.0",
25
+ "@vueuse/motion": "^2.0.0-beta.22",
26
26
  "codemirror": "^5.65.5",
27
27
  "defu": "^6.1.0",
28
28
  "drauu": "^0.3.1",
@@ -36,14 +36,14 @@
36
36
  "prettier": "^2.7.1",
37
37
  "recordrtc": "^5.6.2",
38
38
  "resolve": "^1.22.1",
39
- "unocss": "^0.45.14",
40
- "vite-plugin-windicss": "^1.8.7",
41
- "vue": "^3.2.38",
39
+ "unocss": "^0.45.20",
40
+ "vite-plugin-windicss": "^1.8.8",
41
+ "vue": "^3.2.39",
42
42
  "vue-router": "^4.1.5",
43
43
  "vue-starport": "^0.3.0",
44
44
  "windicss": "^3.5.6"
45
45
  },
46
46
  "devDependencies": {
47
- "vite": "^3.0.9"
47
+ "vite": "^3.1.0"
48
48
  }
49
49
  }
@@ -28,7 +28,8 @@ export default function setupShortcuts() {
28
28
  showGotoDialog: () => showGotoDialog.value = !showGotoDialog.value,
29
29
  }
30
30
 
31
- const injection_arg_2: ShortcutOptions[] = [
31
+ // eslint-disable-next-line prefer-const
32
+ let injection_return: ShortcutOptions[] = [
32
33
  { name: 'next_space', key: and(space, not(shift)), fn: next, autoRepeat: true },
33
34
  { name: 'prev_space', key: and(space, shift), fn: prev, autoRepeat: true },
34
35
  { name: 'next_right', key: and(right, not(shift), not(showOverview)), fn: next, autoRepeat: true },
@@ -50,10 +51,23 @@ export default function setupShortcuts() {
50
51
  { name: 'goto_from_overview', key: and(enter, showOverview), fn: () => { go(currentOverviewPage.value); showOverview.value = false } },
51
52
  ]
52
53
 
53
- // eslint-disable-next-line prefer-const
54
- let injection_return: Array<ShortcutOptions> = []
54
+ const baseShortcutNames = new Set(injection_return.map(s => s.name))
55
+
56
+ /* __chained_injections__ */
55
57
 
56
- /* __injections__ */
58
+ const remainingBaseShortcutNames = injection_return.filter(s => s.name && baseShortcutNames.has(s.name))
59
+ if (remainingBaseShortcutNames.length === 0) {
60
+ const message = [
61
+ '========== WARNING ==========',
62
+ 'defineShortcutsSetup did not return any of the base shortcuts.',
63
+ 'See https://sli.dev/custom/config-shortcuts.html for migration.',
64
+ 'If it is intentional, return at least one shortcut with one of the base names (e.g. name:"goto").',
65
+ ].join('\n\n')
66
+ // eslint-disable-next-line no-alert
67
+ alert(message)
68
+
69
+ console.warn(message)
70
+ }
57
71
 
58
- return { customShortcuts: injection_return, defaultShortcuts: injection_arg_2 }
72
+ return injection_return
59
73
  }