Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to Vue 3 #48

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
> 1%
last 2 versions
not dead
not ie 11
34 changes: 25 additions & 9 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,35 @@ const isProduction = process.env.NODE_ENV === 'production'

module.exports = {
root: true,
extends: [
'plugin:vue/vue3-recommended'
],
parserOptions: {
parser: 'babel-eslint',
parser: '@babel/eslint-parser',
sourceType: 'module'
},
extends: ['standard', 'plugin:vue/recommended'],
plugins: ['vue'],
overrides: [{
files: ['**/*.spec.js'],
plugins: ['jest'],
env: {
jest: true
overrides: [
{
files: [
'**/*.spec.js'
],
plugins: [
'jest'
],
env: {
jest: true
}
},
{
files: [
'**/__tests__/*.{j,t}s?(x)',
'**/tests/unit/**/*.spec.{j,t}s?(x)'
],
env: {
jest: true
}
}
}],
],
rules: {
'arrow-parens': 'off',
'generator-star-spacing': 'off',
Expand Down
25 changes: 17 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[![github license](https://badgen.net/github/license/dafrok/v-hotkey)](https://github.com/dafrok/v-hotkey/blob/master/LICENSE)
[![js standard style](https://badgen.net/badge/code%20style/standard/pink)](https://standardjs.com)

Vue 2.x directive for binding hotkeys to components.
Vue 3.x directive for binding hotkeys to components.

## Play with me

Expand All @@ -22,10 +22,14 @@ $ yarn add v-hotkey
## Usage

```javascript
import Vue from 'vue'
import { createApp } from 'vue'
import VueHotkey from 'v-hotkey'

Vue.use(VueHotkey)
const app = createApp({
/* ... */
})
app.use(VueHotkey)

```

```vue
Expand Down Expand Up @@ -119,10 +123,13 @@ This ability to provide their own key code alias for developers who using keyboa
### Definition

```javascript
import Vue from 'vue'
import { createApp } from 'vue'
import VueHotkey from 'v-hotkey'

Vue.use(VueHotkey, {
const app = createApp({
/* ... */
})
app.use(VueHotkey, {
'①': 49 // the key code of character '1'
})
```
Expand All @@ -133,13 +140,15 @@ Vue.use(VueHotkey, {
<span v-hotkey="keymap"></span>
<script>
export default {
foo () {
console.log('Hooray!')
methods: {
foo () {
console.log('Hooray!')
},
},
computed: {
keymap () {
return {
'①': foo
'①': this.foo
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict'

module.exports = {
presets: ['@babel/preset-env']
presets: [
'@vue/cli-plugin-babel/preset'
]
}
2 changes: 2 additions & 0 deletions docs/css/chunk-vendors.023d53d0.css

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions docs/css/chunk-vendors.aa245b99.css

This file was deleted.

1 change: 1 addition & 0 deletions docs/css/index.3233b882.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion docs/css/index.a639c980.css

This file was deleted.

Binary file added docs/favicon.ico
Binary file not shown.
File renamed without changes
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta content="ie=edge" http-equiv=x-ua-compatible><title>V-Hotkey</title><link href=/v-hotkey/css/chunk-vendors.aa245b99.css rel=stylesheet><link href=/v-hotkey/css/index.a639c980.css rel=stylesheet></head><body><div id=app></div><script src=/v-hotkey/js/chunk-vendors.6c30874f.js></script><script src=/v-hotkey/js/index.91841365.js></script></body></html>
<!doctype html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="/v-hotkey/favicon.ico"><title>V-Hotkey</title><script defer="defer" src="/v-hotkey/js/chunk-vendors.45213b80.js"></script><script defer="defer" src="/v-hotkey/js/index.f64fdb76.js"></script><link href="/v-hotkey/css/chunk-vendors.023d53d0.css" rel="stylesheet"><link href="/v-hotkey/css/index.3233b882.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but V-Hotkey doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div></body></html>
8 changes: 8 additions & 0 deletions docs/js/chunk-vendors.45213b80.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/js/chunk-vendors.45213b80.js.map

Large diffs are not rendered by default.

13 changes: 0 additions & 13 deletions docs/js/chunk-vendors.6c30874f.js

This file was deleted.

1 change: 0 additions & 1 deletion docs/js/chunk-vendors.6c30874f.js.map

This file was deleted.

2 changes: 0 additions & 2 deletions docs/js/index.91841365.js

This file was deleted.

1 change: 0 additions & 1 deletion docs/js/index.91841365.js.map

This file was deleted.

2 changes: 2 additions & 0 deletions docs/js/index.f64fdb76.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/js/index.f64fdb76.js.map

Large diffs are not rendered by default.

Loading