deck-plugin-sdk 0.22.0 → 1.2.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 +8 -0
- package/shim/p2p.d.ts +4 -0
- package/shim/p2p.js +15 -0
- package/shim/react-dom.js +19 -0
- package/shim/settings.d.ts +1 -1
- package/shim/settings.js +3 -0
- package/shim/terminals.d.ts +1 -1
- package/shim/ui.d.ts +10 -0
- package/shim/ui.js +47 -0
- package/template/plugin.json +9 -8
- package/types/components/ActivityBar.d.ts +20 -0
- package/types/components/ContextMenu.d.ts +3 -1
- package/types/components/FileIcon.d.ts +7 -0
- package/types/components/TabStrip.d.ts +7 -1
- package/types/components/menuplace.d.ts +7 -1
- package/types/components/useResize.d.ts +12 -0
- package/types/core/bridge.d.ts +37 -1
- 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 +193 -0
- package/types/core/p2p.d.ts +117 -0
- package/types/core/patterntokens.d.ts +24 -0
- package/types/core/remotepath.d.ts +17 -0
- package/types/core/settingsstore.d.ts +1 -0
- 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,117 @@
|
|
|
1
|
+
// GENERATED by sdk/gen-types.mjs from Deck's source — do not edit.
|
|
2
|
+
/** What can travel: anything JSON can carry. */
|
|
3
|
+
export type Json = string | number | boolean | null | Json[] | {
|
|
4
|
+
[k: string]: Json;
|
|
5
|
+
};
|
|
6
|
+
/** Whether someone may change what is shared, or only watch. */
|
|
7
|
+
export type Mode = "edit" | "view";
|
|
8
|
+
/** Who may change things: a default for everyone, and a choice per person that wins over it. */
|
|
9
|
+
export interface Roles {
|
|
10
|
+
def: Mode;
|
|
11
|
+
per: Record<string, Mode>;
|
|
12
|
+
}
|
|
13
|
+
/** Why a share ended for a joiner: the host stopped, vanished, removed this Deck, turned it away,
|
|
14
|
+
* or speaks another version. */
|
|
15
|
+
export type Gone = "ended" | "lost" | "removed" | "denied" | "version";
|
|
16
|
+
export interface Person {
|
|
17
|
+
id: string;
|
|
18
|
+
name: string; /** Round trip in ms, once measured. */
|
|
19
|
+
ms?: number;
|
|
20
|
+
}
|
|
21
|
+
/** What a share's bar and dialogs show. Replaced, never mutated, so React sees a change. */
|
|
22
|
+
export interface ShareView {
|
|
23
|
+
/** Who is in and connected: on the host, everyone let in; on a joiner, the host and the others. */
|
|
24
|
+
peers: Person[];
|
|
25
|
+
/** On the host: who is asking to be let in. */
|
|
26
|
+
knocking: Person[];
|
|
27
|
+
/** On a joiner: the host is there but has not let this Deck in yet. */
|
|
28
|
+
waiting: boolean;
|
|
29
|
+
/** On a joiner: no host heard from for a while (wrong code, or a network that blocks it). */
|
|
30
|
+
stuck: boolean;
|
|
31
|
+
gone: Gone | null;
|
|
32
|
+
hostName: string;
|
|
33
|
+
/** A passing line: someone on another version, or whatever the plugin `say`s. */
|
|
34
|
+
note: string;
|
|
35
|
+
roles: Roles;
|
|
36
|
+
/** Whether this Deck may change things. */
|
|
37
|
+
canEdit: boolean;
|
|
38
|
+
}
|
|
39
|
+
export interface ShareOptions {
|
|
40
|
+
/** What the share is for, e.g. "canvas-share". Decks only meet others using the same one. */
|
|
41
|
+
app: string;
|
|
42
|
+
/** The share code, which names the room (see newCode). */
|
|
43
|
+
code: string;
|
|
44
|
+
/** Optional extra secret, needed with the code to connect at all. Sharing works without one. */
|
|
45
|
+
password?: string;
|
|
46
|
+
/** The plugin's message channel, at most 12 bytes (Trystero's cap). Defaults to "msg". */
|
|
47
|
+
channel?: string;
|
|
48
|
+
/** Whether this Deck is the one sharing. */
|
|
49
|
+
host: boolean;
|
|
50
|
+
/** Shown to the others: in the host's knock, on cursors, in the list of who is here. */
|
|
51
|
+
name: string;
|
|
52
|
+
/** The plugin's own protocol version. Decks on different versions do not share. */
|
|
53
|
+
version: number;
|
|
54
|
+
/** The host's default for who may change things. Joiners may until the host says otherwise. */
|
|
55
|
+
mode?: Mode;
|
|
56
|
+
}
|
|
57
|
+
export interface ShareHandlers<T> {
|
|
58
|
+
/** A plugin message, only ever from someone let in (and the host). Check `mayEdit(peer)` before
|
|
59
|
+
* applying a change: a view-only person's edits are to be dropped by every Deck. */
|
|
60
|
+
message: (msg: T, peer: string) => void;
|
|
61
|
+
/** On the host: someone was just let in. Send them what they need to start, e.g. the board. */
|
|
62
|
+
welcome?: (peer: string) => void;
|
|
63
|
+
/** Someone left or was removed: forget what was kept for them (a cursor). */
|
|
64
|
+
left?: (peer: string) => void;
|
|
65
|
+
}
|
|
66
|
+
export interface P2pShare<T> {
|
|
67
|
+
readonly host: boolean;
|
|
68
|
+
/** Send a plugin message to everyone let in, or to one of them. Sends nothing before this Deck is
|
|
69
|
+
* let in. Settles once handed to the connection, so awaiting it paces the sender. */
|
|
70
|
+
send(msg: T, to?: string): Promise<void>;
|
|
71
|
+
/** Whether a peer may change things: the host always, anyone else by the roles. */
|
|
72
|
+
mayEdit(peer: string): boolean;
|
|
73
|
+
/** The host: let someone in, or turn them away. */
|
|
74
|
+
allow(peer: string): void;
|
|
75
|
+
deny(peer: string): void;
|
|
76
|
+
/** The host: remove someone who was let in. They cannot come back with the same Deck. */
|
|
77
|
+
kick(peer: string): void;
|
|
78
|
+
/** The host: everyone's default, and one person's own choice (`null` follows the default). */
|
|
79
|
+
setDefault(mode: Mode): void;
|
|
80
|
+
setPerson(peer: string, mode: Mode | null): void;
|
|
81
|
+
/** Show a passing line in the view for a few seconds. */
|
|
82
|
+
say(note: string): void;
|
|
83
|
+
/** Leave. With `announce` (the host ending on purpose) everyone is told first, so they end at
|
|
84
|
+
* once rather than when the connection times out. Safe to call twice. */
|
|
85
|
+
close(announce?: boolean): Promise<void>;
|
|
86
|
+
/** For useSyncExternalStore. */
|
|
87
|
+
subscribe(fn: () => void): () => void;
|
|
88
|
+
getView(): ShareView;
|
|
89
|
+
}
|
|
90
|
+
/** The part of a Trystero room a share uses: a seam, so the check can run a share without a network. */
|
|
91
|
+
export interface RoomLike {
|
|
92
|
+
/** This Deck's id in the room; Trystero's own is `selfId()`. */
|
|
93
|
+
selfId?: string;
|
|
94
|
+
makeAction(name: string, config: {
|
|
95
|
+
onMessage: (data: any, ctx: {
|
|
96
|
+
peerId: string;
|
|
97
|
+
}) => void;
|
|
98
|
+
}): {
|
|
99
|
+
send(data: any, options?: {
|
|
100
|
+
target?: string | string[];
|
|
101
|
+
}): Promise<void>;
|
|
102
|
+
};
|
|
103
|
+
ping(peer: string): Promise<number>;
|
|
104
|
+
leave(): Promise<void>;
|
|
105
|
+
getPeers(): Record<string, unknown>;
|
|
106
|
+
onPeerJoin: ((peer: string) => void) | null;
|
|
107
|
+
onPeerLeave: ((peer: string) => void) | null;
|
|
108
|
+
}
|
|
109
|
+
/** This Deck's id in every share: the one the others know it by. The same for the whole session,
|
|
110
|
+
* so someone let in who rejoins after a dropped connection is let straight back in. */
|
|
111
|
+
export declare function selfId(): string;
|
|
112
|
+
/** Start sharing (`host`), or ask to join someone's share. */
|
|
113
|
+
export declare function share<T extends Json>(opts: ShareOptions, on: ShareHandlers<T>, room?: RoomLike): P2pShare<T>;
|
|
114
|
+
/** A share code: 16 random characters in four groups, easy to read out or paste. */
|
|
115
|
+
export declare function newCode(random?: (n: number) => Uint8Array): string;
|
|
116
|
+
/** A pasted code, tidied: spaces dropped, case folded. Empty when it is not a code. */
|
|
117
|
+
export declare function cleanCode(text: string): string;
|
|
@@ -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,4 +13,5 @@ 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
|
+
export declare function userName(): Promise<string>;
|
|
16
17
|
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;
|