impact-nova 1.3.0 → 1.5.2
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/README.md +49 -0
- package/dist/components/layout/dashboard-layout.d.ts +15 -1
- package/dist/components/ui/accordion-nested-list/accordion-nested-list.js +65 -64
- package/dist/components/ui/accordion.js +38 -34
- package/dist/components/ui/ag-grid-react/cell-renderers/badge-cell-renderer.js +1 -1
- package/dist/components/ui/ag-grid-react/cell-renderers/cell-renderer-utils.d.ts +58 -0
- package/dist/components/ui/ag-grid-react/cell-renderers/cell-renderer-utils.js +104 -0
- package/dist/components/ui/ag-grid-react/cell-renderers/editors/input-cell-editor.js +62 -54
- package/dist/components/ui/ag-grid-react/cell-renderers/editors/split-cell-editor.d.ts +4 -6
- package/dist/components/ui/ag-grid-react/cell-renderers/editors/split-cell-editor.js +54 -68
- package/dist/components/ui/ag-grid-react/cell-renderers/index.d.ts +3 -1
- package/dist/components/ui/ag-grid-react/cell-renderers/index.js +33 -27
- package/dist/components/ui/ag-grid-react/cell-renderers/input-display-renderer.d.ts +3 -0
- package/dist/components/ui/ag-grid-react/cell-renderers/input-display-renderer.js +28 -12
- package/dist/components/ui/ag-grid-react/cell-renderers/link-with-batch-cell-renderer.d.ts +2 -0
- package/dist/components/ui/ag-grid-react/cell-renderers/link-with-batch-cell-renderer.js +45 -44
- package/dist/components/ui/ag-grid-react/cell-renderers/split-cell-renderer.d.ts +4 -6
- package/dist/components/ui/ag-grid-react/cell-renderers/split-cell-renderer.js +23 -37
- package/dist/components/ui/ag-grid-react/cell-renderers/types.d.ts +33 -17
- package/dist/components/ui/ag-grid-react/editable-utils.d.ts +27 -0
- package/dist/components/ui/ag-grid-react/editable-utils.js +62 -0
- package/dist/components/ui/ag-grid-react/headers/advanced-filter/advanced-filter-dialog.js +99 -98
- package/dist/components/ui/ag-grid-react/headers/advanced-filter/column-filter-section.js +110 -143
- package/dist/components/ui/ag-grid-react/headers/column-menu/column-settings-menu.js +72 -69
- package/dist/components/ui/ag-grid-react/headers/components/header-info.js +36 -35
- package/dist/components/ui/ag-grid-react/headers/components/info-modal.js +14 -12
- package/dist/components/ui/ag-grid-react/headers/custom-header.js +111 -110
- package/dist/components/ui/ag-grid-react/headers/header-search-input.js +204 -203
- package/dist/components/ui/alert.js +62 -58
- package/dist/components/ui/breadcrumb.js +81 -74
- package/dist/components/ui/calendar.js +354 -354
- package/dist/components/ui/chart/chart.js +63 -62
- package/dist/components/ui/chips.js +42 -38
- package/dist/components/ui/command-palette/command-palette-context.d.ts +52 -0
- package/dist/components/ui/command-palette/command-palette-context.js +110 -0
- package/dist/components/ui/command-palette/command-palette.d.ts +67 -0
- package/dist/components/ui/command-palette/command-palette.js +402 -0
- package/dist/components/ui/command-palette/index.d.ts +23 -0
- package/dist/components/ui/command-palette/index.js +44 -0
- package/dist/components/ui/command-palette/kbd.d.ts +28 -0
- package/dist/components/ui/command-palette/kbd.js +52 -0
- package/dist/components/ui/command-palette/shortcut-registry.d.ts +68 -0
- package/dist/components/ui/command-palette/shortcut-registry.js +183 -0
- package/dist/components/ui/command-palette/shortcut-scope-provider.d.ts +55 -0
- package/dist/components/ui/command-palette/shortcut-scope-provider.js +55 -0
- package/dist/components/ui/command-palette/shortcut-settings.d.ts +27 -0
- package/dist/components/ui/command-palette/shortcut-settings.js +266 -0
- package/dist/components/ui/command-palette/use-browser-shortcuts.d.ts +32 -0
- package/dist/components/ui/command-palette/use-browser-shortcuts.js +48 -0
- package/dist/components/ui/command-palette/use-global-shortcut.d.ts +3 -0
- package/dist/components/ui/command-palette/use-global-shortcut.js +7 -0
- package/dist/components/ui/command-palette/use-shortcut.d.ts +47 -0
- package/dist/components/ui/command-palette/use-shortcut.js +49 -0
- package/dist/components/ui/command-palette/utils.d.ts +119 -0
- package/dist/components/ui/command-palette/utils.js +248 -0
- package/dist/components/ui/data-table/data-table-column-list.js +87 -86
- package/dist/components/ui/data-table/data-table-format-options.js +45 -44
- package/dist/components/ui/data-table/data-table-view-options.js +39 -38
- package/dist/components/ui/date-picker/date-picker.js +89 -87
- package/dist/components/ui/date-picker/date-range-picker.js +140 -138
- package/dist/components/ui/date-picker/month-picker.js +82 -81
- package/dist/components/ui/date-picker/month-range-picker.js +108 -105
- package/dist/components/ui/date-picker/multi-date-picker.js +68 -66
- package/dist/components/ui/date-picker/multi-month-picker.js +59 -58
- package/dist/components/ui/date-picker/multi-week-picker.js +80 -78
- package/dist/components/ui/date-picker/week-picker.js +117 -115
- package/dist/components/ui/date-picker/week-range-picker.js +166 -164
- package/dist/components/ui/dialog.js +78 -73
- package/dist/components/ui/drawer.js +71 -66
- package/dist/components/ui/file-upload.js +131 -127
- package/dist/components/ui/filter-panel/filter-panel.js +98 -94
- package/dist/components/ui/filter-strip/filter-strip.js +95 -91
- package/dist/components/ui/filter-strip/filter-summary.js +91 -90
- package/dist/components/ui/header.js +57 -53
- package/dist/components/ui/horizontal-scroller/horizontal-scroller.js +78 -76
- package/dist/components/ui/loader.js +17 -16
- package/dist/components/ui/nested-list/components/NestedListHeader.d.ts +1 -0
- package/dist/components/ui/nested-list/components/NestedListHeader.js +51 -48
- package/dist/components/ui/nested-list/components/SortableItem.js +60 -59
- package/dist/components/ui/nested-list/nested-list.js +184 -182
- package/dist/components/ui/notification-panel/notification-panel.js +60 -53
- package/dist/components/ui/popover.js +45 -40
- package/dist/components/ui/prompt.js +90 -86
- package/dist/components/ui/select/select.js +206 -209
- package/dist/components/ui/sheet.d.ts +1 -0
- package/dist/components/ui/sheet.js +50 -48
- package/dist/components/ui/sidebar.js +273 -267
- package/dist/components/ui/stepper.js +75 -63
- package/dist/components/ui/tag.js +48 -44
- package/dist/components/ui/toast.js +46 -41
- package/dist/i18n/ImpactNovaI18nContext.d.ts +21 -0
- package/dist/i18n/ImpactNovaI18nContext.js +76 -0
- package/dist/i18n/defaultMessages.d.ts +231 -0
- package/dist/i18n/defaultMessages.js +206 -0
- package/dist/i18n/getDateFnsLocale.d.ts +11 -0
- package/dist/i18n/getDateFnsLocale.js +21 -0
- package/dist/i18n/index.d.ts +5 -0
- package/dist/i18n/locales/de.d.ts +2 -0
- package/dist/i18n/locales/de.js +206 -0
- package/dist/i18n/locales/es.d.ts +2 -0
- package/dist/i18n/locales/es.js +206 -0
- package/dist/i18n/locales/hi.d.ts +2 -0
- package/dist/i18n/locales/hi.js +206 -0
- package/dist/i18n/locales/index.d.ts +4 -0
- package/dist/i18n/locales/kn.d.ts +2 -0
- package/dist/i18n/locales/kn.js +206 -0
- package/dist/icons/assets/boxAdd.svg.js +5 -0
- package/dist/icons/assets/boxed.svg.js +5 -0
- package/dist/icons/assets/trolley.svg.js +5 -0
- package/dist/icons/assets/unlocked.svg.js +5 -0
- package/dist/icons/index.d.ts +4 -0
- package/dist/icons/index.js +179 -171
- package/dist/impact-nova.css +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +232 -172
- package/package.json +36 -4
- package/dist/components/ui/ag-grid-react/cell-renderers/types.js +0 -74
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { ShortcutScope, KeyBinding } from './utils';
|
|
2
|
+
/**
|
|
3
|
+
* useShortcut — Hook to register a scoped keyboard shortcut.
|
|
4
|
+
*
|
|
5
|
+
* Registers the command on mount, unregisters on unmount.
|
|
6
|
+
* Any saved user override is automatically applied by the registry.
|
|
7
|
+
*/
|
|
8
|
+
import * as React from 'react';
|
|
9
|
+
export interface UseShortcutOptions {
|
|
10
|
+
/** Unique command ID, e.g. 'planning.save-draft' */
|
|
11
|
+
id: string;
|
|
12
|
+
/** Human-readable label shown in the command palette */
|
|
13
|
+
label: string;
|
|
14
|
+
/** Optional description */
|
|
15
|
+
description?: string;
|
|
16
|
+
/** Optional icon (React node) */
|
|
17
|
+
icon?: React.ReactNode;
|
|
18
|
+
/** Category for grouping in the palette (e.g. 'Navigation') */
|
|
19
|
+
category?: string;
|
|
20
|
+
/** Scope: 'global' | 'module' | 'page' | 'modal' */
|
|
21
|
+
scope: ShortcutScope;
|
|
22
|
+
/** Default keybinding (can be overridden by user) */
|
|
23
|
+
defaultKeybinding?: KeyBinding;
|
|
24
|
+
/** Whether the user can customise this shortcut (default: true) */
|
|
25
|
+
customisable?: boolean;
|
|
26
|
+
/** Hide from the command palette list (default: false) */
|
|
27
|
+
hidden?: boolean;
|
|
28
|
+
/** Condition guard — shortcut only fires when this returns true */
|
|
29
|
+
when?: () => boolean;
|
|
30
|
+
/** The action to perform */
|
|
31
|
+
handler: () => void;
|
|
32
|
+
/** Source label for the settings panel */
|
|
33
|
+
source?: 'system' | 'user' | 'ag-grid';
|
|
34
|
+
/** Whether the shortcut is currently enabled (default: true) */
|
|
35
|
+
enabled?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* When true, the shortcut is display-only — shown in the palette/settings
|
|
38
|
+
* but the registry will NOT intercept the keyboard event.
|
|
39
|
+
*/
|
|
40
|
+
passive?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Instance ID — usually auto-inherited from the parent ShortcutScopeProvider.
|
|
43
|
+
* Only provide explicitly if needed.
|
|
44
|
+
*/
|
|
45
|
+
instance?: string;
|
|
46
|
+
}
|
|
47
|
+
export declare function useShortcut(options: UseShortcutOptions): void;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import * as e from "react";
|
|
2
|
+
import { useCommandPalette as I } from "./command-palette-context.js";
|
|
3
|
+
import { ShortcutInstanceContext as S } from "./shortcut-scope-provider.js";
|
|
4
|
+
function P(l) {
|
|
5
|
+
const { registerCommand: r, unregisterCommand: s } = I(), h = e.useContext(S), {
|
|
6
|
+
id: n,
|
|
7
|
+
label: c,
|
|
8
|
+
description: p,
|
|
9
|
+
icon: C,
|
|
10
|
+
category: x,
|
|
11
|
+
scope: o,
|
|
12
|
+
defaultKeybinding: R,
|
|
13
|
+
customisable: b = !0,
|
|
14
|
+
hidden: g = !1,
|
|
15
|
+
when: a,
|
|
16
|
+
handler: i,
|
|
17
|
+
source: w = "user",
|
|
18
|
+
enabled: u = !0,
|
|
19
|
+
passive: d = !1,
|
|
20
|
+
instance: v
|
|
21
|
+
} = l, m = v ?? h?.instance, f = e.useRef(i);
|
|
22
|
+
f.current = i;
|
|
23
|
+
const t = e.useRef(a);
|
|
24
|
+
t.current = a, e.useEffect(() => {
|
|
25
|
+
if (!u) return;
|
|
26
|
+
const y = {
|
|
27
|
+
id: n,
|
|
28
|
+
label: c,
|
|
29
|
+
description: p,
|
|
30
|
+
icon: C,
|
|
31
|
+
category: x,
|
|
32
|
+
scope: o,
|
|
33
|
+
defaultKeybinding: R,
|
|
34
|
+
customisable: b,
|
|
35
|
+
hidden: g,
|
|
36
|
+
when: t.current ? () => t.current() : void 0,
|
|
37
|
+
handler: () => f.current(),
|
|
38
|
+
source: w,
|
|
39
|
+
passive: d,
|
|
40
|
+
instance: m
|
|
41
|
+
};
|
|
42
|
+
return r(y), () => {
|
|
43
|
+
s(n);
|
|
44
|
+
};
|
|
45
|
+
}, [n, c, o, u, d, m, r, s]);
|
|
46
|
+
}
|
|
47
|
+
export {
|
|
48
|
+
P as useShortcut
|
|
49
|
+
};
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Command Palette & Keyboard Shortcuts — Shared Utilities
|
|
3
|
+
*
|
|
4
|
+
* Platform detection, keybinding parsing/matching, fuzzy search,
|
|
5
|
+
* and browser-reserved shortcut constants.
|
|
6
|
+
*/
|
|
7
|
+
export type ShortcutScope = 'global' | 'module' | 'page' | 'modal';
|
|
8
|
+
export interface KeyBinding {
|
|
9
|
+
key: string;
|
|
10
|
+
meta?: boolean;
|
|
11
|
+
ctrl?: boolean;
|
|
12
|
+
alt?: boolean;
|
|
13
|
+
shift?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface CommandDefinition {
|
|
16
|
+
id: string;
|
|
17
|
+
label: string;
|
|
18
|
+
description?: string;
|
|
19
|
+
icon?: React.ReactNode;
|
|
20
|
+
category?: string;
|
|
21
|
+
scope: ShortcutScope;
|
|
22
|
+
defaultKeybinding?: KeyBinding;
|
|
23
|
+
keybinding?: KeyBinding;
|
|
24
|
+
customisable: boolean;
|
|
25
|
+
hidden?: boolean;
|
|
26
|
+
when?: () => boolean;
|
|
27
|
+
handler: () => void;
|
|
28
|
+
source?: 'system' | 'user' | 'ag-grid' | 'browser';
|
|
29
|
+
/**
|
|
30
|
+
* When true, the shortcut is displayed in the palette/settings but the
|
|
31
|
+
* registry will NOT intercept the keyboard event. The owning component
|
|
32
|
+
* (e.g. AG Grid) handles its own keyboard handling natively.
|
|
33
|
+
*/
|
|
34
|
+
passive?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Optional instance identifier. When multiple components of the same type
|
|
37
|
+
* exist on a page (e.g. two DataTables), each registers commands with a
|
|
38
|
+
* unique instance id. Only the *focused* instance's commands are dispatched.
|
|
39
|
+
*/
|
|
40
|
+
instance?: string;
|
|
41
|
+
}
|
|
42
|
+
export declare function isMac(): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Get the display symbol for a modifier or special key.
|
|
45
|
+
*/
|
|
46
|
+
export declare function getKeySymbol(key: string): string;
|
|
47
|
+
/**
|
|
48
|
+
* Convert a KeyBinding into an ordered array of display symbols.
|
|
49
|
+
* Order: Ctrl → Alt → Shift → Meta → Key (Mac: ⌃ ⌥ ⇧ ⌘ Key)
|
|
50
|
+
*/
|
|
51
|
+
export declare function keybindingToSymbols(kb: KeyBinding): string[];
|
|
52
|
+
/**
|
|
53
|
+
* Human-readable string representation of a keybinding.
|
|
54
|
+
* e.g. "⌘⇧P" on Mac, "Ctrl+Shift+P" on Windows
|
|
55
|
+
*/
|
|
56
|
+
export declare function keybindingToString(kb: KeyBinding): string;
|
|
57
|
+
/**
|
|
58
|
+
* Check if a keyboard event matches a KeyBinding definition.
|
|
59
|
+
*/
|
|
60
|
+
export declare function matchesKeybinding(event: KeyboardEvent, kb: KeyBinding): boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Parse a human-readable string like "Ctrl+Shift+P" or "⌘⇧P" into a KeyBinding.
|
|
63
|
+
* Accepts both Mac symbol and Windows-style notation.
|
|
64
|
+
*/
|
|
65
|
+
export declare function parseKeybinding(str: string): KeyBinding;
|
|
66
|
+
export declare function keybindingsEqual(a: KeyBinding, b: KeyBinding): boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Capture the current keyboard state from an event as a KeyBinding.
|
|
69
|
+
* Useful for the "recording mode" in shortcut settings.
|
|
70
|
+
*/
|
|
71
|
+
export declare function keybindingFromEvent(event: KeyboardEvent): KeyBinding | null;
|
|
72
|
+
/**
|
|
73
|
+
* Comprehensive list of Chrome browser shortcuts that web pages cannot
|
|
74
|
+
* reliably override. Sourced from:
|
|
75
|
+
* https://support.google.com/chrome/answer/157179
|
|
76
|
+
*
|
|
77
|
+
* Stored as normalised strings: modifiers in order meta/alt/shift + key.
|
|
78
|
+
* `meta` means ⌘ on Mac and Ctrl on Windows/Linux.
|
|
79
|
+
*/
|
|
80
|
+
export interface BrowserShortcutInfo {
|
|
81
|
+
/** Normalised shortcut string (used for matching) */
|
|
82
|
+
shortcut: string;
|
|
83
|
+
/** Human-readable description */
|
|
84
|
+
label: string;
|
|
85
|
+
/** Category grouping */
|
|
86
|
+
category: 'Tab & Window' | 'Chrome Features' | 'Address Bar' | 'Webpage' | 'System';
|
|
87
|
+
}
|
|
88
|
+
export declare const BROWSER_SHORTCUTS: BrowserShortcutInfo[];
|
|
89
|
+
export declare function isReservedShortcut(kb: KeyBinding): boolean;
|
|
90
|
+
/**
|
|
91
|
+
* Get browser shortcut info for a given keybinding (if it's reserved).
|
|
92
|
+
* Returns the label and category to show in the settings panel.
|
|
93
|
+
*/
|
|
94
|
+
export declare function getBrowserShortcutInfo(kb: KeyBinding): BrowserShortcutInfo | undefined;
|
|
95
|
+
export interface FuzzyResult<T> {
|
|
96
|
+
item: T;
|
|
97
|
+
score: number;
|
|
98
|
+
matches: [number, number][];
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Lightweight fuzzy search scorer.
|
|
102
|
+
* Scores based on: consecutive character matches, word-start bonus,
|
|
103
|
+
* exact prefix bonus, and case-sensitive bonus.
|
|
104
|
+
*/
|
|
105
|
+
export declare function fuzzyScore(query: string, text: string): {
|
|
106
|
+
score: number;
|
|
107
|
+
matches: [number, number][];
|
|
108
|
+
} | null;
|
|
109
|
+
/**
|
|
110
|
+
* Filter and rank an array of items by a fuzzy query.
|
|
111
|
+
*/
|
|
112
|
+
export declare function fuzzyFilter<T>(items: T[], query: string, getText: (item: T) => string): FuzzyResult<T>[];
|
|
113
|
+
export declare function scopePriority(scope: ShortcutScope): number;
|
|
114
|
+
export interface SerializedOverride {
|
|
115
|
+
commandId: string;
|
|
116
|
+
keybinding: KeyBinding;
|
|
117
|
+
}
|
|
118
|
+
export declare function serialiseOverrides(overrides: Map<string, KeyBinding>): string;
|
|
119
|
+
export declare function deserialiseOverrides(json: string): Map<string, KeyBinding>;
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
let f = null;
|
|
2
|
+
function u() {
|
|
3
|
+
return f !== null ? f : typeof navigator > "u" ? !1 : (f = /mac|ipod|iphone|ipad/i.test(navigator.platform ?? navigator.userAgent ?? ""), f);
|
|
4
|
+
}
|
|
5
|
+
const d = {
|
|
6
|
+
meta: "⌘",
|
|
7
|
+
ctrl: "⌃",
|
|
8
|
+
alt: "⌥",
|
|
9
|
+
shift: "⇧",
|
|
10
|
+
enter: "↵",
|
|
11
|
+
backspace: "⌫",
|
|
12
|
+
delete: "⌦",
|
|
13
|
+
escape: "Esc",
|
|
14
|
+
arrowup: "↑",
|
|
15
|
+
arrowdown: "↓",
|
|
16
|
+
arrowleft: "←",
|
|
17
|
+
arrowright: "→",
|
|
18
|
+
tab: "⇥",
|
|
19
|
+
space: "␣"
|
|
20
|
+
}, w = {
|
|
21
|
+
meta: "Ctrl",
|
|
22
|
+
ctrl: "Ctrl",
|
|
23
|
+
alt: "Alt",
|
|
24
|
+
shift: "Shift",
|
|
25
|
+
enter: "Enter",
|
|
26
|
+
backspace: "Backspace",
|
|
27
|
+
delete: "Delete",
|
|
28
|
+
escape: "Esc",
|
|
29
|
+
arrowup: "↑",
|
|
30
|
+
arrowdown: "↓",
|
|
31
|
+
arrowleft: "←",
|
|
32
|
+
arrowright: "→",
|
|
33
|
+
tab: "Tab",
|
|
34
|
+
space: "Space"
|
|
35
|
+
};
|
|
36
|
+
function i(t) {
|
|
37
|
+
return (u() ? d : w)[t.toLowerCase()] ?? t.toUpperCase();
|
|
38
|
+
}
|
|
39
|
+
function C(t) {
|
|
40
|
+
const e = [];
|
|
41
|
+
return u() ? (t.ctrl && e.push(i("ctrl")), t.alt && e.push(i("alt")), t.shift && e.push(i("shift")), t.meta && e.push(i("meta"))) : ((t.meta || t.ctrl) && e.push(i("ctrl")), t.alt && e.push(i("alt")), t.shift && e.push(i("shift"))), e.push(i(t.key)), e;
|
|
42
|
+
}
|
|
43
|
+
function W(t) {
|
|
44
|
+
const e = C(t);
|
|
45
|
+
return u() ? e.join("") : e.join("+");
|
|
46
|
+
}
|
|
47
|
+
function O(t, e) {
|
|
48
|
+
if (!(t.key.toLowerCase() === e.key.toLowerCase())) return !1;
|
|
49
|
+
const o = !!e.meta, a = !!e.ctrl, s = !!e.alt, c = !!e.shift;
|
|
50
|
+
if (u())
|
|
51
|
+
return t.metaKey === o && t.ctrlKey === a && t.altKey === s && t.shiftKey === c;
|
|
52
|
+
const h = o || a;
|
|
53
|
+
return t.ctrlKey === h && t.altKey === s && t.shiftKey === c && !t.metaKey;
|
|
54
|
+
}
|
|
55
|
+
function k(t) {
|
|
56
|
+
const e = { key: "" }, r = t.includes("+") ? t.split("+").map((o) => o.trim()) : S(t);
|
|
57
|
+
for (const o of r) {
|
|
58
|
+
const a = o.toLowerCase();
|
|
59
|
+
a === "⌘" || a === "meta" || a === "cmd" || a === "command" ? e.meta = !0 : a === "⌃" || a === "ctrl" || a === "control" ? e.ctrl = !0 : a === "⌥" || a === "alt" || a === "option" ? e.alt = !0 : a === "⇧" || a === "shift" ? e.shift = !0 : e.key = o;
|
|
60
|
+
}
|
|
61
|
+
return e;
|
|
62
|
+
}
|
|
63
|
+
function S(t) {
|
|
64
|
+
const e = ["⌘", "⌃", "⌥", "⇧"], r = [];
|
|
65
|
+
let o = t;
|
|
66
|
+
for (const a of e)
|
|
67
|
+
o.includes(a) && (r.push(a), o = o.replace(a, ""));
|
|
68
|
+
return o.trim() && r.push(o.trim()), r;
|
|
69
|
+
}
|
|
70
|
+
function K(t, e) {
|
|
71
|
+
return t.key.toLowerCase() === e.key.toLowerCase() && !!t.meta == !!e.meta && !!t.ctrl == !!e.ctrl && !!t.alt == !!e.alt && !!t.shift == !!e.shift;
|
|
72
|
+
}
|
|
73
|
+
function R(t) {
|
|
74
|
+
return (/* @__PURE__ */ new Set([
|
|
75
|
+
"Control",
|
|
76
|
+
"Shift",
|
|
77
|
+
"Alt",
|
|
78
|
+
"Meta",
|
|
79
|
+
"CapsLock",
|
|
80
|
+
"NumLock",
|
|
81
|
+
"ScrollLock"
|
|
82
|
+
])).has(t.key) ? null : {
|
|
83
|
+
key: t.key,
|
|
84
|
+
meta: u() ? t.metaKey : !1,
|
|
85
|
+
ctrl: u() ? t.ctrlKey : t.ctrlKey || t.metaKey,
|
|
86
|
+
alt: t.altKey,
|
|
87
|
+
shift: t.shiftKey
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
const b = [
|
|
91
|
+
// ─── Tab & Window Shortcuts ────────────────────────────────────────────
|
|
92
|
+
{ shortcut: "meta+n", label: "New window", category: "Tab & Window" },
|
|
93
|
+
{ shortcut: "meta+shift+n", label: "New incognito window", category: "Tab & Window" },
|
|
94
|
+
{ shortcut: "meta+t", label: "New tab", category: "Tab & Window" },
|
|
95
|
+
{ shortcut: "meta+w", label: "Close current tab", category: "Tab & Window" },
|
|
96
|
+
{ shortcut: "meta+shift+w", label: "Close current window", category: "Tab & Window" },
|
|
97
|
+
{ shortcut: "meta+shift+t", label: "Reopen last closed tab", category: "Tab & Window" },
|
|
98
|
+
{ shortcut: "meta+1", label: "Switch to tab 1", category: "Tab & Window" },
|
|
99
|
+
{ shortcut: "meta+2", label: "Switch to tab 2", category: "Tab & Window" },
|
|
100
|
+
{ shortcut: "meta+3", label: "Switch to tab 3", category: "Tab & Window" },
|
|
101
|
+
{ shortcut: "meta+4", label: "Switch to tab 4", category: "Tab & Window" },
|
|
102
|
+
{ shortcut: "meta+5", label: "Switch to tab 5", category: "Tab & Window" },
|
|
103
|
+
{ shortcut: "meta+6", label: "Switch to tab 6", category: "Tab & Window" },
|
|
104
|
+
{ shortcut: "meta+7", label: "Switch to tab 7", category: "Tab & Window" },
|
|
105
|
+
{ shortcut: "meta+8", label: "Switch to tab 8", category: "Tab & Window" },
|
|
106
|
+
{ shortcut: "meta+9", label: "Switch to last tab", category: "Tab & Window" },
|
|
107
|
+
{ shortcut: "meta+shift+a", label: "Search open tabs", category: "Tab & Window" },
|
|
108
|
+
{ shortcut: "meta+m", label: "Minimise window", category: "Tab & Window" },
|
|
109
|
+
{ shortcut: "meta+q", label: "Quit Chrome", category: "Tab & Window" },
|
|
110
|
+
// ─── Google Chrome Feature Shortcuts ───────────────────────────────────
|
|
111
|
+
{ shortcut: "meta+shift+b", label: "Show/hide bookmarks bar", category: "Chrome Features" },
|
|
112
|
+
{ shortcut: "meta+alt+b", label: "Open Bookmarks Manager", category: "Chrome Features" },
|
|
113
|
+
{ shortcut: "meta+,", label: "Open Chrome Settings", category: "Chrome Features" },
|
|
114
|
+
{ shortcut: "meta+shift+delete", label: "Open Clear Browsing Data", category: "Chrome Features" },
|
|
115
|
+
{ shortcut: "meta+d", label: "Bookmark current page", category: "Chrome Features" },
|
|
116
|
+
{ shortcut: "meta+shift+d", label: "Bookmark all open tabs", category: "Chrome Features" },
|
|
117
|
+
{ shortcut: "meta+f", label: "Find on page", category: "Chrome Features" },
|
|
118
|
+
{ shortcut: "meta+g", label: "Find next", category: "Chrome Features" },
|
|
119
|
+
{ shortcut: "meta+shift+g", label: "Find previous", category: "Chrome Features" },
|
|
120
|
+
{ shortcut: "meta+h", label: "Hide Chrome", category: "Chrome Features" },
|
|
121
|
+
{ shortcut: "meta+y", label: "Open History", category: "Chrome Features" },
|
|
122
|
+
{ shortcut: "meta+j", label: "Open Downloads", category: "Chrome Features" },
|
|
123
|
+
{ shortcut: "meta+shift+j", label: "Open DevTools (Console)", category: "Chrome Features" },
|
|
124
|
+
{ shortcut: "meta+l", label: "Focus address bar", category: "Chrome Features" },
|
|
125
|
+
{ shortcut: "meta+shift+m", label: "Switch Chrome profile", category: "Chrome Features" },
|
|
126
|
+
{ shortcut: "meta+o", label: "Open file", category: "Chrome Features" },
|
|
127
|
+
{ shortcut: "meta+p", label: "Print", category: "Chrome Features" },
|
|
128
|
+
{ shortcut: "meta+r", label: "Reload page", category: "Chrome Features" },
|
|
129
|
+
{ shortcut: "meta+shift+r", label: "Hard reload (skip cache)", category: "Chrome Features" },
|
|
130
|
+
{ shortcut: "meta+s", label: "Save page as", category: "Chrome Features" },
|
|
131
|
+
{ shortcut: "meta+shift+i", label: "Open DevTools", category: "Chrome Features" },
|
|
132
|
+
{ shortcut: "meta+alt+i", label: "Open DevTools (Elements)", category: "Chrome Features" },
|
|
133
|
+
{ shortcut: "meta+alt+j", label: "Open DevTools (Console)", category: "Chrome Features" },
|
|
134
|
+
{ shortcut: "meta+shift+c", label: "Open DevTools (Inspect)", category: "Chrome Features" },
|
|
135
|
+
{ shortcut: "meta+alt+u", label: "View page source", category: "Chrome Features" },
|
|
136
|
+
{ shortcut: "meta+u", label: "View page source", category: "Chrome Features" },
|
|
137
|
+
// ─── Address Bar Shortcuts ─────────────────────────────────────────────
|
|
138
|
+
{ shortcut: "meta+e", label: "Search from address bar", category: "Address Bar" },
|
|
139
|
+
// ─── Webpage Shortcuts ─────────────────────────────────────────────────
|
|
140
|
+
{ shortcut: "meta+z", label: "Undo", category: "Webpage" },
|
|
141
|
+
{ shortcut: "meta+shift+z", label: "Redo", category: "Webpage" },
|
|
142
|
+
{ shortcut: "meta+x", label: "Cut", category: "Webpage" },
|
|
143
|
+
{ shortcut: "meta+c", label: "Copy", category: "Webpage" },
|
|
144
|
+
{ shortcut: "meta+v", label: "Paste", category: "Webpage" },
|
|
145
|
+
{ shortcut: "meta+a", label: "Select all", category: "Webpage" },
|
|
146
|
+
{ shortcut: "meta+shift+v", label: "Paste without formatting", category: "Webpage" },
|
|
147
|
+
{ shortcut: "meta+plus", label: "Zoom in", category: "Webpage" },
|
|
148
|
+
{ shortcut: "meta+-", label: "Zoom out", category: "Webpage" },
|
|
149
|
+
{ shortcut: "meta+=", label: "Zoom in", category: "Webpage" },
|
|
150
|
+
{ shortcut: "meta+0", label: "Reset zoom", category: "Webpage" },
|
|
151
|
+
// ─── System / Function Keys ────────────────────────────────────────────
|
|
152
|
+
{ shortcut: "f1", label: "Open Help", category: "System" },
|
|
153
|
+
{ shortcut: "f3", label: "Find on page", category: "System" },
|
|
154
|
+
{ shortcut: "f5", label: "Reload page", category: "System" },
|
|
155
|
+
{ shortcut: "f6", label: "Focus address bar / panels", category: "System" },
|
|
156
|
+
{ shortcut: "f7", label: "Toggle caret browsing", category: "System" },
|
|
157
|
+
{ shortcut: "f11", label: "Toggle fullscreen", category: "System" },
|
|
158
|
+
{ shortcut: "f12", label: "Open DevTools", category: "System" },
|
|
159
|
+
{ shortcut: "meta+f5", label: "Hard reload", category: "System" },
|
|
160
|
+
{ shortcut: "ctrl+f5", label: "Hard reload (Windows)", category: "System" },
|
|
161
|
+
{ shortcut: "ctrl+r", label: "Reload (Windows)", category: "System" },
|
|
162
|
+
{ shortcut: "ctrl+shift+i", label: "DevTools (Windows)", category: "System" },
|
|
163
|
+
{ shortcut: "ctrl+shift+j", label: "DevTools Console (Windows)", category: "System" }
|
|
164
|
+
], g = new Set(
|
|
165
|
+
b.map((t) => t.shortcut)
|
|
166
|
+
);
|
|
167
|
+
function p(t) {
|
|
168
|
+
const e = [];
|
|
169
|
+
return (t.meta || t.ctrl) && e.push("meta"), t.alt && e.push("alt"), t.shift && e.push("shift"), e.push(t.key.toLowerCase()), e.join("+");
|
|
170
|
+
}
|
|
171
|
+
function L(t) {
|
|
172
|
+
const e = p(t);
|
|
173
|
+
return g.has(e) || g.has(e.replace("meta+", "ctrl+"));
|
|
174
|
+
}
|
|
175
|
+
function M(t) {
|
|
176
|
+
const e = p(t);
|
|
177
|
+
return b.find(
|
|
178
|
+
(r) => r.shortcut === e || r.shortcut === e.replace("meta+", "ctrl+")
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
function T(t, e) {
|
|
182
|
+
if (!t) return { score: 0, matches: [] };
|
|
183
|
+
const r = t.toLowerCase(), o = e.toLowerCase();
|
|
184
|
+
let a = 0;
|
|
185
|
+
for (const l of r) {
|
|
186
|
+
const m = o.indexOf(l, a);
|
|
187
|
+
if (m === -1) return null;
|
|
188
|
+
a = m + 1;
|
|
189
|
+
}
|
|
190
|
+
let s = 0, c = 0, h = 0;
|
|
191
|
+
const y = [];
|
|
192
|
+
let n = -1;
|
|
193
|
+
for (let l = 0; l < e.length && c < r.length; l++)
|
|
194
|
+
o[l] === r[c] ? (s += 1, h++, h > 1 && (s += h), (l === 0 || /[\s\-_./:]/.test(e[l - 1])) && (s += 5), e[l] === t[c] && (s += 0.5), n === -1 && (n = l), c++) : (n !== -1 && (y.push([n, l - 1]), n = -1), h = 0);
|
|
195
|
+
return n !== -1 && y.push([n, n + (c - y.reduce((l, m) => l + (m[1] - m[0] + 1), 0)) - 1]), c < r.length ? null : (o.startsWith(r) && (s += 10), s += Math.max(0, 5 - (e.length - t.length) * 0.1), { score: s, matches: y });
|
|
196
|
+
}
|
|
197
|
+
function D(t, e, r) {
|
|
198
|
+
if (!e.trim()) return t.map((a) => ({ item: a, score: 0, matches: [] }));
|
|
199
|
+
const o = [];
|
|
200
|
+
for (const a of t) {
|
|
201
|
+
const s = r(a), c = T(e, s);
|
|
202
|
+
c && o.push({ item: a, score: c.score, matches: c.matches });
|
|
203
|
+
}
|
|
204
|
+
return o.sort((a, s) => s.score - a.score), o;
|
|
205
|
+
}
|
|
206
|
+
const F = {
|
|
207
|
+
global: 0,
|
|
208
|
+
module: 1,
|
|
209
|
+
page: 2,
|
|
210
|
+
modal: 3
|
|
211
|
+
};
|
|
212
|
+
function E(t) {
|
|
213
|
+
return F[t];
|
|
214
|
+
}
|
|
215
|
+
function B(t) {
|
|
216
|
+
const e = [];
|
|
217
|
+
return t.forEach((r, o) => {
|
|
218
|
+
e.push({ commandId: o, keybinding: r });
|
|
219
|
+
}), JSON.stringify(e);
|
|
220
|
+
}
|
|
221
|
+
function x(t) {
|
|
222
|
+
const e = /* @__PURE__ */ new Map();
|
|
223
|
+
try {
|
|
224
|
+
const r = JSON.parse(t);
|
|
225
|
+
for (const o of r)
|
|
226
|
+
e.set(o.commandId, o.keybinding);
|
|
227
|
+
} catch {
|
|
228
|
+
}
|
|
229
|
+
return e;
|
|
230
|
+
}
|
|
231
|
+
export {
|
|
232
|
+
b as BROWSER_SHORTCUTS,
|
|
233
|
+
x as deserialiseOverrides,
|
|
234
|
+
D as fuzzyFilter,
|
|
235
|
+
T as fuzzyScore,
|
|
236
|
+
M as getBrowserShortcutInfo,
|
|
237
|
+
i as getKeySymbol,
|
|
238
|
+
u as isMac,
|
|
239
|
+
L as isReservedShortcut,
|
|
240
|
+
R as keybindingFromEvent,
|
|
241
|
+
W as keybindingToString,
|
|
242
|
+
C as keybindingToSymbols,
|
|
243
|
+
K as keybindingsEqual,
|
|
244
|
+
O as matchesKeybinding,
|
|
245
|
+
k as parseKeybinding,
|
|
246
|
+
E as scopePriority,
|
|
247
|
+
B as serialiseOverrides
|
|
248
|
+
};
|