impact-nova 1.5.6 → 1.5.8
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/dist/components/layout/dashboard-layout.d.ts +24 -39
- package/dist/components/ui/ag-grid-react/cell-renderers/date-display-renderer.js +39 -32
- package/dist/components/ui/ag-grid-react/cell-renderers/editors/date-cell-editor.js +47 -47
- package/dist/components/ui/ag-grid-react/cell-renderers/editors/percent-progress-cell-editor.d.ts +16 -0
- package/dist/components/ui/ag-grid-react/cell-renderers/editors/percent-progress-cell-editor.js +135 -0
- package/dist/components/ui/ag-grid-react/cell-renderers/editors/select-cell-editor.js +39 -36
- package/dist/components/ui/ag-grid-react/cell-renderers/index.d.ts +14 -1
- package/dist/components/ui/ag-grid-react/cell-renderers/index.js +41 -35
- package/dist/components/ui/ag-grid-react/cell-renderers/percent-progress-display-renderer.d.ts +31 -0
- package/dist/components/ui/ag-grid-react/cell-renderers/percent-progress-display-renderer.js +63 -0
- package/dist/components/ui/ag-grid-react/cell-renderers/select-display-renderer.js +18 -12
- package/dist/components/ui/badge.d.ts +2 -1
- package/dist/components/ui/badge.js +17 -12
- package/dist/components/ui/command-palette/command-palette-context.d.ts +4 -2
- package/dist/components/ui/command-palette/command-palette-context.js +76 -77
- package/dist/components/ui/command-palette/command-palette.d.ts +20 -4
- package/dist/components/ui/command-palette/command-palette.js +210 -180
- package/dist/components/ui/command-palette/index.d.ts +3 -3
- package/dist/components/ui/command-palette/index.js +43 -40
- package/dist/components/ui/command-palette/shortcut-registry.d.ts +15 -2
- package/dist/components/ui/command-palette/shortcut-registry.js +61 -35
- package/dist/components/ui/command-palette/shortcut-settings.d.ts +14 -3
- package/dist/components/ui/command-palette/shortcut-settings.js +97 -90
- package/dist/components/ui/command-palette/utils.d.ts +15 -0
- package/dist/components/ui/command-palette/utils.js +105 -70
- package/dist/components/ui/filter-strip/filter-strip.d.ts +1 -1
- package/dist/components/ui/filter-strip/filter-strip.js +24 -22
- package/dist/components/ui/filter-strip/filter-tag-list.js +4 -4
- package/dist/components/ui/select/select.js +41 -41
- package/dist/components/ui/tabs.js +46 -45
- package/dist/icons/assets/command-pallet.svg.js +5 -0
- package/dist/icons/index.d.ts +2 -0
- package/dist/icons/index.js +146 -143
- package/dist/impact-nova.css +1 -1
- package/dist/index.js +100 -97
- package/package.json +1 -1
|
@@ -1,44 +1,47 @@
|
|
|
1
|
-
import { BROWSER_SHORTCUTS as o,
|
|
2
|
-
import { ShortcutRegistry as
|
|
3
|
-
import { CommandPaletteProvider as
|
|
4
|
-
import { useShortcut as
|
|
5
|
-
import { useGlobalShortcut as
|
|
6
|
-
import { useBrowserShortcuts as
|
|
7
|
-
import { ShortcutScopeProvider as
|
|
8
|
-
import { CommandPalette as
|
|
9
|
-
import { Kbd as
|
|
10
|
-
import { ShortcutSettings as
|
|
1
|
+
import { BROWSER_SHORTCUTS as o, deserialiseOverrides as r, fuzzyFilter as m, fuzzyScore as a, getBrowserShortcutInfo as i, getKeySymbol as n, isMac as d, isReservedShortcut as s, keybindingFromEvent as l, keybindingToString as S, keybindingToSymbols as p, keybindingsEqual as u, matchesKeybinding as c, parseKeybinding as y, scopePriority as P, serialiseOverrides as f } from "./utils.js";
|
|
2
|
+
import { LocalStorageAdapter as C, ShortcutRegistry as b } from "./shortcut-registry.js";
|
|
3
|
+
import { CommandPaletteProvider as x, useCommandPalette as v } from "./command-palette-context.js";
|
|
4
|
+
import { useShortcut as k } from "./use-shortcut.js";
|
|
5
|
+
import { useGlobalShortcut as E } from "./use-global-shortcut.js";
|
|
6
|
+
import { useBrowserShortcuts as O } from "./use-browser-shortcuts.js";
|
|
7
|
+
import { ShortcutScopeProvider as B } from "./shortcut-scope-provider.js";
|
|
8
|
+
import { CommandPalette as I, CommandPaletteEmpty as w, CommandPaletteFooter as G, CommandPaletteGroup as L, CommandPaletteInput as q, CommandPaletteItem as A, CommandPaletteList as H, CommandPaletteSeparator as M, CommandPaletteShortcut as U } from "./command-palette.js";
|
|
9
|
+
import { Kbd as _ } from "./kbd.js";
|
|
10
|
+
import { ShortcutSettings as D } from "./shortcut-settings.js";
|
|
11
11
|
export {
|
|
12
12
|
o as BROWSER_SHORTCUTS,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
13
|
+
I as CommandPalette,
|
|
14
|
+
w as CommandPaletteEmpty,
|
|
15
|
+
G as CommandPaletteFooter,
|
|
16
|
+
L as CommandPaletteGroup,
|
|
17
|
+
q as CommandPaletteInput,
|
|
18
|
+
A as CommandPaletteItem,
|
|
19
|
+
H as CommandPaletteList,
|
|
20
|
+
x as CommandPaletteProvider,
|
|
21
|
+
M as CommandPaletteSeparator,
|
|
22
|
+
U as CommandPaletteShortcut,
|
|
23
|
+
_ as Kbd,
|
|
24
|
+
C as LocalStorageAdapter,
|
|
25
|
+
b as ShortcutRegistry,
|
|
26
|
+
B as ShortcutScopeProvider,
|
|
27
|
+
D as ShortcutSettings,
|
|
28
|
+
r as deserialiseOverrides,
|
|
29
|
+
m as fuzzyFilter,
|
|
30
|
+
a as fuzzyScore,
|
|
31
|
+
i as getBrowserShortcutInfo,
|
|
30
32
|
n as getKeySymbol,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
33
|
+
d as isMac,
|
|
34
|
+
s as isReservedShortcut,
|
|
35
|
+
l as keybindingFromEvent,
|
|
36
|
+
S as keybindingToString,
|
|
37
|
+
p as keybindingToSymbols,
|
|
38
|
+
u as keybindingsEqual,
|
|
39
|
+
c as matchesKeybinding,
|
|
40
|
+
y as parseKeybinding,
|
|
41
|
+
P as scopePriority,
|
|
42
|
+
f as serialiseOverrides,
|
|
43
|
+
O as useBrowserShortcuts,
|
|
44
|
+
v as useCommandPalette,
|
|
45
|
+
E as useGlobalShortcut,
|
|
46
|
+
k as useShortcut
|
|
44
47
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CommandDefinition, KeyBinding, ShortcutScope } from './utils';
|
|
1
|
+
import { CommandDefinition, KeyBinding, ShortcutScope, ShortcutStorageAdapter } from './utils';
|
|
2
2
|
export type RegistryChangeEvent = {
|
|
3
3
|
type: 'register' | 'unregister' | 'update-keybinding' | 'reset-keybinding' | 'scope-change';
|
|
4
4
|
commandId?: string;
|
|
@@ -9,6 +9,18 @@ export interface ConflictInfo {
|
|
|
9
9
|
conflictingLabel: string;
|
|
10
10
|
scope: ShortcutScope;
|
|
11
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* Default localStorage-based storage adapter.
|
|
14
|
+
* Maintains backward compatibility with existing localStorage implementation.
|
|
15
|
+
*/
|
|
16
|
+
export declare class LocalStorageAdapter implements ShortcutStorageAdapter {
|
|
17
|
+
private static readonly STORAGE_KEY;
|
|
18
|
+
private static readonly RECENT_COMMANDS_KEY;
|
|
19
|
+
getOverrides(): Map<string, KeyBinding> | null;
|
|
20
|
+
saveOverrides(overrides: Map<string, KeyBinding>): void;
|
|
21
|
+
getRecentCommands(): string[] | null;
|
|
22
|
+
saveRecentCommands(ids: string[]): void;
|
|
23
|
+
}
|
|
12
24
|
export declare class ShortcutRegistry {
|
|
13
25
|
private commands;
|
|
14
26
|
private overrides;
|
|
@@ -16,7 +28,8 @@ export declare class ShortcutRegistry {
|
|
|
16
28
|
private listeners;
|
|
17
29
|
private activeScopes;
|
|
18
30
|
private activeInstance;
|
|
19
|
-
|
|
31
|
+
private storage;
|
|
32
|
+
constructor(storage?: ShortcutStorageAdapter);
|
|
20
33
|
setActiveInstance(instance: string | null): void;
|
|
21
34
|
getActiveInstance(): string | null;
|
|
22
35
|
/**
|
|
@@ -1,5 +1,45 @@
|
|
|
1
|
-
import {
|
|
2
|
-
const
|
|
1
|
+
import { deserialiseOverrides as h, serialiseOverrides as u, isReservedShortcut as f, keybindingsEqual as m, matchesKeybinding as g, scopePriority as o } from "./utils.js";
|
|
2
|
+
const v = 10;
|
|
3
|
+
class c {
|
|
4
|
+
static STORAGE_KEY = "impact-nova-shortcuts";
|
|
5
|
+
static RECENT_COMMANDS_KEY = "impact-nova-recent-commands";
|
|
6
|
+
getOverrides() {
|
|
7
|
+
if (typeof localStorage > "u") return null;
|
|
8
|
+
try {
|
|
9
|
+
const e = localStorage.getItem(c.STORAGE_KEY);
|
|
10
|
+
return e ? h(e) : null;
|
|
11
|
+
} catch {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
saveOverrides(e) {
|
|
16
|
+
if (!(typeof localStorage > "u"))
|
|
17
|
+
try {
|
|
18
|
+
localStorage.setItem(c.STORAGE_KEY, u(e));
|
|
19
|
+
} catch {
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
getRecentCommands() {
|
|
23
|
+
if (typeof localStorage > "u") return null;
|
|
24
|
+
try {
|
|
25
|
+
const e = localStorage.getItem(c.RECENT_COMMANDS_KEY);
|
|
26
|
+
if (e) {
|
|
27
|
+
const t = JSON.parse(e);
|
|
28
|
+
return Array.isArray(t) ? t : null;
|
|
29
|
+
}
|
|
30
|
+
return null;
|
|
31
|
+
} catch {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
saveRecentCommands(e) {
|
|
36
|
+
if (!(typeof localStorage > "u"))
|
|
37
|
+
try {
|
|
38
|
+
localStorage.setItem(c.RECENT_COMMANDS_KEY, JSON.stringify(e));
|
|
39
|
+
} catch {
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
3
43
|
class C {
|
|
4
44
|
commands = /* @__PURE__ */ new Map();
|
|
5
45
|
overrides = /* @__PURE__ */ new Map();
|
|
@@ -7,8 +47,9 @@ class C {
|
|
|
7
47
|
listeners = /* @__PURE__ */ new Set();
|
|
8
48
|
activeScopes = /* @__PURE__ */ new Set();
|
|
9
49
|
activeInstance = null;
|
|
10
|
-
|
|
11
|
-
|
|
50
|
+
storage;
|
|
51
|
+
constructor(e) {
|
|
52
|
+
this.storage = e ?? new c(), this.activeScopes.add("global"), this.loadOverrides(), this.loadRecentCommands();
|
|
12
53
|
}
|
|
13
54
|
// ─── Instance Management ────────────────────────────────────────────────
|
|
14
55
|
setActiveInstance(e) {
|
|
@@ -58,8 +99,8 @@ class C {
|
|
|
58
99
|
findConflict(e, t, s) {
|
|
59
100
|
for (const [n, r] of this.commands) {
|
|
60
101
|
if (n === e || r.scope !== s) continue;
|
|
61
|
-
const
|
|
62
|
-
if (
|
|
102
|
+
const a = this.getEffectiveKeybinding(n);
|
|
103
|
+
if (a && m(a, t))
|
|
63
104
|
return {
|
|
64
105
|
conflictingCommandId: n,
|
|
65
106
|
conflictingLabel: r.label,
|
|
@@ -99,7 +140,7 @@ class C {
|
|
|
99
140
|
*/
|
|
100
141
|
getPaletteCommands() {
|
|
101
142
|
const t = this.getRegisteredInstances().length > 1;
|
|
102
|
-
return this.getAllCommands().filter((s) => !(s.hidden || s.when && !s.when() || s.instance && t && this.activeInstance && s.instance !== this.activeInstance));
|
|
143
|
+
return this.getAllCommands().filter((s) => !(s.hidden || s.when && !s.when() || !this.activeScopes.has(s.scope) || s.instance && t && this.activeInstance && s.instance !== this.activeInstance));
|
|
103
144
|
}
|
|
104
145
|
/**
|
|
105
146
|
* Get commands for the settings panel (all registered, including hidden).
|
|
@@ -116,13 +157,13 @@ class C {
|
|
|
116
157
|
*/
|
|
117
158
|
handleKeyEvent(e) {
|
|
118
159
|
const t = this.activeScopes.has("modal"), n = this.getRegisteredInstances().length > 1;
|
|
119
|
-
let r = null,
|
|
160
|
+
let r = null, a = -1;
|
|
120
161
|
for (const i of this.commands.values()) {
|
|
121
162
|
if (i.passive) continue;
|
|
122
|
-
const
|
|
123
|
-
if (
|
|
124
|
-
const
|
|
125
|
-
|
|
163
|
+
const d = this.getEffectiveKeybinding(i.id);
|
|
164
|
+
if (d && !(t && i.scope !== "modal") && !(i.instance && n && i.instance !== this.activeInstance) && !(i.when && !i.when()) && g(e, d)) {
|
|
165
|
+
const l = o(i.scope);
|
|
166
|
+
l > a && (r = i, a = l);
|
|
126
167
|
}
|
|
127
168
|
}
|
|
128
169
|
return r ? (e.preventDefault(), e.stopPropagation(), r.handler(), this.addRecentCommand(r.id), !0) : !1;
|
|
@@ -135,7 +176,7 @@ class C {
|
|
|
135
176
|
this.recentCommandIds = [
|
|
136
177
|
e,
|
|
137
178
|
...this.recentCommandIds.filter((t) => t !== e)
|
|
138
|
-
].slice(0,
|
|
179
|
+
].slice(0, v), this.saveRecentCommands();
|
|
139
180
|
}
|
|
140
181
|
// ─── Event System ─────────────────────────────────────────────────────
|
|
141
182
|
subscribe(e) {
|
|
@@ -148,36 +189,21 @@ class C {
|
|
|
148
189
|
}
|
|
149
190
|
// ─── Persistence ──────────────────────────────────────────────────────
|
|
150
191
|
loadOverrides() {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
const e = localStorage.getItem(l);
|
|
154
|
-
e && (this.overrides = g(e));
|
|
155
|
-
} catch {
|
|
156
|
-
}
|
|
192
|
+
const e = this.storage.getOverrides();
|
|
193
|
+
e && (this.overrides = e);
|
|
157
194
|
}
|
|
158
195
|
saveOverrides() {
|
|
159
|
-
|
|
160
|
-
try {
|
|
161
|
-
localStorage.setItem(l, v(this.overrides));
|
|
162
|
-
} catch {
|
|
163
|
-
}
|
|
196
|
+
this.storage.saveOverrides(this.overrides);
|
|
164
197
|
}
|
|
165
198
|
loadRecentCommands() {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
const e = localStorage.getItem(h);
|
|
169
|
-
e && (this.recentCommandIds = JSON.parse(e));
|
|
170
|
-
} catch {
|
|
171
|
-
}
|
|
199
|
+
const e = this.storage.getRecentCommands();
|
|
200
|
+
e && (this.recentCommandIds = e);
|
|
172
201
|
}
|
|
173
202
|
saveRecentCommands() {
|
|
174
|
-
|
|
175
|
-
try {
|
|
176
|
-
localStorage.setItem(h, JSON.stringify(this.recentCommandIds));
|
|
177
|
-
} catch {
|
|
178
|
-
}
|
|
203
|
+
this.storage.saveRecentCommands(this.recentCommandIds);
|
|
179
204
|
}
|
|
180
205
|
}
|
|
181
206
|
export {
|
|
207
|
+
c as LocalStorageAdapter,
|
|
182
208
|
C as ShortcutRegistry
|
|
183
209
|
};
|
|
@@ -19,9 +19,20 @@ export interface ShortcutSettingsProps extends Omit<React.HTMLAttributes<HTMLDiv
|
|
|
19
19
|
sources?: Array<'system' | 'user' | 'ag-grid' | 'browser'>;
|
|
20
20
|
/** Optional render prop to hoist the recording indicator/conflict message up to a parent toolbar */
|
|
21
21
|
renderStatus?: (node: React.ReactNode | null) => React.ReactNode;
|
|
22
|
+
/** Label shown during recording mode */
|
|
23
|
+
recordingLabel?: string;
|
|
24
|
+
/** Instruction for recording a shortcut */
|
|
25
|
+
pressShortcutLabel?: string;
|
|
26
|
+
/** Label for adding a new shortcut */
|
|
27
|
+
addShortcutLabel?: string;
|
|
28
|
+
/** Warning message for shortcut conflicts */
|
|
29
|
+
conflictWarnLabel?: string;
|
|
30
|
+
/** Warning message for browser-reserved shortcuts */
|
|
31
|
+
reservedWarnLabel?: string;
|
|
32
|
+
/** Detailed instruction for recording state */
|
|
33
|
+
recordingInstruction?: string;
|
|
22
34
|
}
|
|
23
|
-
declare function ShortcutSettings({ className, scopes, sources, renderStatus, ...props }: ShortcutSettingsProps): import("react/jsx-runtime").JSX.Element;
|
|
24
|
-
declare namespace ShortcutSettings {
|
|
35
|
+
export declare function ShortcutSettings({ className, scopes, sources, renderStatus, recordingLabel, pressShortcutLabel, addShortcutLabel, conflictWarnLabel, reservedWarnLabel, recordingInstruction, ...props }: ShortcutSettingsProps): import("react/jsx-runtime").JSX.Element;
|
|
36
|
+
export declare namespace ShortcutSettings {
|
|
25
37
|
var displayName: string;
|
|
26
38
|
}
|
|
27
|
-
export { ShortcutSettings };
|
|
@@ -1,158 +1,167 @@
|
|
|
1
|
-
import { jsx as r, jsxs as
|
|
1
|
+
import { jsx as r, jsxs as g, Fragment as U } from "react/jsx-runtime";
|
|
2
2
|
import * as n from "react";
|
|
3
|
-
import { User as
|
|
4
|
-
import { cn as
|
|
5
|
-
import { ModuleRegistry as
|
|
6
|
-
import { AllEnterpriseModule as
|
|
7
|
-
import { DataTable as
|
|
8
|
-
import { AG_CELL_NO_PADDING as
|
|
9
|
-
import { Kbd as
|
|
10
|
-
import { useCommandPalette as
|
|
11
|
-
import { keybindingToString as
|
|
12
|
-
import { BadgeCellRenderer as
|
|
13
|
-
|
|
14
|
-
const
|
|
3
|
+
import { User as _, Monitor as K, AlertTriangle as j, Lock as G, RotateCcw as z } from "lucide-react";
|
|
4
|
+
import { cn as h } from "../../../lib/utils.js";
|
|
5
|
+
import { ModuleRegistry as B, AllCommunityModule as O } from "ag-grid-community";
|
|
6
|
+
import { AllEnterpriseModule as $ } from "ag-grid-enterprise";
|
|
7
|
+
import { DataTable as H, DataTableContent as V } from "../data-table/data-table.js";
|
|
8
|
+
import { AG_CELL_NO_PADDING as A } from "../ag-grid-react/cell-renderers/index.js";
|
|
9
|
+
import { Kbd as q } from "./kbd.js";
|
|
10
|
+
import { useCommandPalette as J } from "./command-palette-context.js";
|
|
11
|
+
import { keybindingToString as Q, keybindingFromEvent as X, isReservedShortcut as Y } from "./utils.js";
|
|
12
|
+
import { BadgeCellRenderer as Z } from "../ag-grid-react/cell-renderers/badge-cell-renderer.js";
|
|
13
|
+
B.registerModules([O, $]);
|
|
14
|
+
const W = {
|
|
15
15
|
system: "System",
|
|
16
16
|
user: "User",
|
|
17
17
|
"ag-grid": "AG Grid",
|
|
18
18
|
browser: "Browser"
|
|
19
19
|
};
|
|
20
|
-
function
|
|
21
|
-
const e =
|
|
22
|
-
return e ? /* @__PURE__ */
|
|
23
|
-
!e.customisable && /* @__PURE__ */ r(
|
|
24
|
-
/* @__PURE__ */
|
|
20
|
+
function ee(i) {
|
|
21
|
+
const e = i.data;
|
|
22
|
+
return e ? /* @__PURE__ */ g("div", { className: "flex items-center gap-2 min-w-0 h-full", children: [
|
|
23
|
+
!e.customisable && /* @__PURE__ */ r(G, { className: "h-3 w-3 text-[#9ca3af] shrink-0" }),
|
|
24
|
+
/* @__PURE__ */ g("div", { className: "flex flex-col min-w-0 gap-0", children: [
|
|
25
25
|
/* @__PURE__ */ r("span", { className: "truncate font-medium text-[#374151] text-xs leading-tight", children: e.command }),
|
|
26
26
|
e.description && /* @__PURE__ */ r("span", { className: "truncate text-[10px] text-[#9ca3af] leading-tight", children: e.description })
|
|
27
27
|
] })
|
|
28
28
|
] }) : null;
|
|
29
29
|
}
|
|
30
|
-
function
|
|
31
|
-
const e =
|
|
30
|
+
function te(i) {
|
|
31
|
+
const e = i.data;
|
|
32
32
|
if (!e) return null;
|
|
33
|
-
const c =
|
|
34
|
-
return /* @__PURE__ */ r("div", { className:
|
|
33
|
+
const c = i.recordingCommandId === e.id;
|
|
34
|
+
return /* @__PURE__ */ r("div", { className: h(
|
|
35
35
|
"w-full h-full flex items-center ag-cell-inner-padding",
|
|
36
36
|
e.customisable ? "in-ag-editable-cell-highlight" : ""
|
|
37
37
|
), children: /* @__PURE__ */ r(
|
|
38
38
|
"div",
|
|
39
39
|
{
|
|
40
|
-
className:
|
|
40
|
+
className: h(
|
|
41
41
|
"flex items-center justify-between w-full h-7 rounded-[8px] px-1.5 group/row relative",
|
|
42
42
|
e.customisable ? "bg-white" : "bg-transparent",
|
|
43
43
|
c && "ring-1 ring-[#4259ee] border border-[#4259ee]"
|
|
44
44
|
),
|
|
45
|
-
children: c ? /* @__PURE__ */ r("span", { className: "text-xs text-[#4259ee] font-medium animate-pulse", children: "Press desired shortcut..." }) : /* @__PURE__ */
|
|
45
|
+
children: c ? /* @__PURE__ */ r("span", { className: "text-xs text-[#4259ee] font-medium animate-pulse", children: i.recordingLabel ?? "Press desired shortcut..." }) : /* @__PURE__ */ g(U, { children: [
|
|
46
46
|
e.keybinding ? /* @__PURE__ */ r(
|
|
47
47
|
"button",
|
|
48
48
|
{
|
|
49
|
+
type: "button",
|
|
49
50
|
onClick: (a) => {
|
|
50
|
-
a.stopPropagation(), e.customisable &&
|
|
51
|
+
a.stopPropagation(), e.customisable && i.onStartRecording(e.id);
|
|
51
52
|
},
|
|
52
53
|
disabled: !e.customisable,
|
|
53
|
-
className:
|
|
54
|
+
className: h(
|
|
54
55
|
"flex items-center justify-end h-full w-full text-right",
|
|
55
56
|
e.customisable ? "cursor-pointer" : "cursor-default opacity-70"
|
|
56
57
|
),
|
|
57
|
-
children: /* @__PURE__ */ r(
|
|
58
|
+
children: /* @__PURE__ */ r(q, { keybinding: e.keybinding, size: "sm" })
|
|
58
59
|
}
|
|
59
60
|
) : e.customisable ? /* @__PURE__ */ r(
|
|
60
61
|
"button",
|
|
61
62
|
{
|
|
63
|
+
type: "button",
|
|
62
64
|
onClick: (a) => {
|
|
63
|
-
a.stopPropagation(),
|
|
65
|
+
a.stopPropagation(), i.onStartRecording(e.id);
|
|
64
66
|
},
|
|
65
67
|
className: "flex items-center justify-end h-full w-full text-xs text-[#9ca3af] hover:text-[#4259ee] transition-colors cursor-pointer text-right",
|
|
66
|
-
children: "Add shortcut"
|
|
68
|
+
children: i.addShortcutLabel ?? "Add shortcut"
|
|
67
69
|
}
|
|
68
70
|
) : /* @__PURE__ */ r("span", { className: "text-xs text-transparent", children: "--" }),
|
|
69
71
|
e.hasOverride && e.customisable && !c && /* @__PURE__ */ r(
|
|
70
72
|
"button",
|
|
71
73
|
{
|
|
74
|
+
type: "button",
|
|
72
75
|
onClick: (a) => {
|
|
73
|
-
a.stopPropagation(),
|
|
76
|
+
a.stopPropagation(), i.onReset(e.id);
|
|
74
77
|
},
|
|
75
78
|
className: "absolute right-1 p-0.5 rounded bg-white hover:bg-[#f3f4f6] hover:text-[#ef4444] cursor-pointer opacity-0 group-hover/row:opacity-100 transition-opacity z-10",
|
|
76
79
|
title: "Reset to default",
|
|
77
|
-
children: /* @__PURE__ */ r(
|
|
80
|
+
children: /* @__PURE__ */ r(z, { className: "h-3 w-3" })
|
|
78
81
|
}
|
|
79
82
|
)
|
|
80
83
|
] })
|
|
81
84
|
}
|
|
82
85
|
) });
|
|
83
86
|
}
|
|
84
|
-
function
|
|
85
|
-
const e =
|
|
87
|
+
function re(i) {
|
|
88
|
+
const e = i.data;
|
|
86
89
|
return e ? /* @__PURE__ */ r("div", { className: "flex items-center h-full", children: /* @__PURE__ */ r("span", { className: "text-xs text-[#6b7280] capitalize", children: e.scope }) }) : null;
|
|
87
90
|
}
|
|
88
|
-
function
|
|
89
|
-
className:
|
|
91
|
+
function se({
|
|
92
|
+
className: i,
|
|
90
93
|
scopes: e,
|
|
91
94
|
sources: c,
|
|
92
95
|
renderStatus: a,
|
|
93
|
-
|
|
96
|
+
recordingLabel: ie,
|
|
97
|
+
pressShortcutLabel: b,
|
|
98
|
+
addShortcutLabel: x,
|
|
99
|
+
conflictWarnLabel: y = "Conflicts with other shortcuts",
|
|
100
|
+
reservedWarnLabel: p = "This shortcut is reserved by the browser",
|
|
101
|
+
recordingInstruction: P = "Recording: Press shortcut or Esc",
|
|
102
|
+
...le
|
|
94
103
|
}) {
|
|
95
104
|
const {
|
|
96
|
-
getSettingsCommands:
|
|
97
|
-
getEffectiveKeybinding:
|
|
98
|
-
updateKeybinding:
|
|
99
|
-
resetKeybinding:
|
|
100
|
-
version:
|
|
101
|
-
} =
|
|
102
|
-
let s =
|
|
105
|
+
getSettingsCommands: w,
|
|
106
|
+
getEffectiveKeybinding: C,
|
|
107
|
+
updateKeybinding: v,
|
|
108
|
+
resetKeybinding: S,
|
|
109
|
+
version: D
|
|
110
|
+
} = J(), [o, m] = n.useState(null), [d, l] = n.useState(null), T = n.useMemo(() => {
|
|
111
|
+
let s = w();
|
|
103
112
|
return e && (s = s.filter((t) => e.includes(t.scope))), c && (s = s.filter((t) => t.source && c.includes(t.source))), s.map((t) => {
|
|
104
|
-
const u =
|
|
113
|
+
const u = C(t.id), f = t.source ?? "user", E = W[f] ?? t.source ?? "User", M = E.toLowerCase() === "user";
|
|
105
114
|
return {
|
|
106
115
|
id: t.id,
|
|
107
116
|
command: t.label,
|
|
108
117
|
description: t.description || "",
|
|
109
118
|
category: t.category || "General",
|
|
110
119
|
keybinding: u,
|
|
111
|
-
keybindingDisplay: u ?
|
|
120
|
+
keybindingDisplay: u ? Q(u) : "",
|
|
112
121
|
scope: t.scope,
|
|
113
|
-
source:
|
|
114
|
-
sourceColor:
|
|
115
|
-
sourceIcon:
|
|
122
|
+
source: E,
|
|
123
|
+
sourceColor: M ? "primary" : "neutral",
|
|
124
|
+
sourceIcon: M ? /* @__PURE__ */ r(_, { className: "h-3 w-3" }) : /* @__PURE__ */ r(K, { className: "h-3 w-3" }),
|
|
116
125
|
customisable: t.customisable !== !1,
|
|
117
126
|
passive: t.passive === !0,
|
|
118
127
|
hasOverride: t.keybinding !== void 0,
|
|
119
128
|
_def: t
|
|
120
129
|
};
|
|
121
130
|
});
|
|
122
|
-
}, [
|
|
123
|
-
|
|
124
|
-
}, []),
|
|
125
|
-
|
|
126
|
-
}, [
|
|
131
|
+
}, [D, e, c, w, C]), N = n.useCallback((s) => {
|
|
132
|
+
m(s), l(null);
|
|
133
|
+
}, []), R = n.useCallback((s) => {
|
|
134
|
+
S(s), l(null);
|
|
135
|
+
}, [S]);
|
|
127
136
|
n.useEffect(() => {
|
|
128
137
|
if (!o) return;
|
|
129
138
|
const s = (t) => {
|
|
130
139
|
if (t.preventDefault(), t.stopPropagation(), t.key === "Escape") {
|
|
131
|
-
|
|
140
|
+
m(null), l(null);
|
|
132
141
|
return;
|
|
133
142
|
}
|
|
134
|
-
const u =
|
|
143
|
+
const u = X(t);
|
|
135
144
|
if (!u) return;
|
|
136
|
-
if (
|
|
137
|
-
|
|
145
|
+
if (Y(u)) {
|
|
146
|
+
l({ type: "reserved", text: p }), m(null), setTimeout(() => l(null), 3e3);
|
|
138
147
|
return;
|
|
139
148
|
}
|
|
140
|
-
const
|
|
141
|
-
|
|
149
|
+
const f = v(o, u);
|
|
150
|
+
f.success ? (m(null), l(null)) : f.conflict ? (l({
|
|
142
151
|
type: "conflict",
|
|
143
|
-
text:
|
|
144
|
-
}),
|
|
152
|
+
text: y
|
|
153
|
+
}), m(null), setTimeout(() => l(null), 3e3)) : f.reserved && (l({ type: "reserved", text: p }), m(null), setTimeout(() => l(null), 3e3));
|
|
145
154
|
};
|
|
146
155
|
return window.addEventListener("keydown", s, !0), () => window.removeEventListener("keydown", s, !0);
|
|
147
|
-
}, [o,
|
|
148
|
-
const
|
|
156
|
+
}, [o, v, p, y]);
|
|
157
|
+
const F = n.useMemo(() => [
|
|
149
158
|
{
|
|
150
159
|
field: "command",
|
|
151
160
|
headerName: "Command",
|
|
152
161
|
flex: 1,
|
|
153
162
|
minWidth: 200,
|
|
154
163
|
filter: "agTextColumnFilter",
|
|
155
|
-
cellRenderer:
|
|
164
|
+
cellRenderer: ee,
|
|
156
165
|
filterValueGetter: (s) => {
|
|
157
166
|
const t = s.data;
|
|
158
167
|
return t ? `${t.command} ${t.description}` : "";
|
|
@@ -170,12 +179,14 @@ function Z({
|
|
|
170
179
|
width: 180,
|
|
171
180
|
type: "rightAligned",
|
|
172
181
|
filter: "agTextColumnFilter",
|
|
173
|
-
cellRenderer:
|
|
174
|
-
cellClass:
|
|
182
|
+
cellRenderer: te,
|
|
183
|
+
cellClass: A,
|
|
175
184
|
cellRendererParams: {
|
|
176
185
|
recordingCommandId: o,
|
|
177
|
-
onStartRecording:
|
|
178
|
-
onReset:
|
|
186
|
+
onStartRecording: N,
|
|
187
|
+
onReset: R,
|
|
188
|
+
recordingLabel: b,
|
|
189
|
+
addShortcutLabel: x
|
|
179
190
|
},
|
|
180
191
|
sortable: !0
|
|
181
192
|
},
|
|
@@ -184,15 +195,15 @@ function Z({
|
|
|
184
195
|
headerName: "Scope",
|
|
185
196
|
width: 100,
|
|
186
197
|
filter: "agSetColumnFilter",
|
|
187
|
-
cellRenderer:
|
|
198
|
+
cellRenderer: re
|
|
188
199
|
},
|
|
189
200
|
{
|
|
190
201
|
field: "source",
|
|
191
202
|
headerName: "Source",
|
|
192
203
|
width: 130,
|
|
193
204
|
filter: "agSetColumnFilter",
|
|
194
|
-
cellClass:
|
|
195
|
-
cellRenderer:
|
|
205
|
+
cellClass: A,
|
|
206
|
+
cellRenderer: Z,
|
|
196
207
|
cellRendererParams: {
|
|
197
208
|
variant: "subtle",
|
|
198
209
|
colorField: "sourceColor",
|
|
@@ -212,16 +223,16 @@ function Z({
|
|
|
212
223
|
isMultiSelect: !0
|
|
213
224
|
}
|
|
214
225
|
}
|
|
215
|
-
], [o,
|
|
226
|
+
], [o, N, R, b, x]), L = n.useMemo(() => ({
|
|
216
227
|
filter: {
|
|
217
228
|
filterModel: {
|
|
218
229
|
source: {
|
|
219
230
|
filterType: "set",
|
|
220
|
-
values: ["
|
|
231
|
+
values: ["User", "AG Grid"]
|
|
221
232
|
}
|
|
222
233
|
}
|
|
223
234
|
}
|
|
224
|
-
}), []),
|
|
235
|
+
}), []), I = n.useMemo(() => ({
|
|
225
236
|
sortable: !0,
|
|
226
237
|
resizable: !0,
|
|
227
238
|
filter: !0,
|
|
@@ -229,26 +240,22 @@ function Z({
|
|
|
229
240
|
isSearchable: !0,
|
|
230
241
|
advanceSearchEnabled: !0
|
|
231
242
|
}
|
|
232
|
-
}), []),
|
|
243
|
+
}), []), k = d || o ? /* @__PURE__ */ g("div", { className: h(
|
|
233
244
|
"px-3 py-1.5 text-[10px] md:text-sm font-medium rounded-md whitespace-nowrap flex items-center gap-2",
|
|
234
245
|
d?.type === "conflict" ? "bg-[#fef3c7] text-[#92400e]" : d?.type === "reserved" ? "bg-[#fee2e2] text-[#991b1b]" : o ? "bg-[#eff6ff] text-[#1e40af] animate-[pulse_1.5s_ease-in-out_infinite]" : ""
|
|
235
246
|
), children: [
|
|
236
|
-
d?.type === "conflict" ? /* @__PURE__ */ r(
|
|
237
|
-
/* @__PURE__ */ r("span", { children: d ? d.text :
|
|
238
|
-
/* @__PURE__ */ r("strong", { children: "Recording:" }),
|
|
239
|
-
" Press shortcut or ",
|
|
240
|
-
/* @__PURE__ */ r("strong", { children: "Esc" })
|
|
241
|
-
] }) })
|
|
247
|
+
d?.type === "conflict" ? /* @__PURE__ */ r(j, { className: "h-3.5 w-3.5 shrink-0" }) : d?.type === "reserved" ? /* @__PURE__ */ r(G, { className: "h-3.5 w-3.5 shrink-0" }) : o ? /* @__PURE__ */ r("span", { className: "shrink-0 text-base", children: "⌨️" }) : null,
|
|
248
|
+
/* @__PURE__ */ r("span", { children: d ? d.text : P })
|
|
242
249
|
] }) : null;
|
|
243
|
-
return /* @__PURE__ */
|
|
244
|
-
a ? a(
|
|
250
|
+
return /* @__PURE__ */ g(H, { className: h("flex flex-col w-full h-full border-t-0", i), children: [
|
|
251
|
+
a ? a(k) : k,
|
|
245
252
|
/* @__PURE__ */ r(
|
|
246
|
-
|
|
253
|
+
V,
|
|
247
254
|
{
|
|
248
|
-
rowData:
|
|
249
|
-
columnDefs:
|
|
250
|
-
defaultColDef:
|
|
251
|
-
initialState:
|
|
255
|
+
rowData: T,
|
|
256
|
+
columnDefs: F,
|
|
257
|
+
defaultColDef: I,
|
|
258
|
+
initialState: L,
|
|
252
259
|
rowHeight: 44,
|
|
253
260
|
animateRows: !1,
|
|
254
261
|
rowSelection: "single",
|
|
@@ -260,7 +267,7 @@ function Z({
|
|
|
260
267
|
)
|
|
261
268
|
] });
|
|
262
269
|
}
|
|
263
|
-
|
|
270
|
+
se.displayName = "ShortcutSettings";
|
|
264
271
|
export {
|
|
265
|
-
|
|
272
|
+
se as ShortcutSettings
|
|
266
273
|
};
|