@vuetify/nightly 3.9.0-beta.1-dev.2025-06-26 → 3.9.0-beta.1-dev.2025-06-28
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/CHANGELOG.md +8 -3
- package/dist/_component-variables-labs.sass +1 -0
- package/dist/json/attributes.json +2183 -2123
- package/dist/json/importMap-labs.json +28 -24
- package/dist/json/importMap.json +170 -170
- package/dist/json/tags.json +20 -0
- package/dist/json/web-types.json +4186 -4020
- package/dist/vuetify-labs.cjs +738 -4
- package/dist/vuetify-labs.css +4753 -4502
- package/dist/vuetify-labs.d.ts +309 -63
- package/dist/vuetify-labs.esm.js +738 -5
- package/dist/vuetify-labs.esm.js.map +1 -1
- package/dist/vuetify-labs.js +738 -4
- package/dist/vuetify-labs.min.css +2 -2
- package/dist/vuetify.cjs +345 -4
- package/dist/vuetify.cjs.map +1 -1
- package/dist/vuetify.css +4301 -4292
- package/dist/vuetify.d.ts +82 -62
- package/dist/vuetify.esm.js +345 -5
- package/dist/vuetify.esm.js.map +1 -1
- package/dist/vuetify.js +345 -4
- package/dist/vuetify.js.map +1 -1
- package/dist/vuetify.min.css +2 -2
- package/dist/vuetify.min.js +284 -245
- package/dist/vuetify.min.js.map +1 -1
- package/lib/components/VKbd/VKbd.css +14 -5
- package/lib/components/VKbd/VKbd.js.map +1 -1
- package/lib/components/VKbd/VKbd.scss +26 -0
- package/lib/components/VKbd/_variables.scss +12 -6
- package/lib/components/VKbd/index.js.map +1 -1
- package/lib/composables/hotkey/hotkey-parsing.d.ts +15 -0
- package/lib/composables/hotkey/hotkey-parsing.js +154 -0
- package/lib/composables/hotkey/hotkey-parsing.js.map +1 -0
- package/lib/composables/hotkey/hotkey.d.ts +9 -0
- package/lib/composables/{hotkey.js → hotkey/hotkey.js} +31 -39
- package/lib/composables/hotkey/hotkey.js.map +1 -0
- package/lib/composables/hotkey/index.d.ts +1 -0
- package/lib/composables/hotkey/index.js +2 -0
- package/lib/composables/hotkey/index.js.map +1 -0
- package/lib/composables/hotkey/key-aliases.d.ts +14 -0
- package/lib/composables/hotkey/key-aliases.js +38 -0
- package/lib/composables/hotkey/key-aliases.js.map +1 -0
- package/lib/composables/icons.d.ts +11 -0
- package/lib/composables/icons.js.map +1 -1
- package/lib/composables/index.d.ts +1 -0
- package/lib/composables/index.js +1 -0
- package/lib/composables/index.js.map +1 -1
- package/lib/entry-bundler.js +1 -1
- package/lib/framework.d.ts +83 -62
- package/lib/framework.js +1 -1
- package/lib/iconsets/fa.js +12 -1
- package/lib/iconsets/fa.js.map +1 -1
- package/lib/iconsets/fa4.js +12 -1
- package/lib/iconsets/fa4.js.map +1 -1
- package/lib/iconsets/md.js +12 -1
- package/lib/iconsets/md.js.map +1 -1
- package/lib/iconsets/mdi-svg.js +12 -1
- package/lib/iconsets/mdi-svg.js.map +1 -1
- package/lib/iconsets/mdi.js +12 -1
- package/lib/iconsets/mdi.js.map +1 -1
- package/lib/labs/VHotkey/VHotkey.css +242 -0
- package/lib/labs/VHotkey/VHotkey.d.ts +387 -0
- package/lib/labs/VHotkey/VHotkey.js +432 -0
- package/lib/labs/VHotkey/VHotkey.js.map +1 -0
- package/lib/labs/VHotkey/VHotkey.scss +253 -0
- package/lib/labs/VHotkey/_variables.scss +43 -0
- package/lib/labs/VHotkey/index.d.ts +1 -0
- package/lib/labs/VHotkey/index.js +2 -0
- package/lib/labs/VHotkey/index.js.map +1 -0
- package/lib/labs/components.d.ts +1 -0
- package/lib/labs/components.js +1 -0
- package/lib/labs/components.js.map +1 -1
- package/lib/locale/af.d.ts +18 -0
- package/lib/locale/af.js +18 -0
- package/lib/locale/af.js.map +1 -1
- package/lib/locale/ar.d.ts +18 -0
- package/lib/locale/ar.js +18 -0
- package/lib/locale/ar.js.map +1 -1
- package/lib/locale/az.d.ts +18 -0
- package/lib/locale/az.js +18 -0
- package/lib/locale/az.js.map +1 -1
- package/lib/locale/bg.d.ts +18 -0
- package/lib/locale/bg.js +18 -0
- package/lib/locale/bg.js.map +1 -1
- package/lib/locale/ca.d.ts +18 -0
- package/lib/locale/ca.js +18 -0
- package/lib/locale/ca.js.map +1 -1
- package/lib/locale/ckb.d.ts +18 -0
- package/lib/locale/ckb.js +18 -0
- package/lib/locale/ckb.js.map +1 -1
- package/lib/locale/cs.d.ts +18 -0
- package/lib/locale/cs.js +18 -0
- package/lib/locale/cs.js.map +1 -1
- package/lib/locale/da.d.ts +18 -0
- package/lib/locale/da.js +18 -0
- package/lib/locale/da.js.map +1 -1
- package/lib/locale/de.d.ts +18 -0
- package/lib/locale/de.js +18 -0
- package/lib/locale/de.js.map +1 -1
- package/lib/locale/el.d.ts +18 -0
- package/lib/locale/el.js +18 -0
- package/lib/locale/el.js.map +1 -1
- package/lib/locale/en.d.ts +18 -0
- package/lib/locale/en.js +18 -0
- package/lib/locale/en.js.map +1 -1
- package/lib/locale/es.d.ts +18 -0
- package/lib/locale/es.js +18 -0
- package/lib/locale/es.js.map +1 -1
- package/lib/locale/et.d.ts +18 -0
- package/lib/locale/et.js +18 -0
- package/lib/locale/et.js.map +1 -1
- package/lib/locale/fa.d.ts +18 -0
- package/lib/locale/fa.js +18 -0
- package/lib/locale/fa.js.map +1 -1
- package/lib/locale/fi.d.ts +18 -0
- package/lib/locale/fi.js +18 -0
- package/lib/locale/fi.js.map +1 -1
- package/lib/locale/fr.d.ts +18 -0
- package/lib/locale/fr.js +18 -0
- package/lib/locale/fr.js.map +1 -1
- package/lib/locale/he.d.ts +18 -0
- package/lib/locale/he.js +18 -0
- package/lib/locale/he.js.map +1 -1
- package/lib/locale/hr.d.ts +18 -0
- package/lib/locale/hr.js +18 -0
- package/lib/locale/hr.js.map +1 -1
- package/lib/locale/hu.d.ts +18 -0
- package/lib/locale/hu.js +18 -0
- package/lib/locale/hu.js.map +1 -1
- package/lib/locale/id.d.ts +18 -0
- package/lib/locale/id.js +18 -0
- package/lib/locale/id.js.map +1 -1
- package/lib/locale/it.d.ts +18 -0
- package/lib/locale/it.js +18 -0
- package/lib/locale/it.js.map +1 -1
- package/lib/locale/ja.d.ts +18 -0
- package/lib/locale/ja.js +18 -0
- package/lib/locale/ja.js.map +1 -1
- package/lib/locale/km.d.ts +18 -0
- package/lib/locale/km.js +18 -0
- package/lib/locale/km.js.map +1 -1
- package/lib/locale/ko.d.ts +18 -0
- package/lib/locale/ko.js +18 -0
- package/lib/locale/ko.js.map +1 -1
- package/lib/locale/lt.d.ts +18 -0
- package/lib/locale/lt.js +18 -0
- package/lib/locale/lt.js.map +1 -1
- package/lib/locale/lv.d.ts +18 -0
- package/lib/locale/lv.js +18 -0
- package/lib/locale/lv.js.map +1 -1
- package/lib/locale/nl.d.ts +18 -0
- package/lib/locale/nl.js +18 -0
- package/lib/locale/nl.js.map +1 -1
- package/lib/locale/no.d.ts +18 -0
- package/lib/locale/no.js +18 -0
- package/lib/locale/no.js.map +1 -1
- package/lib/locale/pl.d.ts +18 -0
- package/lib/locale/pl.js +18 -0
- package/lib/locale/pl.js.map +1 -1
- package/lib/locale/pt.d.ts +18 -0
- package/lib/locale/pt.js +18 -0
- package/lib/locale/pt.js.map +1 -1
- package/lib/locale/ro.d.ts +18 -0
- package/lib/locale/ro.js +18 -0
- package/lib/locale/ro.js.map +1 -1
- package/lib/locale/ru.d.ts +18 -0
- package/lib/locale/ru.js +18 -0
- package/lib/locale/ru.js.map +1 -1
- package/lib/locale/sk.d.ts +18 -0
- package/lib/locale/sk.js +18 -0
- package/lib/locale/sk.js.map +1 -1
- package/lib/locale/sl.d.ts +18 -0
- package/lib/locale/sl.js +18 -0
- package/lib/locale/sl.js.map +1 -1
- package/lib/locale/sr-Cyrl.d.ts +18 -0
- package/lib/locale/sr-Cyrl.js +18 -0
- package/lib/locale/sr-Cyrl.js.map +1 -1
- package/lib/locale/sr-Latn.d.ts +18 -0
- package/lib/locale/sr-Latn.js +18 -0
- package/lib/locale/sr-Latn.js.map +1 -1
- package/lib/locale/sv.d.ts +18 -0
- package/lib/locale/sv.js +18 -0
- package/lib/locale/sv.js.map +1 -1
- package/lib/locale/th.d.ts +18 -0
- package/lib/locale/th.js +18 -0
- package/lib/locale/th.js.map +1 -1
- package/lib/locale/tr.d.ts +18 -0
- package/lib/locale/tr.js +18 -0
- package/lib/locale/tr.js.map +1 -1
- package/lib/locale/uk.d.ts +18 -0
- package/lib/locale/uk.js +18 -0
- package/lib/locale/uk.js.map +1 -1
- package/lib/locale/vi.d.ts +18 -0
- package/lib/locale/vi.js +18 -0
- package/lib/locale/vi.js.map +1 -1
- package/lib/locale/zh-Hans.d.ts +18 -0
- package/lib/locale/zh-Hans.js +18 -0
- package/lib/locale/zh-Hans.js.map +1 -1
- package/lib/locale/zh-Hant.d.ts +18 -0
- package/lib/locale/zh-Hant.js +18 -0
- package/lib/locale/zh-Hant.js.map +1 -1
- package/package.json +1 -1
- package/lib/components/VKbd/VKbd.sass +0 -15
- package/lib/composables/hotkey.d.ts +0 -9
- package/lib/composables/hotkey.js.map +0 -1
@@ -1,10 +1,19 @@
|
|
1
1
|
.v-kbd {
|
2
|
+
font-family: "Roboto", sans-serif;
|
3
|
+
align-items: center;
|
4
|
+
align-self: stretch;
|
2
5
|
background: rgb(var(--v-theme-kbd));
|
3
6
|
color: rgb(var(--v-theme-on-kbd));
|
4
|
-
display: inline;
|
5
|
-
font-size:
|
7
|
+
display: inline-flex;
|
8
|
+
font-size: 0.875em;
|
6
9
|
font-weight: normal;
|
7
|
-
|
10
|
+
line-height: 1;
|
11
|
+
justify-content: center;
|
12
|
+
min-height: 1em;
|
13
|
+
min-width: 20px;
|
14
|
+
padding: 3px 6px;
|
15
|
+
vertical-align: baseline;
|
16
|
+
margin-inline: 1px;
|
8
17
|
}
|
9
18
|
.v-kbd {
|
10
19
|
border-color: rgba(var(--v-border-color), var(--v-border-opacity));
|
@@ -16,8 +25,8 @@
|
|
16
25
|
box-shadow: none;
|
17
26
|
}
|
18
27
|
.v-kbd {
|
19
|
-
box-shadow: 0px
|
28
|
+
box-shadow: 0px 2px 1px -1px var(--v-shadow-key-umbra-opacity, rgba(0, 0, 0, 0.2)), 0px 1px 1px 0px var(--v-shadow-key-penumbra-opacity, rgba(0, 0, 0, 0.14)), 0px 1px 3px 0px var(--v-shadow-key-ambient-opacity, rgba(0, 0, 0, 0.12));
|
20
29
|
}
|
21
30
|
.v-kbd {
|
22
|
-
border-radius:
|
31
|
+
border-radius: 4px;
|
23
32
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"VKbd.js","names":["makeBorderProps","useBorder","useBackgroundColor","makeComponentProps","makeElevationProps","useElevation","makeRoundedProps","useRounded","makeTagProps","makeThemeProps","provideTheme","genericComponent","propsFactory","useRender","makeVKbdProps","color","String","tag","VKbd","name","props","setup","_ref","slots","themeClasses","borderClasses","roundedClasses","backgroundColorClasses","backgroundColorStyles","elevationClasses","_createVNode","_normalizeClass","value","class","_normalizeStyle","style"],"sources":["../../../src/components/VKbd/VKbd.tsx"],"sourcesContent":["// Styles\nimport './VKbd.
|
1
|
+
{"version":3,"file":"VKbd.js","names":["makeBorderProps","useBorder","useBackgroundColor","makeComponentProps","makeElevationProps","useElevation","makeRoundedProps","useRounded","makeTagProps","makeThemeProps","provideTheme","genericComponent","propsFactory","useRender","makeVKbdProps","color","String","tag","VKbd","name","props","setup","_ref","slots","themeClasses","borderClasses","roundedClasses","backgroundColorClasses","backgroundColorStyles","elevationClasses","_createVNode","_normalizeClass","value","class","_normalizeStyle","style"],"sources":["../../../src/components/VKbd/VKbd.tsx"],"sourcesContent":["// Styles\nimport './VKbd.scss'\n\n// Composables\nimport { makeBorderProps, useBorder } from '@/composables/border'\nimport { useBackgroundColor } from '@/composables/color'\nimport { makeComponentProps } from '@/composables/component'\nimport { makeElevationProps, useElevation } from '@/composables/elevation'\nimport { makeRoundedProps, useRounded } from '@/composables/rounded'\nimport { makeTagProps } from '@/composables/tag'\nimport { makeThemeProps, provideTheme } from '@/composables/theme'\n\n// Utilities\nimport { genericComponent, propsFactory, useRender } from '@/util'\n\nexport const makeVKbdProps = propsFactory({\n color: String,\n\n ...makeBorderProps(),\n ...makeComponentProps(),\n ...makeRoundedProps(),\n ...makeTagProps({ tag: 'kbd' }),\n ...makeThemeProps(),\n ...makeElevationProps(),\n}, 'VKbd')\n\nexport const VKbd = genericComponent()({\n name: 'VKbd',\n\n props: makeVKbdProps(),\n\n setup (props, { slots }) {\n const { themeClasses } = provideTheme(props)\n const { borderClasses } = useBorder(props)\n const { roundedClasses } = useRounded(props)\n const { backgroundColorClasses, backgroundColorStyles } = useBackgroundColor(() => props.color)\n const { elevationClasses } = useElevation(props)\n\n useRender(() => (\n <props.tag\n class={[\n 'v-kbd',\n themeClasses.value,\n backgroundColorClasses.value,\n borderClasses.value,\n elevationClasses.value,\n roundedClasses.value,\n props.class,\n ]}\n style={[\n backgroundColorStyles.value,\n props.style,\n ]}\n v-slots={ slots }\n />\n ))\n\n return {}\n },\n})\n\nexport type VKbd = InstanceType<typeof VKbd>\n"],"mappings":";AAAA;AACA;;AAEA;AAAA,SACSA,eAAe,EAAEC,SAAS;AAAA,SAC1BC,kBAAkB;AAAA,SAClBC,kBAAkB;AAAA,SAClBC,kBAAkB,EAAEC,YAAY;AAAA,SAChCC,gBAAgB,EAAEC,UAAU;AAAA,SAC5BC,YAAY;AAAA,SACZC,cAAc,EAAEC,YAAY,sCAErC;AAAA,SACSC,gBAAgB,EAAEC,YAAY,EAAEC,SAAS;AAElD,OAAO,MAAMC,aAAa,GAAGF,YAAY,CAAC;EACxCG,KAAK,EAAEC,MAAM;EAEb,GAAGhB,eAAe,CAAC,CAAC;EACpB,GAAGG,kBAAkB,CAAC,CAAC;EACvB,GAAGG,gBAAgB,CAAC,CAAC;EACrB,GAAGE,YAAY,CAAC;IAAES,GAAG,EAAE;EAAM,CAAC,CAAC;EAC/B,GAAGR,cAAc,CAAC,CAAC;EACnB,GAAGL,kBAAkB,CAAC;AACxB,CAAC,EAAE,MAAM,CAAC;AAEV,OAAO,MAAMc,IAAI,GAAGP,gBAAgB,CAAC,CAAC,CAAC;EACrCQ,IAAI,EAAE,MAAM;EAEZC,KAAK,EAAEN,aAAa,CAAC,CAAC;EAEtBO,KAAKA,CAAED,KAAK,EAAAE,IAAA,EAAa;IAAA,IAAX;MAAEC;IAAM,CAAC,GAAAD,IAAA;IACrB,MAAM;MAAEE;IAAa,CAAC,GAAGd,YAAY,CAACU,KAAK,CAAC;IAC5C,MAAM;MAAEK;IAAc,CAAC,GAAGxB,SAAS,CAACmB,KAAK,CAAC;IAC1C,MAAM;MAAEM;IAAe,CAAC,GAAGnB,UAAU,CAACa,KAAK,CAAC;IAC5C,MAAM;MAAEO,sBAAsB;MAAEC;IAAsB,CAAC,GAAG1B,kBAAkB,CAAC,MAAMkB,KAAK,CAACL,KAAK,CAAC;IAC/F,MAAM;MAAEc;IAAiB,CAAC,GAAGxB,YAAY,CAACe,KAAK,CAAC;IAEhDP,SAAS,CAAC,MAAAiB,YAAA,CAAAV,KAAA,CAAAH,GAAA;MAAA,SAAAc,eAAA,CAEC,CACL,OAAO,EACPP,YAAY,CAACQ,KAAK,EAClBL,sBAAsB,CAACK,KAAK,EAC5BP,aAAa,CAACO,KAAK,EACnBH,gBAAgB,CAACG,KAAK,EACtBN,cAAc,CAACM,KAAK,EACpBZ,KAAK,CAACa,KAAK,CACZ;MAAA,SAAAC,eAAA,CACM,CACLN,qBAAqB,CAACI,KAAK,EAC3BZ,KAAK,CAACe,KAAK,CACZ;IAAA,GACSZ,KAAK,CAElB,CAAC;IAEF,OAAO,CAAC,CAAC;EACX;AACF,CAAC,CAAC","ignoreList":[]}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
@use '../../styles/tools';
|
2
|
+
@use './variables' as *;
|
3
|
+
|
4
|
+
@include tools.layer('components') {
|
5
|
+
.v-kbd {
|
6
|
+
font-family: $kbd-font-family;
|
7
|
+
align-items: center;
|
8
|
+
align-self: stretch;
|
9
|
+
background: rgb(var(--v-theme-kbd));
|
10
|
+
color: rgb(var(--v-theme-on-kbd));
|
11
|
+
display: $kbd-display;
|
12
|
+
font-size: $kbd-font-size;
|
13
|
+
font-weight: $kbd-font-weight;
|
14
|
+
line-height: $kbd-line-height;
|
15
|
+
justify-content: center;
|
16
|
+
min-height: $kbd-min-height;
|
17
|
+
min-width: $kbd-min-width;
|
18
|
+
padding: $kbd-padding;
|
19
|
+
vertical-align: baseline;
|
20
|
+
margin-inline: $kbd-margin-inline;
|
21
|
+
|
22
|
+
@include tools.border($kbd-border...);
|
23
|
+
@include tools.elevation($kbd-elevation);
|
24
|
+
@include tools.rounded($kbd-border-radius);
|
25
|
+
}
|
26
|
+
}
|
@@ -1,11 +1,17 @@
|
|
1
1
|
// VKbd
|
2
|
-
|
3
|
-
$kbd-
|
4
|
-
$kbd-
|
5
|
-
$kbd-
|
2
|
+
// Kbd elements naturally use monospace fonts, if users want to change this, they can do so by setting the font-family on the v-kbd element.
|
3
|
+
$kbd-font-family: "Roboto", sans-serif !default;
|
4
|
+
$kbd-border-radius: 4px !default;
|
5
|
+
$kbd-display: inline-flex !default;
|
6
|
+
$kbd-elevation: 1 !default;
|
7
|
+
// Kbd elements are used inline with text, so we should use the same font size as the text it's with.
|
8
|
+
$kbd-font-size: 0.875em !default;
|
6
9
|
$kbd-font-weight: normal !default;
|
7
|
-
$kbd-
|
8
|
-
|
10
|
+
$kbd-line-height: 1 !default;
|
11
|
+
$kbd-padding: 3px 6px !default;;
|
12
|
+
$kbd-min-height: 1em !default;
|
13
|
+
$kbd-min-width: 20px !default;
|
14
|
+
$kbd-margin-inline: 1px !default;
|
9
15
|
$kbd-border-color: rgba(var(--v-border-color), var(--v-border-opacity)) !default;
|
10
16
|
$kbd-border-style: solid !default;
|
11
17
|
$kbd-border-width: thin !default;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","names":["VKbd"],"sources":["../../../src/components/VKbd/index.ts"],"sourcesContent":["// Styles\nimport './VKbd.
|
1
|
+
{"version":3,"file":"index.js","names":["VKbd"],"sources":["../../../src/components/VKbd/index.ts"],"sourcesContent":["// Styles\nimport './VKbd.scss'\n\nexport { VKbd } from './VKbd'\n"],"mappings":"AAAA;AACA;AAAoB,SAEXA,IAAI","ignoreList":[]}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
export declare const MODIFIERS: string[];
|
2
|
+
/**
|
3
|
+
* Splits a single combination string into individual key parts.
|
4
|
+
*
|
5
|
+
* A combination is a set of keys that must be pressed simultaneously.
|
6
|
+
* e.g. `ctrl+k`, `shift--`
|
7
|
+
*/
|
8
|
+
export declare function splitKeyCombination(combination: string, isInternal?: boolean): string[];
|
9
|
+
/**
|
10
|
+
* Splits a hotkey string into its constituent combination groups.
|
11
|
+
*
|
12
|
+
* A sequence is a series of combinations that must be pressed in order.
|
13
|
+
* e.g. `a-b`, `ctrl+k-p`
|
14
|
+
*/
|
15
|
+
export declare function splitKeySequence(str: string): string[];
|
@@ -0,0 +1,154 @@
|
|
1
|
+
// Utilities
|
2
|
+
import { normalizeKey } from "./key-aliases.js";
|
3
|
+
import { consoleWarn } from "../../util/console.js"; // Types
|
4
|
+
export const MODIFIERS = ['ctrl', 'shift', 'alt', 'meta', 'cmd'];
|
5
|
+
|
6
|
+
/**
|
7
|
+
* Splits a single combination string into individual key parts.
|
8
|
+
*
|
9
|
+
* A combination is a set of keys that must be pressed simultaneously.
|
10
|
+
* e.g. `ctrl+k`, `shift--`
|
11
|
+
*/
|
12
|
+
export function splitKeyCombination(combination) {
|
13
|
+
let isInternal = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
14
|
+
if (!combination) {
|
15
|
+
if (!isInternal) consoleWarn('Invalid hotkey combination: empty string provided');
|
16
|
+
return [];
|
17
|
+
}
|
18
|
+
|
19
|
+
// --- VALIDATION ---
|
20
|
+
const startsWithPlusOrUnderscore = combination.startsWith('+') || combination.startsWith('_');
|
21
|
+
const hasInvalidLeadingSeparator =
|
22
|
+
// Starts with a single '+' or '_' followed by a non-separator character (e.g. '+a', '_a')
|
23
|
+
startsWithPlusOrUnderscore && !(combination.startsWith('++') || combination.startsWith('__'));
|
24
|
+
const hasInvalidStructure =
|
25
|
+
// Invalid leading separator patterns
|
26
|
+
combination.length > 1 && hasInvalidLeadingSeparator ||
|
27
|
+
// Disallow literal + or _ keys (they require shift)
|
28
|
+
combination.includes('++') || combination.includes('__') || combination === '+' || combination === '_' ||
|
29
|
+
// Ends with a separator that is not part of a doubled literal
|
30
|
+
combination.length > 1 && (combination.endsWith('+') || combination.endsWith('_')) && combination.at(-2) !== combination.at(-1) ||
|
31
|
+
// Stand-alone doubled separators (dangling)
|
32
|
+
combination === '++' || combination === '--' || combination === '__';
|
33
|
+
if (hasInvalidStructure) {
|
34
|
+
if (!isInternal) consoleWarn(`Invalid hotkey combination: "${combination}" has invalid structure`);
|
35
|
+
return [];
|
36
|
+
}
|
37
|
+
const keys = [];
|
38
|
+
let buffer = '';
|
39
|
+
const flushBuffer = () => {
|
40
|
+
if (buffer) {
|
41
|
+
keys.push(normalizeKey(buffer));
|
42
|
+
buffer = '';
|
43
|
+
}
|
44
|
+
};
|
45
|
+
for (let i = 0; i < combination.length; i++) {
|
46
|
+
const char = combination[i];
|
47
|
+
const nextChar = combination[i + 1];
|
48
|
+
if (char === '+' || char === '_' || char === '-') {
|
49
|
+
if (char === nextChar) {
|
50
|
+
flushBuffer();
|
51
|
+
keys.push(char);
|
52
|
+
i++;
|
53
|
+
} else if (char === '+' || char === '_') {
|
54
|
+
flushBuffer();
|
55
|
+
} else {
|
56
|
+
buffer += char;
|
57
|
+
}
|
58
|
+
} else {
|
59
|
+
buffer += char;
|
60
|
+
}
|
61
|
+
}
|
62
|
+
flushBuffer();
|
63
|
+
|
64
|
+
// Within a combination, `-` is only valid as a literal key (e.g., `ctrl+-`).
|
65
|
+
// `-` cannot be part of a longer key name within a combination.
|
66
|
+
const hasInvalidMinus = keys.some(key => key.length > 1 && key.includes('-') && key !== '--');
|
67
|
+
if (hasInvalidMinus) {
|
68
|
+
if (!isInternal) consoleWarn(`Invalid hotkey combination: "${combination}" has invalid structure`);
|
69
|
+
return [];
|
70
|
+
}
|
71
|
+
if (keys.length === 0 && combination) {
|
72
|
+
return [normalizeKey(combination)];
|
73
|
+
}
|
74
|
+
return keys;
|
75
|
+
}
|
76
|
+
|
77
|
+
/**
|
78
|
+
* Splits a hotkey string into its constituent combination groups.
|
79
|
+
*
|
80
|
+
* A sequence is a series of combinations that must be pressed in order.
|
81
|
+
* e.g. `a-b`, `ctrl+k-p`
|
82
|
+
*/
|
83
|
+
export function splitKeySequence(str) {
|
84
|
+
if (!str) {
|
85
|
+
consoleWarn('Invalid hotkey sequence: empty string provided');
|
86
|
+
return [];
|
87
|
+
}
|
88
|
+
|
89
|
+
// A sequence is invalid if it starts or ends with a separator,
|
90
|
+
// unless it is part of a combination (e.g., `shift+-`).
|
91
|
+
const hasInvalidStart = str.startsWith('-') && !['---', '--+'].includes(str);
|
92
|
+
const hasInvalidEnd = str.endsWith('-') && !str.endsWith('+-') && !str.endsWith('_-') && str !== '-' && str !== '---';
|
93
|
+
if (hasInvalidStart || hasInvalidEnd) {
|
94
|
+
consoleWarn(`Invalid hotkey sequence: "${str}" contains invalid combinations`);
|
95
|
+
return [];
|
96
|
+
}
|
97
|
+
const result = [];
|
98
|
+
let buffer = '';
|
99
|
+
let i = 0;
|
100
|
+
while (i < str.length) {
|
101
|
+
const char = str[i];
|
102
|
+
if (char === '-') {
|
103
|
+
// Determine if this hyphen is part of the current combination
|
104
|
+
const prevChar = str[i - 1];
|
105
|
+
const prevPrevChar = i > 1 ? str[i - 2] : undefined;
|
106
|
+
const precededBySinglePlusOrUnderscore = (prevChar === '+' || prevChar === '_') && prevPrevChar !== '+';
|
107
|
+
if (precededBySinglePlusOrUnderscore) {
|
108
|
+
// Treat as part of the combination (e.g., 'ctrl+-')
|
109
|
+
buffer += char;
|
110
|
+
i++;
|
111
|
+
} else {
|
112
|
+
// Treat as sequence separator
|
113
|
+
if (buffer) {
|
114
|
+
result.push(buffer);
|
115
|
+
buffer = '';
|
116
|
+
} else {
|
117
|
+
// Empty buffer means we have a literal '-' key
|
118
|
+
result.push('-');
|
119
|
+
}
|
120
|
+
i++;
|
121
|
+
}
|
122
|
+
} else {
|
123
|
+
buffer += char;
|
124
|
+
i++;
|
125
|
+
}
|
126
|
+
}
|
127
|
+
|
128
|
+
// Add final buffer if it exists
|
129
|
+
if (buffer) {
|
130
|
+
result.push(buffer);
|
131
|
+
}
|
132
|
+
|
133
|
+
// Collapse runs of '-' so that every second '-' is removed
|
134
|
+
const collapsed = [];
|
135
|
+
let minusCount = 0;
|
136
|
+
for (const part of result) {
|
137
|
+
if (part === '-') {
|
138
|
+
if (minusCount % 2 === 0) collapsed.push('-');
|
139
|
+
minusCount++;
|
140
|
+
} else {
|
141
|
+
minusCount = 0;
|
142
|
+
collapsed.push(part);
|
143
|
+
}
|
144
|
+
}
|
145
|
+
|
146
|
+
// Validate that each part of the sequence is a valid combination
|
147
|
+
const areAllValid = collapsed.every(s => splitKeyCombination(s, true).length > 0);
|
148
|
+
if (!areAllValid) {
|
149
|
+
consoleWarn(`Invalid hotkey sequence: "${str}" contains invalid combinations`);
|
150
|
+
return [];
|
151
|
+
}
|
152
|
+
return collapsed;
|
153
|
+
}
|
154
|
+
//# sourceMappingURL=hotkey-parsing.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"hotkey-parsing.js","names":["normalizeKey","consoleWarn","MODIFIERS","splitKeyCombination","combination","isInternal","arguments","length","undefined","startsWithPlusOrUnderscore","startsWith","hasInvalidLeadingSeparator","hasInvalidStructure","includes","endsWith","at","keys","buffer","flushBuffer","push","i","char","nextChar","hasInvalidMinus","some","key","splitKeySequence","str","hasInvalidStart","hasInvalidEnd","result","prevChar","prevPrevChar","precededBySinglePlusOrUnderscore","collapsed","minusCount","part","areAllValid","every","s"],"sources":["../../../src/composables/hotkey/hotkey-parsing.ts"],"sourcesContent":["// Utilities\nimport { normalizeKey } from './key-aliases'\nimport { consoleWarn } from '../../util/console'\n\n// Types\nexport const MODIFIERS = ['ctrl', 'shift', 'alt', 'meta', 'cmd']\n\n/**\n * Splits a single combination string into individual key parts.\n *\n * A combination is a set of keys that must be pressed simultaneously.\n * e.g. `ctrl+k`, `shift--`\n */\nexport function splitKeyCombination (combination: string, isInternal = false): string[] {\n if (!combination) {\n if (!isInternal) consoleWarn('Invalid hotkey combination: empty string provided')\n return []\n }\n\n // --- VALIDATION ---\n const startsWithPlusOrUnderscore = combination.startsWith('+') || combination.startsWith('_')\n\n const hasInvalidLeadingSeparator = (\n // Starts with a single '+' or '_' followed by a non-separator character (e.g. '+a', '_a')\n startsWithPlusOrUnderscore &&\n !(combination.startsWith('++') || combination.startsWith('__'))\n )\n\n const hasInvalidStructure = (\n // Invalid leading separator patterns\n (combination.length > 1 && hasInvalidLeadingSeparator) ||\n // Disallow literal + or _ keys (they require shift)\n combination.includes('++') || combination.includes('__') ||\n combination === '+' || combination === '_' ||\n // Ends with a separator that is not part of a doubled literal\n (combination.length > 1 && (combination.endsWith('+') || combination.endsWith('_')) && combination.at(-2) !== combination.at(-1)) ||\n // Stand-alone doubled separators (dangling)\n combination === '++' || combination === '--' || combination === '__'\n )\n\n if (hasInvalidStructure) {\n if (!isInternal) consoleWarn(`Invalid hotkey combination: \"${combination}\" has invalid structure`)\n return []\n }\n\n const keys: string[] = []\n let buffer = ''\n\n const flushBuffer = () => {\n if (buffer) {\n keys.push(normalizeKey(buffer))\n buffer = ''\n }\n }\n\n for (let i = 0; i < combination.length; i++) {\n const char = combination[i]\n const nextChar = combination[i + 1]\n\n if (char === '+' || char === '_' || char === '-') {\n if (char === nextChar) {\n flushBuffer()\n keys.push(char)\n i++\n } else if (char === '+' || char === '_') {\n flushBuffer()\n } else {\n buffer += char\n }\n } else {\n buffer += char\n }\n }\n flushBuffer()\n\n // Within a combination, `-` is only valid as a literal key (e.g., `ctrl+-`).\n // `-` cannot be part of a longer key name within a combination.\n const hasInvalidMinus = keys.some(key => key.length > 1 && key.includes('-') && key !== '--')\n if (hasInvalidMinus) {\n if (!isInternal) consoleWarn(`Invalid hotkey combination: \"${combination}\" has invalid structure`)\n return []\n }\n\n if (keys.length === 0 && combination) {\n return [normalizeKey(combination)]\n }\n\n return keys\n}\n\n/**\n * Splits a hotkey string into its constituent combination groups.\n *\n * A sequence is a series of combinations that must be pressed in order.\n * e.g. `a-b`, `ctrl+k-p`\n */\nexport function splitKeySequence (str: string): string[] {\n if (!str) {\n consoleWarn('Invalid hotkey sequence: empty string provided')\n return []\n }\n\n // A sequence is invalid if it starts or ends with a separator,\n // unless it is part of a combination (e.g., `shift+-`).\n const hasInvalidStart = str.startsWith('-') && !['---', '--+'].includes(str)\n const hasInvalidEnd = str.endsWith('-') && !str.endsWith('+-') && !str.endsWith('_-') && str !== '-' && str !== '---'\n\n if (hasInvalidStart || hasInvalidEnd) {\n consoleWarn(`Invalid hotkey sequence: \"${str}\" contains invalid combinations`)\n return []\n }\n\n const result: string[] = []\n let buffer = ''\n let i = 0\n\n while (i < str.length) {\n const char = str[i]\n\n if (char === '-') {\n // Determine if this hyphen is part of the current combination\n const prevChar = str[i - 1]\n const prevPrevChar = i > 1 ? str[i - 2] : undefined\n\n const precededBySinglePlusOrUnderscore = (\n (prevChar === '+' || prevChar === '_') && prevPrevChar !== '+'\n )\n\n if (precededBySinglePlusOrUnderscore) {\n // Treat as part of the combination (e.g., 'ctrl+-')\n buffer += char\n i++\n } else {\n // Treat as sequence separator\n if (buffer) {\n result.push(buffer)\n buffer = ''\n } else {\n // Empty buffer means we have a literal '-' key\n result.push('-')\n }\n i++\n }\n } else {\n buffer += char\n i++\n }\n }\n\n // Add final buffer if it exists\n if (buffer) {\n result.push(buffer)\n }\n\n // Collapse runs of '-' so that every second '-' is removed\n const collapsed: string[] = []\n let minusCount = 0\n for (const part of result) {\n if (part === '-') {\n if (minusCount % 2 === 0) collapsed.push('-')\n minusCount++\n } else {\n minusCount = 0\n collapsed.push(part)\n }\n }\n\n // Validate that each part of the sequence is a valid combination\n const areAllValid = collapsed.every(s => splitKeyCombination(s, true).length > 0)\n\n if (!areAllValid) {\n consoleWarn(`Invalid hotkey sequence: \"${str}\" contains invalid combinations`)\n return []\n }\n\n return collapsed\n}\n"],"mappings":"AAAA;AAAA,SACSA,YAAY;AAAA,SACZC,WAAW,iCAEpB;AACA,OAAO,MAAMC,SAAS,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC;;AAEhE;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,mBAAmBA,CAAEC,WAAmB,EAAgC;EAAA,IAA9BC,UAAU,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,KAAK;EAC1E,IAAI,CAACF,WAAW,EAAE;IAChB,IAAI,CAACC,UAAU,EAAEJ,WAAW,CAAC,mDAAmD,CAAC;IACjF,OAAO,EAAE;EACX;;EAEA;EACA,MAAMQ,0BAA0B,GAAGL,WAAW,CAACM,UAAU,CAAC,GAAG,CAAC,IAAIN,WAAW,CAACM,UAAU,CAAC,GAAG,CAAC;EAE7F,MAAMC,0BAA0B;EAC9B;EACAF,0BAA0B,IAC1B,EAAEL,WAAW,CAACM,UAAU,CAAC,IAAI,CAAC,IAAIN,WAAW,CAACM,UAAU,CAAC,IAAI,CAAC,CAC/D;EAED,MAAME,mBAAmB;EACvB;EACCR,WAAW,CAACG,MAAM,GAAG,CAAC,IAAII,0BAA0B;EACrD;EACAP,WAAW,CAACS,QAAQ,CAAC,IAAI,CAAC,IAAIT,WAAW,CAACS,QAAQ,CAAC,IAAI,CAAC,IACxDT,WAAW,KAAK,GAAG,IAAIA,WAAW,KAAK,GAAG;EAC1C;EACCA,WAAW,CAACG,MAAM,GAAG,CAAC,KAAKH,WAAW,CAACU,QAAQ,CAAC,GAAG,CAAC,IAAIV,WAAW,CAACU,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAIV,WAAW,CAACW,EAAE,CAAC,CAAC,CAAC,C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AI,CAAC8B,WAAW,EAAE;IAChBpC,WAAW,CAAC,6BAA6B0B,GAAG,iCAAiC,CAAC;IAC9E,OAAO,EAAE;EACX;EAEA,OAAOO,SAAS;AAClB","ignoreList":[]}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import type { MaybeRef } from "../../util/index.js";
|
2
|
+
interface HotkeyOptions {
|
3
|
+
event?: MaybeRef<'keydown' | 'keyup'>;
|
4
|
+
inputs?: MaybeRef<boolean>;
|
5
|
+
preventDefault?: MaybeRef<boolean>;
|
6
|
+
sequenceTimeout?: MaybeRef<number>;
|
7
|
+
}
|
8
|
+
export declare function useHotkey(keys: MaybeRef<string | undefined>, callback: (e: KeyboardEvent) => void, options?: HotkeyOptions): () => void;
|
9
|
+
|
@@ -1,7 +1,8 @@
|
|
1
|
-
//
|
1
|
+
// Composables
|
2
|
+
import { splitKeyCombination, splitKeySequence } from "./hotkey-parsing.js"; // Utilities
|
2
3
|
import { onBeforeUnmount, toValue, watch } from 'vue';
|
3
|
-
import { IN_BROWSER } from "
|
4
|
-
import { getCurrentInstance } from "
|
4
|
+
import { IN_BROWSER } from "../../util/index.js";
|
5
|
+
import { getCurrentInstance } from "../../util/getCurrentInstance.js"; // Types
|
5
6
|
export function useHotkey(keys, callback) {
|
6
7
|
let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
7
8
|
if (!IN_BROWSER) return function () {};
|
@@ -11,7 +12,7 @@ export function useHotkey(keys, callback) {
|
|
11
12
|
preventDefault = true,
|
12
13
|
sequenceTimeout = 1000
|
13
14
|
} = options;
|
14
|
-
const isMac = navigator?.userAgent?.includes('Macintosh');
|
15
|
+
const isMac = navigator?.userAgent?.includes('Macintosh') ?? false;
|
15
16
|
let timeout = 0;
|
16
17
|
let keyGroups;
|
17
18
|
let isSequence = false;
|
@@ -22,7 +23,7 @@ export function useHotkey(keys, callback) {
|
|
22
23
|
timeout = 0;
|
23
24
|
}
|
24
25
|
function isInputFocused() {
|
25
|
-
if (inputs) return false;
|
26
|
+
if (toValue(inputs)) return false;
|
26
27
|
const activeElement = document.activeElement;
|
27
28
|
return activeElement && (activeElement.tagName === 'INPUT' || activeElement.tagName === 'TEXTAREA' || activeElement.isContentEditable || activeElement.contentEditable === 'true');
|
28
29
|
}
|
@@ -37,7 +38,7 @@ export function useHotkey(keys, callback) {
|
|
37
38
|
if (isSequence) resetSequence();
|
38
39
|
return;
|
39
40
|
}
|
40
|
-
if (preventDefault) e.preventDefault();
|
41
|
+
if (toValue(preventDefault)) e.preventDefault();
|
41
42
|
if (!isSequence) {
|
42
43
|
callback(e);
|
43
44
|
return;
|
@@ -49,32 +50,12 @@ export function useHotkey(keys, callback) {
|
|
49
50
|
resetSequence();
|
50
51
|
return;
|
51
52
|
}
|
52
|
-
timeout = window.setTimeout(resetSequence, sequenceTimeout);
|
53
|
+
timeout = window.setTimeout(resetSequence, toValue(sequenceTimeout));
|
53
54
|
}
|
54
55
|
function cleanup() {
|
55
|
-
window.removeEventListener(event, handler);
|
56
|
+
window.removeEventListener(toValue(event), handler);
|
56
57
|
clearTimer();
|
57
58
|
}
|
58
|
-
function splitKeySequence(str) {
|
59
|
-
const groups = [];
|
60
|
-
let current = '';
|
61
|
-
for (let i = 0; i < str.length; i++) {
|
62
|
-
const char = str[i];
|
63
|
-
if (char === '-') {
|
64
|
-
const next = str[i + 1];
|
65
|
-
// Treat '-' as a sequence delimiter only if the next character exists
|
66
|
-
// and is NOT one of '-', '+', or '_' (these indicate the '-' belongs to the key itself)
|
67
|
-
if (next && !['-', '+', '_'].includes(next)) {
|
68
|
-
groups.push(current);
|
69
|
-
current = '';
|
70
|
-
continue;
|
71
|
-
}
|
72
|
-
}
|
73
|
-
current += char;
|
74
|
-
}
|
75
|
-
groups.push(current);
|
76
|
-
return groups;
|
77
|
-
}
|
78
59
|
watch(() => toValue(keys), function (unrefKeys) {
|
79
60
|
cleanup();
|
80
61
|
if (unrefKeys) {
|
@@ -82,11 +63,19 @@ export function useHotkey(keys, callback) {
|
|
82
63
|
isSequence = groups.length > 1;
|
83
64
|
keyGroups = groups;
|
84
65
|
resetSequence();
|
85
|
-
window.addEventListener(event, handler);
|
66
|
+
window.addEventListener(toValue(event), handler);
|
86
67
|
}
|
87
68
|
}, {
|
88
69
|
immediate: true
|
89
70
|
});
|
71
|
+
|
72
|
+
// Watch for changes in the event type to re-register the listener
|
73
|
+
watch(() => toValue(event), function (newEvent, oldEvent) {
|
74
|
+
if (oldEvent && keyGroups && keyGroups.length > 0) {
|
75
|
+
window.removeEventListener(oldEvent, handler);
|
76
|
+
window.addEventListener(newEvent, handler);
|
77
|
+
}
|
78
|
+
});
|
90
79
|
try {
|
91
80
|
getCurrentInstance('useHotkey');
|
92
81
|
onBeforeUnmount(cleanup);
|
@@ -96,24 +85,25 @@ export function useHotkey(keys, callback) {
|
|
96
85
|
function parseKeyGroup(group) {
|
97
86
|
const MODIFIERS = ['ctrl', 'shift', 'alt', 'meta', 'cmd'];
|
98
87
|
|
99
|
-
//
|
100
|
-
const parts = group.toLowerCase()
|
88
|
+
// Use the shared combination splitting logic
|
89
|
+
const parts = splitKeyCombination(group.toLowerCase());
|
90
|
+
|
91
|
+
// If the combination is invalid, return empty result
|
92
|
+
if (parts.length === 0) {
|
93
|
+
return {
|
94
|
+
modifiers: Object.fromEntries(MODIFIERS.map(m => [m, false])),
|
95
|
+
actualKey: undefined
|
96
|
+
};
|
97
|
+
}
|
101
98
|
const modifiers = Object.fromEntries(MODIFIERS.map(m => [m, false]));
|
102
99
|
let actualKey;
|
103
100
|
for (const part of parts) {
|
104
|
-
if (!part) continue; // Skip empty tokens
|
105
101
|
if (MODIFIERS.includes(part)) {
|
106
102
|
modifiers[part] = true;
|
107
103
|
} else {
|
108
104
|
actualKey = part;
|
109
105
|
}
|
110
106
|
}
|
111
|
-
|
112
|
-
// Fallback for cases where actualKey is a literal '+' or '-' (e.g. alt--, alt++ , alt+-, alt-+)
|
113
|
-
if (!actualKey) {
|
114
|
-
const lastChar = group.slice(-1);
|
115
|
-
if (['+', '-', '_'].includes(lastChar)) actualKey = lastChar;
|
116
|
-
}
|
117
107
|
return {
|
118
108
|
modifiers,
|
119
109
|
actualKey
|
@@ -124,7 +114,9 @@ export function useHotkey(keys, callback) {
|
|
124
114
|
modifiers,
|
125
115
|
actualKey
|
126
116
|
} = parseKeyGroup(group);
|
127
|
-
|
117
|
+
const expectCtrl = modifiers.ctrl || !isMac && (modifiers.cmd || modifiers.meta);
|
118
|
+
const expectMeta = isMac && (modifiers.cmd || modifiers.meta);
|
119
|
+
return e.ctrlKey === expectCtrl && e.metaKey === expectMeta && e.shiftKey === modifiers.shift && e.altKey === modifiers.alt && e.key.toLowerCase() === actualKey?.toLowerCase();
|
128
120
|
}
|
129
121
|
return cleanup;
|
130
122
|
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"hotkey.js","names":["splitKeyCombination","splitKeySequence","onBeforeUnmount","toValue","watch","IN_BROWSER","getCurrentInstance","useHotkey","keys","callback","options","arguments","length","undefined","event","inputs","preventDefault","sequenceTimeout","isMac","navigator","userAgent","includes","timeout","keyGroups","isSequence","groupIndex","clearTimer","clearTimeout","isInputFocused","activeElement","document","tagName","isContentEditable","contentEditable","resetSequence","handler","e","group","matchesKeyGroup","window","setTimeout","cleanup","removeEventListener","unrefKeys","groups","toLowerCase","addEventListener","immediate","newEvent","oldEvent","parseKeyGroup","MODIFIERS","parts","modifiers","Object","fromEntries","map","m","actualKey","part","expectCtrl","ctrl","cmd","meta","expectMeta","ctrlKey","metaKey","shiftKey","shift","altKey","alt","key"],"sources":["../../../src/composables/hotkey/hotkey.ts"],"sourcesContent":["// Composables\nimport { splitKeyCombination, splitKeySequence } from '@/composables/hotkey/hotkey-parsing'\n\n// Utilities\nimport { onBeforeUnmount, toValue, watch } from 'vue'\nimport { IN_BROWSER } from '@/util'\nimport { getCurrentInstance } from '@/util/getCurrentInstance'\n\n// Types\nimport type { MaybeRef } from '@/util'\n\ninterface HotkeyOptions {\n event?: MaybeRef<'keydown' | 'keyup'>\n inputs?: MaybeRef<boolean>\n preventDefault?: MaybeRef<boolean>\n sequenceTimeout?: MaybeRef<number>\n}\n\nexport function useHotkey (\n keys: MaybeRef<string | undefined>,\n callback: (e: KeyboardEvent) => void,\n options: HotkeyOptions = {}\n) {\n if (!IN_BROWSER) return function () {}\n\n const {\n event = 'keydown',\n inputs = false,\n preventDefault = true,\n sequenceTimeout = 1000,\n } = options\n\n const isMac = navigator?.userAgent?.includes('Macintosh') ?? false\n let timeout = 0\n let keyGroups: string[]\n let isSequence = false\n let groupIndex = 0\n\n function clearTimer () {\n if (!timeout) return\n\n clearTimeout(timeout)\n timeout = 0\n }\n\n function isInputFocused () {\n if (toValue(inputs)) return false\n\n const activeElement = document.activeElement as HTMLElement\n\n return activeElement && (\n activeElement.tagName === 'INPUT' ||\n activeElement.tagName === 'TEXTAREA' ||\n activeElement.isContentEditable ||\n activeElement.contentEditable === 'true'\n )\n }\n\n function resetSequence () {\n groupIndex = 0\n clearTimer()\n }\n\n function handler (e: KeyboardEvent) {\n const group = keyGroups[groupIndex]\n\n if (!group || isInputFocused()) return\n\n if (!matchesKeyGroup(e, group)) {\n if (isSequence) resetSequence()\n return\n }\n\n if (toValue(preventDefault)) e.preventDefault()\n\n if (!isSequence) {\n callback(e)\n return\n }\n\n clearTimer()\n groupIndex++\n\n if (groupIndex === keyGroups.length) {\n callback(e)\n resetSequence()\n return\n }\n\n timeout = window.setTimeout(resetSequence, toValue(sequenceTimeout))\n }\n\n function cleanup () {\n window.removeEventListener(toValue(event), handler)\n clearTimer()\n }\n\n watch(() => toValue(keys), function (unrefKeys) {\n cleanup()\n\n if (unrefKeys) {\n const groups = splitKeySequence(unrefKeys.toLowerCase())\n isSequence = groups.length > 1\n keyGroups = groups\n resetSequence()\n window.addEventListener(toValue(event), handler)\n }\n }, { immediate: true })\n\n // Watch for changes in the event type to re-register the listener\n watch(() => toValue(event), function (newEvent, oldEvent) {\n if (oldEvent && keyGroups && keyGroups.length > 0) {\n window.removeEventListener(oldEvent, handler)\n window.addEventListener(newEvent, handler)\n }\n })\n\n try {\n getCurrentInstance('useHotkey')\n onBeforeUnmount(cleanup)\n } catch {\n // Not in Vue setup context\n }\n\n function parseKeyGroup (group: string) {\n const MODIFIERS = ['ctrl', 'shift', 'alt', 'meta', 'cmd']\n\n // Use the shared combination splitting logic\n const parts = splitKeyCombination(group.toLowerCase())\n\n // If the combination is invalid, return empty result\n if (parts.length === 0) {\n return { modifiers: Object.fromEntries(MODIFIERS.map(m => [m, false])), actualKey: undefined }\n }\n\n const modifiers = Object.fromEntries(MODIFIERS.map(m => [m, false])) as Record<string, boolean>\n let actualKey: string | undefined\n\n for (const part of parts) {\n if (MODIFIERS.includes(part)) {\n modifiers[part] = true\n } else {\n actualKey = part\n }\n }\n\n return { modifiers, actualKey }\n }\n\n function matchesKeyGroup (e: KeyboardEvent, group: string) {\n const { modifiers, actualKey } = parseKeyGroup(group)\n\n const expectCtrl = modifiers.ctrl || (!isMac && (modifiers.cmd || modifiers.meta))\n const expectMeta = isMac && (modifiers.cmd || modifiers.meta)\n\n return (\n e.ctrlKey === expectCtrl &&\n e.metaKey === expectMeta &&\n e.shiftKey === modifiers.shift &&\n e.altKey === modifiers.alt &&\n e.key.toLowerCase() === actualKey?.toLowerCase()\n )\n }\n\n return cleanup\n}\n"],"mappings":"AAAA;AAAA,SACSA,mBAAmB,EAAEC,gBAAgB,+BAE9C;AACA,SAASC,eAAe,EAAEC,OAAO,EAAEC,KAAK,QAAQ,KAAK;AAAA,SAC5CC,UAAU;AAAA,SACVC,kBAAkB,4CAE3B;AAUA,OAAO,SAASC,SAASA,CACvBC,IAAkC,EAClCC,QAAoC,EAEpC;EAAA,IADAC,OAAsB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAE3B,IAAI,CAACN,UAAU,EAAE,OAAO,YAAY,CAAC,CAAC;EAEtC,MAAM;IACJS,KAA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KAAK,KAAKmC,SAAS,CAACS,GAAG,IAAIT,SAAS,CAACU,IAAI,CAAC;IAE7D,OACE3B,CAAC,CAAC6B,OAAO,KAAKL,UAAU,IACxBxB,CAAC,CAAC8B,OAAO,KAAKF,UAAU,IACxB5B,CAAC,CAAC+B,QAAQ,KAAKd,SAAS,CAACe,KAAK,IAC9BhC,CAAC,CAACiC,MAAM,KAAKhB,SAAS,CAACiB,GAAG,IAC1BlC,CAAC,CAACmC,GAAG,CAAC1B,WAAW,CAAC,CAAC,KAAKa,SAAS,EAAEb,WAAW,CAAC,CAAC;EAEpD;EAEA,OAAOJ,OAAO;AAChB","ignoreList":[]}
|
@@ -0,0 +1 @@
|
|
1
|
+
export { useHotkey } from './hotkey.js';
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","names":["useHotkey"],"sources":["../../../src/composables/hotkey/index.ts"],"sourcesContent":["export { useHotkey } from './hotkey'\n"],"mappings":"SAASA,SAAS","ignoreList":[]}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
/**
|
2
|
+
* Centralized key alias mapping for consistent key normalization across the hotkey system.
|
3
|
+
*
|
4
|
+
* This maps various user-friendly aliases to canonical key names that match
|
5
|
+
* KeyboardEvent.key values (in lowercase) where possible.
|
6
|
+
*/
|
7
|
+
export declare const keyAliasMap: Record<string, string>;
|
8
|
+
/**
|
9
|
+
* Normalizes a key string to its canonical form using the alias map.
|
10
|
+
*
|
11
|
+
* @param key - The key string to normalize
|
12
|
+
* @returns The canonical key name in lowercase
|
13
|
+
*/
|
14
|
+
export declare function normalizeKey(key: string): string;
|
@@ -0,0 +1,38 @@
|
|
1
|
+
/**
|
2
|
+
* Centralized key alias mapping for consistent key normalization across the hotkey system.
|
3
|
+
*
|
4
|
+
* This maps various user-friendly aliases to canonical key names that match
|
5
|
+
* KeyboardEvent.key values (in lowercase) where possible.
|
6
|
+
*/
|
7
|
+
export const keyAliasMap = {
|
8
|
+
// Modifier aliases (from vue-use, other libraries, and current implementation)
|
9
|
+
control: 'ctrl',
|
10
|
+
command: 'cmd',
|
11
|
+
option: 'alt',
|
12
|
+
// Arrow key aliases (common abbreviations)
|
13
|
+
up: 'arrowup',
|
14
|
+
down: 'arrowdown',
|
15
|
+
left: 'arrowleft',
|
16
|
+
right: 'arrowright',
|
17
|
+
// Other common key aliases
|
18
|
+
esc: 'escape',
|
19
|
+
spacebar: ' ',
|
20
|
+
space: ' ',
|
21
|
+
return: 'enter',
|
22
|
+
del: 'delete',
|
23
|
+
// Symbol aliases (existing from hotkey-parsing.ts)
|
24
|
+
minus: '-',
|
25
|
+
hyphen: '-'
|
26
|
+
};
|
27
|
+
|
28
|
+
/**
|
29
|
+
* Normalizes a key string to its canonical form using the alias map.
|
30
|
+
*
|
31
|
+
* @param key - The key string to normalize
|
32
|
+
* @returns The canonical key name in lowercase
|
33
|
+
*/
|
34
|
+
export function normalizeKey(key) {
|
35
|
+
const lowerKey = key.toLowerCase();
|
36
|
+
return keyAliasMap[lowerKey] || lowerKey;
|
37
|
+
}
|
38
|
+
//# sourceMappingURL=key-aliases.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"key-aliases.js","names":["keyAliasMap","control","command","option","up","down","left","right","esc","spacebar","space","return","del","minus","hyphen","normalizeKey","key","lowerKey","toLowerCase"],"sources":["../../../src/composables/hotkey/key-aliases.ts"],"sourcesContent":["/**\n * Centralized key alias mapping for consistent key normalization across the hotkey system.\n *\n * This maps various user-friendly aliases to canonical key names that match\n * KeyboardEvent.key values (in lowercase) where possible.\n */\nexport const keyAliasMap: Record<string, string> = {\n // Modifier aliases (from vue-use, other libraries, and current implementation)\n control: 'ctrl',\n command: 'cmd',\n option: 'alt',\n\n // Arrow key aliases (common abbreviations)\n up: 'arrowup',\n down: 'arrowdown',\n left: 'arrowleft',\n right: 'arrowright',\n\n // Other common key aliases\n esc: 'escape',\n spacebar: ' ',\n space: ' ',\n return: 'enter',\n del: 'delete',\n\n // Symbol aliases (existing from hotkey-parsing.ts)\n minus: '-',\n hyphen: '-',\n}\n\n/**\n * Normalizes a key string to its canonical form using the alias map.\n *\n * @param key - The key string to normalize\n * @returns The canonical key name in lowercase\n */\nexport function normalizeKey (key: string): string {\n const lowerKey = key.toLowerCase()\n return keyAliasMap[lowerKey] || lowerKey\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,WAAmC,GAAG;EACjD;EACAC,OAAO,EAAE,MAAM;EACfC,OAAO,EAAE,KAAK;EACdC,MAAM,EAAE,KAAK;EAEb;EACAC,EAAE,EAAE,SAAS;EACbC,IAAI,EAAE,WAAW;EACjBC,IAAI,EAAE,WAAW;EACjBC,KAAK,EAAE,YAAY;EAEnB;EACAC,GAAG,EAAE,QAAQ;EACbC,QAAQ,EAAE,GAAG;EACbC,KAAK,EAAE,GAAG;EACVC,MAAM,EAAE,OAAO;EACfC,GAAG,EAAE,QAAQ;EAEb;EACAC,KAAK,EAAE,GAAG;EACVC,MAAM,EAAE;AACV,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,YAAYA,CAAEC,GAAW,EAAU;EACjD,MAAMC,QAAQ,GAAGD,GAAG,CAACE,WAAW,CAAC,CAAC;EAClC,OAAOlB,WAAW,CAACiB,QAAQ,CAAC,IAAIA,QAAQ;AAC1C","ignoreList":[]}
|
@@ -45,6 +45,17 @@ export interface IconAliases {
|
|
45
45
|
eyeDropper: IconValue;
|
46
46
|
upload: IconValue;
|
47
47
|
color: IconValue;
|
48
|
+
command: IconValue;
|
49
|
+
ctrl: IconValue;
|
50
|
+
space: IconValue;
|
51
|
+
shift: IconValue;
|
52
|
+
alt: IconValue;
|
53
|
+
enter: IconValue;
|
54
|
+
arrowup: IconValue;
|
55
|
+
arrowdown: IconValue;
|
56
|
+
arrowleft: IconValue;
|
57
|
+
arrowright: IconValue;
|
58
|
+
backspace: IconValue;
|
48
59
|
}
|
49
60
|
export interface IconProps {
|
50
61
|
tag: string | JSXComponent;
|