deck-plugin-sdk 0.21.0 → 1.1.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/build-plugin.mjs +150 -143
- package/package.json +1 -1
- package/shim/bridge.js +13 -12
- package/shim/react-dom.js +19 -0
- package/shim/ui.d.ts +10 -0
- package/shim/ui.js +47 -0
- package/types/components/ActivityBar.d.ts +20 -0
- package/types/components/FileIcon.d.ts +7 -0
- package/types/components/TabStrip.d.ts +7 -1
- package/types/components/useResize.d.ts +12 -0
- package/types/core/bridge.d.ts +55 -77
- package/types/core/dap.d.ts +181 -0
- package/types/core/decode.d.ts +13 -0
- package/types/core/icontheme.d.ts +28 -0
- package/types/core/inlay.d.ts +37 -0
- package/types/core/keys.d.ts +1 -1
- package/types/core/keystore.d.ts +16 -2
- package/types/core/lsp.d.ts +190 -0
- package/types/core/patterntokens.d.ts +24 -0
- package/types/core/remotepath.d.ts +17 -0
- package/types/core/settingsstore.d.ts +0 -3
- package/types/core/snippets.d.ts +15 -0
- package/types/core/timeFormat.d.ts +12 -0
- package/types/modules/editor/MonacoHosts.d.ts +80 -0
- package/types/modules/editor/annotations.d.ts +2 -0
- package/types/modules/editor/diffline.d.ts +13 -0
- package/types/modules/editor/editorstatus.d.ts +16 -0
- package/types/modules/editor/models.d.ts +8 -0
- package/types/modules/editor/tree.d.ts +59 -0
- package/types/modules/editor/viewers.d.ts +41 -0
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
// GENERATED by sdk/gen-types.mjs from Deck's source — do not edit.
|
|
2
|
+
import { monaco } from "./monaco";
|
|
3
|
+
/** How to launch the server — passed straight to Rust, which implements the strategies. */
|
|
4
|
+
interface ServerSpec {
|
|
5
|
+
/** "path" | "node-module" | "exe-search" — see resolve_server() in lsp.rs. */
|
|
6
|
+
strategy: string;
|
|
7
|
+
command?: string;
|
|
8
|
+
module?: string;
|
|
9
|
+
args?: string[];
|
|
10
|
+
/** How to install the server, for the Install button in Settings › Languages. */
|
|
11
|
+
install?: Install;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* What to install for a server or a debugger, as one of a few kinds Deck turns into a command
|
|
15
|
+
* itself (tools.rs): a definition from the registry never names a command to run.
|
|
16
|
+
*/
|
|
17
|
+
export type InstallSpec = {
|
|
18
|
+
kind: "pip" | "npm";
|
|
19
|
+
packages: string[];
|
|
20
|
+
} | {
|
|
21
|
+
kind: "github-release";
|
|
22
|
+
name: string;
|
|
23
|
+
repo: string;
|
|
24
|
+
tag: string;
|
|
25
|
+
asset: string;
|
|
26
|
+
sha256: string;
|
|
27
|
+
};
|
|
28
|
+
/** A structured install, or a sentence for what Deck cannot install itself (an SDK). */
|
|
29
|
+
export type Install = InstallSpec | string;
|
|
30
|
+
/** An install as one sentence, for where a button would not fit or there is nothing to run. */
|
|
31
|
+
export declare function installText(i: Install): string;
|
|
32
|
+
/** Whether Deck can run it (an Install button), rather than only describe it. */
|
|
33
|
+
export declare const canInstall: (i: Install | undefined) => i is InstallSpec;
|
|
34
|
+
/** A language's server or debugger install entry, if its definition has one. */
|
|
35
|
+
export declare function installFor(languageId: string, what: "server" | "debug"): Install | undefined;
|
|
36
|
+
/** A language's debug adapter, or null when its definition names none (or there is no such language). */
|
|
37
|
+
export declare function debugAdapterFor(languageId: string): {
|
|
38
|
+
adapter: ServerSpec;
|
|
39
|
+
type: string;
|
|
40
|
+
rootMarker: string;
|
|
41
|
+
launch?: Record<string, unknown>;
|
|
42
|
+
launchUnless?: string;
|
|
43
|
+
install?: Install;
|
|
44
|
+
} | null;
|
|
45
|
+
/**
|
|
46
|
+
* Whether a language's debug adapter runs on this machine: starts it and sees whether it is still
|
|
47
|
+
* running a moment later. Resolves to what was run, rejects with why not (the adapter's first line
|
|
48
|
+
* of output: Python's "No module named debugpy", Node's "Cannot find module"). Null when the
|
|
49
|
+
* language names no adapter.
|
|
50
|
+
*/
|
|
51
|
+
export declare function probeDebugger(languageId: string): Promise<string | null>;
|
|
52
|
+
/**
|
|
53
|
+
* Load every language definition from %APPDATA%\Deck\languages.
|
|
54
|
+
*
|
|
55
|
+
* This is the ONLY source of languages. Deck used to compile a few in from src/languages/, which
|
|
56
|
+
* meant the shipped ones and a user's own obeyed different rules — one needed a rebuild to
|
|
57
|
+
* change, the other a restart, and only the first could carry snippets. Now there is one kind of
|
|
58
|
+
* language definition, and Deck ships none: an empty folder means Monaco's own highlighting and
|
|
59
|
+
* no language server, which is a coherent state rather than a broken one.
|
|
60
|
+
*
|
|
61
|
+
* Never rejects. A language that fails to load is one language that does not work; it is not a
|
|
62
|
+
* reason for the editor not to start, and the same contract loadPlugins states.
|
|
63
|
+
*/
|
|
64
|
+
export declare function loadExternalLanguages(): Promise<void>;
|
|
65
|
+
/** One language, as Settings lists it. Flattened from its LangDef — the panel shows what a
|
|
66
|
+
* definition claims, not the definition itself. */
|
|
67
|
+
export interface LoadedLanguage {
|
|
68
|
+
languageId: string;
|
|
69
|
+
serverId: string;
|
|
70
|
+
extensions: string[];
|
|
71
|
+
rootMarker: string;
|
|
72
|
+
strategy: string;
|
|
73
|
+
/** The command or node module the strategy will look for. */
|
|
74
|
+
command: string;
|
|
75
|
+
/** The folder it came from, which is the name to look for on disk. */
|
|
76
|
+
folder: string;
|
|
77
|
+
/** language.json's version, or "" when it has none (a pack from before versions). */
|
|
78
|
+
version: string;
|
|
79
|
+
snippets?: number;
|
|
80
|
+
}
|
|
81
|
+
export interface LanguageError {
|
|
82
|
+
folder: string;
|
|
83
|
+
message: string;
|
|
84
|
+
}
|
|
85
|
+
/** Every language definition that loaded. */
|
|
86
|
+
export declare function loadedLanguages(): readonly LoadedLanguage[];
|
|
87
|
+
/**
|
|
88
|
+
* Re-read the languages folder whenever it changes on disk. Called once at startup.
|
|
89
|
+
*
|
|
90
|
+
* What makes installing a language from the registry take effect without a restart, the same way
|
|
91
|
+
* the plugin watcher does for a plugin. Debounced: writing a definition and its snippets emits
|
|
92
|
+
* several events, and each would otherwise re-read the whole folder.
|
|
93
|
+
*
|
|
94
|
+
* Only NEW definitions and changed data are picked up. A language whose server is already
|
|
95
|
+
* running keeps that session — lsp.rs owns it, and restarting one because a snippet file changed
|
|
96
|
+
* would lose whatever it had analysed.
|
|
97
|
+
*/
|
|
98
|
+
export declare function watchLanguages(): void;
|
|
99
|
+
/**
|
|
100
|
+
* Whether a language's server is actually installed, without opening a file of that type.
|
|
101
|
+
*
|
|
102
|
+
* Until this existed, a definition naming a server you do not have was only discoverable by
|
|
103
|
+
* opening such a file and reading the error — so "Python needs basedpyright installed" was
|
|
104
|
+
* something Deck knew and never said.
|
|
105
|
+
*
|
|
106
|
+
* `root` is optional and usually empty: a node module resolves from the project's node_modules
|
|
107
|
+
* first, so a check with no project answers "is it installed globally".
|
|
108
|
+
*/
|
|
109
|
+
export declare function probeLanguage(languageId: string, root?: string): Promise<string>;
|
|
110
|
+
/**
|
|
111
|
+
* Folders that failed to load, and why.
|
|
112
|
+
*
|
|
113
|
+
* The point of surfacing these: a definition with a typo is otherwise completely silent — the
|
|
114
|
+
* language simply does not work, with nothing on screen to say a file was even read.
|
|
115
|
+
*/
|
|
116
|
+
export declare function languageErrors(): readonly LanguageError[];
|
|
117
|
+
export declare function lspSupports(languageId: string): boolean;
|
|
118
|
+
export type LspPhase = "starting" | "ready" | "error" | "stopped";
|
|
119
|
+
export interface LspStatus {
|
|
120
|
+
id: string;
|
|
121
|
+
serverId: string;
|
|
122
|
+
root: string;
|
|
123
|
+
phase: LspPhase;
|
|
124
|
+
detail: string;
|
|
125
|
+
log: string[];
|
|
126
|
+
}
|
|
127
|
+
/** React hook: current LSP server statuses (for the editor indicator). */
|
|
128
|
+
export declare function useLspStatus(): LspStatus[];
|
|
129
|
+
export declare function lspErrorVersion(): number;
|
|
130
|
+
/** Live path -> error count. Read after subscribing to changes with subscribeLspErrors. */
|
|
131
|
+
export declare function lspErrorCounts(): Map<string, number>;
|
|
132
|
+
export declare function subscribeLspErrors(cb: () => void): () => void;
|
|
133
|
+
/** Notify the server a document is open. Call when a file tab opens. */
|
|
134
|
+
export declare function lspOpenDoc(path: string, content: string, root: string): Promise<void>;
|
|
135
|
+
/**
|
|
136
|
+
* Notify the server a document changed. Call for EVERY Monaco change, synchronously — no
|
|
137
|
+
* debounce.
|
|
138
|
+
*
|
|
139
|
+
* Under incremental sync each notification describes one edit relative to the server's current
|
|
140
|
+
* copy, so dropping or reordering any of them desynchronizes the document permanently. That is
|
|
141
|
+
* also why this is no longer debounced: a debounce necessarily drops intermediate states, which
|
|
142
|
+
* is only legal when every message carries the whole file. Sending immediately has the better
|
|
143
|
+
* property anyway — completion and hover fire on the keystroke, so under the old 300ms debounce
|
|
144
|
+
* they queried a server whose buffer was up to 300ms stale and answered for a position that did
|
|
145
|
+
* not exist there yet.
|
|
146
|
+
*
|
|
147
|
+
* `changes` comes straight from Monaco's content-change event. Its ranges are in pre-edit
|
|
148
|
+
* coordinates and it orders them end-of-document first, which is exactly what LSP expects for a
|
|
149
|
+
* sequentially-applied batch: applying a later-in-document edit never shifts an earlier range.
|
|
150
|
+
* Do not sort them.
|
|
151
|
+
*/
|
|
152
|
+
export declare function lspChangeDoc(path: string, content: string, root: string, changes?: readonly monaco.editor.IModelContentChange[]): Promise<void>;
|
|
153
|
+
/** Notify the server a document closed. Call when a tab closes. */
|
|
154
|
+
export declare function lspCloseDoc(path: string, root: string): Promise<void>;
|
|
155
|
+
/** One result of a project-wide symbol search (Ctrl+T). `line` and `col` are 1-based. */
|
|
156
|
+
export interface ProjectSymbol {
|
|
157
|
+
name: string;
|
|
158
|
+
kind: number;
|
|
159
|
+
container: string;
|
|
160
|
+
path: string;
|
|
161
|
+
line: number;
|
|
162
|
+
col: number;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Classes, functions and the rest whose name matches `query`, from every language server running
|
|
166
|
+
* for `root` (a TypeScript and a Python server can share one), each server's own ranking kept and
|
|
167
|
+
* the lists joined. Only servers already running answer: Ctrl+T does not start one. [] for an
|
|
168
|
+
* empty query.
|
|
169
|
+
*/
|
|
170
|
+
export declare function workspaceSymbols(root: string, query: string): Promise<ProjectSymbol[]>;
|
|
171
|
+
/** A file's outline from its language server, or [] when no server has it open. Also what the
|
|
172
|
+
* debugger's inline values use to find the function a frame is in. */
|
|
173
|
+
export declare function documentSymbols(model: monaco.editor.ITextModel): Promise<monaco.languages.DocumentSymbol[]>;
|
|
174
|
+
type OpenFileHandler = (path: string, line: number, column: number) => void;
|
|
175
|
+
export declare function setLspOpenFileHandler(fn: OpenFileHandler): void;
|
|
176
|
+
/** Stop the servers no project has touched for IDLE_STOP_MS. Exported for the check. */
|
|
177
|
+
export declare function stopIdleServers(now?: number): string[];
|
|
178
|
+
/** Stop all sessions (e.g. on workspace close). */
|
|
179
|
+
export declare function lspStopAll(): void;
|
|
180
|
+
/** Restart one server (UI action from the status popover). */
|
|
181
|
+
/**
|
|
182
|
+
* Stop a language server. The next file opened for that root starts a fresh one, which is why
|
|
183
|
+
* this is both the Restart action and the memory readout's stop button — there is no difference
|
|
184
|
+
* between the two beyond what the caller says about it.
|
|
185
|
+
*
|
|
186
|
+
* Deleting the frontend session alongside the process matters: leaving it would send didOpen to
|
|
187
|
+
* a dead pipe on the next open, and the editor would sit at "ready" with no diagnostics.
|
|
188
|
+
*/
|
|
189
|
+
export declare function lspRestart(id: string): Promise<void>;
|
|
190
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// GENERATED by sdk/gen-types.mjs from Deck's source — do not edit.
|
|
2
|
+
import * as monaco from "monaco-editor";
|
|
3
|
+
/** One pattern, from a language definition. */
|
|
4
|
+
export interface TokenPattern {
|
|
5
|
+
/** The semantic token type to emit — the name an extraTokenColors rule matches. */
|
|
6
|
+
token: string;
|
|
7
|
+
/**
|
|
8
|
+
* A regular expression, as a string, with ONE capturing group: the part to colour.
|
|
9
|
+
*
|
|
10
|
+
* The group is what makes `new\s+(\w+)` colour the class and not the keyword. A pattern with
|
|
11
|
+
* no group is ignored rather than colouring its whole match, because the whole match is almost
|
|
12
|
+
* never what was meant.
|
|
13
|
+
*/
|
|
14
|
+
pattern: string;
|
|
15
|
+
/** Regex flags. `g` is added if absent; `i` is the only one usually wanted beyond it. */
|
|
16
|
+
flags?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Register pattern-based semantic tokens for one language.
|
|
20
|
+
*
|
|
21
|
+
* Returns a disposable, so reloading a definition does not leave the previous provider behind
|
|
22
|
+
* emitting the old patterns alongside the new ones.
|
|
23
|
+
*/
|
|
24
|
+
export declare function registerPatternTokens(languageId: string, patterns: TokenPattern[]): monaco.IDisposable | null;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// GENERATED by sdk/gen-types.mjs from Deck's source — do not edit.
|
|
2
|
+
export interface RemotePath {
|
|
3
|
+
host: string;
|
|
4
|
+
/** File access runs through sudo on the server. */
|
|
5
|
+
sudo: boolean;
|
|
6
|
+
/** Absolute POSIX path on the server. */
|
|
7
|
+
path: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const isRemote: (p: string) => boolean;
|
|
10
|
+
export declare function parseRemote(p: string): RemotePath | null;
|
|
11
|
+
export declare function formatRemote(r: RemotePath): string;
|
|
12
|
+
/** What a remote workspace is called: `vps:project`, or `vps:/` for the server's root. */
|
|
13
|
+
export declare function remoteLabel(p: string): string;
|
|
14
|
+
/** The ssh arguments that open an interactive shell in the folder. The path is single-quoted for
|
|
15
|
+
* the remote shell, so spaces and `$` in it are taken literally. A server that sets no $SHELL
|
|
16
|
+
* (minimal Alpine images) gets /bin/sh. */
|
|
17
|
+
export declare function sshShellArgs(p: string): string[] | null;
|
|
@@ -13,7 +13,4 @@ export declare function publishSettings(s: Settings): void;
|
|
|
13
13
|
export declare function saveSettings(next: Settings): void;
|
|
14
14
|
/** Current settings for non-React callers (the palette's providers). */
|
|
15
15
|
export declare const getSettings: () => Settings;
|
|
16
|
-
/** The OS account name — the home directory's last segment. "" if it can't be read. */
|
|
17
|
-
export declare function osAccountName(): Promise<string>;
|
|
18
|
-
export declare function userName(): Promise<string>;
|
|
19
16
|
export declare function useSettings(): Settings;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// GENERATED by sdk/gen-types.mjs from Deck's source — do not edit.
|
|
2
|
+
export interface Snippet {
|
|
3
|
+
prefix: string;
|
|
4
|
+
body: string;
|
|
5
|
+
detail?: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Load every snippet file in one language folder's `snippets/` subfolder.
|
|
9
|
+
*
|
|
10
|
+
* Never rejects, and never throws: a language with no snippets folder is the normal case, not an
|
|
11
|
+
* error, and one malformed file must not cost the others in the same folder.
|
|
12
|
+
*/
|
|
13
|
+
export declare function loadSnippets(languageId: string, languageDir: string): Promise<void>;
|
|
14
|
+
/** Snippets for a language id (empty if none dropped in for it). */
|
|
15
|
+
export declare function snippetsFor(languageId: string): Snippet[];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// GENERATED by sdk/gen-types.mjs from Deck's source — do not edit.
|
|
2
|
+
/** Format an "HH:mm" (24h storage) string for display in 12h or 24h. */
|
|
3
|
+
export declare function fmtTime(hhmm: string, is12h: boolean): string;
|
|
4
|
+
/** Format an epoch-ms timestamp's clock time (with seconds) for display. */
|
|
5
|
+
export declare function fmtClock(ms: number, is12h: boolean): string;
|
|
6
|
+
/** The app displays 12-hour time everywhere. */
|
|
7
|
+
export declare function useTimeFormat(): boolean;
|
|
8
|
+
/** Coarse relative time from an epoch-ms timestamp, e.g. "5 months ago", "just now". */
|
|
9
|
+
export declare function fmtRelative(ms: number): string;
|
|
10
|
+
export declare const useSettingBool: (key: string, fallback?: boolean) => boolean;
|
|
11
|
+
export declare const useSettingString: (key: string, fallback?: string) => string;
|
|
12
|
+
export declare const useSettingNumber: (key: string, fallback?: number) => number;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// GENERATED by sdk/gen-types.mjs from Deck's source — do not edit.
|
|
2
|
+
import { monaco } from "../../core/monaco";
|
|
3
|
+
import { type EditorSettings } from "../../core/editorsettings";
|
|
4
|
+
import type { DirtyRange } from "./tree";
|
|
5
|
+
declare function MonacoEditorInner({ path, rel, value, onChange, onSave, gotoLine, gotoCol, gotoNonce, highlight, dirty, settings, onEditor }: {
|
|
6
|
+
path: string;
|
|
7
|
+
rel?: string | null;
|
|
8
|
+
value: string;
|
|
9
|
+
onChange: (v: string) => void;
|
|
10
|
+
onSave?: () => void;
|
|
11
|
+
gotoLine?: number;
|
|
12
|
+
gotoCol?: number;
|
|
13
|
+
gotoNonce?: number;
|
|
14
|
+
highlight?: {
|
|
15
|
+
query: string;
|
|
16
|
+
caseSensitive: boolean;
|
|
17
|
+
isRegex: boolean;
|
|
18
|
+
wholeWord: boolean;
|
|
19
|
+
} | null;
|
|
20
|
+
dirty?: DirtyRange[];
|
|
21
|
+
settings: EditorSettings;
|
|
22
|
+
/** Hands the live editor out, and null on unmount. For a formatting toolbar, which has to
|
|
23
|
+
* dispatch into this instance rather than rewrite the string around it. */
|
|
24
|
+
onEditor?: (e: monaco.editor.IStandaloneCodeEditor | null) => void;
|
|
25
|
+
}): import("react").JSX.Element;
|
|
26
|
+
/**
|
|
27
|
+
* Monaco owns its buffer, so this component re-rendering achieves nothing on its own — yet it was
|
|
28
|
+
* re-rendering on every keystroke, because Editor re-renders per character and passes a new
|
|
29
|
+
* `value` and freshly-defined callbacks each time.
|
|
30
|
+
*
|
|
31
|
+
* The comparator ignores exactly the props that cannot affect what is on screen: every callback
|
|
32
|
+
* (each is read through a ref that is reassigned on render, so identity is already irrelevant) and
|
|
33
|
+
* `value` itself (the editor's text comes from its model, never from this prop after mount).
|
|
34
|
+
* What remains are the props that really do drive an effect.
|
|
35
|
+
*/
|
|
36
|
+
export declare const MonacoEditor: import("react").MemoExoticComponent<typeof MonacoEditorInner>;
|
|
37
|
+
export declare function applyLineChanges(original: monaco.editor.ITextModel, modified: monaco.editor.ITextModel, diffs: monaco.editor.ILineChange[]): string;
|
|
38
|
+
export interface HunkAction {
|
|
39
|
+
label: string;
|
|
40
|
+
unstage: boolean;
|
|
41
|
+
run: (change: monaco.editor.ILineChange, models: {
|
|
42
|
+
original: monaco.editor.ITextModel;
|
|
43
|
+
modified: monaco.editor.ITextModel;
|
|
44
|
+
}) => void;
|
|
45
|
+
}
|
|
46
|
+
/** A side of a diff: LEFT the old version, RIGHT the new — GitHub's names, which line comments use. */
|
|
47
|
+
export type DiffSide = "LEFT" | "RIGHT";
|
|
48
|
+
/**
|
|
49
|
+
* Line comments on a diff (a pull request's): a mark in the gutter for each thread, a click on a
|
|
50
|
+
* line number to start one, and a line to bring into view when a thread is picked from the list.
|
|
51
|
+
*/
|
|
52
|
+
export interface LineComments {
|
|
53
|
+
marks: {
|
|
54
|
+
line: number;
|
|
55
|
+
side: DiffSide;
|
|
56
|
+
resolved: boolean;
|
|
57
|
+
}[];
|
|
58
|
+
/** `other`: the same line on the other side when this one is unchanged, else null. */
|
|
59
|
+
onPick: (line: number, side: DiffSide, other: number | null) => void;
|
|
60
|
+
/** `n` changes to reveal again, even the same line. */
|
|
61
|
+
reveal?: {
|
|
62
|
+
line: number;
|
|
63
|
+
side: DiffSide;
|
|
64
|
+
n: number;
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
export declare function MonacoDiff({ path, head, work, sideBySide, readOnly, rev, onChange, onSave, hunkAction, lineComments }: {
|
|
68
|
+
path: string;
|
|
69
|
+
head: string;
|
|
70
|
+
work: string;
|
|
71
|
+
sideBySide: boolean;
|
|
72
|
+
readOnly: boolean;
|
|
73
|
+
rev: number;
|
|
74
|
+
onChange: (v: string) => void;
|
|
75
|
+
/** Ctrl+S from inside the diff. Without it an editable diff took edits and silently lost them. */
|
|
76
|
+
onSave?: () => void;
|
|
77
|
+
hunkAction?: HunkAction;
|
|
78
|
+
lineComments?: LineComments;
|
|
79
|
+
}): import("react").JSX.Element;
|
|
80
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// GENERATED by sdk/gen-types.mjs from Deck's source — do not edit.
|
|
2
|
+
/** A line change as Monaco's diff reports it: an end of 0 means that side's range is empty. */
|
|
3
|
+
export interface LineChange {
|
|
4
|
+
originalStartLineNumber: number;
|
|
5
|
+
originalEndLineNumber: number;
|
|
6
|
+
modifiedStartLineNumber: number;
|
|
7
|
+
modifiedEndLineNumber: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The line on the other side of the diff that `line` on `side` is the same line as, or null when
|
|
11
|
+
* it is inside a change. GitLab needs both numbers to place a comment on an unchanged line.
|
|
12
|
+
*/
|
|
13
|
+
export declare function counterpartLine(changes: readonly LineChange[], line: number, side: "LEFT" | "RIGHT"): number | null;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// GENERATED by sdk/gen-types.mjs from Deck's source — do not edit.
|
|
2
|
+
export interface EditorStatus {
|
|
3
|
+
line: number;
|
|
4
|
+
col: number;
|
|
5
|
+
errors: number;
|
|
6
|
+
warnings: number;
|
|
7
|
+
/** Blame for the cursor's line, for the status bar. null when unknown or uncommitted. */
|
|
8
|
+
blame?: {
|
|
9
|
+
hash: string;
|
|
10
|
+
author: string;
|
|
11
|
+
summary: string;
|
|
12
|
+
} | null;
|
|
13
|
+
}
|
|
14
|
+
export declare let editorStatus: EditorStatus;
|
|
15
|
+
export declare function setEditorStatus(patch: Partial<EditorStatus>): void;
|
|
16
|
+
export declare function useEditorStatus(): EditorStatus;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// GENERATED by sdk/gen-types.mjs from Deck's source — do not edit.
|
|
2
|
+
import { monaco } from "../../core/monaco";
|
|
3
|
+
export declare const viewStates: Map<string, monaco.editor.ICodeEditorViewState | null>;
|
|
4
|
+
export declare function fileUri(path: string): monaco.Uri;
|
|
5
|
+
export declare function getFileModel(path: string, initial: string): monaco.editor.ITextModel;
|
|
6
|
+
export declare function setModelValue(path: string, value: string): void;
|
|
7
|
+
export declare function disposeModel(path: string | undefined): void;
|
|
8
|
+
export declare function remapModel(oldPath: string, newPath: string): void;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// GENERATED by sdk/gen-types.mjs from Deck's source — do not edit.
|
|
2
|
+
import type { GitStatusRow } from "../../core/bridge";
|
|
3
|
+
/** Last path segment, trailing separators ignored. */
|
|
4
|
+
export declare const baseName: (p: string) => string;
|
|
5
|
+
/** Windows paths use both separators; normalize to "/" for comparison and display. */
|
|
6
|
+
export declare const normPath: (p: string) => string;
|
|
7
|
+
/** The folder a path is in. */
|
|
8
|
+
export declare const dirName: (p: string) => string;
|
|
9
|
+
/** A repo as a picker names it: its path under `root`, or its own name when it is not under it. */
|
|
10
|
+
export declare function repoLabel(root: string, repo: string): string;
|
|
11
|
+
export interface ChangeDir<T> {
|
|
12
|
+
kind: "dir";
|
|
13
|
+
name: string;
|
|
14
|
+
children: TreeNodeOf<T>[];
|
|
15
|
+
}
|
|
16
|
+
export interface ChangeFile<T> {
|
|
17
|
+
kind: "file";
|
|
18
|
+
row: T;
|
|
19
|
+
name: string;
|
|
20
|
+
}
|
|
21
|
+
export type TreeNodeOf<T> = ChangeDir<T> | ChangeFile<T>;
|
|
22
|
+
export type ChangeTreeNode = TreeNodeOf<GitStatusRow>;
|
|
23
|
+
/**
|
|
24
|
+
* Whether two git-status lists are the same, field by field.
|
|
25
|
+
*
|
|
26
|
+
* The poll returns a fresh array every few seconds, and a new reference re-renders the whole
|
|
27
|
+
* Changes list even when nothing changed. Order is part of the comparison: git reports a stable
|
|
28
|
+
* order, so a positional walk is enough and sorting first would cost more than the render.
|
|
29
|
+
*/
|
|
30
|
+
export declare function sameRows(a: readonly {
|
|
31
|
+
path: string;
|
|
32
|
+
rel: string;
|
|
33
|
+
letter: string;
|
|
34
|
+
staged: boolean;
|
|
35
|
+
}[], b: readonly {
|
|
36
|
+
path: string;
|
|
37
|
+
rel: string;
|
|
38
|
+
letter: string;
|
|
39
|
+
staged: boolean;
|
|
40
|
+
}[]): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Group rows into a folder tree by their `rel` path.
|
|
43
|
+
*
|
|
44
|
+
* Generic in the leaf payload so the Commit panel builds the same tree from a commit's files
|
|
45
|
+
* (CommitFile) that Source Control builds from working-tree changes (GitStatusRow) — the shape
|
|
46
|
+
* and the single-child compression are identical, only the row type differs.
|
|
47
|
+
*/
|
|
48
|
+
export declare function buildChangeTree<T extends {
|
|
49
|
+
rel: string;
|
|
50
|
+
}>(rows: T[]): TreeNodeOf<T>[];
|
|
51
|
+
export interface DirtyRange {
|
|
52
|
+
start: number;
|
|
53
|
+
end: number;
|
|
54
|
+
type: "added" | "modified" | "deleted";
|
|
55
|
+
}
|
|
56
|
+
export declare function statusColor(letter: string): string;
|
|
57
|
+
/** Flatten a tree node to the file rows underneath it (a file node is just itself). */
|
|
58
|
+
export declare function collectFiles(node: ChangeTreeNode): GitStatusRow[];
|
|
59
|
+
export declare function parseDirty(diff: string): DirtyRange[];
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// GENERATED by sdk/gen-types.mjs from Deck's source — do not edit.
|
|
2
|
+
export declare function mediaKind(path: string): "image" | "video" | "audio" | "font" | null;
|
|
3
|
+
export declare function MediaViewer({ path, src: srcOverride }: {
|
|
4
|
+
path: string;
|
|
5
|
+
src?: string;
|
|
6
|
+
}): import("react").JSX.Element;
|
|
7
|
+
/**
|
|
8
|
+
* A media file's two versions, side by side: the committed one and the one on disk.
|
|
9
|
+
*
|
|
10
|
+
* Each side is a full MediaViewer, so an image still zooms and pans and a font still shows its
|
|
11
|
+
* specimen. A side with no bytes — the file was added, or deleted — says so rather than rendering
|
|
12
|
+
* a broken image, which is the difference between "no old version" and "it failed to load".
|
|
13
|
+
*/
|
|
14
|
+
export declare function MediaDiff({ path, oldBytes, newBytes, gone, oldLabel, newLabel }: {
|
|
15
|
+
path: string;
|
|
16
|
+
/** The committed bytes, or null when the file is not in that revision. */
|
|
17
|
+
oldBytes: Uint8Array | null;
|
|
18
|
+
/** The new side's bytes, when it is a revision too (a commit's diff) rather than the file on
|
|
19
|
+
* disk. Empty: the file is not in that revision. Omitted: read the file at `path`. */
|
|
20
|
+
newBytes?: Uint8Array;
|
|
21
|
+
/** The working file was deleted — there is nothing on disk to show on the new side. */
|
|
22
|
+
gone: boolean;
|
|
23
|
+
oldLabel: string;
|
|
24
|
+
newLabel: string;
|
|
25
|
+
}): import("react").JSX.Element;
|
|
26
|
+
export declare function FontViewer({ src, name }: {
|
|
27
|
+
src: string;
|
|
28
|
+
name: string;
|
|
29
|
+
}): import("react").JSX.Element;
|
|
30
|
+
export declare function ImageViewer({ src, alt, bg }: {
|
|
31
|
+
src: string;
|
|
32
|
+
alt: string;
|
|
33
|
+
bg: string;
|
|
34
|
+
}): import("react").JSX.Element;
|
|
35
|
+
export declare const MarkdownPreview: import("react").NamedExoticComponent<{
|
|
36
|
+
text: string;
|
|
37
|
+
}>;
|
|
38
|
+
export declare function MonacoViewer({ content, language }: {
|
|
39
|
+
content: string;
|
|
40
|
+
language: string;
|
|
41
|
+
}): import("react").JSX.Element;
|