@vicinae/api 0.11.0 → 0.12.1
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 +2 -11
- package/dist/api/clipboard.d.ts +6 -10
- package/dist/api/clipboard.js +22 -16
- package/dist/api/file-search.d.ts +7 -11
- package/dist/api/file-search.js +5 -5
- package/dist/api/window-management.d.ts +23 -13
- package/dist/api/window-management.js +33 -13
- package/package.json +6 -2
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@ This package lets you extend the [Vicinae](https://docs.vicinae.com/) launcher u
|
|
|
7
7
|
|
|
8
8
|
The recommend way to start developing a new extension is to [read the docs](https://docs.vicinae.com/extensions/introduction).
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
The full API reference (expect breaking changes) can be found [here](./docs/README.md).
|
|
11
11
|
|
|
12
12
|
# Installation
|
|
13
13
|
|
|
@@ -32,15 +32,6 @@ npx vici --help
|
|
|
32
32
|
|
|
33
33
|
# assuming vicinae is running
|
|
34
34
|
npx vici develop
|
|
35
|
-
npx vici build -o my/output/path
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
# API developers
|
|
39
|
-
|
|
40
|
-
If you are working on developing the API, it is recommended to point `@vicinae/api` to the local api directory:
|
|
41
35
|
|
|
36
|
+
npx vici build -o my/output/path
|
|
42
37
|
```
|
|
43
|
-
npm install /path/to/vicinae/source/api
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
Note that you need to recompile the `api` package on every change you make to it.
|
package/dist/api/clipboard.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { PathLike } from "fs";
|
|
2
|
-
import { ClipboardContent } from "./proto/clipboard";
|
|
3
2
|
export declare namespace Clipboard {
|
|
4
3
|
type Content = {
|
|
5
4
|
text: string;
|
|
@@ -19,16 +18,13 @@ export declare namespace Clipboard {
|
|
|
19
18
|
type CopyOptions = {
|
|
20
19
|
concealed?: boolean;
|
|
21
20
|
};
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
copy(text: string | number | Clipboard.Content, options?: Clipboard.CopyOptions): Promise<void>;
|
|
26
|
-
paste(text: string | Clipboard.Content): Promise<void>;
|
|
27
|
-
read(options?: {
|
|
21
|
+
function copy(text: string | number | Clipboard.Content, options?: Clipboard.CopyOptions): Promise<void>;
|
|
22
|
+
function paste(text: string | Clipboard.Content): Promise<void>;
|
|
23
|
+
function read(options?: {
|
|
28
24
|
offset?: number;
|
|
29
25
|
}): Promise<Clipboard.ReadContent>;
|
|
30
|
-
readText(options?: {
|
|
26
|
+
function readText(options?: {
|
|
31
27
|
offset?: number;
|
|
32
28
|
}): Promise<string | undefined>;
|
|
33
|
-
clear(text: string): Promise<
|
|
34
|
-
}
|
|
29
|
+
function clear(text: string): Promise<void>;
|
|
30
|
+
}
|
package/dist/api/clipboard.js
CHANGED
|
@@ -3,8 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Clipboard = void 0;
|
|
4
4
|
const bus_1 = require("./bus");
|
|
5
5
|
const clipboard_1 = require("./proto/clipboard");
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
var Clipboard;
|
|
7
|
+
(function (Clipboard) {
|
|
8
|
+
function mapContent(content) {
|
|
8
9
|
let ct = clipboard_1.ClipboardContent.create();
|
|
9
10
|
if (typeof content != "object") {
|
|
10
11
|
ct.text = `${content}`;
|
|
@@ -21,25 +22,30 @@ exports.Clipboard = {
|
|
|
21
22
|
}
|
|
22
23
|
}
|
|
23
24
|
return ct;
|
|
24
|
-
}
|
|
25
|
-
async copy(text, options = {}) {
|
|
25
|
+
}
|
|
26
|
+
async function copy(text, options = {}) {
|
|
26
27
|
await bus_1.bus.turboRequest("clipboard.copy", {
|
|
27
|
-
content:
|
|
28
|
+
content: mapContent(text),
|
|
28
29
|
options: { concealed: options.concealed ?? false },
|
|
29
30
|
});
|
|
30
|
-
}
|
|
31
|
-
|
|
31
|
+
}
|
|
32
|
+
Clipboard.copy = copy;
|
|
33
|
+
async function paste(text) {
|
|
32
34
|
await bus_1.bus.turboRequest("clipboard.paste", {
|
|
33
|
-
content:
|
|
35
|
+
content: mapContent(text),
|
|
34
36
|
});
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
+
}
|
|
38
|
+
Clipboard.paste = paste;
|
|
39
|
+
async function read(options) {
|
|
37
40
|
throw new Error('Clipboard.read not implemented');
|
|
38
|
-
}
|
|
39
|
-
|
|
41
|
+
}
|
|
42
|
+
Clipboard.read = read;
|
|
43
|
+
async function readText(options) {
|
|
40
44
|
throw new Error('Clipboard.readText not implemented');
|
|
41
|
-
}
|
|
42
|
-
|
|
45
|
+
}
|
|
46
|
+
Clipboard.readText = readText;
|
|
47
|
+
async function clear(text) {
|
|
43
48
|
throw new Error('Clibpoard.clear not implemented');
|
|
44
|
-
}
|
|
45
|
-
|
|
49
|
+
}
|
|
50
|
+
Clipboard.clear = clear;
|
|
51
|
+
})(Clipboard || (exports.Clipboard = Clipboard = {}));
|
|
@@ -1,11 +1,4 @@
|
|
|
1
1
|
import { FileInfo as ProtoFileInfo } from './proto/file-search';
|
|
2
|
-
export declare namespace FileSearch {
|
|
3
|
-
/**
|
|
4
|
-
* For now we provide no options, but in the future we will implement mime type and file type filtering.
|
|
5
|
-
* */
|
|
6
|
-
type SearchOptions = {};
|
|
7
|
-
type FileInfo = ProtoFileInfo;
|
|
8
|
-
}
|
|
9
2
|
/**
|
|
10
3
|
* Access Vicinae's built-in file search functionality.
|
|
11
4
|
*
|
|
@@ -24,7 +17,12 @@ export declare namespace FileSearch {
|
|
|
24
17
|
*
|
|
25
18
|
* @public
|
|
26
19
|
*/
|
|
27
|
-
declare
|
|
20
|
+
export declare namespace FileSearch {
|
|
21
|
+
/**
|
|
22
|
+
* For now we provide no options, but in the future we will implement mime type and file type filtering.
|
|
23
|
+
* */
|
|
24
|
+
type SearchOptions = {};
|
|
25
|
+
type FileInfo = ProtoFileInfo;
|
|
28
26
|
/**
|
|
29
27
|
* Search for files matching the provided query string.
|
|
30
28
|
*
|
|
@@ -43,7 +41,5 @@ declare class FileSearchImpl {
|
|
|
43
41
|
* const files = await fileSearch.search('invoice');
|
|
44
42
|
* ```
|
|
45
43
|
*/
|
|
46
|
-
search(query: string, _?: FileSearch.SearchOptions): Promise<FileSearch.FileInfo[]>;
|
|
44
|
+
function search(query: string, _?: FileSearch.SearchOptions): Promise<FileSearch.FileInfo[]>;
|
|
47
45
|
}
|
|
48
|
-
export declare const FileSearch: FileSearchImpl;
|
|
49
|
-
export {};
|
package/dist/api/file-search.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FileSearch = void 0;
|
|
4
4
|
const bus_1 = require("./bus");
|
|
5
|
-
;
|
|
6
5
|
/**
|
|
7
6
|
* Access Vicinae's built-in file search functionality.
|
|
8
7
|
*
|
|
@@ -21,7 +20,8 @@ const bus_1 = require("./bus");
|
|
|
21
20
|
*
|
|
22
21
|
* @public
|
|
23
22
|
*/
|
|
24
|
-
|
|
23
|
+
var FileSearch;
|
|
24
|
+
(function (FileSearch) {
|
|
25
25
|
/**
|
|
26
26
|
* Search for files matching the provided query string.
|
|
27
27
|
*
|
|
@@ -40,10 +40,10 @@ class FileSearchImpl {
|
|
|
40
40
|
* const files = await fileSearch.search('invoice');
|
|
41
41
|
* ```
|
|
42
42
|
*/
|
|
43
|
-
async search(query, _ = {}) {
|
|
43
|
+
async function search(query, _ = {}) {
|
|
44
44
|
const res = await bus_1.bus.turboRequest('fileSearch.search', { query });
|
|
45
45
|
return res.unwrap().files;
|
|
46
46
|
}
|
|
47
|
-
|
|
47
|
+
FileSearch.search = search;
|
|
48
|
+
})(FileSearch || (exports.FileSearch = FileSearch = {}));
|
|
48
49
|
;
|
|
49
|
-
exports.FileSearch = new FileSearchImpl();
|
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
import { Application } from './proto/application';
|
|
2
2
|
import * as wm from './proto/wm';
|
|
3
|
+
/**
|
|
4
|
+
* Access Vicinae's window management features.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* Window management features are available to a different degree depending on what environment vicinae runs
|
|
8
|
+
* in.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* import { WindowManagement } from '@vicinae/api';
|
|
13
|
+
*
|
|
14
|
+
* const windows = await WindowManagement.getWindows();
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
3
19
|
export declare namespace WindowManagement {
|
|
4
20
|
type Window = {
|
|
5
21
|
id: string;
|
|
@@ -23,17 +39,11 @@ export declare namespace WindowManagement {
|
|
|
23
39
|
monitorId: string;
|
|
24
40
|
active: boolean;
|
|
25
41
|
};
|
|
42
|
+
function ping(): Promise<boolean>;
|
|
43
|
+
function getWindows(options?: wm.GetWindowsRequest): Promise<WindowManagement.Window[]>;
|
|
44
|
+
function getActiveWorkspace(): Promise<WindowManagement.Workspace>;
|
|
45
|
+
function getWorkspaces(): Promise<WindowManagement.Workspace[]>;
|
|
46
|
+
function getWindowsOnActiveWorkspace(): Promise<WindowManagement.Window[]>;
|
|
47
|
+
function setWindowBounds(payload: wm.SetWindowBoundsRequest): Promise<void>;
|
|
48
|
+
function getActiveWindow(): Promise<WindowManagement.Window>;
|
|
26
49
|
}
|
|
27
|
-
/**
|
|
28
|
-
*/
|
|
29
|
-
declare class WindowManagementImpl {
|
|
30
|
-
ping(): Promise<boolean>;
|
|
31
|
-
getWindows(options?: wm.GetWindowsRequest): Promise<WindowManagement.Window[]>;
|
|
32
|
-
getActiveWorkspace(): Promise<WindowManagement.Workspace>;
|
|
33
|
-
getWorkspaces(): Promise<WindowManagement.Workspace[]>;
|
|
34
|
-
getWindowsOnActiveWorkspace(): Promise<WindowManagement.Window[]>;
|
|
35
|
-
setWindowBounds(payload: wm.SetWindowBoundsRequest): Promise<void>;
|
|
36
|
-
getActiveWindow(): Promise<WindowManagement.Window>;
|
|
37
|
-
}
|
|
38
|
-
export declare const WindowManagement: WindowManagementImpl;
|
|
39
|
-
export {};
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.WindowManagement = void 0;
|
|
4
4
|
const bus_1 = require("./bus");
|
|
5
|
-
;
|
|
6
5
|
const transformWorkspace = (proto) => {
|
|
7
6
|
return {
|
|
8
7
|
id: proto.id,
|
|
@@ -21,35 +20,56 @@ const transformWindow = (proto) => {
|
|
|
21
20
|
};
|
|
22
21
|
};
|
|
23
22
|
/**
|
|
23
|
+
* Access Vicinae's window management features.
|
|
24
|
+
*
|
|
25
|
+
* @remarks
|
|
26
|
+
* Window management features are available to a different degree depending on what environment vicinae runs
|
|
27
|
+
* in.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
* import { WindowManagement } from '@vicinae/api';
|
|
32
|
+
*
|
|
33
|
+
* const windows = await WindowManagement.getWindows();
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* @public
|
|
24
37
|
*/
|
|
25
|
-
|
|
26
|
-
|
|
38
|
+
var WindowManagement;
|
|
39
|
+
(function (WindowManagement) {
|
|
40
|
+
async function ping() {
|
|
27
41
|
const res = await bus_1.bus.turboRequest('wm.ping', {});
|
|
28
42
|
return res.unwrap().ok;
|
|
29
43
|
}
|
|
30
|
-
|
|
44
|
+
WindowManagement.ping = ping;
|
|
45
|
+
async function getWindows(options = {}) {
|
|
31
46
|
const res = await bus_1.bus.turboRequest('wm.getWindows', options);
|
|
32
47
|
return res.unwrap().windows.map(transformWindow);
|
|
33
48
|
}
|
|
34
|
-
|
|
49
|
+
WindowManagement.getWindows = getWindows;
|
|
50
|
+
async function getActiveWorkspace() {
|
|
35
51
|
const res = await bus_1.bus.turboRequest('wm.getActiveWorkspace', {});
|
|
36
52
|
return transformWorkspace(res.unwrap().workspace);
|
|
37
53
|
}
|
|
38
|
-
|
|
54
|
+
WindowManagement.getActiveWorkspace = getActiveWorkspace;
|
|
55
|
+
async function getWorkspaces() {
|
|
39
56
|
const res = await bus_1.bus.turboRequest('wm.getWorkspaces', {});
|
|
40
57
|
return res.unwrap().workspaces.map(transformWorkspace);
|
|
41
58
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
59
|
+
WindowManagement.getWorkspaces = getWorkspaces;
|
|
60
|
+
async function getWindowsOnActiveWorkspace() {
|
|
61
|
+
const workspace = await getActiveWorkspace();
|
|
62
|
+
return getWindows({ workspaceId: workspace.id });
|
|
45
63
|
}
|
|
46
|
-
|
|
64
|
+
WindowManagement.getWindowsOnActiveWorkspace = getWindowsOnActiveWorkspace;
|
|
65
|
+
async function setWindowBounds(payload) {
|
|
47
66
|
await bus_1.bus.turboRequest('wm.setWindowBounds', payload);
|
|
48
67
|
}
|
|
49
|
-
|
|
68
|
+
WindowManagement.setWindowBounds = setWindowBounds;
|
|
69
|
+
async function getActiveWindow() {
|
|
50
70
|
const res = await bus_1.bus.turboRequest('wm.getActiveWindow', {});
|
|
51
71
|
return transformWindow(res.unwrap().window);
|
|
52
72
|
}
|
|
53
|
-
|
|
73
|
+
WindowManagement.getActiveWindow = getActiveWindow;
|
|
74
|
+
})(WindowManagement || (exports.WindowManagement = WindowManagement = {}));
|
|
54
75
|
;
|
|
55
|
-
exports.WindowManagement = new WindowManagementImpl();
|
package/package.json
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vicinae/api",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.1",
|
|
4
4
|
"description": "TypeScript SDK to build Vicinae extensions",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
7
7
|
"build": "tsc --outDir dist",
|
|
8
|
-
"pack": "npm run build && npm pack"
|
|
8
|
+
"pack": "npm run build && npm pack",
|
|
9
|
+
"docgen-html": "typedoc src/api/index.ts",
|
|
10
|
+
"docgen-md": "typedoc src/api/index.ts --readme none --plugin typedoc-plugin-markdown --out ./docs"
|
|
9
11
|
},
|
|
10
12
|
"bin": {
|
|
11
13
|
"vici": "./bin/run.js"
|
|
@@ -57,6 +59,8 @@
|
|
|
57
59
|
"shx": "^0.3.3",
|
|
58
60
|
"ts-node": "^10",
|
|
59
61
|
"ts-proto": "^2.7.5",
|
|
62
|
+
"typedoc": "^0.28.13",
|
|
63
|
+
"typedoc-plugin-markdown": "^4.8.1",
|
|
60
64
|
"typescript": "^5"
|
|
61
65
|
},
|
|
62
66
|
"oclif": {
|