aboutsummaryrefslogtreecommitdiff
path: root/src/tools/keycode-info/keycode-info.vue
blob: a999d8ae8a9d4b2f9e79569dc6700e498791f079 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<script setup lang="ts">
import { useEventListener } from '@vueuse/core';

import InputCopyable from '../../components/InputCopyable.vue';

const event = ref<KeyboardEvent>();

useEventListener(document, 'keydown', (e) => {
  event.value = e;
});

const fields = computed(() => {
  if (!event.value) {
    return [];
  }

  return [
    {
      label: 'Key :',
      value: event.value.key,
      placeholder: 'Key name...',
    },
    {
      label: 'Keycode :',
      value: String(event.value.keyCode),
      placeholder: 'Keycode...',
    },
    {
      label: 'Code :',
      value: event.value.code,
      placeholder: 'Code...',
    },
    {
      label: 'Location :',
      value: String(event.value.location),
      placeholder: 'Code...',
    },

    {
      label: 'Modifiers :',
      value: [
        event.value.metaKey && 'Meta',
        event.value.shiftKey && 'Shift',
        event.value.ctrlKey && 'Ctrl',
        event.value.altKey && 'Alt',
      ]
        .filter(Boolean)
        .join(' + '),
      placeholder: 'None',
    },
  ];
});
</script>

<template>
  <div>
    <c-card mb-5 text-center important:py-12>
      <div v-if="event" mb-2 text-3xl>
        {{ event.key }}
      </div>
      <span lh-1 op-70>
        Press the key on your keyboard you want to get info about this key
      </span>
    </c-card>

    <n-input-group v-for="({ label, value, placeholder }, i) of fields" :key="i" style="margin-bottom: 5px">
      <n-input-group-label style="flex: 0 0 150px">
        {{ label }}
      </n-input-group-label>
      <InputCopyable :value="value" readonly :placeholder="placeholder" />
    </n-input-group>
  </div>
</template>
ession Unnamed repository; edit this file 'description' to name the repository.
aboutsummaryrefslogtreecommitdiff
path: root/integration/snippets/bundled-entry-point.js (unfollow)
AgeCommit message (Expand)AuthorFilesLines
2022-06-22Update WebKitGravatar Jarred Sumner 1-0/+0
2022-06-22cleanup websocket testGravatar Jarred Sumner 1-3/+6
2022-06-22Fix `WebSocket` when HTTP server is not runningGravatar Jarred Sumner 14-38/+103
2022-06-22Update build-idGravatar Jarred Sumner 1-1/+1
2022-06-22cleanupGravatar Jarred Sumner 6-719/+3
2022-06-22Update index.d.tsGravatar Jarred Sumner 1-0/+1
2022-06-22types for `bun:jsc`Gravatar Jarred Sumner 2-1/+37
2022-06-22Slightly customize the `events` polyfill so it uses ESMGravatar Jarred Sumner 1-1/+522
2022-06-22Fix memory bugs in escapeHTML & arrayBufferToStringGravatar Jarred Sumner 1-65/+61