@vicinae/api 0.20.3 → 0.20.5
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/dist/api/bus.d.ts +1 -0
- package/dist/api/components/actions.d.ts +1 -0
- package/dist/api/components/actions.js +3 -2
- package/dist/api/proto/application.d.ts +7 -0
- package/dist/api/proto/application.js +119 -3
- package/dist/api/utils.d.ts +10 -1
- package/dist/api/utils.js +8 -1
- package/package.json +2 -2
package/dist/api/bus.d.ts
CHANGED
|
@@ -42,6 +42,7 @@ type EndpointMapping = {
|
|
|
42
42
|
"app.open": "app.open";
|
|
43
43
|
"app.getDefault": "app.getDefault";
|
|
44
44
|
"app.runInTerminal": "app.runInTerminal";
|
|
45
|
+
"app.showInFileBrowser": "app.showInFileBrowser";
|
|
45
46
|
"ui.render": "ui.render";
|
|
46
47
|
"ui.showToast": "ui.showToast";
|
|
47
48
|
"ui.hideToast": "ui.hideToast";
|
|
@@ -43,9 +43,10 @@ const OpenInBrowser = ({ url, title = "Open in Browser", ...props }) => {
|
|
|
43
43
|
await (0, controls_1.closeMainWindow)();
|
|
44
44
|
} }));
|
|
45
45
|
};
|
|
46
|
-
const ShowInFinder = ({ path, title = "Show in
|
|
46
|
+
const ShowInFinder = ({ path, select = true, title = "Show in file browser", ...props }) => {
|
|
47
47
|
return ((0, jsx_runtime_1.jsx)(ActionRoot, { ...props, title: title, onAction: () => {
|
|
48
|
-
(0, utils_1.showInFileBrowser)(path);
|
|
48
|
+
(0, utils_1.showInFileBrowser)(path, { select });
|
|
49
|
+
(0, controls_1.closeMainWindow)();
|
|
49
50
|
} }));
|
|
50
51
|
};
|
|
51
52
|
const Push = ({ target, ...props }) => {
|
|
@@ -24,17 +24,23 @@ export interface GetDefaultApplicationRequest {
|
|
|
24
24
|
export interface GetDefaultApplicationResponse {
|
|
25
25
|
app: Application | undefined;
|
|
26
26
|
}
|
|
27
|
+
export interface ShowInFileBrowserRequest {
|
|
28
|
+
target: string;
|
|
29
|
+
select: boolean;
|
|
30
|
+
}
|
|
27
31
|
export interface Request {
|
|
28
32
|
list?: ListApplicationRequest | undefined;
|
|
29
33
|
open?: OpenApplicationRequest | undefined;
|
|
30
34
|
getDefault?: GetDefaultApplicationRequest | undefined;
|
|
31
35
|
runInTerminal?: RunInTerminalRequest | undefined;
|
|
36
|
+
showInFileBrowser?: ShowInFileBrowserRequest | undefined;
|
|
32
37
|
}
|
|
33
38
|
export interface Response {
|
|
34
39
|
list?: ListApplicationResponse | undefined;
|
|
35
40
|
open?: AckResponse | undefined;
|
|
36
41
|
getDefault?: GetDefaultApplicationResponse | undefined;
|
|
37
42
|
runInTerminal?: AckResponse | undefined;
|
|
43
|
+
showInFileBrowser?: AckResponse | undefined;
|
|
38
44
|
}
|
|
39
45
|
export interface Application {
|
|
40
46
|
id: string;
|
|
@@ -48,6 +54,7 @@ export declare const ListApplicationRequest: MessageFns<ListApplicationRequest>;
|
|
|
48
54
|
export declare const ListApplicationResponse: MessageFns<ListApplicationResponse>;
|
|
49
55
|
export declare const GetDefaultApplicationRequest: MessageFns<GetDefaultApplicationRequest>;
|
|
50
56
|
export declare const GetDefaultApplicationResponse: MessageFns<GetDefaultApplicationResponse>;
|
|
57
|
+
export declare const ShowInFileBrowserRequest: MessageFns<ShowInFileBrowserRequest>;
|
|
51
58
|
export declare const Request: MessageFns<Request>;
|
|
52
59
|
export declare const Response: MessageFns<Response>;
|
|
53
60
|
export declare const Application: MessageFns<Application>;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// protoc v6.33.1
|
|
6
6
|
// source: application.proto
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.Application = exports.Response = exports.Request = exports.GetDefaultApplicationResponse = exports.GetDefaultApplicationRequest = exports.ListApplicationResponse = exports.ListApplicationRequest = exports.RunInTerminalRequest = exports.OpenApplicationRequest = exports.protobufPackage = void 0;
|
|
8
|
+
exports.Application = exports.Response = exports.Request = exports.ShowInFileBrowserRequest = exports.GetDefaultApplicationResponse = exports.GetDefaultApplicationRequest = exports.ListApplicationResponse = exports.ListApplicationRequest = exports.RunInTerminalRequest = exports.OpenApplicationRequest = exports.protobufPackage = void 0;
|
|
9
9
|
/* eslint-disable */
|
|
10
10
|
const wire_1 = require("@bufbuild/protobuf/wire");
|
|
11
11
|
const common_1 = require("./common");
|
|
@@ -395,8 +395,82 @@ exports.GetDefaultApplicationResponse = {
|
|
|
395
395
|
return message;
|
|
396
396
|
},
|
|
397
397
|
};
|
|
398
|
+
function createBaseShowInFileBrowserRequest() {
|
|
399
|
+
return { target: "", select: false };
|
|
400
|
+
}
|
|
401
|
+
exports.ShowInFileBrowserRequest = {
|
|
402
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
403
|
+
if (message.target !== "") {
|
|
404
|
+
writer.uint32(10).string(message.target);
|
|
405
|
+
}
|
|
406
|
+
if (message.select !== false) {
|
|
407
|
+
writer.uint32(16).bool(message.select);
|
|
408
|
+
}
|
|
409
|
+
return writer;
|
|
410
|
+
},
|
|
411
|
+
decode(input, length) {
|
|
412
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
413
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
414
|
+
const message = createBaseShowInFileBrowserRequest();
|
|
415
|
+
while (reader.pos < end) {
|
|
416
|
+
const tag = reader.uint32();
|
|
417
|
+
switch (tag >>> 3) {
|
|
418
|
+
case 1: {
|
|
419
|
+
if (tag !== 10) {
|
|
420
|
+
break;
|
|
421
|
+
}
|
|
422
|
+
message.target = reader.string();
|
|
423
|
+
continue;
|
|
424
|
+
}
|
|
425
|
+
case 2: {
|
|
426
|
+
if (tag !== 16) {
|
|
427
|
+
break;
|
|
428
|
+
}
|
|
429
|
+
message.select = reader.bool();
|
|
430
|
+
continue;
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
434
|
+
break;
|
|
435
|
+
}
|
|
436
|
+
reader.skip(tag & 7);
|
|
437
|
+
}
|
|
438
|
+
return message;
|
|
439
|
+
},
|
|
440
|
+
fromJSON(object) {
|
|
441
|
+
return {
|
|
442
|
+
target: isSet(object.target) ? globalThis.String(object.target) : "",
|
|
443
|
+
select: isSet(object.select) ? globalThis.Boolean(object.select) : false,
|
|
444
|
+
};
|
|
445
|
+
},
|
|
446
|
+
toJSON(message) {
|
|
447
|
+
const obj = {};
|
|
448
|
+
if (message.target !== "") {
|
|
449
|
+
obj.target = message.target;
|
|
450
|
+
}
|
|
451
|
+
if (message.select !== false) {
|
|
452
|
+
obj.select = message.select;
|
|
453
|
+
}
|
|
454
|
+
return obj;
|
|
455
|
+
},
|
|
456
|
+
create(base) {
|
|
457
|
+
return exports.ShowInFileBrowserRequest.fromPartial(base ?? {});
|
|
458
|
+
},
|
|
459
|
+
fromPartial(object) {
|
|
460
|
+
const message = createBaseShowInFileBrowserRequest();
|
|
461
|
+
message.target = object.target ?? "";
|
|
462
|
+
message.select = object.select ?? false;
|
|
463
|
+
return message;
|
|
464
|
+
},
|
|
465
|
+
};
|
|
398
466
|
function createBaseRequest() {
|
|
399
|
-
return {
|
|
467
|
+
return {
|
|
468
|
+
list: undefined,
|
|
469
|
+
open: undefined,
|
|
470
|
+
getDefault: undefined,
|
|
471
|
+
runInTerminal: undefined,
|
|
472
|
+
showInFileBrowser: undefined,
|
|
473
|
+
};
|
|
400
474
|
}
|
|
401
475
|
exports.Request = {
|
|
402
476
|
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
@@ -412,6 +486,9 @@ exports.Request = {
|
|
|
412
486
|
if (message.runInTerminal !== undefined) {
|
|
413
487
|
exports.RunInTerminalRequest.encode(message.runInTerminal, writer.uint32(34).fork()).join();
|
|
414
488
|
}
|
|
489
|
+
if (message.showInFileBrowser !== undefined) {
|
|
490
|
+
exports.ShowInFileBrowserRequest.encode(message.showInFileBrowser, writer.uint32(42).fork()).join();
|
|
491
|
+
}
|
|
415
492
|
return writer;
|
|
416
493
|
},
|
|
417
494
|
decode(input, length) {
|
|
@@ -449,6 +526,13 @@ exports.Request = {
|
|
|
449
526
|
message.runInTerminal = exports.RunInTerminalRequest.decode(reader, reader.uint32());
|
|
450
527
|
continue;
|
|
451
528
|
}
|
|
529
|
+
case 5: {
|
|
530
|
+
if (tag !== 42) {
|
|
531
|
+
break;
|
|
532
|
+
}
|
|
533
|
+
message.showInFileBrowser = exports.ShowInFileBrowserRequest.decode(reader, reader.uint32());
|
|
534
|
+
continue;
|
|
535
|
+
}
|
|
452
536
|
}
|
|
453
537
|
if ((tag & 7) === 4 || tag === 0) {
|
|
454
538
|
break;
|
|
@@ -463,6 +547,9 @@ exports.Request = {
|
|
|
463
547
|
open: isSet(object.open) ? exports.OpenApplicationRequest.fromJSON(object.open) : undefined,
|
|
464
548
|
getDefault: isSet(object.getDefault) ? exports.GetDefaultApplicationRequest.fromJSON(object.getDefault) : undefined,
|
|
465
549
|
runInTerminal: isSet(object.runInTerminal) ? exports.RunInTerminalRequest.fromJSON(object.runInTerminal) : undefined,
|
|
550
|
+
showInFileBrowser: isSet(object.showInFileBrowser)
|
|
551
|
+
? exports.ShowInFileBrowserRequest.fromJSON(object.showInFileBrowser)
|
|
552
|
+
: undefined,
|
|
466
553
|
};
|
|
467
554
|
},
|
|
468
555
|
toJSON(message) {
|
|
@@ -479,6 +566,9 @@ exports.Request = {
|
|
|
479
566
|
if (message.runInTerminal !== undefined) {
|
|
480
567
|
obj.runInTerminal = exports.RunInTerminalRequest.toJSON(message.runInTerminal);
|
|
481
568
|
}
|
|
569
|
+
if (message.showInFileBrowser !== undefined) {
|
|
570
|
+
obj.showInFileBrowser = exports.ShowInFileBrowserRequest.toJSON(message.showInFileBrowser);
|
|
571
|
+
}
|
|
482
572
|
return obj;
|
|
483
573
|
},
|
|
484
574
|
create(base) {
|
|
@@ -498,11 +588,20 @@ exports.Request = {
|
|
|
498
588
|
message.runInTerminal = (object.runInTerminal !== undefined && object.runInTerminal !== null)
|
|
499
589
|
? exports.RunInTerminalRequest.fromPartial(object.runInTerminal)
|
|
500
590
|
: undefined;
|
|
591
|
+
message.showInFileBrowser = (object.showInFileBrowser !== undefined && object.showInFileBrowser !== null)
|
|
592
|
+
? exports.ShowInFileBrowserRequest.fromPartial(object.showInFileBrowser)
|
|
593
|
+
: undefined;
|
|
501
594
|
return message;
|
|
502
595
|
},
|
|
503
596
|
};
|
|
504
597
|
function createBaseResponse() {
|
|
505
|
-
return {
|
|
598
|
+
return {
|
|
599
|
+
list: undefined,
|
|
600
|
+
open: undefined,
|
|
601
|
+
getDefault: undefined,
|
|
602
|
+
runInTerminal: undefined,
|
|
603
|
+
showInFileBrowser: undefined,
|
|
604
|
+
};
|
|
506
605
|
}
|
|
507
606
|
exports.Response = {
|
|
508
607
|
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
@@ -518,6 +617,9 @@ exports.Response = {
|
|
|
518
617
|
if (message.runInTerminal !== undefined) {
|
|
519
618
|
common_1.AckResponse.encode(message.runInTerminal, writer.uint32(34).fork()).join();
|
|
520
619
|
}
|
|
620
|
+
if (message.showInFileBrowser !== undefined) {
|
|
621
|
+
common_1.AckResponse.encode(message.showInFileBrowser, writer.uint32(42).fork()).join();
|
|
622
|
+
}
|
|
521
623
|
return writer;
|
|
522
624
|
},
|
|
523
625
|
decode(input, length) {
|
|
@@ -555,6 +657,13 @@ exports.Response = {
|
|
|
555
657
|
message.runInTerminal = common_1.AckResponse.decode(reader, reader.uint32());
|
|
556
658
|
continue;
|
|
557
659
|
}
|
|
660
|
+
case 5: {
|
|
661
|
+
if (tag !== 42) {
|
|
662
|
+
break;
|
|
663
|
+
}
|
|
664
|
+
message.showInFileBrowser = common_1.AckResponse.decode(reader, reader.uint32());
|
|
665
|
+
continue;
|
|
666
|
+
}
|
|
558
667
|
}
|
|
559
668
|
if ((tag & 7) === 4 || tag === 0) {
|
|
560
669
|
break;
|
|
@@ -569,6 +678,7 @@ exports.Response = {
|
|
|
569
678
|
open: isSet(object.open) ? common_1.AckResponse.fromJSON(object.open) : undefined,
|
|
570
679
|
getDefault: isSet(object.getDefault) ? exports.GetDefaultApplicationResponse.fromJSON(object.getDefault) : undefined,
|
|
571
680
|
runInTerminal: isSet(object.runInTerminal) ? common_1.AckResponse.fromJSON(object.runInTerminal) : undefined,
|
|
681
|
+
showInFileBrowser: isSet(object.showInFileBrowser) ? common_1.AckResponse.fromJSON(object.showInFileBrowser) : undefined,
|
|
572
682
|
};
|
|
573
683
|
},
|
|
574
684
|
toJSON(message) {
|
|
@@ -585,6 +695,9 @@ exports.Response = {
|
|
|
585
695
|
if (message.runInTerminal !== undefined) {
|
|
586
696
|
obj.runInTerminal = common_1.AckResponse.toJSON(message.runInTerminal);
|
|
587
697
|
}
|
|
698
|
+
if (message.showInFileBrowser !== undefined) {
|
|
699
|
+
obj.showInFileBrowser = common_1.AckResponse.toJSON(message.showInFileBrowser);
|
|
700
|
+
}
|
|
588
701
|
return obj;
|
|
589
702
|
},
|
|
590
703
|
create(base) {
|
|
@@ -604,6 +717,9 @@ exports.Response = {
|
|
|
604
717
|
message.runInTerminal = (object.runInTerminal !== undefined && object.runInTerminal !== null)
|
|
605
718
|
? common_1.AckResponse.fromPartial(object.runInTerminal)
|
|
606
719
|
: undefined;
|
|
720
|
+
message.showInFileBrowser = (object.showInFileBrowser !== undefined && object.showInFileBrowser !== null)
|
|
721
|
+
? common_1.AckResponse.fromPartial(object.showInFileBrowser)
|
|
722
|
+
: undefined;
|
|
607
723
|
return message;
|
|
608
724
|
},
|
|
609
725
|
};
|
package/dist/api/utils.d.ts
CHANGED
|
@@ -35,6 +35,15 @@ export type RunInTerminalOptions = {
|
|
|
35
35
|
*/
|
|
36
36
|
title?: string;
|
|
37
37
|
};
|
|
38
|
+
/**
|
|
39
|
+
* @category System
|
|
40
|
+
*/
|
|
41
|
+
export type ShowInFileBrowserOptions = {
|
|
42
|
+
/**
|
|
43
|
+
* Reveal the item selected in its containing folder instead of just opening the target path.
|
|
44
|
+
*/
|
|
45
|
+
select?: boolean;
|
|
46
|
+
};
|
|
38
47
|
/**
|
|
39
48
|
* Run a command in a new terminal emulator window.
|
|
40
49
|
*
|
|
@@ -70,5 +79,5 @@ export declare const getDefaultApplication: (path: string) => Promise<Applicatio
|
|
|
70
79
|
/**
|
|
71
80
|
* @category System
|
|
72
81
|
*/
|
|
73
|
-
export declare const showInFileBrowser: (path: PathLike) => Promise<void>;
|
|
82
|
+
export declare const showInFileBrowser: (path: PathLike, options?: ShowInFileBrowserOptions) => Promise<void>;
|
|
74
83
|
export { Application } from "./proto/application";
|
package/dist/api/utils.js
CHANGED
|
@@ -90,7 +90,14 @@ exports.getDefaultApplication = getDefaultApplication;
|
|
|
90
90
|
/**
|
|
91
91
|
* @category System
|
|
92
92
|
*/
|
|
93
|
-
const showInFileBrowser = async (path) => {
|
|
93
|
+
const showInFileBrowser = async (path, options = {}) => {
|
|
94
|
+
if (options.select) {
|
|
95
|
+
await bus_1.bus.request("app.showInFileBrowser", {
|
|
96
|
+
target: path.toString(),
|
|
97
|
+
select: true,
|
|
98
|
+
});
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
94
101
|
const fileBrowser = await (0, exports.getDefaultApplication)("inode/directory"); // FIXME: we may want something more robust
|
|
95
102
|
await (0, exports.open)(path.toString(), fileBrowser);
|
|
96
103
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vicinae/api",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.5",
|
|
4
4
|
"description": "TypeScript SDK to build Vicinae extensions",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"@types/chai": "^4",
|
|
51
51
|
"@types/mocha": "^10",
|
|
52
52
|
"chai": "^4",
|
|
53
|
-
"mocha": "^
|
|
53
|
+
"mocha": "^11.7.5",
|
|
54
54
|
"oclif": "^4",
|
|
55
55
|
"shx": "^0.3.3",
|
|
56
56
|
"ts-node": "^10",
|