@sigma-file-manager/api 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/README.md +44 -0
- package/index.d.ts +578 -0
- package/manifest.schema.json +406 -0
- package/package.json +20 -0
package/README.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# @sigma-file-manager/api
|
|
2
|
+
|
|
3
|
+
Types and manifest schema for Sigma File Manager extensions.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -D @sigma-file-manager/api
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Use in JavaScript extensions
|
|
12
|
+
|
|
13
|
+
Use `// @ts-check` and JSDoc imports from the package:
|
|
14
|
+
|
|
15
|
+
```js
|
|
16
|
+
// @ts-check
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @typedef {import('@sigma-file-manager/api').ExtensionActivationContext} ExtensionActivationContext
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @param {ExtensionActivationContext} context
|
|
24
|
+
*/
|
|
25
|
+
async function activate(context) {
|
|
26
|
+
console.log(context.extensionPath);
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Manifest schema
|
|
31
|
+
|
|
32
|
+
Use this schema URL in your extension `package.json`:
|
|
33
|
+
|
|
34
|
+
```json
|
|
35
|
+
{
|
|
36
|
+
"$schema": "https://raw.githubusercontent.com/aleksey-hoffman/sigma-file-manager/main/packages/api/manifest.schema.json"
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Release
|
|
41
|
+
|
|
42
|
+
- Package versions are independent from app versions.
|
|
43
|
+
- Use `api-vX.Y.Z` tags for package releases.
|
|
44
|
+
- Publish from `packages/api` with `npm publish`.
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,578 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
const sigma: SigmaExtensionAPI;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export type ExtensionType = 'api' | 'iframe' | 'webview';
|
|
6
|
+
|
|
7
|
+
export type ExtensionPermission
|
|
8
|
+
= | 'contextMenu'
|
|
9
|
+
| 'sidebar'
|
|
10
|
+
| 'toolbar'
|
|
11
|
+
| 'commands'
|
|
12
|
+
| 'fs.read'
|
|
13
|
+
| 'fs.write'
|
|
14
|
+
| 'notifications'
|
|
15
|
+
| 'dialogs'
|
|
16
|
+
| 'shell';
|
|
17
|
+
|
|
18
|
+
export type ExtensionActivationEvent
|
|
19
|
+
= | 'onStartup'
|
|
20
|
+
| 'onInstall'
|
|
21
|
+
| 'onUninstall'
|
|
22
|
+
| 'onEnable'
|
|
23
|
+
| 'onDisable'
|
|
24
|
+
| 'onUpdate'
|
|
25
|
+
| `onCommand:${string}`;
|
|
26
|
+
|
|
27
|
+
export interface ExtensionPublisher {
|
|
28
|
+
name: string;
|
|
29
|
+
url?: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface ExtensionCommand {
|
|
33
|
+
id: string;
|
|
34
|
+
title: string;
|
|
35
|
+
description?: string;
|
|
36
|
+
icon?: string;
|
|
37
|
+
shortcut?: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface ExtensionContextMenuCondition {
|
|
41
|
+
selectionType?: 'single' | 'multiple' | 'any';
|
|
42
|
+
entryType?: 'file' | 'directory' | 'any';
|
|
43
|
+
fileExtensions?: string[];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface ExtensionContextMenuItem {
|
|
47
|
+
id: string;
|
|
48
|
+
title: string;
|
|
49
|
+
icon?: string;
|
|
50
|
+
when?: ExtensionContextMenuCondition;
|
|
51
|
+
group?: string;
|
|
52
|
+
order?: number;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface ExtensionSidebarItem {
|
|
56
|
+
id: string;
|
|
57
|
+
title: string;
|
|
58
|
+
icon: string;
|
|
59
|
+
order?: number;
|
|
60
|
+
url?: string;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface ExtensionToolbarDropdownItem {
|
|
64
|
+
id: string;
|
|
65
|
+
title: string;
|
|
66
|
+
icon?: string;
|
|
67
|
+
commandId?: string;
|
|
68
|
+
separator?: boolean;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface ExtensionToolbarDropdown {
|
|
72
|
+
id: string;
|
|
73
|
+
title: string;
|
|
74
|
+
icon?: string;
|
|
75
|
+
items: ExtensionToolbarDropdownItem[];
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export type ExtensionConfigurationPropertyType = 'string' | 'number' | 'boolean' | 'array';
|
|
79
|
+
|
|
80
|
+
export interface ExtensionConfigurationProperty {
|
|
81
|
+
type: ExtensionConfigurationPropertyType;
|
|
82
|
+
default?: unknown;
|
|
83
|
+
description?: string;
|
|
84
|
+
enum?: (string | number)[];
|
|
85
|
+
enumDescriptions?: string[];
|
|
86
|
+
minimum?: number;
|
|
87
|
+
maximum?: number;
|
|
88
|
+
minLength?: number;
|
|
89
|
+
maxLength?: number;
|
|
90
|
+
items?: {
|
|
91
|
+
type: 'string' | 'number';
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export interface ExtensionConfiguration {
|
|
96
|
+
title?: string;
|
|
97
|
+
properties: Record<string, ExtensionConfigurationProperty>;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export type ExtensionKeybindingWhen
|
|
101
|
+
= | 'always'
|
|
102
|
+
| 'fileSelected'
|
|
103
|
+
| 'directorySelected'
|
|
104
|
+
| 'singleSelected'
|
|
105
|
+
| 'multipleSelected'
|
|
106
|
+
| 'navigatorFocused';
|
|
107
|
+
|
|
108
|
+
export interface ExtensionKeybinding {
|
|
109
|
+
command: string;
|
|
110
|
+
key: string;
|
|
111
|
+
when?: ExtensionKeybindingWhen;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export interface ExtensionContributions {
|
|
115
|
+
commands?: ExtensionCommand[];
|
|
116
|
+
contextMenu?: ExtensionContextMenuItem[];
|
|
117
|
+
sidebar?: ExtensionSidebarItem[];
|
|
118
|
+
toolbar?: ExtensionToolbarDropdown[];
|
|
119
|
+
configuration?: ExtensionConfiguration;
|
|
120
|
+
keybindings?: ExtensionKeybinding[];
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export interface ExtensionEngines {
|
|
124
|
+
sigmaFileManager: string;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export type PlatformOS = 'windows' | 'macos' | 'linux';
|
|
128
|
+
export type PlatformArch = 'x64' | 'arm64' | 'x86';
|
|
129
|
+
|
|
130
|
+
export interface ExtensionManifest {
|
|
131
|
+
id: string;
|
|
132
|
+
name: string;
|
|
133
|
+
previousName?: string;
|
|
134
|
+
version: string;
|
|
135
|
+
publisher?: ExtensionPublisher;
|
|
136
|
+
repository: string;
|
|
137
|
+
license: string;
|
|
138
|
+
icon?: string;
|
|
139
|
+
banner?: string;
|
|
140
|
+
categories?: string[];
|
|
141
|
+
tags?: string[];
|
|
142
|
+
extensionType: ExtensionType;
|
|
143
|
+
main: string;
|
|
144
|
+
permissions: ExtensionPermission[];
|
|
145
|
+
activationEvents?: ExtensionActivationEvent[];
|
|
146
|
+
contributes?: ExtensionContributions;
|
|
147
|
+
platforms?: PlatformOS[];
|
|
148
|
+
engines: ExtensionEngines;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export interface Disposable {
|
|
152
|
+
dispose(): void;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export interface ContextMenuContext {
|
|
156
|
+
selectedEntries: {
|
|
157
|
+
path: string;
|
|
158
|
+
name: string;
|
|
159
|
+
isDirectory: boolean;
|
|
160
|
+
size?: number;
|
|
161
|
+
extension?: string;
|
|
162
|
+
}[];
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export interface NotificationOptions {
|
|
166
|
+
title: string;
|
|
167
|
+
subtitle?: string;
|
|
168
|
+
description?: string;
|
|
169
|
+
type?: 'info' | 'success' | 'warning' | 'error';
|
|
170
|
+
duration?: number;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export interface DialogOptions {
|
|
174
|
+
title: string;
|
|
175
|
+
message: string;
|
|
176
|
+
type?: 'info' | 'confirm' | 'prompt';
|
|
177
|
+
confirmText?: string;
|
|
178
|
+
cancelText?: string;
|
|
179
|
+
defaultValue?: string;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export interface DialogResult {
|
|
183
|
+
confirmed: boolean;
|
|
184
|
+
value?: string;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export type ProgressLocation = 'notification' | 'statusBar';
|
|
188
|
+
|
|
189
|
+
export interface ProgressOptions {
|
|
190
|
+
subtitle: string;
|
|
191
|
+
location?: ProgressLocation;
|
|
192
|
+
cancellable?: boolean;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export interface ProgressReport {
|
|
196
|
+
subtitle?: string;
|
|
197
|
+
description?: string;
|
|
198
|
+
increment?: number;
|
|
199
|
+
value?: number;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export interface Progress {
|
|
203
|
+
report(value: ProgressReport): void;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
export interface CancellationToken {
|
|
207
|
+
readonly isCancellationRequested: boolean;
|
|
208
|
+
onCancellationRequested(listener: () => void): Disposable;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
export interface ExtensionDirEntry {
|
|
212
|
+
path: string;
|
|
213
|
+
name: string;
|
|
214
|
+
isDirectory: boolean;
|
|
215
|
+
size?: number;
|
|
216
|
+
modifiedAt?: number;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
export interface ExtensionScopedDirectory {
|
|
220
|
+
path: string;
|
|
221
|
+
permissions: ('read' | 'write')[];
|
|
222
|
+
grantedAt: number;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
export interface ExtensionContextEntry {
|
|
226
|
+
path: string;
|
|
227
|
+
name: string;
|
|
228
|
+
isDirectory: boolean;
|
|
229
|
+
isFile: boolean;
|
|
230
|
+
size: number;
|
|
231
|
+
extension: string | null;
|
|
232
|
+
createdAt: number;
|
|
233
|
+
modifiedAt: number;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
export interface BuiltinCommandInfo {
|
|
237
|
+
id: string;
|
|
238
|
+
title: string;
|
|
239
|
+
description: string;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
export interface FileDialogFilter {
|
|
243
|
+
name: string;
|
|
244
|
+
extensions: string[];
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
export interface OpenFileDialogOptions {
|
|
248
|
+
title?: string;
|
|
249
|
+
defaultPath?: string;
|
|
250
|
+
filters?: FileDialogFilter[];
|
|
251
|
+
multiple?: boolean;
|
|
252
|
+
directory?: boolean;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
export interface SaveFileDialogOptions {
|
|
256
|
+
title?: string;
|
|
257
|
+
defaultPath?: string;
|
|
258
|
+
filters?: FileDialogFilter[];
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
export interface BinaryInstallOptions {
|
|
262
|
+
name: string;
|
|
263
|
+
downloadUrl: string | ((platform: PlatformOS) => string);
|
|
264
|
+
integrity?: string;
|
|
265
|
+
executable?: string;
|
|
266
|
+
version?: string;
|
|
267
|
+
repository?: string;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
export interface BinaryInfo {
|
|
271
|
+
id: string;
|
|
272
|
+
path: string;
|
|
273
|
+
version?: string;
|
|
274
|
+
storageVersion?: string | null;
|
|
275
|
+
repository?: string;
|
|
276
|
+
latestVersion?: string;
|
|
277
|
+
hasUpdate?: boolean;
|
|
278
|
+
latestCheckedAt?: number;
|
|
279
|
+
installedAt: number;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
export type UIElementType
|
|
283
|
+
= | 'input'
|
|
284
|
+
| 'select'
|
|
285
|
+
| 'checkbox'
|
|
286
|
+
| 'textarea'
|
|
287
|
+
| 'button'
|
|
288
|
+
| 'separator'
|
|
289
|
+
| 'text'
|
|
290
|
+
| 'image'
|
|
291
|
+
| 'skeleton'
|
|
292
|
+
| 'alert'
|
|
293
|
+
| 'previewCard'
|
|
294
|
+
| 'previewCardSkeleton';
|
|
295
|
+
|
|
296
|
+
export interface UISelectOption {
|
|
297
|
+
value: string;
|
|
298
|
+
label: string;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
export interface UIElement {
|
|
302
|
+
type: UIElementType;
|
|
303
|
+
id?: string;
|
|
304
|
+
label?: string;
|
|
305
|
+
placeholder?: string;
|
|
306
|
+
value?: string | boolean | number;
|
|
307
|
+
options?: UISelectOption[];
|
|
308
|
+
rows?: number;
|
|
309
|
+
variant?: 'primary' | 'secondary' | 'danger';
|
|
310
|
+
tone?: 'info' | 'success' | 'warning' | 'error';
|
|
311
|
+
size?: 'xs' | 'sm' | 'default' | 'lg';
|
|
312
|
+
disabled?: boolean;
|
|
313
|
+
subtitle?: string;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
export interface KeyboardShortcut {
|
|
317
|
+
key: string;
|
|
318
|
+
modifiers?: ('ctrl' | 'shift' | 'alt' | 'meta')[];
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
export interface ModalButton {
|
|
322
|
+
id: string;
|
|
323
|
+
label: string;
|
|
324
|
+
variant?: 'primary' | 'secondary' | 'danger';
|
|
325
|
+
shortcut?: KeyboardShortcut;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
export interface ModalOptions {
|
|
329
|
+
title: string;
|
|
330
|
+
width?: number;
|
|
331
|
+
content: UIElement[];
|
|
332
|
+
buttons?: ModalButton[];
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
export interface ModalHandle {
|
|
336
|
+
onSubmit(callback: (values: Record<string, unknown>, buttonId: string) => void | boolean | Promise<void | boolean>): void;
|
|
337
|
+
onClose(callback: () => void): void;
|
|
338
|
+
onValueChange(callback: (elementId: string, value: unknown, allValues: Record<string, unknown>) => void): void;
|
|
339
|
+
close(): void;
|
|
340
|
+
updateElement(id: string, updates: Partial<UIElement>): void;
|
|
341
|
+
setContent(content: UIElement[]): void;
|
|
342
|
+
getValues(): Record<string, unknown>;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
export interface ToolbarRenderHandle {
|
|
346
|
+
unmount(): void;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
export interface PlatformInfo {
|
|
350
|
+
os: PlatformOS;
|
|
351
|
+
arch: PlatformArch;
|
|
352
|
+
pathSeparator: string;
|
|
353
|
+
isWindows: boolean;
|
|
354
|
+
isMacos: boolean;
|
|
355
|
+
isLinux: boolean;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
export interface SigmaExtensionAPI {
|
|
359
|
+
contextMenu: {
|
|
360
|
+
registerItem(
|
|
361
|
+
item: ExtensionContextMenuItem,
|
|
362
|
+
handler: (context: ContextMenuContext) => Promise<void> | void
|
|
363
|
+
): Disposable;
|
|
364
|
+
};
|
|
365
|
+
sidebar: {
|
|
366
|
+
registerPage(page: ExtensionSidebarItem): Disposable;
|
|
367
|
+
};
|
|
368
|
+
toolbar: {
|
|
369
|
+
registerDropdown(
|
|
370
|
+
dropdown: ExtensionToolbarDropdown,
|
|
371
|
+
handlers: Record<string, () => Promise<void> | void>
|
|
372
|
+
): Disposable;
|
|
373
|
+
};
|
|
374
|
+
commands: {
|
|
375
|
+
registerCommand(
|
|
376
|
+
command: ExtensionCommand,
|
|
377
|
+
handler: (...args: unknown[]) => Promise<unknown> | unknown
|
|
378
|
+
): Disposable;
|
|
379
|
+
executeCommand(commandId: string, ...args: unknown[]): Promise<unknown>;
|
|
380
|
+
getBuiltinCommands(): BuiltinCommandInfo[];
|
|
381
|
+
};
|
|
382
|
+
context: {
|
|
383
|
+
getCurrentPath(): string | null;
|
|
384
|
+
getSelectedEntries(): ExtensionContextEntry[];
|
|
385
|
+
getAppVersion(): Promise<string>;
|
|
386
|
+
getDownloadsDir(): Promise<string>;
|
|
387
|
+
getPicturesDir(): Promise<string>;
|
|
388
|
+
openUrl(url: string): Promise<void>;
|
|
389
|
+
onPathChange(callback: (path: string | null) => void): Disposable;
|
|
390
|
+
onSelectionChange(callback: (entries: ExtensionContextEntry[]) => void): Disposable;
|
|
391
|
+
};
|
|
392
|
+
fs: {
|
|
393
|
+
readFile(path: string): Promise<Uint8Array>;
|
|
394
|
+
writeFile(path: string, data: Uint8Array): Promise<void>;
|
|
395
|
+
readDir(path: string): Promise<ExtensionDirEntry[]>;
|
|
396
|
+
exists(path: string): Promise<boolean>;
|
|
397
|
+
downloadFile(url: string, path: string): Promise<void>;
|
|
398
|
+
private: {
|
|
399
|
+
readFile(relativePath: string): Promise<Uint8Array>;
|
|
400
|
+
writeFile(relativePath: string, data: Uint8Array): Promise<void>;
|
|
401
|
+
readDir(relativePath?: string): Promise<ExtensionDirEntry[]>;
|
|
402
|
+
exists(relativePath: string): Promise<boolean>;
|
|
403
|
+
resolvePath(relativePath: string): Promise<string>;
|
|
404
|
+
};
|
|
405
|
+
storage: {
|
|
406
|
+
readFile(relativePath: string): Promise<Uint8Array>;
|
|
407
|
+
writeFile(relativePath: string, data: Uint8Array): Promise<void>;
|
|
408
|
+
readDir(relativePath?: string): Promise<ExtensionDirEntry[]>;
|
|
409
|
+
exists(relativePath: string): Promise<boolean>;
|
|
410
|
+
resolvePath(relativePath: string): Promise<string>;
|
|
411
|
+
importFile(sourcePath: string, targetRelativePath: string): Promise<string>;
|
|
412
|
+
deleteFile(relativePath: string): Promise<void>;
|
|
413
|
+
};
|
|
414
|
+
scoped: {
|
|
415
|
+
requestDirectoryAccess(options?: {
|
|
416
|
+
permission?: 'read' | 'write' | 'readWrite';
|
|
417
|
+
title?: string;
|
|
418
|
+
defaultPath?: string;
|
|
419
|
+
}): Promise<{
|
|
420
|
+
granted: boolean;
|
|
421
|
+
path?: string;
|
|
422
|
+
permissions?: ('read' | 'write')[];
|
|
423
|
+
}>;
|
|
424
|
+
getDirectories(): Promise<ExtensionScopedDirectory[]>;
|
|
425
|
+
readFile(path: string): Promise<Uint8Array>;
|
|
426
|
+
writeFile(path: string, data: Uint8Array): Promise<void>;
|
|
427
|
+
readDir(path: string): Promise<ExtensionDirEntry[]>;
|
|
428
|
+
exists(path: string): Promise<boolean>;
|
|
429
|
+
};
|
|
430
|
+
};
|
|
431
|
+
ui: {
|
|
432
|
+
showNotification(options: NotificationOptions): void;
|
|
433
|
+
showDialog(options: DialogOptions): Promise<DialogResult>;
|
|
434
|
+
withProgress<T>(
|
|
435
|
+
options: ProgressOptions,
|
|
436
|
+
task: (progress: Progress, token: CancellationToken) => Promise<T>
|
|
437
|
+
): Promise<T>;
|
|
438
|
+
createModal(options: ModalOptions): ModalHandle;
|
|
439
|
+
input(options: {
|
|
440
|
+
id: string;
|
|
441
|
+
label?: string;
|
|
442
|
+
placeholder?: string;
|
|
443
|
+
value?: string;
|
|
444
|
+
disabled?: boolean;
|
|
445
|
+
}): UIElement;
|
|
446
|
+
select(options: {
|
|
447
|
+
id: string;
|
|
448
|
+
label?: string;
|
|
449
|
+
placeholder?: string;
|
|
450
|
+
options: UISelectOption[];
|
|
451
|
+
value?: string;
|
|
452
|
+
disabled?: boolean;
|
|
453
|
+
}): UIElement;
|
|
454
|
+
checkbox(options: {
|
|
455
|
+
id: string;
|
|
456
|
+
label?: string;
|
|
457
|
+
checked?: boolean;
|
|
458
|
+
disabled?: boolean;
|
|
459
|
+
}): UIElement;
|
|
460
|
+
textarea(options: {
|
|
461
|
+
id: string;
|
|
462
|
+
label?: string;
|
|
463
|
+
placeholder?: string;
|
|
464
|
+
value?: string;
|
|
465
|
+
rows?: number;
|
|
466
|
+
disabled?: boolean;
|
|
467
|
+
}): UIElement;
|
|
468
|
+
separator(): UIElement;
|
|
469
|
+
text(content: string): UIElement;
|
|
470
|
+
alert(options: {
|
|
471
|
+
title: string;
|
|
472
|
+
description?: string;
|
|
473
|
+
tone?: 'info' | 'success' | 'warning' | 'error';
|
|
474
|
+
}): UIElement;
|
|
475
|
+
image(options: {
|
|
476
|
+
id?: string;
|
|
477
|
+
src: string;
|
|
478
|
+
alt?: string;
|
|
479
|
+
}): UIElement;
|
|
480
|
+
previewCard(options: {
|
|
481
|
+
thumbnail: string;
|
|
482
|
+
title: string;
|
|
483
|
+
subtitle?: string;
|
|
484
|
+
}): UIElement;
|
|
485
|
+
previewCardSkeleton(): UIElement;
|
|
486
|
+
skeleton(options?: {
|
|
487
|
+
id?: string;
|
|
488
|
+
width?: number;
|
|
489
|
+
height?: number;
|
|
490
|
+
}): UIElement;
|
|
491
|
+
button(options: {
|
|
492
|
+
id: string;
|
|
493
|
+
label: string;
|
|
494
|
+
variant?: 'primary' | 'secondary' | 'danger';
|
|
495
|
+
size?: 'xs' | 'sm' | 'default' | 'lg';
|
|
496
|
+
disabled?: boolean;
|
|
497
|
+
}): UIElement;
|
|
498
|
+
renderToolbar(
|
|
499
|
+
container: HTMLElement,
|
|
500
|
+
elements: UIElement[],
|
|
501
|
+
onButtonClick?: (buttonId: string) => void
|
|
502
|
+
): ToolbarRenderHandle;
|
|
503
|
+
};
|
|
504
|
+
dialog: {
|
|
505
|
+
openFile(options?: OpenFileDialogOptions): Promise<string | string[] | null>;
|
|
506
|
+
saveFile(options?: SaveFileDialogOptions): Promise<string | null>;
|
|
507
|
+
};
|
|
508
|
+
shell: {
|
|
509
|
+
run(
|
|
510
|
+
commandPath: string,
|
|
511
|
+
args?: string[]
|
|
512
|
+
): Promise<{
|
|
513
|
+
code: number;
|
|
514
|
+
stdout: string;
|
|
515
|
+
stderr: string;
|
|
516
|
+
}>;
|
|
517
|
+
runWithProgress(
|
|
518
|
+
commandPath: string,
|
|
519
|
+
args: string[] | undefined,
|
|
520
|
+
onProgress?: (payload: {
|
|
521
|
+
taskId: string;
|
|
522
|
+
line: string;
|
|
523
|
+
isStderr: boolean;
|
|
524
|
+
}) => void
|
|
525
|
+
): Promise<{
|
|
526
|
+
taskId: string;
|
|
527
|
+
result: Promise<{
|
|
528
|
+
code: number;
|
|
529
|
+
stdout: string;
|
|
530
|
+
stderr: string;
|
|
531
|
+
}>;
|
|
532
|
+
cancel: () => Promise<void>;
|
|
533
|
+
}>;
|
|
534
|
+
renamePartFilesToTs(directory: string): Promise<number>;
|
|
535
|
+
};
|
|
536
|
+
settings: {
|
|
537
|
+
get<T>(key: string): Promise<T | undefined>;
|
|
538
|
+
set<T>(key: string, value: T): Promise<void>;
|
|
539
|
+
getAll(): Promise<Record<string, unknown>>;
|
|
540
|
+
reset(key: string): Promise<void>;
|
|
541
|
+
onChange(key: string, callback: (newValue: unknown, oldValue: unknown) => void): Disposable;
|
|
542
|
+
};
|
|
543
|
+
storage: {
|
|
544
|
+
get<T>(key: string): Promise<T | undefined>;
|
|
545
|
+
set<T>(key: string, value: T): Promise<void>;
|
|
546
|
+
remove(key: string): Promise<void>;
|
|
547
|
+
};
|
|
548
|
+
platform: {
|
|
549
|
+
readonly os: PlatformOS;
|
|
550
|
+
readonly arch: PlatformArch;
|
|
551
|
+
readonly pathSeparator: string;
|
|
552
|
+
readonly isWindows: boolean;
|
|
553
|
+
readonly isMacos: boolean;
|
|
554
|
+
readonly isLinux: boolean;
|
|
555
|
+
joinPath(...segments: string[]): string;
|
|
556
|
+
};
|
|
557
|
+
binary: {
|
|
558
|
+
ensureInstalled(id: string, options: BinaryInstallOptions): Promise<string>;
|
|
559
|
+
getPath(id: string): Promise<string | null>;
|
|
560
|
+
isInstalled(id: string): Promise<boolean>;
|
|
561
|
+
remove(id: string): Promise<void>;
|
|
562
|
+
getInfo(id: string): Promise<BinaryInfo | null>;
|
|
563
|
+
};
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
export interface ExtensionActivationContext {
|
|
567
|
+
extensionId: string;
|
|
568
|
+
extensionPath: string;
|
|
569
|
+
storagePath: string;
|
|
570
|
+
activationEvent: ExtensionActivationEvent;
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
export interface ExtensionModule {
|
|
574
|
+
activate?(context: ExtensionActivationContext): Promise<void> | void;
|
|
575
|
+
deactivate?(): Promise<void> | void;
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
export {};
|
|
@@ -0,0 +1,406 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "https://raw.githubusercontent.com/aleksey-hoffman/sigma-file-manager/main/packages/api/manifest.schema.json",
|
|
4
|
+
"title": "Sigma File Manager Extension Manifest",
|
|
5
|
+
"description": "Schema for Sigma File Manager extension package.json files",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": [
|
|
8
|
+
"id",
|
|
9
|
+
"name",
|
|
10
|
+
"version",
|
|
11
|
+
"repository",
|
|
12
|
+
"license",
|
|
13
|
+
"extensionType",
|
|
14
|
+
"main",
|
|
15
|
+
"permissions",
|
|
16
|
+
"engines"
|
|
17
|
+
],
|
|
18
|
+
"properties": {
|
|
19
|
+
"id": {
|
|
20
|
+
"type": "string",
|
|
21
|
+
"description": "Unique extension identifier in format 'publisher.extension-name'",
|
|
22
|
+
"pattern": "^[a-z0-9-]+\\.[a-z0-9-]+$"
|
|
23
|
+
},
|
|
24
|
+
"name": {
|
|
25
|
+
"type": "string",
|
|
26
|
+
"description": "Display name of the extension"
|
|
27
|
+
},
|
|
28
|
+
"previousName": {
|
|
29
|
+
"type": "string",
|
|
30
|
+
"description": "Previous name of the extension (shown in extension details and used for search)"
|
|
31
|
+
},
|
|
32
|
+
"version": {
|
|
33
|
+
"type": "string",
|
|
34
|
+
"description": "Semantic version of the extension",
|
|
35
|
+
"pattern": "^\\d+\\.\\d+\\.\\d+(-[a-zA-Z0-9.]+)?$"
|
|
36
|
+
},
|
|
37
|
+
"publisher": {
|
|
38
|
+
"type": "object",
|
|
39
|
+
"description": "Extension publisher information",
|
|
40
|
+
"required": [
|
|
41
|
+
"name"
|
|
42
|
+
],
|
|
43
|
+
"properties": {
|
|
44
|
+
"name": {
|
|
45
|
+
"type": "string",
|
|
46
|
+
"description": "Publisher name"
|
|
47
|
+
},
|
|
48
|
+
"url": {
|
|
49
|
+
"type": "string",
|
|
50
|
+
"format": "uri",
|
|
51
|
+
"description": "Publisher website URL"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"repository": {
|
|
56
|
+
"type": "string",
|
|
57
|
+
"format": "uri",
|
|
58
|
+
"description": "GitHub repository URL"
|
|
59
|
+
},
|
|
60
|
+
"license": {
|
|
61
|
+
"type": "string",
|
|
62
|
+
"description": "SPDX license identifier"
|
|
63
|
+
},
|
|
64
|
+
"icon": {
|
|
65
|
+
"type": "string",
|
|
66
|
+
"description": "Relative path to extension icon"
|
|
67
|
+
},
|
|
68
|
+
"banner": {
|
|
69
|
+
"type": "string",
|
|
70
|
+
"description": "Relative path to banner image"
|
|
71
|
+
},
|
|
72
|
+
"categories": {
|
|
73
|
+
"type": "array",
|
|
74
|
+
"description": "Categories for extension classification",
|
|
75
|
+
"items": {
|
|
76
|
+
"type": "string",
|
|
77
|
+
"enum": [
|
|
78
|
+
"File Management",
|
|
79
|
+
"Media",
|
|
80
|
+
"Security",
|
|
81
|
+
"Backup & Sync",
|
|
82
|
+
"Productivity",
|
|
83
|
+
"Search & Filter",
|
|
84
|
+
"Appearance",
|
|
85
|
+
"Integration",
|
|
86
|
+
"Developer Tools",
|
|
87
|
+
"Example",
|
|
88
|
+
"Other"
|
|
89
|
+
]
|
|
90
|
+
},
|
|
91
|
+
"minItems": 1
|
|
92
|
+
},
|
|
93
|
+
"tags": {
|
|
94
|
+
"type": "array",
|
|
95
|
+
"description": "Keywords for discovery",
|
|
96
|
+
"items": {
|
|
97
|
+
"type": "string"
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
"extensionType": {
|
|
101
|
+
"type": "string",
|
|
102
|
+
"description": "Extension execution type",
|
|
103
|
+
"enum": [
|
|
104
|
+
"api",
|
|
105
|
+
"iframe",
|
|
106
|
+
"webview"
|
|
107
|
+
],
|
|
108
|
+
"enumDescriptions": [
|
|
109
|
+
"API-only extension that runs JavaScript with access to the extension API",
|
|
110
|
+
"Sandboxed iframe extension with postMessage communication",
|
|
111
|
+
"Separate Tauri webview window for full page content"
|
|
112
|
+
]
|
|
113
|
+
},
|
|
114
|
+
"main": {
|
|
115
|
+
"type": "string",
|
|
116
|
+
"description": "Entry point file"
|
|
117
|
+
},
|
|
118
|
+
"permissions": {
|
|
119
|
+
"type": "array",
|
|
120
|
+
"description": "Permissions required by the extension",
|
|
121
|
+
"items": {
|
|
122
|
+
"type": "string",
|
|
123
|
+
"enum": [
|
|
124
|
+
"contextMenu",
|
|
125
|
+
"sidebar",
|
|
126
|
+
"toolbar",
|
|
127
|
+
"commands",
|
|
128
|
+
"fs.read",
|
|
129
|
+
"fs.write",
|
|
130
|
+
"notifications",
|
|
131
|
+
"dialogs",
|
|
132
|
+
"shell"
|
|
133
|
+
]
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
"activationEvents": {
|
|
137
|
+
"type": "array",
|
|
138
|
+
"description": "Events that activate the extension",
|
|
139
|
+
"items": {
|
|
140
|
+
"type": "string",
|
|
141
|
+
"anyOf": [
|
|
142
|
+
{
|
|
143
|
+
"enum": [
|
|
144
|
+
"onStartup",
|
|
145
|
+
"onInstall",
|
|
146
|
+
"onUninstall",
|
|
147
|
+
"onEnable",
|
|
148
|
+
"onDisable",
|
|
149
|
+
"onUpdate"
|
|
150
|
+
]
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"pattern": "^onCommand:.+$"
|
|
154
|
+
}
|
|
155
|
+
]
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
"contributes": {
|
|
159
|
+
"type": "object",
|
|
160
|
+
"description": "Static contributions declared by the extension",
|
|
161
|
+
"properties": {
|
|
162
|
+
"commands": {
|
|
163
|
+
"type": "array",
|
|
164
|
+
"items": {
|
|
165
|
+
"type": "object",
|
|
166
|
+
"required": [
|
|
167
|
+
"id",
|
|
168
|
+
"title"
|
|
169
|
+
],
|
|
170
|
+
"properties": {
|
|
171
|
+
"id": { "type": "string" },
|
|
172
|
+
"title": { "type": "string" },
|
|
173
|
+
"description": { "type": "string" },
|
|
174
|
+
"icon": { "type": "string" },
|
|
175
|
+
"shortcut": { "type": "string" }
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
"contextMenu": {
|
|
180
|
+
"type": "array",
|
|
181
|
+
"items": {
|
|
182
|
+
"type": "object",
|
|
183
|
+
"required": [
|
|
184
|
+
"id",
|
|
185
|
+
"title"
|
|
186
|
+
],
|
|
187
|
+
"properties": {
|
|
188
|
+
"id": { "type": "string" },
|
|
189
|
+
"title": { "type": "string" },
|
|
190
|
+
"icon": { "type": "string" },
|
|
191
|
+
"group": { "type": "string" },
|
|
192
|
+
"order": { "type": "number" },
|
|
193
|
+
"when": {
|
|
194
|
+
"type": "object",
|
|
195
|
+
"properties": {
|
|
196
|
+
"selectionType": {
|
|
197
|
+
"type": "string",
|
|
198
|
+
"enum": [
|
|
199
|
+
"single",
|
|
200
|
+
"multiple",
|
|
201
|
+
"any"
|
|
202
|
+
]
|
|
203
|
+
},
|
|
204
|
+
"entryType": {
|
|
205
|
+
"type": "string",
|
|
206
|
+
"enum": [
|
|
207
|
+
"file",
|
|
208
|
+
"directory",
|
|
209
|
+
"any"
|
|
210
|
+
]
|
|
211
|
+
},
|
|
212
|
+
"fileExtensions": {
|
|
213
|
+
"type": "array",
|
|
214
|
+
"items": {
|
|
215
|
+
"type": "string"
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
"sidebar": {
|
|
224
|
+
"type": "array",
|
|
225
|
+
"items": {
|
|
226
|
+
"type": "object",
|
|
227
|
+
"required": [
|
|
228
|
+
"id",
|
|
229
|
+
"title",
|
|
230
|
+
"icon"
|
|
231
|
+
],
|
|
232
|
+
"properties": {
|
|
233
|
+
"id": { "type": "string" },
|
|
234
|
+
"title": { "type": "string" },
|
|
235
|
+
"icon": { "type": "string" },
|
|
236
|
+
"order": { "type": "number" },
|
|
237
|
+
"url": {
|
|
238
|
+
"type": "string",
|
|
239
|
+
"format": "uri"
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
},
|
|
244
|
+
"toolbar": {
|
|
245
|
+
"type": "array",
|
|
246
|
+
"items": {
|
|
247
|
+
"type": "object",
|
|
248
|
+
"required": [
|
|
249
|
+
"id",
|
|
250
|
+
"title",
|
|
251
|
+
"items"
|
|
252
|
+
],
|
|
253
|
+
"properties": {
|
|
254
|
+
"id": { "type": "string" },
|
|
255
|
+
"title": { "type": "string" },
|
|
256
|
+
"icon": { "type": "string" },
|
|
257
|
+
"items": {
|
|
258
|
+
"type": "array",
|
|
259
|
+
"items": {
|
|
260
|
+
"type": "object",
|
|
261
|
+
"required": [
|
|
262
|
+
"id",
|
|
263
|
+
"title"
|
|
264
|
+
],
|
|
265
|
+
"properties": {
|
|
266
|
+
"id": { "type": "string" },
|
|
267
|
+
"title": { "type": "string" },
|
|
268
|
+
"icon": { "type": "string" },
|
|
269
|
+
"commandId": { "type": "string" },
|
|
270
|
+
"separator": { "type": "boolean" }
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
},
|
|
277
|
+
"configuration": {
|
|
278
|
+
"type": "object",
|
|
279
|
+
"properties": {
|
|
280
|
+
"title": {
|
|
281
|
+
"type": "string"
|
|
282
|
+
},
|
|
283
|
+
"properties": {
|
|
284
|
+
"type": "object",
|
|
285
|
+
"additionalProperties": {
|
|
286
|
+
"type": "object",
|
|
287
|
+
"required": [
|
|
288
|
+
"type"
|
|
289
|
+
],
|
|
290
|
+
"properties": {
|
|
291
|
+
"type": {
|
|
292
|
+
"type": "string",
|
|
293
|
+
"enum": [
|
|
294
|
+
"string",
|
|
295
|
+
"number",
|
|
296
|
+
"boolean",
|
|
297
|
+
"array"
|
|
298
|
+
]
|
|
299
|
+
},
|
|
300
|
+
"default": {},
|
|
301
|
+
"description": {
|
|
302
|
+
"type": "string"
|
|
303
|
+
},
|
|
304
|
+
"enum": {
|
|
305
|
+
"type": "array",
|
|
306
|
+
"items": {
|
|
307
|
+
"type": [
|
|
308
|
+
"string",
|
|
309
|
+
"number"
|
|
310
|
+
]
|
|
311
|
+
}
|
|
312
|
+
},
|
|
313
|
+
"enumDescriptions": {
|
|
314
|
+
"type": "array",
|
|
315
|
+
"items": {
|
|
316
|
+
"type": "string"
|
|
317
|
+
}
|
|
318
|
+
},
|
|
319
|
+
"minimum": {
|
|
320
|
+
"type": "number"
|
|
321
|
+
},
|
|
322
|
+
"maximum": {
|
|
323
|
+
"type": "number"
|
|
324
|
+
},
|
|
325
|
+
"minLength": {
|
|
326
|
+
"type": "number"
|
|
327
|
+
},
|
|
328
|
+
"maxLength": {
|
|
329
|
+
"type": "number"
|
|
330
|
+
},
|
|
331
|
+
"items": {
|
|
332
|
+
"type": "object",
|
|
333
|
+
"required": [
|
|
334
|
+
"type"
|
|
335
|
+
],
|
|
336
|
+
"properties": {
|
|
337
|
+
"type": {
|
|
338
|
+
"type": "string",
|
|
339
|
+
"enum": [
|
|
340
|
+
"string",
|
|
341
|
+
"number"
|
|
342
|
+
]
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
},
|
|
351
|
+
"keybindings": {
|
|
352
|
+
"type": "array",
|
|
353
|
+
"items": {
|
|
354
|
+
"type": "object",
|
|
355
|
+
"required": [
|
|
356
|
+
"command",
|
|
357
|
+
"key"
|
|
358
|
+
],
|
|
359
|
+
"properties": {
|
|
360
|
+
"command": { "type": "string" },
|
|
361
|
+
"key": { "type": "string" },
|
|
362
|
+
"when": {
|
|
363
|
+
"type": "string",
|
|
364
|
+
"enum": [
|
|
365
|
+
"always",
|
|
366
|
+
"fileSelected",
|
|
367
|
+
"directorySelected",
|
|
368
|
+
"singleSelected",
|
|
369
|
+
"multipleSelected",
|
|
370
|
+
"navigatorFocused"
|
|
371
|
+
]
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
},
|
|
378
|
+
"platforms": {
|
|
379
|
+
"type": "array",
|
|
380
|
+
"description": "Supported operating systems",
|
|
381
|
+
"items": {
|
|
382
|
+
"type": "string",
|
|
383
|
+
"enum": [
|
|
384
|
+
"windows",
|
|
385
|
+
"macos",
|
|
386
|
+
"linux"
|
|
387
|
+
]
|
|
388
|
+
},
|
|
389
|
+
"minItems": 1,
|
|
390
|
+
"uniqueItems": true
|
|
391
|
+
},
|
|
392
|
+
"engines": {
|
|
393
|
+
"type": "object",
|
|
394
|
+
"description": "Version constraints",
|
|
395
|
+
"required": [
|
|
396
|
+
"sigmaFileManager"
|
|
397
|
+
],
|
|
398
|
+
"properties": {
|
|
399
|
+
"sigmaFileManager": {
|
|
400
|
+
"type": "string",
|
|
401
|
+
"description": "Required Sigma File Manager version range"
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sigma-file-manager/api",
|
|
3
|
+
"version": "1.2.0",
|
|
4
|
+
"description": "Type definitions and manifest schema for Sigma File Manager extensions",
|
|
5
|
+
"license": "GPL-3.0-or-later",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/aleksey-hoffman/sigma-file-manager.git",
|
|
9
|
+
"directory": "packages/api"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"index.d.ts",
|
|
13
|
+
"manifest.schema.json",
|
|
14
|
+
"README.md"
|
|
15
|
+
],
|
|
16
|
+
"types": "index.d.ts",
|
|
17
|
+
"publishConfig": {
|
|
18
|
+
"access": "public"
|
|
19
|
+
}
|
|
20
|
+
}
|