@sigma-file-manager/api 1.3.0 → 1.5.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 +11 -3
- package/index.d.ts +51 -16
- package/manifest.schema.json +176 -27
- package/package.json +20 -20
package/README.md
CHANGED
|
@@ -27,6 +27,16 @@ async function activate(context) {
|
|
|
27
27
|
}
|
|
28
28
|
```
|
|
29
29
|
|
|
30
|
+
Bundled English defaults with locale JSON from `mergeFromPath`:
|
|
31
|
+
|
|
32
|
+
```js
|
|
33
|
+
import { extensionMessages } from './messages.js';
|
|
34
|
+
|
|
35
|
+
export const t = sigma.i18n.createExtensionTranslator(extensionMessages);
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
`formatMessage` for `{placeholder}` strings is available as `sigma.i18n.formatMessage` when needed.
|
|
39
|
+
|
|
30
40
|
## Manifest schema
|
|
31
41
|
|
|
32
42
|
Use this schema URL in your extension `package.json`:
|
|
@@ -39,6 +49,4 @@ Use this schema URL in your extension `package.json`:
|
|
|
39
49
|
|
|
40
50
|
## Release
|
|
41
51
|
|
|
42
|
-
|
|
43
|
-
- Use `api-vX.Y.Z` tags for package releases.
|
|
44
|
-
- Publish from `packages/api` with `npm publish`.
|
|
52
|
+
API package versions are independent from app versions and tagged as `api-vX.Y.Z`.
|
package/index.d.ts
CHANGED
|
@@ -13,7 +13,9 @@ export type ExtensionPermission
|
|
|
13
13
|
| 'fs.write'
|
|
14
14
|
| 'notifications'
|
|
15
15
|
| 'dialogs'
|
|
16
|
-
| 'shell'
|
|
16
|
+
| 'shell'
|
|
17
|
+
| 'clipboard'
|
|
18
|
+
| 'openUrl';
|
|
17
19
|
|
|
18
20
|
export type ExtensionActivationEvent
|
|
19
21
|
= | 'onStartup'
|
|
@@ -22,6 +24,7 @@ export type ExtensionActivationEvent
|
|
|
22
24
|
| 'onEnable'
|
|
23
25
|
| 'onDisable'
|
|
24
26
|
| 'onUpdate'
|
|
27
|
+
| 'onLocaleChange'
|
|
25
28
|
| `onCommand:${string}`;
|
|
26
29
|
|
|
27
30
|
export interface ExtensionPublisher {
|
|
@@ -125,7 +128,26 @@ export interface ExtensionEngines {
|
|
|
125
128
|
}
|
|
126
129
|
|
|
127
130
|
export type PlatformOS = 'windows' | 'macos' | 'linux';
|
|
128
|
-
export type PlatformArch = 'x64' | 'arm64'
|
|
131
|
+
export type PlatformArch = 'x64' | 'arm64';
|
|
132
|
+
|
|
133
|
+
export interface ManifestBinaryAsset {
|
|
134
|
+
platform: PlatformOS;
|
|
135
|
+
arch?: PlatformArch[];
|
|
136
|
+
downloadUrl: string;
|
|
137
|
+
integrity: string;
|
|
138
|
+
archive?: boolean;
|
|
139
|
+
executable?: string;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export interface ManifestBinaryDefinition {
|
|
143
|
+
id: string;
|
|
144
|
+
name: string;
|
|
145
|
+
version: string;
|
|
146
|
+
executable?: string;
|
|
147
|
+
repository?: string;
|
|
148
|
+
platforms?: PlatformOS[];
|
|
149
|
+
assets: ManifestBinaryAsset[];
|
|
150
|
+
}
|
|
129
151
|
|
|
130
152
|
export interface ExtensionManifest {
|
|
131
153
|
id: string;
|
|
@@ -145,6 +167,7 @@ export interface ExtensionManifest {
|
|
|
145
167
|
activationEvents?: ExtensionActivationEvent[];
|
|
146
168
|
contributes?: ExtensionContributions;
|
|
147
169
|
platforms?: PlatformOS[];
|
|
170
|
+
binaries?: ManifestBinaryDefinition[];
|
|
148
171
|
engines: ExtensionEngines;
|
|
149
172
|
}
|
|
150
173
|
|
|
@@ -258,21 +281,13 @@ export interface SaveFileDialogOptions {
|
|
|
258
281
|
filters?: FileDialogFilter[];
|
|
259
282
|
}
|
|
260
283
|
|
|
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
284
|
export interface BinaryInfo {
|
|
271
285
|
id: string;
|
|
272
286
|
path: string;
|
|
273
287
|
version?: string;
|
|
274
288
|
storageVersion?: string | null;
|
|
275
289
|
repository?: string;
|
|
290
|
+
downloadUrl?: string;
|
|
276
291
|
latestVersion?: string;
|
|
277
292
|
hasUpdate?: boolean;
|
|
278
293
|
latestCheckedAt?: number;
|
|
@@ -339,6 +354,7 @@ export interface ModalHandle {
|
|
|
339
354
|
close(): void;
|
|
340
355
|
updateElement(id: string, updates: Partial<UIElement>): void;
|
|
341
356
|
setContent(content: UIElement[]): void;
|
|
357
|
+
setButtons(buttons: ModalButton[]): void;
|
|
342
358
|
getValues(): Record<string, unknown>;
|
|
343
359
|
}
|
|
344
360
|
|
|
@@ -348,7 +364,7 @@ export interface ToolbarRenderHandle {
|
|
|
348
364
|
|
|
349
365
|
export interface PlatformInfo {
|
|
350
366
|
os: PlatformOS;
|
|
351
|
-
arch:
|
|
367
|
+
arch: string;
|
|
352
368
|
pathSeparator: string;
|
|
353
369
|
isWindows: boolean;
|
|
354
370
|
isMacos: boolean;
|
|
@@ -360,7 +376,11 @@ export interface SigmaExtensionAPI {
|
|
|
360
376
|
t(key: string, params?: Record<string, string | number>): string;
|
|
361
377
|
mergeMessages(messages: Record<string, Record<string, string>>): void;
|
|
362
378
|
mergeFromPath(basePath: string): Promise<void>;
|
|
363
|
-
extensionT(key: string, params?: Record<string, string | number
|
|
379
|
+
extensionT(key: string, params?: Record<string, string | number>, fallback?: string): string;
|
|
380
|
+
formatMessage(template: string, params?: Record<string, string | number>): string;
|
|
381
|
+
createExtensionTranslator(
|
|
382
|
+
messages: Record<string, string>,
|
|
383
|
+
): (key: string, params?: Record<string, string | number>) => string;
|
|
364
384
|
};
|
|
365
385
|
contextMenu: {
|
|
366
386
|
registerItem(
|
|
@@ -437,11 +457,20 @@ export interface SigmaExtensionAPI {
|
|
|
437
457
|
ui: {
|
|
438
458
|
showNotification(options: NotificationOptions): void;
|
|
439
459
|
showDialog(options: DialogOptions): Promise<DialogResult>;
|
|
460
|
+
copyText(text: string): Promise<void>;
|
|
461
|
+
/**
|
|
462
|
+
* Writes data to the clipboard. Supported MIME types: `image/png`, `text/html`, `text/plain`.
|
|
463
|
+
* When `text/html` is provided alongside `text/plain`, the plain text is used as fallback.
|
|
464
|
+
* Writes the first supported representation found across items (image/png > text/html > text/plain).
|
|
465
|
+
* Throws if only unsupported types are provided.
|
|
466
|
+
*/
|
|
467
|
+
clipboardWrite(items: Record<string, Uint8Array>[]): Promise<void>;
|
|
440
468
|
withProgress<T>(
|
|
441
469
|
options: ProgressOptions,
|
|
442
470
|
task: (progress: Progress, token: CancellationToken) => Promise<T>
|
|
443
471
|
): Promise<T>;
|
|
444
472
|
createModal(options: ModalOptions): ModalHandle;
|
|
473
|
+
showModal(options: ModalOptions): Promise<Record<string, unknown> | null>;
|
|
445
474
|
input(options: {
|
|
446
475
|
id: string;
|
|
447
476
|
label?: string;
|
|
@@ -553,18 +582,24 @@ export interface SigmaExtensionAPI {
|
|
|
553
582
|
};
|
|
554
583
|
platform: {
|
|
555
584
|
readonly os: PlatformOS;
|
|
556
|
-
readonly arch:
|
|
585
|
+
readonly arch: string;
|
|
557
586
|
readonly pathSeparator: string;
|
|
558
587
|
readonly isWindows: boolean;
|
|
559
588
|
readonly isMacos: boolean;
|
|
560
589
|
readonly isLinux: boolean;
|
|
561
590
|
joinPath(...segments: string[]): string;
|
|
562
591
|
};
|
|
592
|
+
path: {
|
|
593
|
+
dirname(filePath: string): string;
|
|
594
|
+
basename(filePath: string, suffix?: string): string;
|
|
595
|
+
extname(filePath: string): string;
|
|
596
|
+
};
|
|
597
|
+
runtime: {
|
|
598
|
+
isExtensionInstallCancelledError(error: unknown): boolean;
|
|
599
|
+
};
|
|
563
600
|
binary: {
|
|
564
|
-
ensureInstalled(id: string, options: BinaryInstallOptions): Promise<string>;
|
|
565
601
|
getPath(id: string): Promise<string | null>;
|
|
566
602
|
isInstalled(id: string): Promise<boolean>;
|
|
567
|
-
remove(id: string): Promise<void>;
|
|
568
603
|
getInfo(id: string): Promise<BinaryInfo | null>;
|
|
569
604
|
};
|
|
570
605
|
}
|
package/manifest.schema.json
CHANGED
|
@@ -129,7 +129,9 @@
|
|
|
129
129
|
"fs.write",
|
|
130
130
|
"notifications",
|
|
131
131
|
"dialogs",
|
|
132
|
-
"shell"
|
|
132
|
+
"shell",
|
|
133
|
+
"clipboard",
|
|
134
|
+
"openUrl"
|
|
133
135
|
]
|
|
134
136
|
}
|
|
135
137
|
},
|
|
@@ -146,7 +148,8 @@
|
|
|
146
148
|
"onUninstall",
|
|
147
149
|
"onEnable",
|
|
148
150
|
"onDisable",
|
|
149
|
-
"onUpdate"
|
|
151
|
+
"onUpdate",
|
|
152
|
+
"onLocaleChange"
|
|
150
153
|
]
|
|
151
154
|
},
|
|
152
155
|
{
|
|
@@ -168,11 +171,21 @@
|
|
|
168
171
|
"title"
|
|
169
172
|
],
|
|
170
173
|
"properties": {
|
|
171
|
-
"id": {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
"
|
|
175
|
-
|
|
174
|
+
"id": {
|
|
175
|
+
"type": "string"
|
|
176
|
+
},
|
|
177
|
+
"title": {
|
|
178
|
+
"type": "string"
|
|
179
|
+
},
|
|
180
|
+
"description": {
|
|
181
|
+
"type": "string"
|
|
182
|
+
},
|
|
183
|
+
"icon": {
|
|
184
|
+
"type": "string"
|
|
185
|
+
},
|
|
186
|
+
"shortcut": {
|
|
187
|
+
"type": "string"
|
|
188
|
+
}
|
|
176
189
|
}
|
|
177
190
|
}
|
|
178
191
|
},
|
|
@@ -185,11 +198,21 @@
|
|
|
185
198
|
"title"
|
|
186
199
|
],
|
|
187
200
|
"properties": {
|
|
188
|
-
"id": {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
"
|
|
192
|
-
|
|
201
|
+
"id": {
|
|
202
|
+
"type": "string"
|
|
203
|
+
},
|
|
204
|
+
"title": {
|
|
205
|
+
"type": "string"
|
|
206
|
+
},
|
|
207
|
+
"icon": {
|
|
208
|
+
"type": "string"
|
|
209
|
+
},
|
|
210
|
+
"group": {
|
|
211
|
+
"type": "string"
|
|
212
|
+
},
|
|
213
|
+
"order": {
|
|
214
|
+
"type": "number"
|
|
215
|
+
},
|
|
193
216
|
"when": {
|
|
194
217
|
"type": "object",
|
|
195
218
|
"properties": {
|
|
@@ -230,10 +253,18 @@
|
|
|
230
253
|
"icon"
|
|
231
254
|
],
|
|
232
255
|
"properties": {
|
|
233
|
-
"id": {
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
"
|
|
256
|
+
"id": {
|
|
257
|
+
"type": "string"
|
|
258
|
+
},
|
|
259
|
+
"title": {
|
|
260
|
+
"type": "string"
|
|
261
|
+
},
|
|
262
|
+
"icon": {
|
|
263
|
+
"type": "string"
|
|
264
|
+
},
|
|
265
|
+
"order": {
|
|
266
|
+
"type": "number"
|
|
267
|
+
},
|
|
237
268
|
"url": {
|
|
238
269
|
"type": "string",
|
|
239
270
|
"format": "uri"
|
|
@@ -251,9 +282,15 @@
|
|
|
251
282
|
"items"
|
|
252
283
|
],
|
|
253
284
|
"properties": {
|
|
254
|
-
"id": {
|
|
255
|
-
|
|
256
|
-
|
|
285
|
+
"id": {
|
|
286
|
+
"type": "string"
|
|
287
|
+
},
|
|
288
|
+
"title": {
|
|
289
|
+
"type": "string"
|
|
290
|
+
},
|
|
291
|
+
"icon": {
|
|
292
|
+
"type": "string"
|
|
293
|
+
},
|
|
257
294
|
"items": {
|
|
258
295
|
"type": "array",
|
|
259
296
|
"items": {
|
|
@@ -263,11 +300,21 @@
|
|
|
263
300
|
"title"
|
|
264
301
|
],
|
|
265
302
|
"properties": {
|
|
266
|
-
"id": {
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
"
|
|
270
|
-
|
|
303
|
+
"id": {
|
|
304
|
+
"type": "string"
|
|
305
|
+
},
|
|
306
|
+
"title": {
|
|
307
|
+
"type": "string"
|
|
308
|
+
},
|
|
309
|
+
"icon": {
|
|
310
|
+
"type": "string"
|
|
311
|
+
},
|
|
312
|
+
"commandId": {
|
|
313
|
+
"type": "string"
|
|
314
|
+
},
|
|
315
|
+
"separator": {
|
|
316
|
+
"type": "boolean"
|
|
317
|
+
}
|
|
271
318
|
}
|
|
272
319
|
}
|
|
273
320
|
}
|
|
@@ -357,8 +404,12 @@
|
|
|
357
404
|
"key"
|
|
358
405
|
],
|
|
359
406
|
"properties": {
|
|
360
|
-
"command": {
|
|
361
|
-
|
|
407
|
+
"command": {
|
|
408
|
+
"type": "string"
|
|
409
|
+
},
|
|
410
|
+
"key": {
|
|
411
|
+
"type": "string"
|
|
412
|
+
},
|
|
362
413
|
"when": {
|
|
363
414
|
"type": "string",
|
|
364
415
|
"enum": [
|
|
@@ -389,6 +440,104 @@
|
|
|
389
440
|
"minItems": 1,
|
|
390
441
|
"uniqueItems": true
|
|
391
442
|
},
|
|
443
|
+
"binaries": {
|
|
444
|
+
"type": "array",
|
|
445
|
+
"description": "Binary definitions installed and managed by the host application",
|
|
446
|
+
"items": {
|
|
447
|
+
"type": "object",
|
|
448
|
+
"required": [
|
|
449
|
+
"id",
|
|
450
|
+
"name",
|
|
451
|
+
"version",
|
|
452
|
+
"assets"
|
|
453
|
+
],
|
|
454
|
+
"properties": {
|
|
455
|
+
"id": {
|
|
456
|
+
"type": "string",
|
|
457
|
+
"description": "Unique binary identifier shared across extensions"
|
|
458
|
+
},
|
|
459
|
+
"name": {
|
|
460
|
+
"type": "string",
|
|
461
|
+
"description": "Display name of the binary"
|
|
462
|
+
},
|
|
463
|
+
"version": {
|
|
464
|
+
"type": "string",
|
|
465
|
+
"description": "Pinned binary version used for shared lookup and install",
|
|
466
|
+
"minLength": 1
|
|
467
|
+
},
|
|
468
|
+
"executable": {
|
|
469
|
+
"type": "string",
|
|
470
|
+
"description": "Relative path to the executable inside the extracted directory"
|
|
471
|
+
},
|
|
472
|
+
"repository": {
|
|
473
|
+
"type": "string",
|
|
474
|
+
"format": "uri",
|
|
475
|
+
"description": "Upstream repository URL for reference"
|
|
476
|
+
},
|
|
477
|
+
"platforms": {
|
|
478
|
+
"type": "array",
|
|
479
|
+
"items": {
|
|
480
|
+
"type": "string",
|
|
481
|
+
"enum": [
|
|
482
|
+
"windows",
|
|
483
|
+
"macos",
|
|
484
|
+
"linux"
|
|
485
|
+
]
|
|
486
|
+
},
|
|
487
|
+
"minItems": 1,
|
|
488
|
+
"uniqueItems": true
|
|
489
|
+
},
|
|
490
|
+
"assets": {
|
|
491
|
+
"type": "array",
|
|
492
|
+
"minItems": 1,
|
|
493
|
+
"items": {
|
|
494
|
+
"type": "object",
|
|
495
|
+
"required": [
|
|
496
|
+
"platform",
|
|
497
|
+
"downloadUrl",
|
|
498
|
+
"integrity"
|
|
499
|
+
],
|
|
500
|
+
"properties": {
|
|
501
|
+
"platform": {
|
|
502
|
+
"type": "string",
|
|
503
|
+
"enum": [
|
|
504
|
+
"windows",
|
|
505
|
+
"macos",
|
|
506
|
+
"linux"
|
|
507
|
+
]
|
|
508
|
+
},
|
|
509
|
+
"arch": {
|
|
510
|
+
"type": "array",
|
|
511
|
+
"items": {
|
|
512
|
+
"type": "string",
|
|
513
|
+
"enum": [
|
|
514
|
+
"x64",
|
|
515
|
+
"arm64"
|
|
516
|
+
]
|
|
517
|
+
},
|
|
518
|
+
"minItems": 1,
|
|
519
|
+
"uniqueItems": true
|
|
520
|
+
},
|
|
521
|
+
"downloadUrl": {
|
|
522
|
+
"type": "string",
|
|
523
|
+
"format": "uri"
|
|
524
|
+
},
|
|
525
|
+
"integrity": {
|
|
526
|
+
"type": "string",
|
|
527
|
+
"pattern": "^sha256:[a-fA-F0-9]{64}$"
|
|
528
|
+
},
|
|
529
|
+
"archive": {
|
|
530
|
+
"type": "boolean"
|
|
531
|
+
},
|
|
532
|
+
"executable": {
|
|
533
|
+
"type": "string"
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
},
|
|
392
541
|
"engines": {
|
|
393
542
|
"type": "object",
|
|
394
543
|
"description": "Version constraints",
|
|
@@ -403,4 +552,4 @@
|
|
|
403
552
|
}
|
|
404
553
|
}
|
|
405
554
|
}
|
|
406
|
-
}
|
|
555
|
+
}
|
package/package.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@sigma-file-manager/api",
|
|
3
|
-
"version": "1.
|
|
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
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@sigma-file-manager/api",
|
|
3
|
+
"version": "1.5.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
|
+
}
|