Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 5 additions & 0 deletions .changeset/tall-monkeys-shout.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/vite-plugin-svelte-inspector': major
---

Change default key-combo to `alt-x` to avoid conflicts with other combos that started with the previous defaults.
10 changes: 5 additions & 5 deletions docs/inspector.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default {
export default {
vitePlugin: {
inspector: {
toggleKeyCombo: 'meta-shift',
toggleKeyCombo: 'alt-x',
showToggleButton: 'always',
toggleButtonPos: 'bottom-right'
}
Expand All @@ -39,7 +39,7 @@ To allow you to use your own setup, svelte inspector can be configured via envir

```shell
# just keycombo, unquoted string
SVELTE_INSPECTOR_TOGGLE=control-shift
SVELTE_INSPECTOR_TOGGLE=alt-x

# options object as json
SVELTE_INSPECTOR_OPTIONS='{"holdMode": false, "toggleButtonPos": "bottom-left"}'
Expand All @@ -58,13 +58,13 @@ SVELTE_INSPECTOR_OPTIONS=true
### toggleKeyCombo

- **Type:** `string`
- **Default:** `'meta-shift'` on mac, `'control-shift'` on other os
- **Default:** `'alt-x'`

Define a key combo to toggle inspector.

The value is recommended to be any number of modifiers (e.g. `control`, `shift`, `alt`, `meta`) followed by zero or one regular key, separated by `-`. This helps avoid conflicts or accidentally typing into inputs. Note that some keys have native behavior (e.g. `alt-s` opens history menu on firefox).
The value is recommended to be any number of modifiers (e.g. `control`, `shift`, `alt`, `meta`) followed by zero or one regular key, separated by `-`. Note that some keys have native behavior (e.g. `alt-s` opens history menu on firefox).

Examples: `control-shift`, `control-o`, `control-alt-s`, `meta-x`, `control-meta`.
Examples: `control-o`, `control-alt-s`, `meta-x`, `alt-i`.

### navKeys

Expand Down
2 changes: 1 addition & 1 deletion packages/vite-plugin-svelte-inspector/src/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { debug } from './debug.js';

/** @type {import('./public.d.ts').Options} */
export const defaultInspectorOptions = {
toggleKeyCombo: process.platform === 'darwin' ? 'meta-shift' : 'control-shift',
toggleKeyCombo: 'alt-x',
navKeys: { parent: 'ArrowUp', child: 'ArrowDown', next: 'ArrowRight', prev: 'ArrowLeft' },
escapeKeys: ['Backspace', 'Escape'],
openKey: 'Enter',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@
case 'meta':
return event.getModifierState(key.charAt(0).toUpperCase() + key.slice(1));
default:
return key === event.key.toLowerCase();
return key === event.key.toLowerCase() || event.code === `Key${key.toUpperCase()}`;
}
}
Expand Down