@vicinae/api 0.3.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 +37 -0
- package/bin/run.js +9 -0
- package/dist/api/ai.d.ts +110 -0
- package/dist/api/ai.js +120 -0
- package/dist/api/alert.d.ts +22 -0
- package/dist/api/alert.js +61 -0
- package/dist/api/bus.d.ts +95 -0
- package/dist/api/bus.js +211 -0
- package/dist/api/cache.d.ts +117 -0
- package/dist/api/cache.js +52 -0
- package/dist/api/clipboard.d.ts +34 -0
- package/dist/api/clipboard.js +52 -0
- package/dist/api/color.d.ts +24 -0
- package/dist/api/color.js +24 -0
- package/dist/api/components/action-pannel.d.ts +23 -0
- package/dist/api/components/action-pannel.js +30 -0
- package/dist/api/components/actions.d.ts +52 -0
- package/dist/api/components/actions.js +81 -0
- package/dist/api/components/detail.d.ts +21 -0
- package/dist/api/components/detail.js +12 -0
- package/dist/api/components/dropdown.d.ts +36 -0
- package/dist/api/components/dropdown.js +21 -0
- package/dist/api/components/empty-view.d.ts +9 -0
- package/dist/api/components/empty-view.js +12 -0
- package/dist/api/components/form.d.ts +81 -0
- package/dist/api/components/form.js +53 -0
- package/dist/api/components/grid.d.ts +117 -0
- package/dist/api/components/grid.js +80 -0
- package/dist/api/components/index.d.ts +7 -0
- package/dist/api/components/index.js +23 -0
- package/dist/api/components/list.d.ts +109 -0
- package/dist/api/components/list.js +53 -0
- package/dist/api/components/menu-bar.d.ts +26 -0
- package/dist/api/components/menu-bar.js +25 -0
- package/dist/api/components/metadata.d.ts +23 -0
- package/dist/api/components/metadata.js +27 -0
- package/dist/api/components/tag.d.ts +16 -0
- package/dist/api/components/tag.js +28 -0
- package/dist/api/context/index.d.ts +1 -0
- package/dist/api/context/index.js +17 -0
- package/dist/api/context/navigation-context.d.ts +7 -0
- package/dist/api/context/navigation-context.js +8 -0
- package/dist/api/context/navigation-provider.d.ts +4 -0
- package/dist/api/context/navigation-provider.js +40 -0
- package/dist/api/controls.d.ts +3 -0
- package/dist/api/controls.js +20 -0
- package/dist/api/environment.d.ts +118 -0
- package/dist/api/environment.js +17 -0
- package/dist/api/hooks/index.d.ts +2 -0
- package/dist/api/hooks/index.js +18 -0
- package/dist/api/hooks/use-applications.d.ts +2 -0
- package/dist/api/hooks/use-applications.js +19 -0
- package/dist/api/hooks/use-imperative-form-handle.d.ts +3 -0
- package/dist/api/hooks/use-imperative-form-handle.js +25 -0
- package/dist/api/hooks/use-navigation.d.ts +4 -0
- package/dist/api/hooks/use-navigation.js +13 -0
- package/dist/api/hooks.d.ts +1 -0
- package/dist/api/hooks.js +24 -0
- package/dist/api/icon.d.ts +444 -0
- package/dist/api/icon.js +448 -0
- package/dist/api/image.d.ts +35 -0
- package/dist/api/image.js +84 -0
- package/dist/api/index.d.ts +19 -0
- package/dist/api/index.js +35 -0
- package/dist/api/keyboard.d.ts +16 -0
- package/dist/api/keyboard.js +12 -0
- package/dist/api/lib/result.d.ts +9 -0
- package/dist/api/lib/result.js +11 -0
- package/dist/api/local-storage.d.ts +13 -0
- package/dist/api/local-storage.js +31 -0
- package/dist/api/oauth.d.ts +319 -0
- package/dist/api/oauth.js +166 -0
- package/dist/api/preference.d.ts +5 -0
- package/dist/api/preference.js +18 -0
- package/dist/api/proto/application.d.ts +48 -0
- package/dist/api/proto/application.js +378 -0
- package/dist/api/proto/clipboard.d.ts +65 -0
- package/dist/api/proto/clipboard.js +614 -0
- package/dist/api/proto/common.d.ts +28 -0
- package/dist/api/proto/common.js +102 -0
- package/dist/api/proto/extension.d.ts +68 -0
- package/dist/api/proto/extension.js +604 -0
- package/dist/api/proto/google/protobuf/struct.d.ts +107 -0
- package/dist/api/proto/google/protobuf/struct.js +456 -0
- package/dist/api/proto/ipc.d.ts +64 -0
- package/dist/api/proto/ipc.js +604 -0
- package/dist/api/proto/manager.d.ts +82 -0
- package/dist/api/proto/manager.js +689 -0
- package/dist/api/proto/oauth.d.ts +55 -0
- package/dist/api/proto/oauth.js +379 -0
- package/dist/api/proto/storage.d.ts +80 -0
- package/dist/api/proto/storage.js +804 -0
- package/dist/api/proto/ui.d.ts +186 -0
- package/dist/api/proto/ui.js +1993 -0
- package/dist/api/toast.d.ts +168 -0
- package/dist/api/toast.js +152 -0
- package/dist/api/utils.d.ts +15 -0
- package/dist/api/utils.js +64 -0
- package/dist/commands/build/index.d.ts +11 -0
- package/dist/commands/build/index.js +123 -0
- package/dist/commands/develop/index.d.ts +10 -0
- package/dist/commands/develop/index.js +193 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +17 -0
- package/dist/schemas/manifest.d.ts +75 -0
- package/dist/schemas/manifest.js +4 -0
- package/dist/utils/logger.d.ts +13 -0
- package/dist/utils/logger.js +38 -0
- package/dist/utils/utils.d.ts +2 -0
- package/dist/utils/utils.js +19 -0
- package/dist/utils/vicinae.d.ts +12 -0
- package/dist/utils/vicinae.js +33 -0
- package/package.json +73 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./navigation-provider"), exports);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const react_1 = require("react");
|
|
4
|
+
const ctx = (0, react_1.createContext)({
|
|
5
|
+
pop: () => { throw new Error('not implemented'); },
|
|
6
|
+
push: () => { throw new Error('not implemented'); },
|
|
7
|
+
});
|
|
8
|
+
exports.default = ctx;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.NavigationProvider = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
const navigation_context_1 = __importDefault(require("./navigation-context"));
|
|
10
|
+
const bus_1 = require("../bus");
|
|
11
|
+
const View = ({ children }) => {
|
|
12
|
+
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children });
|
|
13
|
+
};
|
|
14
|
+
const NavigationProvider = ({ root }) => {
|
|
15
|
+
const [navStack, setNavStack] = (0, react_1.useState)([root]);
|
|
16
|
+
const pop = () => {
|
|
17
|
+
bus_1.bus.turboRequest('ui.popView', {}).then(() => {
|
|
18
|
+
setNavStack((cur) => cur.slice(0, -1));
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
const push = (node) => {
|
|
22
|
+
bus_1.bus.turboRequest('ui.pushView', {}).then(() => {
|
|
23
|
+
setNavStack((cur) => [...cur, node]);
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
(0, react_1.useEffect)(() => {
|
|
27
|
+
//console.log('changed nav stack size', navStack.length);
|
|
28
|
+
}, [navStack]);
|
|
29
|
+
(0, react_1.useEffect)(() => {
|
|
30
|
+
const listener = bus_1.bus.subscribe('pop-view', () => {
|
|
31
|
+
setNavStack((cur) => cur.slice(0, -1));
|
|
32
|
+
});
|
|
33
|
+
return () => listener.unsubscribe();
|
|
34
|
+
}, []);
|
|
35
|
+
return ((0, jsx_runtime_1.jsx)(navigation_context_1.default.Provider, { value: {
|
|
36
|
+
push,
|
|
37
|
+
pop
|
|
38
|
+
}, children: navStack.map((el, idx) => (0, jsx_runtime_1.jsx)(View, { children: el }, idx)) }));
|
|
39
|
+
};
|
|
40
|
+
exports.NavigationProvider = NavigationProvider;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getSelectedText = exports.clearSearchBar = exports.closeMainWindow = void 0;
|
|
4
|
+
const bus_1 = require("./bus");
|
|
5
|
+
const closeMainWindow = async () => {
|
|
6
|
+
await bus_1.bus.turboRequest('ui.closeMainWindow', {});
|
|
7
|
+
};
|
|
8
|
+
exports.closeMainWindow = closeMainWindow;
|
|
9
|
+
const clearSearchBar = async () => {
|
|
10
|
+
await bus_1.bus.turboRequest('ui.setSearchText', { text: '' });
|
|
11
|
+
};
|
|
12
|
+
exports.clearSearchBar = clearSearchBar;
|
|
13
|
+
const getSelectedText = async () => {
|
|
14
|
+
const response = await bus_1.bus.turboRequest('ui.getSelectedText', {});
|
|
15
|
+
if (!response.ok) {
|
|
16
|
+
throw new Error(`Failed to get selected text`);
|
|
17
|
+
}
|
|
18
|
+
return response.value.text;
|
|
19
|
+
};
|
|
20
|
+
exports.getSelectedText = getSelectedText;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { Form } from "./components";
|
|
2
|
+
export interface LaunchContext {
|
|
3
|
+
[item: string]: any;
|
|
4
|
+
}
|
|
5
|
+
export interface Arguments {
|
|
6
|
+
[item: string]: any;
|
|
7
|
+
}
|
|
8
|
+
export declare type LaunchProps<T extends {
|
|
9
|
+
arguments?: Arguments;
|
|
10
|
+
draftValues?: Form.Values;
|
|
11
|
+
launchContext?: LaunchContext;
|
|
12
|
+
} = {
|
|
13
|
+
arguments: Arguments;
|
|
14
|
+
draftValues: Form.Values;
|
|
15
|
+
launchContext?: LaunchContext;
|
|
16
|
+
}> = {
|
|
17
|
+
/**
|
|
18
|
+
* The type of launch for the command (user initiated or background).
|
|
19
|
+
*/
|
|
20
|
+
launchType: LaunchType;
|
|
21
|
+
/**
|
|
22
|
+
* Use these values to populate the initial state for your command.
|
|
23
|
+
*/
|
|
24
|
+
arguments: T["arguments"];
|
|
25
|
+
/**
|
|
26
|
+
* When a user enters the command via a draft, this object will contain the user inputs that were saved as a draft.
|
|
27
|
+
* Use its values to populate the initial state for your Form.
|
|
28
|
+
*/
|
|
29
|
+
draftValues?: T["draftValues"];
|
|
30
|
+
/**
|
|
31
|
+
* When the command is launched programmatically via `launchCommand`, this object contains the value passed to `context`.
|
|
32
|
+
*/
|
|
33
|
+
launchContext?: T["launchContext"];
|
|
34
|
+
/**
|
|
35
|
+
* When the command is launched as a fallback command, this string contains the text of the root search.
|
|
36
|
+
*/
|
|
37
|
+
fallbackText?: string;
|
|
38
|
+
};
|
|
39
|
+
export declare enum LaunchType {
|
|
40
|
+
/**
|
|
41
|
+
* A regular launch through user interaction
|
|
42
|
+
*/
|
|
43
|
+
UserInitiated = "userInitiated",
|
|
44
|
+
/**
|
|
45
|
+
* Scheduled through an interval and launched from background
|
|
46
|
+
*/
|
|
47
|
+
Background = "background"
|
|
48
|
+
}
|
|
49
|
+
export interface Environment {
|
|
50
|
+
/**
|
|
51
|
+
* The version of the main Raycast app
|
|
52
|
+
*/
|
|
53
|
+
raycastVersion: string;
|
|
54
|
+
/**
|
|
55
|
+
* The name of the extension, as specified in package.json
|
|
56
|
+
*/
|
|
57
|
+
extensionName: string;
|
|
58
|
+
/**
|
|
59
|
+
* The name of the launched command, as specified in package.json
|
|
60
|
+
*/
|
|
61
|
+
commandName: string;
|
|
62
|
+
/**
|
|
63
|
+
* The mode of the launched command, as specified in package.json
|
|
64
|
+
*/
|
|
65
|
+
commandMode: "no-view" | "view" | "menu-bar";
|
|
66
|
+
/**
|
|
67
|
+
* The absolute path to the assets directory of the extension.
|
|
68
|
+
*
|
|
69
|
+
* @remarks
|
|
70
|
+
* This directory is used internally to load icons, images, and other bundled assets.
|
|
71
|
+
*/
|
|
72
|
+
assetsPath: string;
|
|
73
|
+
/**
|
|
74
|
+
* The absolute path for the support directory of an extension. Use it to read and write files related to your extension or command.
|
|
75
|
+
*/
|
|
76
|
+
supportPath: string;
|
|
77
|
+
/**
|
|
78
|
+
* Indicates whether the command is a development command (vs. an installed command from the Store).
|
|
79
|
+
*/
|
|
80
|
+
isDevelopment: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* The appearance used by the Raycast application.
|
|
83
|
+
*/
|
|
84
|
+
appearance: "light" | "dark";
|
|
85
|
+
/**
|
|
86
|
+
* The theme used by the Raycast application.
|
|
87
|
+
* @deprecated Use `appearance` instead
|
|
88
|
+
*/
|
|
89
|
+
theme: "light" | "dark";
|
|
90
|
+
/**
|
|
91
|
+
* The text size used by the Raycast application.
|
|
92
|
+
*/
|
|
93
|
+
textSize: "medium" | "large";
|
|
94
|
+
/**
|
|
95
|
+
* The type of launch for the command (user initiated or background).
|
|
96
|
+
*/
|
|
97
|
+
launchType: LaunchType;
|
|
98
|
+
/**
|
|
99
|
+
* Returns whether the user has access to the given API.
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* ```typescript
|
|
103
|
+
* import { unstableAI, environment } from "@raycast/api";
|
|
104
|
+
*
|
|
105
|
+
* export default function Command() {
|
|
106
|
+
* if (environment.canAccess(unstableAI)) {
|
|
107
|
+
* // use unstableAI
|
|
108
|
+
* }
|
|
109
|
+
* }
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
canAccess(api: unknown): boolean;
|
|
113
|
+
/**
|
|
114
|
+
* @deprecated Use the top-level prop `launchContext` instead.
|
|
115
|
+
*/
|
|
116
|
+
launchContext?: LaunchContext;
|
|
117
|
+
}
|
|
118
|
+
export declare const environment: Environment;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.environment = exports.LaunchType = void 0;
|
|
4
|
+
;
|
|
5
|
+
;
|
|
6
|
+
var LaunchType;
|
|
7
|
+
(function (LaunchType) {
|
|
8
|
+
/**
|
|
9
|
+
* A regular launch through user interaction
|
|
10
|
+
*/
|
|
11
|
+
LaunchType["UserInitiated"] = "userInitiated";
|
|
12
|
+
/**
|
|
13
|
+
* Scheduled through an interval and launched from background
|
|
14
|
+
*/
|
|
15
|
+
LaunchType["Background"] = "background";
|
|
16
|
+
})(LaunchType || (exports.LaunchType = LaunchType = {}));
|
|
17
|
+
exports.environment = {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./use-applications"), exports);
|
|
18
|
+
__exportStar(require("./use-navigation"), exports);
|
|
@@ -0,0 +1,19 @@
|
|
|
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;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useImperativeFormHandle = void 0;
|
|
4
|
+
const crypto_1 = require("crypto");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const bus_1 = require("../bus");
|
|
7
|
+
const useImperativeFormHandle = (ref) => {
|
|
8
|
+
const handleId = (0, react_1.useRef)((0, crypto_1.randomUUID)());
|
|
9
|
+
(0, react_1.useImperativeHandle)(ref, () => {
|
|
10
|
+
return {
|
|
11
|
+
focus: () => {
|
|
12
|
+
bus_1.bus.emit(handleId.current, {
|
|
13
|
+
type: 'focus'
|
|
14
|
+
});
|
|
15
|
+
},
|
|
16
|
+
reset: () => {
|
|
17
|
+
bus_1.bus.emit(handleId.current, {
|
|
18
|
+
type: 'reset'
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
}, []);
|
|
23
|
+
return [handleId.current];
|
|
24
|
+
};
|
|
25
|
+
exports.useImperativeFormHandle = useImperativeFormHandle;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.useNavigation = void 0;
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const navigation_context_1 = __importDefault(require("../context/navigation-context"));
|
|
9
|
+
const useNavigation = () => {
|
|
10
|
+
const { push, pop } = (0, react_1.useContext)(navigation_context_1.default);
|
|
11
|
+
return { push, pop };
|
|
12
|
+
};
|
|
13
|
+
exports.useNavigation = useNavigation;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useEventListener: (fn: ((...args: any[]) => void) | undefined) => string | undefined;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useEventListener = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const bus_1 = require("./bus");
|
|
6
|
+
const handlerIdFactory = {
|
|
7
|
+
nextHandlerId: 0,
|
|
8
|
+
next() {
|
|
9
|
+
return this.nextHandlerId++;
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
const useEventListener = (fn) => {
|
|
13
|
+
const id = (0, react_1.useRef)(`handler:${handlerIdFactory.next()}`);
|
|
14
|
+
const callback = (0, react_1.useRef)();
|
|
15
|
+
(0, react_1.useEffect)(() => {
|
|
16
|
+
const { unsubscribe } = bus_1.bus.subscribe(id.current, (...args) => { callback.current?.(...args); });
|
|
17
|
+
return unsubscribe;
|
|
18
|
+
}, []);
|
|
19
|
+
(0, react_1.useEffect)(() => {
|
|
20
|
+
callback.current = fn;
|
|
21
|
+
}, [fn]);
|
|
22
|
+
return fn && id.current;
|
|
23
|
+
};
|
|
24
|
+
exports.useEventListener = useEventListener;
|