deck-plugin-sdk 0.17.0 → 0.18.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deck-plugin-sdk",
3
- "version": "0.17.0",
3
+ "version": "0.18.0",
4
4
  "description": "Build a plugin for Deck, outside the Deck repository.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/shim/terminals.js CHANGED
@@ -31,6 +31,7 @@ export const leafIds = (...a) => t().leafIds(...a);
31
31
  export const loadLayoutOnce = (...a) => t().loadLayoutOnce(...a);
32
32
  export const markAgentStarted = (...a) => t().markAgentStarted(...a);
33
33
  export const moveLeaf = (...a) => t().moveLeaf(...a);
34
+ export const moveTabToZone = (...a) => t().moveTabToZone(...a);
34
35
  export const moveWorkspace = (...a) => t().moveWorkspace(...a);
35
36
  export const moveZone = (...a) => t().moveZone(...a);
36
37
  export const mutateLayout = (...a) => t().mutateLayout(...a);
@@ -46,6 +47,7 @@ export const pasteInto = (...a) => t().pasteInto(...a);
46
47
  export const publishLayout = (...a) => t().publishLayout(...a);
47
48
  export const queueInput = (...a) => t().queueInput(...a);
48
49
  export const refit = (...a) => t().refit(...a);
50
+ export const reorderTab = (...a) => t().reorderTab(...a);
49
51
  export const restartPane = (...a) => t().restartPane(...a);
50
52
  export const sendInput = (...a) => t().sendInput(...a);
51
53
  export const setLeafLabel = (...a) => t().setLeafLabel(...a);
@@ -52,7 +52,12 @@ export interface EditorSettings {
52
52
  theme: "deck-dark" | "vs-dark" | "hc-black";
53
53
  iconTheme: string;
54
54
  diffSideBySide: boolean;
55
+ /** The git graph's commit list, in px. Its own setting rather than `fontSize`: that is a
56
+ * monospace code font, and the size someone wants for code is not the one for a commit list. */
57
+ graphFontSize: number;
55
58
  }
59
+ /** The sizes the git graph offers — the Settings list and the Ctrl+wheel steps are the same. */
60
+ export declare const GRAPH_FONT_SIZES: number[];
56
61
  export declare const DEFAULT_EDITOR_SETTINGS: EditorSettings;
57
62
  export declare function updateEditorSettings(patch: Partial<EditorSettings>): void;
58
63
  export declare function getEditorSettings(): EditorSettings;
@@ -10,7 +10,7 @@
10
10
  * It is also what lets two bindings share a chord honestly — the editor's save and a terminal
11
11
  * action can both be Ctrl+S if the two surfaces never have the keyboard at the same time.
12
12
  */
13
- export type Scope = "app" | "workspaces" | "editor" | "http" | "terminal" | `plugin:${string}`;
13
+ export type Scope = "app" | "workspaces" | "editor" | "http" | "terminal" | "graph" | "graph-visible" | `plugin:${string}`;
14
14
  /** Which thing owns the chord. Absent means a plain window listener. */
15
15
  export type Surface = "monaco" | "xterm" | "codemirror";
16
16
  export interface KeyBinding {
@@ -20,19 +20,32 @@ export declare function resetOverrides(): Promise<void>;
20
20
  export declare function useKeybindings(): number;
21
21
  /** The chord in force for a binding, for a label or a tooltip. */
22
22
  export declare function chordFor(id: string): string;
23
+ /**
24
+ * An action, or an action with a `when` guard.
25
+ *
26
+ * `when` is how an action says "not here, not now" BEFORE the key is taken. The tree's Ctrl+C is
27
+ * the case it exists for: it only means something with focus in the file tree, and everywhere
28
+ * else Ctrl+C has to stay the text box's, Monaco's or the shell's. An action that simply did
29
+ * nothing was not enough — the key had already been claimed, so the browser's copy was cancelled
30
+ * and a focused terminal had swallowed it, and copy and paste broke across the whole window
31
+ * whenever the Editor was open.
32
+ */
33
+ export type KeyAction = (() => void) | {
34
+ run: () => void;
35
+ when: () => boolean;
36
+ };
23
37
  /** Register one action. Returns a disposer; call it on unmount. */
24
- export declare function onKey(id: string, run: () => void): () => void;
38
+ export declare function onKey(id: string, run: () => void, when?: () => boolean): () => void;
25
39
  /** Register several at once — what a module with a dozen chords wants. */
26
- export declare function onKeys(map: Record<string, () => void>): () => void;
40
+ export declare function onKeys(map: Record<string, KeyAction>): () => void;
27
41
  /** Claim a scope. Returns a disposer. */
28
42
  export declare function pushScope(scope: Scope): () => void;
29
43
  export declare function activeScopes(): ReadonlySet<Scope>;
30
44
  /**
31
45
  * Run whatever this event is bound to, and say whether anything did.
32
46
  *
33
- * The caller decides about preventDefault — this cannot, because some bindings want the default
34
- * suppressed (the palette) and some do not (a chord whose action declines to act, like Ctrl+7
35
- * with only three projects open).
47
+ * The caller preventDefaults only when this says something ran, so a chord nobody is listening
48
+ * for, or whose action's `when` declines, keeps its ordinary meaning.
36
49
  */
37
50
  export declare function dispatch(e: KeyboardEvent): boolean;
38
51
  /**
@@ -112,6 +112,22 @@ export declare function moveZone(tabs: readonly LayoutTab[], id: string, to: {
112
112
  x: number;
113
113
  y: number;
114
114
  }): LayoutTab[];
115
+ /**
116
+ * Move a tab to just before or after another — the order a zone's strip shows its tabs in, which
117
+ * is their order in the list.
118
+ *
119
+ * Every tab's cell is pinned first (placeAll): a tab with no stored position takes its cell from
120
+ * its index, so reordering the list could otherwise move a zone you never touched.
121
+ */
122
+ export declare function reorderTab(tabs: readonly LayoutTab[], srcId: string, overId: string, after: boolean): LayoutTab[];
123
+ /**
124
+ * Move one tab to another zone's cell — joining the zone there as the tab it shows, or making a
125
+ * new zone in an empty cell. The zone it left keeps its other tabs.
126
+ */
127
+ export declare function moveTabToZone(tabs: readonly LayoutTab[], tabId: string, to: {
128
+ x: number;
129
+ y: number;
130
+ }): LayoutTab[];
115
131
  /**
116
132
  * Add a tab to the zone holding `besideId`, as the tab it shows.
117
133
  *
@@ -239,7 +255,7 @@ export declare function isWorkspaceActive(ws: LayoutWorkspace): boolean;
239
255
  /**
240
256
  * Mark a pane as running an agent right now, without waiting for the sweep.
241
257
  *
242
- * agentPanes is refreshed from Rust every 45s, which is the right cadence for noticing an agent
258
+ * agentPanes is refreshed from Rust every 10s, which is the right cadence for noticing an agent
243
259
  * that EXITED but far too slow for one we just started ourselves — the menu would keep offering
244
260
  * to start a second one for most of a minute. The next sweep confirms it, or clears it if the
245
261
  * command never took.