@vicinae/api 0.16.4 → 0.16.6
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 +1 -1
- package/dist/api/ai.d.ts +4 -1
- package/dist/api/ai.js +3 -0
- package/dist/api/alert.d.ts +6 -0
- package/dist/api/alert.js +18 -11
- package/dist/api/bus.d.ts +5 -0
- package/dist/api/bus.js +2 -0
- package/dist/api/cache.d.ts +5 -0
- package/dist/api/cache.js +2 -0
- package/dist/api/clipboard.d.ts +5 -0
- package/dist/api/clipboard.js +5 -0
- package/dist/api/color.d.ts +9 -0
- package/dist/api/color.js +3 -0
- package/dist/api/components/action-pannel.d.ts +32 -20
- package/dist/api/components/action-pannel.js +3 -0
- package/dist/api/components/actions.d.ts +76 -47
- package/dist/api/components/actions.js +3 -0
- package/dist/api/components/detail.d.ts +33 -8
- package/dist/api/components/detail.js +3 -0
- package/dist/api/components/form.d.ts +33 -28
- package/dist/api/components/form.js +3 -0
- package/dist/api/components/grid.d.ts +55 -0
- package/dist/api/components/grid.js +12 -0
- package/dist/api/components/index.d.ts +1 -1
- package/dist/api/components/index.js +3 -1
- package/dist/api/components/list.d.ts +159 -16
- package/dist/api/components/list.js +5 -2
- package/dist/api/components/menu-bar.d.ts +3 -0
- package/dist/api/components/menu-bar.js +3 -0
- package/dist/api/components/metadata.d.ts +5 -1
- package/dist/api/components/metadata.js +13 -1
- package/dist/api/context/navigation-provider.d.ts +3 -0
- package/dist/api/context/navigation-provider.js +3 -0
- package/dist/api/controls.d.ts +14 -0
- package/dist/api/controls.js +14 -1
- package/dist/api/environment.d.ts +11 -0
- package/dist/api/environment.js +11 -0
- package/dist/api/file-search.d.ts +1 -0
- package/dist/api/file-search.js +1 -0
- package/dist/api/hooks/index.d.ts +0 -1
- package/dist/api/hooks/index.js +0 -1
- package/dist/api/hooks/use-imperative-form-handle.d.ts +3 -3
- package/dist/api/hooks/use-imperative-form-handle.js +2 -2
- package/dist/api/hooks/use-navigation.d.ts +6 -0
- package/dist/api/hooks/use-navigation.js +6 -0
- package/dist/api/icon.d.ts +3 -0
- package/dist/api/icon.js +3 -0
- package/dist/api/image.d.ts +11 -1
- package/dist/api/image.js +3 -0
- package/dist/api/index.d.ts +2 -2
- package/dist/api/index.js +5 -2
- package/dist/api/keyboard.d.ts +9 -0
- package/dist/api/keyboard.js +3 -0
- package/dist/api/local-storage.d.ts +8 -7
- package/dist/api/local-storage.js +17 -8
- package/dist/api/oauth.d.ts +11 -9
- package/dist/api/oauth.js +19 -0
- package/dist/api/preference.d.ts +8 -0
- package/dist/api/preference.js +8 -0
- package/dist/api/toast.d.ts +8 -0
- package/dist/api/toast.js +8 -0
- package/dist/api/utils.d.ts +24 -2
- package/dist/api/utils.js +21 -2
- package/dist/api/window-management.d.ts +1 -1
- package/dist/api/window-management.js +1 -1
- package/package.json +3 -3
- package/types/jsx.d.ts +1 -1
- package/dist/api/hooks/use-applications.d.ts +0 -2
- package/dist/api/hooks/use-applications.js +0 -19
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useImperativeFormHandle = void 0;
|
|
4
|
-
const crypto_1 = require("crypto");
|
|
5
4
|
const react_1 = require("react");
|
|
6
5
|
const bus_1 = require("../bus");
|
|
6
|
+
const node_crypto_1 = require("node:crypto");
|
|
7
7
|
const useImperativeFormHandle = (ref) => {
|
|
8
|
-
const handleId = (0, react_1.useRef)((0,
|
|
8
|
+
const handleId = (0, react_1.useRef)((0, node_crypto_1.randomUUID)());
|
|
9
9
|
(0, react_1.useImperativeHandle)(ref, () => {
|
|
10
10
|
return {
|
|
11
11
|
focus: () => {
|
|
@@ -6,6 +6,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.useNavigation = void 0;
|
|
7
7
|
const react_1 = require("react");
|
|
8
8
|
const navigation_context_1 = __importDefault(require("../context/navigation-context"));
|
|
9
|
+
/**
|
|
10
|
+
* A React hook that lets you access methods to push and pop views
|
|
11
|
+
* on the navigation stack.
|
|
12
|
+
*
|
|
13
|
+
* @category Navigation
|
|
14
|
+
*/
|
|
9
15
|
const useNavigation = () => {
|
|
10
16
|
const { push, pop } = (0, react_1.useContext)(navigation_context_1.default);
|
|
11
17
|
return { push, pop };
|
package/dist/api/icon.d.ts
CHANGED
package/dist/api/icon.js
CHANGED
package/dist/api/image.d.ts
CHANGED
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
import { type ColorLike } from "./color";
|
|
2
2
|
import type { Icon } from "./icon";
|
|
3
3
|
import * as ui from "./proto/ui";
|
|
4
|
+
/**
|
|
5
|
+
* Representation of an image, renderable everywhere Vicine expects them.
|
|
6
|
+
* @category Image
|
|
7
|
+
*/
|
|
4
8
|
export type Image = {
|
|
5
9
|
source: Image.Source;
|
|
6
10
|
fallback?: Image.Fallback | undefined | null;
|
|
7
11
|
tintColor?: ColorLike | undefined | null;
|
|
8
12
|
mask?: Image.Mask | undefined | null;
|
|
9
13
|
};
|
|
14
|
+
/**
|
|
15
|
+
* @category Image
|
|
16
|
+
*/
|
|
10
17
|
export type ImageLike = Image.ImageLike;
|
|
11
18
|
export type SerializedImageLike = URL | Image.Asset | Icon | ui.Image | Image.ThemedImage;
|
|
19
|
+
/**
|
|
20
|
+
* @category Image
|
|
21
|
+
*/
|
|
12
22
|
export declare namespace Image {
|
|
13
23
|
type Asset = string;
|
|
14
24
|
type ThemedSource = {
|
|
@@ -17,11 +27,11 @@ export declare namespace Image {
|
|
|
17
27
|
};
|
|
18
28
|
type Fallback = Source;
|
|
19
29
|
type Source = URL | Asset | ThemedSource;
|
|
20
|
-
type ImageLike = URL | Image.Asset | Icon | Image | ThemedImage;
|
|
21
30
|
type ThemedImage = {
|
|
22
31
|
light: URL | Asset;
|
|
23
32
|
dark: URL | Asset;
|
|
24
33
|
};
|
|
34
|
+
type ImageLike = URL | Image.Asset | Icon | Image | Image.ThemedImage;
|
|
25
35
|
enum Mask {
|
|
26
36
|
Circle = "circle",
|
|
27
37
|
RoundedRectangle = "roundedRectangle"
|
package/dist/api/image.js
CHANGED
|
@@ -36,6 +36,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.serializeProtoImage = exports.Image = void 0;
|
|
37
37
|
const color_1 = require("./color");
|
|
38
38
|
const ui = __importStar(require("./proto/ui"));
|
|
39
|
+
/**
|
|
40
|
+
* @category Image
|
|
41
|
+
*/
|
|
39
42
|
var Image;
|
|
40
43
|
(function (Image) {
|
|
41
44
|
let Mask;
|
package/dist/api/index.d.ts
CHANGED
|
@@ -3,9 +3,9 @@ export * from "./components/index.js";
|
|
|
3
3
|
export * from "./hooks/index.js";
|
|
4
4
|
export * from "./context/index.js";
|
|
5
5
|
export * from "./bus.js";
|
|
6
|
-
export
|
|
6
|
+
export { Color, ColorLike } from "./color.js";
|
|
7
7
|
export * from "./keyboard.js";
|
|
8
|
-
export
|
|
8
|
+
export { ImageLike, Image } from "./image.js";
|
|
9
9
|
export * from "./icon.js";
|
|
10
10
|
export * from "./environment.js";
|
|
11
11
|
export * from "./controls.js";
|
package/dist/api/index.js
CHANGED
|
@@ -14,14 +14,17 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.Image = exports.Color = void 0;
|
|
17
18
|
__exportStar(require("./ai.js"), exports);
|
|
18
19
|
__exportStar(require("./components/index.js"), exports);
|
|
19
20
|
__exportStar(require("./hooks/index.js"), exports);
|
|
20
21
|
__exportStar(require("./context/index.js"), exports);
|
|
21
22
|
__exportStar(require("./bus.js"), exports);
|
|
22
|
-
|
|
23
|
+
var color_js_1 = require("./color.js");
|
|
24
|
+
Object.defineProperty(exports, "Color", { enumerable: true, get: function () { return color_js_1.Color; } });
|
|
23
25
|
__exportStar(require("./keyboard.js"), exports);
|
|
24
|
-
|
|
26
|
+
var image_js_1 = require("./image.js");
|
|
27
|
+
Object.defineProperty(exports, "Image", { enumerable: true, get: function () { return image_js_1.Image; } });
|
|
25
28
|
__exportStar(require("./icon.js"), exports);
|
|
26
29
|
__exportStar(require("./environment.js"), exports);
|
|
27
30
|
__exportStar(require("./controls.js"), exports);
|
package/dist/api/keyboard.d.ts
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @category Keyboard
|
|
3
|
+
*/
|
|
1
4
|
export type KeyEquivalent = "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z" | "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "." | "," | ";" | "=" | "+" | "-" | "[" | "]" | "{" | "}" | "«" | "»" | "(" | ")" | "/" | "\\" | "'" | "`" | "§" | "^" | "@" | "$" | "return" | "delete" | "deleteForward" | "tab" | "arrowUp" | "arrowDown" | "arrowLeft" | "arrowRight" | "pageUp" | "pageDown" | "home" | "end" | "space" | "escape" | "enter" | "backspace";
|
|
5
|
+
/**
|
|
6
|
+
* @category Keyboard
|
|
7
|
+
*/
|
|
2
8
|
export type KeyModifier = "cmd" | "ctrl" | "opt" | "shift";
|
|
9
|
+
/**
|
|
10
|
+
* @category Keyboard
|
|
11
|
+
*/
|
|
3
12
|
export declare namespace Keyboard {
|
|
4
13
|
namespace Shortcut {
|
|
5
14
|
type Common = "copy" | "copy-deeplink" | "copy-name" | "copy-path" | "save" | "duplicate" | "edit" | "move-down" | "move-up" | "new" | "open" | "open-with" | "pin" | "refresh" | "remove" | "remove-all";
|
package/dist/api/keyboard.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @category Local Storage
|
|
3
|
+
*/
|
|
1
4
|
export declare namespace LocalStorage {
|
|
2
5
|
type Value = string | number | boolean;
|
|
3
6
|
type Values = {
|
|
4
7
|
[key: string]: Value;
|
|
5
8
|
};
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
static allItems(): Promise<LocalStorage.Values>;
|
|
12
|
-
static clear(): Promise<void>;
|
|
9
|
+
function getItem<T extends LocalStorage.Value>(key: string): Promise<T | undefined>;
|
|
10
|
+
function setItem(key: string, value: LocalStorage.Value): Promise<void>;
|
|
11
|
+
function removeItem(key: string): Promise<void>;
|
|
12
|
+
function allItems(): Promise<LocalStorage.Values>;
|
|
13
|
+
function clear(): Promise<void>;
|
|
13
14
|
}
|
|
@@ -2,28 +2,37 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.LocalStorage = void 0;
|
|
4
4
|
const bus_1 = require("./bus");
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
// Implementation of Raycast's storage API: https://developers.raycast.com/api-reference/storage
|
|
6
|
+
/**
|
|
7
|
+
* @category Local Storage
|
|
8
|
+
*/
|
|
9
|
+
var LocalStorage;
|
|
10
|
+
(function (LocalStorage) {
|
|
11
|
+
async function getItem(key) {
|
|
7
12
|
const res = await bus_1.bus.turboRequest("storage.get", { key });
|
|
8
13
|
if (!res.ok || res.value.value === null) {
|
|
9
14
|
return undefined;
|
|
10
15
|
}
|
|
11
16
|
return res.value.value;
|
|
12
17
|
}
|
|
13
|
-
|
|
18
|
+
LocalStorage.getItem = getItem;
|
|
19
|
+
async function setItem(key, value) {
|
|
14
20
|
await bus_1.bus.turboRequest("storage.set", { key, value });
|
|
15
21
|
}
|
|
16
|
-
|
|
22
|
+
LocalStorage.setItem = setItem;
|
|
23
|
+
async function removeItem(key) {
|
|
17
24
|
await bus_1.bus.turboRequest("storage.remove", { key });
|
|
18
25
|
}
|
|
19
|
-
|
|
26
|
+
LocalStorage.removeItem = removeItem;
|
|
27
|
+
async function allItems() {
|
|
20
28
|
const res = await bus_1.bus.turboRequest("storage.list", {});
|
|
21
29
|
if (!res.ok)
|
|
22
30
|
return {};
|
|
23
31
|
return res.value.values;
|
|
24
32
|
}
|
|
25
|
-
|
|
33
|
+
LocalStorage.allItems = allItems;
|
|
34
|
+
async function clear() {
|
|
26
35
|
await bus_1.bus.turboRequest("storage.clear", {});
|
|
27
36
|
}
|
|
28
|
-
|
|
29
|
-
exports.LocalStorage = LocalStorage;
|
|
37
|
+
LocalStorage.clear = clear;
|
|
38
|
+
})(LocalStorage || (exports.LocalStorage = LocalStorage = {}));
|
package/dist/api/oauth.d.ts
CHANGED
|
@@ -21,6 +21,9 @@ declare enum OauthRedirectMethod {
|
|
|
21
21
|
*/
|
|
22
22
|
AppURI = "appURI"
|
|
23
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* @category OAuth
|
|
26
|
+
*/
|
|
24
27
|
export declare namespace OAuth {
|
|
25
28
|
namespace PKCEClient {
|
|
26
29
|
/**
|
|
@@ -243,6 +246,9 @@ export declare namespace OAuth {
|
|
|
243
246
|
scope?: string;
|
|
244
247
|
}
|
|
245
248
|
}
|
|
249
|
+
/**
|
|
250
|
+
* @category OAuth
|
|
251
|
+
*/
|
|
246
252
|
export declare class PKCEClient {
|
|
247
253
|
redirectMethod: OAuth.RedirectMethod;
|
|
248
254
|
providerName: string;
|
|
@@ -298,15 +304,11 @@ export declare class PKCEClient {
|
|
|
298
304
|
*/
|
|
299
305
|
removeTokens(): Promise<void>;
|
|
300
306
|
}
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
scope?: string;
|
|
307
|
-
updatedAt: Date;
|
|
308
|
-
isExpired: () => boolean;
|
|
309
|
-
};
|
|
307
|
+
/**
|
|
308
|
+
* Main OAuth object exporting all OAuth utilities
|
|
309
|
+
*
|
|
310
|
+
* @category OAuth
|
|
311
|
+
*/
|
|
310
312
|
export declare const OAuth: {
|
|
311
313
|
PKCEClient: typeof PKCEClient;
|
|
312
314
|
RedirectMethod: typeof OauthRedirectMethod;
|
package/dist/api/oauth.js
CHANGED
|
@@ -27,6 +27,9 @@ var OauthRedirectMethod;
|
|
|
27
27
|
*/
|
|
28
28
|
OauthRedirectMethod["AppURI"] = "appURI";
|
|
29
29
|
})(OauthRedirectMethod || (OauthRedirectMethod = {}));
|
|
30
|
+
/**
|
|
31
|
+
* @category OAuth
|
|
32
|
+
*/
|
|
30
33
|
class PKCEClient {
|
|
31
34
|
redirectMethod;
|
|
32
35
|
providerName;
|
|
@@ -193,6 +196,22 @@ class PKCEClient {
|
|
|
193
196
|
}
|
|
194
197
|
}
|
|
195
198
|
exports.PKCEClient = PKCEClient;
|
|
199
|
+
/*
|
|
200
|
+
export type TokenSet = {
|
|
201
|
+
accessToken: string;
|
|
202
|
+
refreshToken?: string;
|
|
203
|
+
idToken?: string;
|
|
204
|
+
expiresIn?: number;
|
|
205
|
+
scope?: string;
|
|
206
|
+
updatedAt: Date;
|
|
207
|
+
isExpired: () => boolean;
|
|
208
|
+
};
|
|
209
|
+
*/
|
|
210
|
+
/**
|
|
211
|
+
* Main OAuth object exporting all OAuth utilities
|
|
212
|
+
*
|
|
213
|
+
* @category OAuth
|
|
214
|
+
*/
|
|
196
215
|
exports.OAuth = {
|
|
197
216
|
PKCEClient,
|
|
198
217
|
RedirectMethod: OauthRedirectMethod,
|
package/dist/api/preference.d.ts
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
export declare const getPreferenceValues: <T = {
|
|
2
2
|
[preferenceName: string]: any;
|
|
3
3
|
}>() => T;
|
|
4
|
+
/**
|
|
5
|
+
* TODO: implement
|
|
6
|
+
* @ignore
|
|
7
|
+
*/
|
|
4
8
|
export declare const openExtensionPreferences: () => Promise<void>;
|
|
9
|
+
/**
|
|
10
|
+
* TODO: implement
|
|
11
|
+
* @ignore
|
|
12
|
+
*/
|
|
5
13
|
export declare const openCommandPreferences: () => Promise<void>;
|
package/dist/api/preference.js
CHANGED
|
@@ -7,10 +7,18 @@ const getPreferenceValues = () => {
|
|
|
7
7
|
return preferenceValues;
|
|
8
8
|
};
|
|
9
9
|
exports.getPreferenceValues = getPreferenceValues;
|
|
10
|
+
/**
|
|
11
|
+
* TODO: implement
|
|
12
|
+
* @ignore
|
|
13
|
+
*/
|
|
10
14
|
const openExtensionPreferences = async () => {
|
|
11
15
|
console.error("openExtensionPreferences is not implemented");
|
|
12
16
|
};
|
|
13
17
|
exports.openExtensionPreferences = openExtensionPreferences;
|
|
18
|
+
/**
|
|
19
|
+
* TODO: implement
|
|
20
|
+
* @ignore
|
|
21
|
+
*/
|
|
14
22
|
const openCommandPreferences = async () => {
|
|
15
23
|
console.error("openCommandPreferences is not implemented");
|
|
16
24
|
};
|
package/dist/api/toast.d.ts
CHANGED
|
@@ -16,6 +16,8 @@ import { Keyboard } from "./keyboard";
|
|
|
16
16
|
* toast.title = "Uploaded image";
|
|
17
17
|
* };
|
|
18
18
|
* ```
|
|
19
|
+
*
|
|
20
|
+
* @category Toast
|
|
19
21
|
*/
|
|
20
22
|
export declare class Toast {
|
|
21
23
|
private options;
|
|
@@ -65,6 +67,9 @@ export declare class Toast {
|
|
|
65
67
|
*/
|
|
66
68
|
hide(): Promise<void>;
|
|
67
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* @category Toast
|
|
72
|
+
*/
|
|
68
73
|
export declare namespace Toast {
|
|
69
74
|
/**
|
|
70
75
|
* The options to create a {@link Toast}.
|
|
@@ -156,4 +161,7 @@ export declare interface ToastOptions extends Toast.Options {
|
|
|
156
161
|
* @deprecated Use {@link Toast.Style} instead
|
|
157
162
|
*/
|
|
158
163
|
export declare const ToastStyle: typeof Toast.Style;
|
|
164
|
+
/**
|
|
165
|
+
* @category Toast
|
|
166
|
+
*/
|
|
159
167
|
export declare const showToast: (init: Toast.Style | Toast.Options, title?: string, message?: string) => Promise<Toast>;
|
package/dist/api/toast.js
CHANGED
|
@@ -54,6 +54,8 @@ const ui = __importStar(require("./proto/ui"));
|
|
|
54
54
|
* toast.title = "Uploaded image";
|
|
55
55
|
* };
|
|
56
56
|
* ```
|
|
57
|
+
*
|
|
58
|
+
* @category Toast
|
|
57
59
|
*/
|
|
58
60
|
class Toast {
|
|
59
61
|
options;
|
|
@@ -184,6 +186,9 @@ class Toast {
|
|
|
184
186
|
}
|
|
185
187
|
}
|
|
186
188
|
exports.Toast = Toast;
|
|
189
|
+
/**
|
|
190
|
+
* @category Toast
|
|
191
|
+
*/
|
|
187
192
|
(function (Toast) {
|
|
188
193
|
/**
|
|
189
194
|
* Defines the visual style of the Toast.
|
|
@@ -200,6 +205,9 @@ exports.Toast = Toast;
|
|
|
200
205
|
Style["Animated"] = "animated";
|
|
201
206
|
})(Style = Toast.Style || (Toast.Style = {}));
|
|
202
207
|
})(Toast || (exports.Toast = Toast = {}));
|
|
208
|
+
/**
|
|
209
|
+
* @category Toast
|
|
210
|
+
*/
|
|
203
211
|
const showToast = async (init, title = "", message) => {
|
|
204
212
|
const toast = typeof init === "string"
|
|
205
213
|
? new Toast({ style: init, message, title })
|
package/dist/api/utils.d.ts
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
import { PathLike } from "fs";
|
|
2
|
-
import { Application } from "./proto/application";
|
|
1
|
+
import type { PathLike } from "node:fs";
|
|
2
|
+
import type { Application } from "./proto/application";
|
|
3
|
+
/**
|
|
4
|
+
@ignore - we should probably move this to raycast compat, I don't think we want that.
|
|
5
|
+
*/
|
|
3
6
|
export declare const trash: (path: PathLike | PathLike[]) => Promise<void>;
|
|
4
7
|
/**
|
|
5
8
|
* Additional options that can be passed in order to tweak the behavior of the terminal window.
|
|
6
9
|
* Note that most options are best-effort, which means that they may or may not work depending on
|
|
7
10
|
* the default terminal emulator that is available.
|
|
8
11
|
* On Linux, Vicinae honors the xdg-terminal-exec specification: https://gitlab.freedesktop.org/terminal-wg/specifications/-/merge_requests/3/diffs
|
|
12
|
+
*
|
|
13
|
+
* @category System
|
|
9
14
|
*/
|
|
10
15
|
export type RunInTerminalOptions = {
|
|
11
16
|
/**
|
|
@@ -42,11 +47,28 @@ export type RunInTerminalOptions = {
|
|
|
42
47
|
* // or, inside a shell:
|
|
43
48
|
* await runInTerminal(['/bin/bash', 'echo "dis is my home: $HOME"'], { hold: true });
|
|
44
49
|
* ```
|
|
50
|
+
*
|
|
51
|
+
* @category System
|
|
45
52
|
*/
|
|
46
53
|
export declare const runInTerminal: (args: string[], options?: RunInTerminalOptions) => Promise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* @category System
|
|
56
|
+
*/
|
|
47
57
|
export declare const open: (target: string, app?: Application | string) => Promise<void>;
|
|
58
|
+
/**
|
|
59
|
+
* @category System
|
|
60
|
+
*/
|
|
48
61
|
export declare const getFrontmostApplication: () => Promise<Application>;
|
|
62
|
+
/**
|
|
63
|
+
* @category System
|
|
64
|
+
*/
|
|
49
65
|
export declare const getApplications: (target?: string) => Promise<Application[]>;
|
|
66
|
+
/**
|
|
67
|
+
* @category System
|
|
68
|
+
*/
|
|
50
69
|
export declare const getDefaultApplication: (path: string) => Promise<Application>;
|
|
70
|
+
/**
|
|
71
|
+
* @category System
|
|
72
|
+
*/
|
|
51
73
|
export declare const showInFileBrowser: (path: PathLike) => Promise<void>;
|
|
52
74
|
export { Application } from "./proto/application";
|
package/dist/api/utils.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Application = exports.showInFileBrowser = exports.getDefaultApplication = exports.getApplications = exports.getFrontmostApplication = exports.open = exports.runInTerminal = exports.trash = void 0;
|
|
4
|
-
const promises_1 = require("fs/promises");
|
|
4
|
+
const promises_1 = require("node:fs/promises");
|
|
5
5
|
const bus_1 = require("./bus");
|
|
6
6
|
const window_management_1 = require("./window-management");
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
@ignore - we should probably move this to raycast compat, I don't think we want that.
|
|
9
|
+
*/
|
|
8
10
|
const trash = async (path) => {
|
|
9
11
|
const targets = Array.isArray(path) ? path : [path];
|
|
10
12
|
const promises = targets.map((p) => (0, promises_1.rm)(p, { recursive: true }));
|
|
@@ -23,6 +25,8 @@ exports.trash = trash;
|
|
|
23
25
|
* // or, inside a shell:
|
|
24
26
|
* await runInTerminal(['/bin/bash', 'echo "dis is my home: $HOME"'], { hold: true });
|
|
25
27
|
* ```
|
|
28
|
+
*
|
|
29
|
+
* @category System
|
|
26
30
|
*/
|
|
27
31
|
const runInTerminal = async (args, options = {}) => {
|
|
28
32
|
const { hold = false, appId, title } = options;
|
|
@@ -34,6 +38,9 @@ const runInTerminal = async (args, options = {}) => {
|
|
|
34
38
|
});
|
|
35
39
|
};
|
|
36
40
|
exports.runInTerminal = runInTerminal;
|
|
41
|
+
/**
|
|
42
|
+
* @category System
|
|
43
|
+
*/
|
|
37
44
|
const open = async (target, app) => {
|
|
38
45
|
let appId;
|
|
39
46
|
if (app) {
|
|
@@ -50,6 +57,9 @@ const open = async (target, app) => {
|
|
|
50
57
|
});
|
|
51
58
|
};
|
|
52
59
|
exports.open = open;
|
|
60
|
+
/**
|
|
61
|
+
* @category System
|
|
62
|
+
*/
|
|
53
63
|
const getFrontmostApplication = async () => {
|
|
54
64
|
const { application } = await window_management_1.WindowManagement.getActiveWindow();
|
|
55
65
|
if (!application) {
|
|
@@ -58,11 +68,17 @@ const getFrontmostApplication = async () => {
|
|
|
58
68
|
return application;
|
|
59
69
|
};
|
|
60
70
|
exports.getFrontmostApplication = getFrontmostApplication;
|
|
71
|
+
/**
|
|
72
|
+
* @category System
|
|
73
|
+
*/
|
|
61
74
|
const getApplications = async (target) => {
|
|
62
75
|
const res = await bus_1.bus.turboRequest("app.list", { target });
|
|
63
76
|
return res.unwrap().apps;
|
|
64
77
|
};
|
|
65
78
|
exports.getApplications = getApplications;
|
|
79
|
+
/**
|
|
80
|
+
* @category System
|
|
81
|
+
*/
|
|
66
82
|
const getDefaultApplication = async (path) => {
|
|
67
83
|
const res = await bus_1.bus.turboRequest("app.getDefault", { target: path });
|
|
68
84
|
const app = res.unwrap().app;
|
|
@@ -71,6 +87,9 @@ const getDefaultApplication = async (path) => {
|
|
|
71
87
|
return app;
|
|
72
88
|
};
|
|
73
89
|
exports.getDefaultApplication = getDefaultApplication;
|
|
90
|
+
/**
|
|
91
|
+
* @category System
|
|
92
|
+
*/
|
|
74
93
|
const showInFileBrowser = async (path) => {
|
|
75
94
|
const fileBrowser = await (0, exports.getDefaultApplication)("inode/directory"); // FIXME: we may want something more robust
|
|
76
95
|
await (0, exports.open)(path.toString(), fileBrowser);
|
package/package.json
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vicinae/api",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.6",
|
|
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
8
|
"protogen": "mkdir -p ./src/api/proto && protoc --plugin=./node_modules/.bin/protoc-gen-ts_proto -I../../proto ../../proto/*.proto --ts_proto_out ./src/api/proto",
|
|
9
9
|
"pack": "npm run build && npm pack",
|
|
10
|
-
"docgen
|
|
11
|
-
"docgen-md": "typedoc src/api/index.ts --disableSources --readme none --plugin typedoc-plugin-markdown --out ./docs",
|
|
10
|
+
"docgen": "typedoc",
|
|
12
11
|
"format": "biome format --write"
|
|
13
12
|
},
|
|
14
13
|
"bin": {
|
|
@@ -58,6 +57,7 @@
|
|
|
58
57
|
"ts-node": "^10",
|
|
59
58
|
"ts-proto": "^2.7.5",
|
|
60
59
|
"typedoc": "^0.28.13",
|
|
60
|
+
"typedoc-github-theme": "^0.3.1",
|
|
61
61
|
"typedoc-plugin-markdown": "^4.8.1",
|
|
62
62
|
"typescript": "^5"
|
|
63
63
|
},
|
package/types/jsx.d.ts
CHANGED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useApplications = void 0;
|
|
4
|
-
const react_1 = require("react");
|
|
5
|
-
const utils_1 = require("../utils");
|
|
6
|
-
const useApplications = () => {
|
|
7
|
-
const [isLoading, setIsLoading] = (0, react_1.useState)(true);
|
|
8
|
-
const [error, setError] = (0, react_1.useState)(null);
|
|
9
|
-
const [apps, setApps] = (0, react_1.useState)([]);
|
|
10
|
-
(0, react_1.useEffect)(() => {
|
|
11
|
-
setIsLoading(true);
|
|
12
|
-
(0, utils_1.getApplications)()
|
|
13
|
-
.then(setApps)
|
|
14
|
-
.catch(setError)
|
|
15
|
-
.finally(() => setIsLoading(false));
|
|
16
|
-
}, []);
|
|
17
|
-
return [apps, isLoading, error];
|
|
18
|
-
};
|
|
19
|
-
exports.useApplications = useApplications;
|