Skip to content

docs: inline Key components in useMagicKeys and useKeyModifier demos #4884

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

Open
wants to merge 2 commits into
base: main
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
21 changes: 20 additions & 1 deletion packages/core/useKeyModifier/demo.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,32 @@
<script setup lang="ts">
import { useKeyModifier } from '@vueuse/core'
import Key from '../useMagicKeys/Key.vue'
import { defineComponent, h } from 'vue'

const capsLock = useKeyModifier('CapsLock')
const numLock = useKeyModifier('NumLock')
const scrollLock = useKeyModifier('ScrollLock')
const shift = useKeyModifier('Shift')
const control = useKeyModifier('Control')
const alt = useKeyModifier('Alt')

const Key = defineComponent({
props: {
value: {
type: Boolean,
required: true,
},
},
render() {
return h('div', {
class: [
'font-mono px-4 py-2 rounded',
this.value
? 'opacity-100 text-primary bg-primary bg-opacity-15'
: 'opacity-50 bg-gray-600 bg-opacity-10 dark:(bg-gray-400 bg-opacity-10)',
],
}, this.$slots.default?.())
},
})
</script>

<template>
Expand Down
17 changes: 0 additions & 17 deletions packages/core/useMagicKeys/Key.vue

This file was deleted.

22 changes: 20 additions & 2 deletions packages/core/useMagicKeys/demo.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,28 @@
<script setup lang="ts">
import { useMagicKeys } from '@vueuse/core'
import { computed } from 'vue'
import Key from './Key.vue'
import { computed, defineComponent, h } from 'vue'

const { shift, v, u, e, s, v_u_e, u_s_e, current } = useMagicKeys()
const keys = computed(() => Array.from(current))

const Key = defineComponent({
props: {
value: {
type: Boolean,
required: true,
},
},
render() {
return h('div', {
class: [
'font-mono px-4 py-2 rounded',
this.value
? 'opacity-100 text-primary bg-primary bg-opacity-15'
: 'opacity-50 bg-gray-600 bg-opacity-10 dark:(bg-gray-400 bg-opacity-10)',
],
}, this.$slots.default?.())
},
})
</script>

<template>
Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy