@andrewcyuan/focusgrid 0.2.0 → 0.3.0
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 +35 -9
- package/dist/core/index.cjs +194 -299
- package/dist/core/index.d.cts +18 -11
- package/dist/core/index.d.ts +18 -11
- package/dist/core/index.js +195 -299
- package/dist/dom/index.cjs +59 -145
- package/dist/dom/index.d.cts +0 -2
- package/dist/dom/index.d.ts +0 -2
- package/dist/dom/index.js +59 -145
- package/dist/react/index.cjs +52 -53
- package/dist/react/index.d.cts +22 -21
- package/dist/react/index.d.ts +22 -21
- package/dist/react/index.js +53 -54
- package/dist/react/styles.css +9 -9
- package/package.json +18 -24
package/dist/react/index.cjs
CHANGED
|
@@ -19,114 +19,120 @@ const defaultPaneShortcutActions = [
|
|
|
19
19
|
id: "split-right",
|
|
20
20
|
label: "Split right",
|
|
21
21
|
action: (controller) => controller.splitActive("right"),
|
|
22
|
-
defaultSequence: "Ctrl-
|
|
22
|
+
defaultSequence: "Ctrl-S |"
|
|
23
23
|
},
|
|
24
24
|
{
|
|
25
25
|
id: "split-down",
|
|
26
26
|
label: "Split down",
|
|
27
27
|
action: (controller) => controller.splitActive("down"),
|
|
28
|
-
defaultSequence: "Ctrl-
|
|
28
|
+
defaultSequence: "Ctrl-S -"
|
|
29
29
|
},
|
|
30
30
|
{
|
|
31
31
|
id: "close",
|
|
32
32
|
label: "Close active",
|
|
33
33
|
action: (controller) => controller.removeActive(),
|
|
34
|
-
defaultSequence: "Ctrl-
|
|
34
|
+
defaultSequence: "Ctrl-S X"
|
|
35
35
|
},
|
|
36
36
|
{
|
|
37
37
|
id: "focus-left",
|
|
38
38
|
label: "Focus left",
|
|
39
39
|
action: (controller) => controller.focusAdjacent("left"),
|
|
40
|
-
defaultSequence: "Ctrl-
|
|
40
|
+
defaultSequence: "Ctrl-H"
|
|
41
41
|
},
|
|
42
42
|
{
|
|
43
43
|
id: "focus-right",
|
|
44
44
|
label: "Focus right",
|
|
45
45
|
action: (controller) => controller.focusAdjacent("right"),
|
|
46
|
-
defaultSequence: "Ctrl-
|
|
46
|
+
defaultSequence: "Ctrl-L"
|
|
47
47
|
},
|
|
48
48
|
{
|
|
49
49
|
id: "focus-up",
|
|
50
50
|
label: "Focus up",
|
|
51
51
|
action: (controller) => controller.focusAdjacent("up"),
|
|
52
|
-
defaultSequence: "Ctrl-
|
|
52
|
+
defaultSequence: "Ctrl-K"
|
|
53
53
|
},
|
|
54
54
|
{
|
|
55
55
|
id: "focus-down",
|
|
56
56
|
label: "Focus down",
|
|
57
57
|
action: (controller) => controller.focusAdjacent("down"),
|
|
58
|
-
defaultSequence: "Ctrl-
|
|
58
|
+
defaultSequence: "Ctrl-J"
|
|
59
59
|
},
|
|
60
60
|
{
|
|
61
61
|
id: "swap-left",
|
|
62
62
|
label: "Swap left",
|
|
63
63
|
action: (controller) => controller.swapAdjacent("left"),
|
|
64
|
-
defaultSequence: "Ctrl-
|
|
64
|
+
defaultSequence: "Ctrl-S Shift-Left"
|
|
65
65
|
},
|
|
66
66
|
{
|
|
67
67
|
id: "swap-right",
|
|
68
68
|
label: "Swap right",
|
|
69
69
|
action: (controller) => controller.swapAdjacent("right"),
|
|
70
|
-
defaultSequence: "Ctrl-
|
|
70
|
+
defaultSequence: "Ctrl-S Shift-Right"
|
|
71
71
|
},
|
|
72
72
|
{
|
|
73
73
|
id: "swap-up",
|
|
74
74
|
label: "Swap up",
|
|
75
75
|
action: (controller) => controller.swapAdjacent("up"),
|
|
76
|
-
defaultSequence: "Ctrl-
|
|
76
|
+
defaultSequence: "Ctrl-S Shift-Up"
|
|
77
77
|
},
|
|
78
78
|
{
|
|
79
79
|
id: "swap-down",
|
|
80
80
|
label: "Swap down",
|
|
81
81
|
action: (controller) => controller.swapAdjacent("down"),
|
|
82
|
-
defaultSequence: "Ctrl-
|
|
82
|
+
defaultSequence: "Ctrl-S Shift-Down"
|
|
83
83
|
},
|
|
84
84
|
{
|
|
85
85
|
id: "resize-left",
|
|
86
86
|
label: "Resize left",
|
|
87
87
|
action: (controller) => controller.resizeActive("left", 48),
|
|
88
|
-
defaultSequence: "Ctrl-
|
|
88
|
+
defaultSequence: "Ctrl-Shift-H",
|
|
89
89
|
repeat: true
|
|
90
90
|
},
|
|
91
91
|
{
|
|
92
92
|
id: "resize-right",
|
|
93
93
|
label: "Resize right",
|
|
94
94
|
action: (controller) => controller.resizeActive("right", 48),
|
|
95
|
-
defaultSequence: "Ctrl-
|
|
95
|
+
defaultSequence: "Ctrl-Shift-L",
|
|
96
96
|
repeat: true
|
|
97
97
|
},
|
|
98
98
|
{
|
|
99
99
|
id: "resize-up",
|
|
100
100
|
label: "Resize up",
|
|
101
101
|
action: (controller) => controller.resizeActive("up", 48),
|
|
102
|
-
defaultSequence: "Ctrl-
|
|
102
|
+
defaultSequence: "Ctrl-Shift-K",
|
|
103
103
|
repeat: true
|
|
104
104
|
},
|
|
105
105
|
{
|
|
106
106
|
id: "resize-down",
|
|
107
107
|
label: "Resize down",
|
|
108
108
|
action: (controller) => controller.resizeActive("down", 48),
|
|
109
|
-
defaultSequence: "Ctrl-
|
|
109
|
+
defaultSequence: "Ctrl-Shift-J",
|
|
110
110
|
repeat: true
|
|
111
111
|
}
|
|
112
112
|
];
|
|
113
113
|
function createDefaultPaneShortcuts() {
|
|
114
114
|
return Object.fromEntries(defaultPaneShortcutActions.map((action) => [action.id, action.defaultSequence]));
|
|
115
115
|
}
|
|
116
|
-
function createDefaultPaneKeymap(controller) {
|
|
116
|
+
function createDefaultPaneKeymap(controller, shortcuts = createDefaultPaneShortcuts()) {
|
|
117
117
|
return defaultPaneShortcutActions.map((definition) => ({
|
|
118
|
-
sequence: definition.
|
|
118
|
+
sequence: shortcuts[definition.id],
|
|
119
119
|
action: () => {
|
|
120
120
|
definition.action(controller);
|
|
121
121
|
},
|
|
122
|
-
repeat: "repeat" in definition
|
|
122
|
+
repeat: "repeat" in definition && definition.repeat
|
|
123
123
|
}));
|
|
124
124
|
}
|
|
125
125
|
//#endregion
|
|
126
126
|
//#region react/src/hooks.ts
|
|
127
|
-
function useFocusGridController(createProps
|
|
128
|
-
const [
|
|
129
|
-
|
|
127
|
+
function useFocusGridController(createProps) {
|
|
128
|
+
const [controllers] = (0, react.useState)(() => {
|
|
129
|
+
const domController = new _andrewcyuan_focusgrid_dom.FocusGridDomController();
|
|
130
|
+
return {
|
|
131
|
+
controller: new _andrewcyuan_focusgrid_core.FocusGridController(createProps(), domController),
|
|
132
|
+
domController
|
|
133
|
+
};
|
|
134
|
+
});
|
|
135
|
+
return controllers;
|
|
130
136
|
}
|
|
131
137
|
function useControllerLayout(controller) {
|
|
132
138
|
const subscribe = (0, react.useCallback)((notify) => controller.subscribe(notify), [controller]);
|
|
@@ -134,34 +140,25 @@ function useControllerLayout(controller) {
|
|
|
134
140
|
return (0, react.useSyncExternalStore)(subscribe, getLayout, getLayout);
|
|
135
141
|
}
|
|
136
142
|
//#endregion
|
|
137
|
-
//#region react/src/ResizeHandle.tsx
|
|
138
|
-
function ResizeHandle({ handle }) {
|
|
139
|
-
const style = {
|
|
140
|
-
left: handle.rect.x,
|
|
141
|
-
top: handle.rect.y,
|
|
142
|
-
width: handle.rect.width,
|
|
143
|
-
height: handle.rect.height
|
|
144
|
-
};
|
|
145
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
146
|
-
className: "FocusgridResizeHandle",
|
|
147
|
-
"data-direction": handle.direction,
|
|
148
|
-
style,
|
|
149
|
-
role: "separator",
|
|
150
|
-
"aria-orientation": handle.direction === "horizontal" ? "vertical" : "horizontal",
|
|
151
|
-
"data-resize-handle": handle.id
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
//#endregion
|
|
155
143
|
//#region react/src/PaneView.tsx
|
|
156
|
-
function PaneView({ node, renderPane }) {
|
|
157
|
-
return renderNode(node, renderPane);
|
|
158
|
-
}
|
|
159
144
|
function renderNode(node, renderPane) {
|
|
160
145
|
if (node.kind === "pane") return [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(PaneShell, {
|
|
161
146
|
pane: node.pane,
|
|
162
147
|
renderPane
|
|
163
148
|
}, `pane:${node.pane.paneId}`)];
|
|
164
|
-
return node.children.flatMap((child, index) =>
|
|
149
|
+
return node.children.flatMap((child, index) => {
|
|
150
|
+
const elements = renderNode(child, renderPane);
|
|
151
|
+
const handle = node.handles[index];
|
|
152
|
+
return handle ? [...elements, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ResizeHandle, { handle }, `handle:${handle.id}`)] : elements;
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
function rectStyle(rect) {
|
|
156
|
+
return {
|
|
157
|
+
left: rect.x,
|
|
158
|
+
top: rect.y,
|
|
159
|
+
width: rect.width,
|
|
160
|
+
height: rect.height
|
|
161
|
+
};
|
|
165
162
|
}
|
|
166
163
|
function PaneShell({ pane, renderPane }) {
|
|
167
164
|
const { controller } = useGridControllers();
|
|
@@ -170,12 +167,7 @@ function PaneShell({ pane, renderPane }) {
|
|
|
170
167
|
"data-active": pane.active,
|
|
171
168
|
"data-pane-id": pane.paneId,
|
|
172
169
|
tabIndex: -1,
|
|
173
|
-
style:
|
|
174
|
-
left: pane.rect.x,
|
|
175
|
-
top: pane.rect.y,
|
|
176
|
-
width: pane.rect.width,
|
|
177
|
-
height: pane.rect.height
|
|
178
|
-
},
|
|
170
|
+
style: rectStyle(pane.rect),
|
|
179
171
|
children: renderPane({
|
|
180
172
|
paneId: pane.paneId,
|
|
181
173
|
rect: pane.rect,
|
|
@@ -184,6 +176,16 @@ function PaneShell({ pane, renderPane }) {
|
|
|
184
176
|
})
|
|
185
177
|
});
|
|
186
178
|
}
|
|
179
|
+
function ResizeHandle({ handle }) {
|
|
180
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
181
|
+
className: "FocusgridResizeHandle",
|
|
182
|
+
"data-direction": handle.direction,
|
|
183
|
+
style: rectStyle(handle.rect),
|
|
184
|
+
role: "separator",
|
|
185
|
+
"aria-orientation": handle.direction === "horizontal" ? "vertical" : "horizontal",
|
|
186
|
+
"data-resize-handle": handle.id
|
|
187
|
+
});
|
|
188
|
+
}
|
|
187
189
|
//#endregion
|
|
188
190
|
//#region react/src/FocusGrid.tsx
|
|
189
191
|
function FocusGrid({ className, onPaneLayoutChange, onPaneClose, ...content }) {
|
|
@@ -211,10 +213,7 @@ function GridContent({ keymap, renderPane }) {
|
|
|
211
213
|
const { controller } = useGridControllers();
|
|
212
214
|
const layout = useControllerLayout(controller);
|
|
213
215
|
(0, _andrewcyuan_shortcut_engine_react.useShortcuts)(keymap ?? createDefaultPaneKeymap(controller));
|
|
214
|
-
return
|
|
215
|
-
node: layout.root,
|
|
216
|
-
renderPane
|
|
217
|
-
});
|
|
216
|
+
return renderNode(layout.root, renderPane);
|
|
218
217
|
}
|
|
219
218
|
//#endregion
|
|
220
219
|
//#region react/src/composite-shortcuts.ts
|
package/dist/react/index.d.cts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { ComputedLayout,
|
|
1
|
+
import { ComputedLayout, FocusGridController, FocusGridControllerProps, PaneEventHandlers, PaneId, Rect } from "@andrewcyuan/focusgrid/core";
|
|
2
2
|
import { FocusGridDomController } from "@andrewcyuan/focusgrid/dom";
|
|
3
3
|
import { ReactNode } from "react";
|
|
4
4
|
import { ShortcutBinding } from "@andrewcyuan/shortcut-engine";
|
|
5
5
|
|
|
6
6
|
//#region react/src/FocusgridController.d.ts
|
|
7
|
-
|
|
7
|
+
type FocusGridControllers = {
|
|
8
8
|
controller: FocusGridController;
|
|
9
9
|
domController: FocusGridDomController;
|
|
10
|
-
}
|
|
10
|
+
};
|
|
11
|
+
declare const FocusgridController: import("react").Context<FocusGridControllers | null>;
|
|
11
12
|
//#endregion
|
|
12
13
|
//#region react/src/PaneView.d.ts
|
|
13
14
|
type Pane = {
|
|
@@ -31,7 +32,7 @@ declare function FocusGrid({
|
|
|
31
32
|
}: FocusGridProps): import("react").JSX.Element;
|
|
32
33
|
//#endregion
|
|
33
34
|
//#region react/src/hooks.d.ts
|
|
34
|
-
declare function useFocusGridController(createProps: () => FocusGridControllerProps
|
|
35
|
+
declare function useFocusGridController(createProps: () => FocusGridControllerProps): FocusGridControllers;
|
|
35
36
|
declare function useControllerLayout(controller: FocusGridController): ComputedLayout;
|
|
36
37
|
//#endregion
|
|
37
38
|
//#region react/src/composite-shortcuts.d.ts
|
|
@@ -43,85 +44,85 @@ declare const defaultPaneShortcutActions: readonly [{
|
|
|
43
44
|
readonly id: "split-right";
|
|
44
45
|
readonly label: "Split right";
|
|
45
46
|
readonly action: (controller: FocusGridController) => string | null;
|
|
46
|
-
readonly defaultSequence: "Ctrl-
|
|
47
|
+
readonly defaultSequence: "Ctrl-S |";
|
|
47
48
|
}, {
|
|
48
49
|
readonly id: "split-down";
|
|
49
50
|
readonly label: "Split down";
|
|
50
51
|
readonly action: (controller: FocusGridController) => string | null;
|
|
51
|
-
readonly defaultSequence: "Ctrl-
|
|
52
|
+
readonly defaultSequence: "Ctrl-S -";
|
|
52
53
|
}, {
|
|
53
54
|
readonly id: "close";
|
|
54
55
|
readonly label: "Close active";
|
|
55
56
|
readonly action: (controller: FocusGridController) => boolean;
|
|
56
|
-
readonly defaultSequence: "Ctrl-
|
|
57
|
+
readonly defaultSequence: "Ctrl-S X";
|
|
57
58
|
}, {
|
|
58
59
|
readonly id: "focus-left";
|
|
59
60
|
readonly label: "Focus left";
|
|
60
61
|
readonly action: (controller: FocusGridController) => boolean;
|
|
61
|
-
readonly defaultSequence: "Ctrl-
|
|
62
|
+
readonly defaultSequence: "Ctrl-H";
|
|
62
63
|
}, {
|
|
63
64
|
readonly id: "focus-right";
|
|
64
65
|
readonly label: "Focus right";
|
|
65
66
|
readonly action: (controller: FocusGridController) => boolean;
|
|
66
|
-
readonly defaultSequence: "Ctrl-
|
|
67
|
+
readonly defaultSequence: "Ctrl-L";
|
|
67
68
|
}, {
|
|
68
69
|
readonly id: "focus-up";
|
|
69
70
|
readonly label: "Focus up";
|
|
70
71
|
readonly action: (controller: FocusGridController) => boolean;
|
|
71
|
-
readonly defaultSequence: "Ctrl-
|
|
72
|
+
readonly defaultSequence: "Ctrl-K";
|
|
72
73
|
}, {
|
|
73
74
|
readonly id: "focus-down";
|
|
74
75
|
readonly label: "Focus down";
|
|
75
76
|
readonly action: (controller: FocusGridController) => boolean;
|
|
76
|
-
readonly defaultSequence: "Ctrl-
|
|
77
|
+
readonly defaultSequence: "Ctrl-J";
|
|
77
78
|
}, {
|
|
78
79
|
readonly id: "swap-left";
|
|
79
80
|
readonly label: "Swap left";
|
|
80
81
|
readonly action: (controller: FocusGridController) => boolean;
|
|
81
|
-
readonly defaultSequence: "Ctrl-
|
|
82
|
+
readonly defaultSequence: "Ctrl-S Shift-Left";
|
|
82
83
|
}, {
|
|
83
84
|
readonly id: "swap-right";
|
|
84
85
|
readonly label: "Swap right";
|
|
85
86
|
readonly action: (controller: FocusGridController) => boolean;
|
|
86
|
-
readonly defaultSequence: "Ctrl-
|
|
87
|
+
readonly defaultSequence: "Ctrl-S Shift-Right";
|
|
87
88
|
}, {
|
|
88
89
|
readonly id: "swap-up";
|
|
89
90
|
readonly label: "Swap up";
|
|
90
91
|
readonly action: (controller: FocusGridController) => boolean;
|
|
91
|
-
readonly defaultSequence: "Ctrl-
|
|
92
|
+
readonly defaultSequence: "Ctrl-S Shift-Up";
|
|
92
93
|
}, {
|
|
93
94
|
readonly id: "swap-down";
|
|
94
95
|
readonly label: "Swap down";
|
|
95
96
|
readonly action: (controller: FocusGridController) => boolean;
|
|
96
|
-
readonly defaultSequence: "Ctrl-
|
|
97
|
+
readonly defaultSequence: "Ctrl-S Shift-Down";
|
|
97
98
|
}, {
|
|
98
99
|
readonly id: "resize-left";
|
|
99
100
|
readonly label: "Resize left";
|
|
100
101
|
readonly action: (controller: FocusGridController) => boolean;
|
|
101
|
-
readonly defaultSequence: "Ctrl-
|
|
102
|
+
readonly defaultSequence: "Ctrl-Shift-H";
|
|
102
103
|
readonly repeat: true;
|
|
103
104
|
}, {
|
|
104
105
|
readonly id: "resize-right";
|
|
105
106
|
readonly label: "Resize right";
|
|
106
107
|
readonly action: (controller: FocusGridController) => boolean;
|
|
107
|
-
readonly defaultSequence: "Ctrl-
|
|
108
|
+
readonly defaultSequence: "Ctrl-Shift-L";
|
|
108
109
|
readonly repeat: true;
|
|
109
110
|
}, {
|
|
110
111
|
readonly id: "resize-up";
|
|
111
112
|
readonly label: "Resize up";
|
|
112
113
|
readonly action: (controller: FocusGridController) => boolean;
|
|
113
|
-
readonly defaultSequence: "Ctrl-
|
|
114
|
+
readonly defaultSequence: "Ctrl-Shift-K";
|
|
114
115
|
readonly repeat: true;
|
|
115
116
|
}, {
|
|
116
117
|
readonly id: "resize-down";
|
|
117
118
|
readonly label: "Resize down";
|
|
118
119
|
readonly action: (controller: FocusGridController) => boolean;
|
|
119
|
-
readonly defaultSequence: "Ctrl-
|
|
120
|
+
readonly defaultSequence: "Ctrl-Shift-J";
|
|
120
121
|
readonly repeat: true;
|
|
121
122
|
}];
|
|
122
123
|
type PaneShortcutId = (typeof defaultPaneShortcutActions)[number]["id"];
|
|
123
124
|
type PaneShortcutValues = Record<PaneShortcutId, string>;
|
|
124
125
|
declare function createDefaultPaneShortcuts(): PaneShortcutValues;
|
|
125
|
-
declare function createDefaultPaneKeymap(controller: FocusGridController): ShortcutBinding[];
|
|
126
|
+
declare function createDefaultPaneKeymap(controller: FocusGridController, shortcuts?: PaneShortcutValues): ShortcutBinding[];
|
|
126
127
|
//#endregion
|
|
127
|
-
export { CompositeNavigationDirection, FocusGrid, type FocusGridProps, FocusgridController, type Pane, type PaneShortcutId, type PaneShortcutValues, createCompositeNavigationKeymap, createDefaultPaneKeymap, createDefaultPaneShortcuts, defaultPaneShortcutActions, useControllerLayout, useFocusGridController };
|
|
128
|
+
export { type CompositeNavigationDirection, FocusGrid, type FocusGridControllers, type FocusGridProps, FocusgridController, type Pane, type PaneShortcutId, type PaneShortcutValues, createCompositeNavigationKeymap, createDefaultPaneKeymap, createDefaultPaneShortcuts, defaultPaneShortcutActions, useControllerLayout, useFocusGridController };
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
2
|
import { FocusGridDomController } from "@andrewcyuan/focusgrid/dom";
|
|
3
3
|
import { ShortcutBinding } from "@andrewcyuan/shortcut-engine";
|
|
4
|
-
import { ComputedLayout,
|
|
4
|
+
import { ComputedLayout, FocusGridController, FocusGridControllerProps, PaneEventHandlers, PaneId, Rect } from "@andrewcyuan/focusgrid/core";
|
|
5
5
|
|
|
6
6
|
//#region react/src/FocusgridController.d.ts
|
|
7
|
-
|
|
7
|
+
type FocusGridControllers = {
|
|
8
8
|
controller: FocusGridController;
|
|
9
9
|
domController: FocusGridDomController;
|
|
10
|
-
}
|
|
10
|
+
};
|
|
11
|
+
declare const FocusgridController: import("react").Context<FocusGridControllers | null>;
|
|
11
12
|
//#endregion
|
|
12
13
|
//#region react/src/PaneView.d.ts
|
|
13
14
|
type Pane = {
|
|
@@ -31,7 +32,7 @@ declare function FocusGrid({
|
|
|
31
32
|
}: FocusGridProps): import("react").JSX.Element;
|
|
32
33
|
//#endregion
|
|
33
34
|
//#region react/src/hooks.d.ts
|
|
34
|
-
declare function useFocusGridController(createProps: () => FocusGridControllerProps
|
|
35
|
+
declare function useFocusGridController(createProps: () => FocusGridControllerProps): FocusGridControllers;
|
|
35
36
|
declare function useControllerLayout(controller: FocusGridController): ComputedLayout;
|
|
36
37
|
//#endregion
|
|
37
38
|
//#region react/src/composite-shortcuts.d.ts
|
|
@@ -43,85 +44,85 @@ declare const defaultPaneShortcutActions: readonly [{
|
|
|
43
44
|
readonly id: "split-right";
|
|
44
45
|
readonly label: "Split right";
|
|
45
46
|
readonly action: (controller: FocusGridController) => string | null;
|
|
46
|
-
readonly defaultSequence: "Ctrl-
|
|
47
|
+
readonly defaultSequence: "Ctrl-S |";
|
|
47
48
|
}, {
|
|
48
49
|
readonly id: "split-down";
|
|
49
50
|
readonly label: "Split down";
|
|
50
51
|
readonly action: (controller: FocusGridController) => string | null;
|
|
51
|
-
readonly defaultSequence: "Ctrl-
|
|
52
|
+
readonly defaultSequence: "Ctrl-S -";
|
|
52
53
|
}, {
|
|
53
54
|
readonly id: "close";
|
|
54
55
|
readonly label: "Close active";
|
|
55
56
|
readonly action: (controller: FocusGridController) => boolean;
|
|
56
|
-
readonly defaultSequence: "Ctrl-
|
|
57
|
+
readonly defaultSequence: "Ctrl-S X";
|
|
57
58
|
}, {
|
|
58
59
|
readonly id: "focus-left";
|
|
59
60
|
readonly label: "Focus left";
|
|
60
61
|
readonly action: (controller: FocusGridController) => boolean;
|
|
61
|
-
readonly defaultSequence: "Ctrl-
|
|
62
|
+
readonly defaultSequence: "Ctrl-H";
|
|
62
63
|
}, {
|
|
63
64
|
readonly id: "focus-right";
|
|
64
65
|
readonly label: "Focus right";
|
|
65
66
|
readonly action: (controller: FocusGridController) => boolean;
|
|
66
|
-
readonly defaultSequence: "Ctrl-
|
|
67
|
+
readonly defaultSequence: "Ctrl-L";
|
|
67
68
|
}, {
|
|
68
69
|
readonly id: "focus-up";
|
|
69
70
|
readonly label: "Focus up";
|
|
70
71
|
readonly action: (controller: FocusGridController) => boolean;
|
|
71
|
-
readonly defaultSequence: "Ctrl-
|
|
72
|
+
readonly defaultSequence: "Ctrl-K";
|
|
72
73
|
}, {
|
|
73
74
|
readonly id: "focus-down";
|
|
74
75
|
readonly label: "Focus down";
|
|
75
76
|
readonly action: (controller: FocusGridController) => boolean;
|
|
76
|
-
readonly defaultSequence: "Ctrl-
|
|
77
|
+
readonly defaultSequence: "Ctrl-J";
|
|
77
78
|
}, {
|
|
78
79
|
readonly id: "swap-left";
|
|
79
80
|
readonly label: "Swap left";
|
|
80
81
|
readonly action: (controller: FocusGridController) => boolean;
|
|
81
|
-
readonly defaultSequence: "Ctrl-
|
|
82
|
+
readonly defaultSequence: "Ctrl-S Shift-Left";
|
|
82
83
|
}, {
|
|
83
84
|
readonly id: "swap-right";
|
|
84
85
|
readonly label: "Swap right";
|
|
85
86
|
readonly action: (controller: FocusGridController) => boolean;
|
|
86
|
-
readonly defaultSequence: "Ctrl-
|
|
87
|
+
readonly defaultSequence: "Ctrl-S Shift-Right";
|
|
87
88
|
}, {
|
|
88
89
|
readonly id: "swap-up";
|
|
89
90
|
readonly label: "Swap up";
|
|
90
91
|
readonly action: (controller: FocusGridController) => boolean;
|
|
91
|
-
readonly defaultSequence: "Ctrl-
|
|
92
|
+
readonly defaultSequence: "Ctrl-S Shift-Up";
|
|
92
93
|
}, {
|
|
93
94
|
readonly id: "swap-down";
|
|
94
95
|
readonly label: "Swap down";
|
|
95
96
|
readonly action: (controller: FocusGridController) => boolean;
|
|
96
|
-
readonly defaultSequence: "Ctrl-
|
|
97
|
+
readonly defaultSequence: "Ctrl-S Shift-Down";
|
|
97
98
|
}, {
|
|
98
99
|
readonly id: "resize-left";
|
|
99
100
|
readonly label: "Resize left";
|
|
100
101
|
readonly action: (controller: FocusGridController) => boolean;
|
|
101
|
-
readonly defaultSequence: "Ctrl-
|
|
102
|
+
readonly defaultSequence: "Ctrl-Shift-H";
|
|
102
103
|
readonly repeat: true;
|
|
103
104
|
}, {
|
|
104
105
|
readonly id: "resize-right";
|
|
105
106
|
readonly label: "Resize right";
|
|
106
107
|
readonly action: (controller: FocusGridController) => boolean;
|
|
107
|
-
readonly defaultSequence: "Ctrl-
|
|
108
|
+
readonly defaultSequence: "Ctrl-Shift-L";
|
|
108
109
|
readonly repeat: true;
|
|
109
110
|
}, {
|
|
110
111
|
readonly id: "resize-up";
|
|
111
112
|
readonly label: "Resize up";
|
|
112
113
|
readonly action: (controller: FocusGridController) => boolean;
|
|
113
|
-
readonly defaultSequence: "Ctrl-
|
|
114
|
+
readonly defaultSequence: "Ctrl-Shift-K";
|
|
114
115
|
readonly repeat: true;
|
|
115
116
|
}, {
|
|
116
117
|
readonly id: "resize-down";
|
|
117
118
|
readonly label: "Resize down";
|
|
118
119
|
readonly action: (controller: FocusGridController) => boolean;
|
|
119
|
-
readonly defaultSequence: "Ctrl-
|
|
120
|
+
readonly defaultSequence: "Ctrl-Shift-J";
|
|
120
121
|
readonly repeat: true;
|
|
121
122
|
}];
|
|
122
123
|
type PaneShortcutId = (typeof defaultPaneShortcutActions)[number]["id"];
|
|
123
124
|
type PaneShortcutValues = Record<PaneShortcutId, string>;
|
|
124
125
|
declare function createDefaultPaneShortcuts(): PaneShortcutValues;
|
|
125
|
-
declare function createDefaultPaneKeymap(controller: FocusGridController): ShortcutBinding[];
|
|
126
|
+
declare function createDefaultPaneKeymap(controller: FocusGridController, shortcuts?: PaneShortcutValues): ShortcutBinding[];
|
|
126
127
|
//#endregion
|
|
127
|
-
export { CompositeNavigationDirection, FocusGrid, type FocusGridProps, FocusgridController, type Pane, type PaneShortcutId, type PaneShortcutValues, createCompositeNavigationKeymap, createDefaultPaneKeymap, createDefaultPaneShortcuts, defaultPaneShortcutActions, useControllerLayout, useFocusGridController };
|
|
128
|
+
export { type CompositeNavigationDirection, FocusGrid, type FocusGridControllers, type FocusGridProps, FocusgridController, type Pane, type PaneShortcutId, type PaneShortcutValues, createCompositeNavigationKeymap, createDefaultPaneKeymap, createDefaultPaneShortcuts, defaultPaneShortcutActions, useControllerLayout, useFocusGridController };
|