@vicinae/api 0.16.0 → 0.16.2
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/bin/run.js +1 -1
- package/dist/api/ai.d.ts +2 -2
- package/dist/api/ai.js +2 -2
- package/dist/api/bus.d.ts +7 -2
- package/dist/api/cache.js +18 -12
- package/dist/api/clipboard.js +2 -2
- package/dist/api/command.js +2 -2
- package/dist/api/components/action-pannel.js +1 -1
- package/dist/api/components/actions.d.ts +21 -0
- package/dist/api/components/actions.js +25 -1
- package/dist/api/components/dropdown.js +2 -2
- package/dist/api/components/form.d.ts +19 -1
- package/dist/api/components/form.js +34 -11
- package/dist/api/components/grid.d.ts +1 -1
- package/dist/api/components/grid.js +11 -11
- package/dist/api/context/navigation-provider.js +1 -4
- package/dist/api/controls.js +6 -4
- package/dist/api/environment.d.ts +4 -0
- package/dist/api/file-search.d.ts +18 -18
- package/dist/api/file-search.js +18 -19
- package/dist/api/keyboard.d.ts +1 -1
- package/dist/api/keyboard.js +15 -17
- package/dist/api/lib/result.js +7 -1
- package/dist/api/oauth.d.ts +3 -8
- package/dist/api/oauth.js +51 -21
- package/dist/api/preference.js +2 -2
- package/dist/api/proto/application.d.ts +10 -0
- package/dist/api/proto/application.js +150 -3
- package/dist/api/proto/manager.d.ts +2 -0
- package/dist/api/proto/manager.js +32 -0
- package/dist/api/proto/oauth.d.ts +42 -0
- package/dist/api/proto/oauth.js +620 -5
- package/dist/api/proto/wm.d.ts +20 -0
- package/dist/api/proto/wm.js +291 -7
- package/dist/api/utils.d.ts +43 -0
- package/dist/api/utils.js +25 -2
- package/dist/api/window-management.d.ts +31 -2
- package/dist/api/window-management.js +29 -10
- package/dist/commands/develop/index.js +13 -11
- package/dist/schemas/manifest.d.ts +1 -1
- package/dist/schemas/manifest.js +5 -3
- package/package.json +73 -76
- package/types/jsx.d.ts +189 -170
package/bin/run.js
CHANGED
package/dist/api/ai.d.ts
CHANGED
|
@@ -65,8 +65,8 @@ export declare namespace AI {
|
|
|
65
65
|
Anthropic_Claude_Opus = "anthropic-claude-opus",
|
|
66
66
|
Anthropic_Claude_Sonnet = "anthropic-claude-sonnet",
|
|
67
67
|
MixtraL_8x7B = "mixtral-8x7b",
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
Mistral_Nemo = "mistral-nemo",
|
|
69
|
+
Mistral_Large2 = "mistral-large-2",
|
|
70
70
|
Llama3_70B = "llama3-70b",
|
|
71
71
|
"Llama3.1_70B" = "llama3.1-70b",
|
|
72
72
|
"Llama3.1_8B" = "llama3.1-8b",
|
package/dist/api/ai.js
CHANGED
|
@@ -33,7 +33,7 @@ var AI;
|
|
|
33
33
|
* ```
|
|
34
34
|
*/
|
|
35
35
|
function ask(prompt, options) {
|
|
36
|
-
throw new Error(
|
|
36
|
+
throw new Error("not implemented");
|
|
37
37
|
}
|
|
38
38
|
AI.ask = ask;
|
|
39
39
|
/**
|
|
@@ -77,6 +77,6 @@ var AI;
|
|
|
77
77
|
Model["OpenAI_GPT3.5-turbo"] = "openai-gpt-3.5-turbo";
|
|
78
78
|
})(Model = AI.Model || (AI.Model = {}));
|
|
79
79
|
AI.getModels = async () => {
|
|
80
|
-
throw new Error(
|
|
80
|
+
throw new Error("not implemented");
|
|
81
81
|
};
|
|
82
82
|
})(AI || (exports.AI = AI = {}));
|
package/dist/api/bus.d.ts
CHANGED
|
@@ -38,6 +38,7 @@ type EndpointMapping = {
|
|
|
38
38
|
"app.list": "app.list";
|
|
39
39
|
"app.open": "app.open";
|
|
40
40
|
"app.getDefault": "app.getDefault";
|
|
41
|
+
"app.runInTerminal": "app.runInTerminal";
|
|
41
42
|
"ui.render": "ui.render";
|
|
42
43
|
"ui.showToast": "ui.showToast";
|
|
43
44
|
"ui.hideToast": "ui.hideToast";
|
|
@@ -53,6 +54,7 @@ type EndpointMapping = {
|
|
|
53
54
|
"wm.getActiveWindow": "wm.getActiveWindow";
|
|
54
55
|
"wm.getActiveWorkspace": "wm.getActiveWorkspace";
|
|
55
56
|
"wm.getWindows": "wm.getWindows";
|
|
57
|
+
"wm.getScreens": "wm.getScreens";
|
|
56
58
|
"wm.getWorkspaces": "wm.getWorkspaces";
|
|
57
59
|
"wm.setWindowBounds": "wm.setWindowBounds";
|
|
58
60
|
"fileSearch.search": "fileSearch.search";
|
|
@@ -64,6 +66,9 @@ type EndpointMapping = {
|
|
|
64
66
|
"storage.clear": "storage.clear";
|
|
65
67
|
"storage.list": "storage.list";
|
|
66
68
|
"oauth.authorize": "oauth.authorize";
|
|
69
|
+
"oauth.getTokens": "oauth.getTokens";
|
|
70
|
+
"oauth.setTokens": "oauth.setTokens";
|
|
71
|
+
"oauth.removeTokens": "oauth.removeTokens";
|
|
67
72
|
"clipboard.copy": "clipboard.copy";
|
|
68
73
|
"clipboard.paste": "clipboard.paste";
|
|
69
74
|
"clipboard.readContent": "clipboard.readContent";
|
|
@@ -94,11 +99,11 @@ declare class Bus {
|
|
|
94
99
|
};
|
|
95
100
|
emit(action: string, data: Record<string, any>): void;
|
|
96
101
|
sendMessage(message: ipc.ExtensionMessage): void;
|
|
97
|
-
addEventHandler(cb: EventListenerInfo[
|
|
102
|
+
addEventHandler(cb: EventListenerInfo["callback"]): {
|
|
98
103
|
id: string;
|
|
99
104
|
unsubscribe: () => void;
|
|
100
105
|
};
|
|
101
|
-
replaceEventHandler(id: string, handler: EventListenerInfo[
|
|
106
|
+
replaceEventHandler(id: string, handler: EventListenerInfo["callback"]): void;
|
|
102
107
|
removeEventHandler(id: string): void;
|
|
103
108
|
private request2;
|
|
104
109
|
}
|
package/dist/api/cache.js
CHANGED
|
@@ -58,7 +58,7 @@ class Cache {
|
|
|
58
58
|
* @remarks You can use this method to check for entries without affecting the LRU access.
|
|
59
59
|
*/
|
|
60
60
|
has = (key) => {
|
|
61
|
-
return typeof this.index.keys[key] !==
|
|
61
|
+
return typeof this.index.keys[key] !== "undefined";
|
|
62
62
|
};
|
|
63
63
|
/**
|
|
64
64
|
* @returns whether the cache is empty.
|
|
@@ -77,19 +77,20 @@ class Cache {
|
|
|
77
77
|
throw new Error(`A single cache entry cannot be bigger than the total capacity of the cache. The data for key ${key} is ${data.length} bytes long while the capacity is set to ${this.capacity}. You should either reduce the amount of data stored or increase the cache's capacity.`);
|
|
78
78
|
}
|
|
79
79
|
const info = this.index.keys[key];
|
|
80
|
-
|
|
80
|
+
const newTotalSize = this.index.size + data.length - (info?.size ?? 0);
|
|
81
81
|
if (newTotalSize > this.capacity) {
|
|
82
82
|
this.popLRU();
|
|
83
|
-
|
|
83
|
+
this.set(key, data); // FIXME: get rid of recursion
|
|
84
|
+
return;
|
|
84
85
|
}
|
|
85
86
|
this.index.size = newTotalSize;
|
|
86
87
|
this.index.keys[key] = { size: data.length };
|
|
87
88
|
this.updateLRU(key);
|
|
89
|
+
this.writeKeyData(key, data);
|
|
90
|
+
this.syncIndex();
|
|
88
91
|
for (const sub of this.subscribers) {
|
|
89
92
|
sub(key, data);
|
|
90
93
|
}
|
|
91
|
-
this.writeKeyData(key, data);
|
|
92
|
-
this.syncIndex();
|
|
93
94
|
};
|
|
94
95
|
/**
|
|
95
96
|
* Removes the data for the given key.
|
|
@@ -131,22 +132,22 @@ class Cache {
|
|
|
131
132
|
return this.dataPath(this.keyHash(key));
|
|
132
133
|
}
|
|
133
134
|
readKeyData(key) {
|
|
134
|
-
return (0, node_fs_1.readFileSync)(this.keyDataPath(key),
|
|
135
|
+
return (0, node_fs_1.readFileSync)(this.keyDataPath(key), "utf8");
|
|
135
136
|
}
|
|
136
137
|
writeKeyData(key, data) {
|
|
137
138
|
(0, node_fs_1.writeFileSync)(this.keyDataPath(key), data);
|
|
138
139
|
}
|
|
139
140
|
keyHash(key) {
|
|
140
|
-
return (0, node_crypto_1.hash)(
|
|
141
|
+
return (0, node_crypto_1.hash)("md5", key);
|
|
141
142
|
}
|
|
142
143
|
get dataDir() {
|
|
143
|
-
return node_path_1.default.join(this.storageDir,
|
|
144
|
+
return node_path_1.default.join(this.storageDir, "data");
|
|
144
145
|
}
|
|
145
146
|
dataPath(id) {
|
|
146
147
|
return node_path_1.default.join(this.dataDir, id);
|
|
147
148
|
}
|
|
148
149
|
get indexPath() {
|
|
149
|
-
return node_path_1.default.join(this.storageDir,
|
|
150
|
+
return node_path_1.default.join(this.storageDir, "index.json");
|
|
150
151
|
}
|
|
151
152
|
updateLRU(key) {
|
|
152
153
|
const idx = this.index.lru.findIndex((entry) => key == entry.key);
|
|
@@ -172,7 +173,12 @@ class Cache {
|
|
|
172
173
|
return true;
|
|
173
174
|
}
|
|
174
175
|
initIndex() {
|
|
175
|
-
const index = {
|
|
176
|
+
const index = {
|
|
177
|
+
revision: this.revision,
|
|
178
|
+
keys: {},
|
|
179
|
+
size: 0,
|
|
180
|
+
lru: [],
|
|
181
|
+
};
|
|
176
182
|
(0, node_fs_1.mkdirSync)(this.dataDir, { recursive: true });
|
|
177
183
|
const indexPath = node_path_1.default.join(this.storageDir, "index.json");
|
|
178
184
|
(0, node_fs_1.writeFileSync)(indexPath, JSON.stringify(index, null, 2));
|
|
@@ -182,7 +188,7 @@ class Cache {
|
|
|
182
188
|
const indexPath = node_path_1.default.join(this.storageDir, "index.json");
|
|
183
189
|
if (!(0, node_fs_1.existsSync)(indexPath))
|
|
184
190
|
return null;
|
|
185
|
-
return JSON.parse((0, node_fs_1.readFileSync)(indexPath,
|
|
191
|
+
return JSON.parse((0, node_fs_1.readFileSync)(indexPath, "utf8"));
|
|
186
192
|
}
|
|
187
193
|
removeCacheDirectory() {
|
|
188
194
|
(0, node_fs_1.rmSync)(this.dataDir, { recursive: true, force: true });
|
|
@@ -199,7 +205,7 @@ class Cache {
|
|
|
199
205
|
* If we want to change the way the data is stored we just change this,
|
|
200
206
|
* which will force a full cache clear and use the new format.
|
|
201
207
|
*/
|
|
202
|
-
revision =
|
|
208
|
+
revision = "1";
|
|
203
209
|
capacity;
|
|
204
210
|
subscribers = [];
|
|
205
211
|
storageDir;
|
package/dist/api/clipboard.js
CHANGED
|
@@ -56,7 +56,7 @@ var Clipboard;
|
|
|
56
56
|
* ```
|
|
57
57
|
*/
|
|
58
58
|
async function read(options) {
|
|
59
|
-
const res = await bus_1.bus.turboRequest(
|
|
59
|
+
const res = await bus_1.bus.turboRequest("clipboard.readContent", {});
|
|
60
60
|
return res.unwrap().content;
|
|
61
61
|
}
|
|
62
62
|
Clipboard.read = read;
|
|
@@ -79,7 +79,7 @@ var Clipboard;
|
|
|
79
79
|
* Clear the current clipboard content.
|
|
80
80
|
*/
|
|
81
81
|
async function clear() {
|
|
82
|
-
await bus_1.bus.turboRequest(
|
|
82
|
+
await bus_1.bus.turboRequest("clipboard.clear", {});
|
|
83
83
|
}
|
|
84
84
|
Clipboard.clear = clear;
|
|
85
85
|
})(Clipboard || (exports.Clipboard = Clipboard = {}));
|
package/dist/api/command.js
CHANGED
|
@@ -10,8 +10,8 @@ const bus_1 = require("./bus");
|
|
|
10
10
|
*/
|
|
11
11
|
async function updateCommandMetadata(metadata) {
|
|
12
12
|
const payload = {};
|
|
13
|
-
if (Object.prototype.hasOwnProperty.call(metadata,
|
|
13
|
+
if (Object.prototype.hasOwnProperty.call(metadata, "subtitle")) {
|
|
14
14
|
payload.subtitle = metadata.subtitle ?? undefined;
|
|
15
15
|
}
|
|
16
|
-
await bus_1.bus.turboRequest(
|
|
16
|
+
await bus_1.bus.turboRequest("command.updateCommandMetadata", payload);
|
|
17
17
|
}
|
|
@@ -13,7 +13,7 @@ const ActionPanelSection = (props) => {
|
|
|
13
13
|
return ((0, jsx_runtime_1.jsx)("action-panel-section", { ...nativeProps, children: props.children }));
|
|
14
14
|
};
|
|
15
15
|
const ActionPannelSubmenu = ({ children, ...props }) => {
|
|
16
|
-
return (
|
|
16
|
+
return (0, jsx_runtime_1.jsx)("action-panel-submenu", { ...props, children: children });
|
|
17
17
|
};
|
|
18
18
|
exports.ActionPanel = Object.assign(ActionPanelRoot, {
|
|
19
19
|
Section: ActionPanelSection,
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React, { ReactNode } from "react";
|
|
2
|
+
import type { PathLike } from "node:fs";
|
|
2
3
|
import { Clipboard } from "../clipboard";
|
|
3
4
|
import { ImageLike } from "../image";
|
|
4
5
|
import { Keyboard } from "../keyboard";
|
|
5
6
|
import { Application } from "../utils";
|
|
6
7
|
import { Form } from "./form";
|
|
8
|
+
import { Icon } from "../icon";
|
|
7
9
|
export type BaseActionProps = {
|
|
8
10
|
title: string;
|
|
9
11
|
icon?: ImageLike;
|
|
@@ -39,10 +41,27 @@ export type ActionPasteProps = BaseActionProps & {
|
|
|
39
41
|
export type ActionOpenInBrowserProps = BaseActionProps & {
|
|
40
42
|
url: string;
|
|
41
43
|
};
|
|
44
|
+
export type ActionShowInFinderProps = {
|
|
45
|
+
path: PathLike;
|
|
46
|
+
icon?: ImageLike;
|
|
47
|
+
onShow?: (path: PathLike) => void;
|
|
48
|
+
shortcut?: Keyboard.Shortcut;
|
|
49
|
+
title?: string;
|
|
50
|
+
};
|
|
42
51
|
export type ActionSubmitFormProps = Omit<BaseActionProps, "title"> & {
|
|
43
52
|
onSubmit: (input: Form.Values) => boolean | void | Promise<boolean | void>;
|
|
44
53
|
title?: string;
|
|
45
54
|
};
|
|
55
|
+
export type Quicklink = {
|
|
56
|
+
name?: string;
|
|
57
|
+
link: string;
|
|
58
|
+
application?: string | Application;
|
|
59
|
+
icon?: Icon;
|
|
60
|
+
};
|
|
61
|
+
export type ActionCreateQuicklinkProps = Omit<BaseActionProps, "title"> & {
|
|
62
|
+
title?: string;
|
|
63
|
+
quicklink: Quicklink;
|
|
64
|
+
};
|
|
46
65
|
export declare const Action: React.FC<ActionProps> & {
|
|
47
66
|
CopyToClipboard: React.FC<CopyToClipboardProps>;
|
|
48
67
|
Push: React.FC<ActionPushProps>;
|
|
@@ -50,6 +69,8 @@ export declare const Action: React.FC<ActionProps> & {
|
|
|
50
69
|
Paste: React.FC<ActionPasteProps>;
|
|
51
70
|
SubmitForm: React.FC<ActionSubmitFormProps>;
|
|
52
71
|
OpenInBrowser: React.FC<ActionOpenInBrowserProps>;
|
|
72
|
+
ShowInFinder: React.FC<ActionShowInFinderProps>;
|
|
73
|
+
CreateQuicklink: React.FC<ActionCreateQuicklinkProps>;
|
|
53
74
|
Style: {
|
|
54
75
|
Regular: "regular";
|
|
55
76
|
Destructive: "destructive";
|
|
@@ -34,6 +34,11 @@ const OpenInBrowser = ({ url, ...props }) => {
|
|
|
34
34
|
(0, utils_1.open)(url);
|
|
35
35
|
} }));
|
|
36
36
|
};
|
|
37
|
+
const ShowInFinder = ({ path, title = "Show in Finder", ...props }) => {
|
|
38
|
+
return ((0, jsx_runtime_1.jsx)(ActionRoot, { ...props, title: title, onAction: () => {
|
|
39
|
+
(0, utils_1.showInFileBrowser)(path);
|
|
40
|
+
} }));
|
|
41
|
+
};
|
|
37
42
|
const Push = ({ target, ...props }) => {
|
|
38
43
|
const { push } = (0, index_1.useNavigation)();
|
|
39
44
|
return ((0, jsx_runtime_1.jsx)(ActionRoot, { ...props, onAction: () => {
|
|
@@ -45,7 +50,24 @@ const SubmitForm = ({ title = "Submit", ...props }) => {
|
|
|
45
50
|
const nativeProps = {
|
|
46
51
|
...props,
|
|
47
52
|
title,
|
|
48
|
-
onAction: () => { }
|
|
53
|
+
onAction: () => { },
|
|
54
|
+
};
|
|
55
|
+
return (0, jsx_runtime_1.jsx)("action", { ...nativeProps });
|
|
56
|
+
};
|
|
57
|
+
const CreateQuicklink = ({ title = "Create Quicklink", quicklink, ...props }) => {
|
|
58
|
+
const nativeProps = {
|
|
59
|
+
...props,
|
|
60
|
+
title,
|
|
61
|
+
type: "create-quicklink",
|
|
62
|
+
quicklink: {
|
|
63
|
+
link: quicklink.link,
|
|
64
|
+
name: quicklink.name,
|
|
65
|
+
application: typeof quicklink.application === "string"
|
|
66
|
+
? quicklink.application
|
|
67
|
+
: quicklink.application?.name,
|
|
68
|
+
icon: quicklink.icon,
|
|
69
|
+
},
|
|
70
|
+
onAction: () => { },
|
|
49
71
|
};
|
|
50
72
|
return (0, jsx_runtime_1.jsx)("action", { ...nativeProps });
|
|
51
73
|
};
|
|
@@ -56,6 +78,8 @@ exports.Action = Object.assign(ActionRoot, {
|
|
|
56
78
|
Paste,
|
|
57
79
|
SubmitForm,
|
|
58
80
|
OpenInBrowser,
|
|
81
|
+
ShowInFinder,
|
|
82
|
+
CreateQuicklink,
|
|
59
83
|
Style: {
|
|
60
84
|
Regular: "regular",
|
|
61
85
|
Destructive: "destructive",
|
|
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Dropdown = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const DropdownRoot = ({ children, ...props }) => {
|
|
6
|
-
return (
|
|
6
|
+
return (0, jsx_runtime_1.jsx)("dropdown", { ...props, children: children });
|
|
7
7
|
};
|
|
8
8
|
const Item = ({ title, value, icon }) => {
|
|
9
|
-
return (
|
|
9
|
+
return (0, jsx_runtime_1.jsx)("dropdown-item", { title: title, value: value, icon: icon });
|
|
10
10
|
};
|
|
11
11
|
const Section = ({ title, children }) => {
|
|
12
12
|
return (0, jsx_runtime_1.jsx)("dropdown-section", { title: title, children: children });
|
|
@@ -57,7 +57,14 @@ interface TextFieldProps extends FormItemProps<string>, WithFormRef<Form.TextFie
|
|
|
57
57
|
}
|
|
58
58
|
interface PasswordFieldProps extends FormItemProps<string>, WithFormRef<Form.PasswordField> {
|
|
59
59
|
}
|
|
60
|
+
export declare enum DatePickerType {
|
|
61
|
+
DateTime = "dateTime",
|
|
62
|
+
Date = "date"
|
|
63
|
+
}
|
|
60
64
|
interface DatePickerProps extends FormItemProps<Date | null>, WithFormRef<Form.DatePicker> {
|
|
65
|
+
min?: Date;
|
|
66
|
+
max?: Date;
|
|
67
|
+
type?: DatePickerType;
|
|
61
68
|
}
|
|
62
69
|
interface CheckboxProps extends FormItemProps<boolean>, WithFormRef<Form.Checkbox> {
|
|
63
70
|
label?: string;
|
|
@@ -77,6 +84,10 @@ interface TagPickerProps extends FormItemProps<string[]>, WithFormRef<Form.TagPi
|
|
|
77
84
|
interface TextAreaProps extends FormItemProps<string>, WithFormRef<Form.TextArea> {
|
|
78
85
|
}
|
|
79
86
|
interface FilePickerProps extends FormItemProps<string[]>, WithFormRef<Form.FilePicker> {
|
|
87
|
+
allowMultipleSelection?: boolean;
|
|
88
|
+
canChooseDirectories?: boolean;
|
|
89
|
+
canChooseFiles?: boolean;
|
|
90
|
+
showHiddenFiles?: boolean;
|
|
80
91
|
}
|
|
81
92
|
type DescriptionProps = {
|
|
82
93
|
text: string;
|
|
@@ -85,7 +96,10 @@ type DescriptionProps = {
|
|
|
85
96
|
export declare const Form: import("react").FC<FormProps> & {
|
|
86
97
|
TextField: import("react").FC<TextFieldProps>;
|
|
87
98
|
PasswordField: import("react").FC<PasswordFieldProps>;
|
|
88
|
-
DatePicker: import("react").FC<DatePickerProps
|
|
99
|
+
DatePicker: import("react").FC<DatePickerProps> & {
|
|
100
|
+
Type: typeof DatePickerType;
|
|
101
|
+
isFullDay: (value: Date | null | undefined) => boolean;
|
|
102
|
+
};
|
|
89
103
|
Checkbox: import("react").FC<CheckboxProps>;
|
|
90
104
|
TextArea: import("react").FC<TextAreaProps>;
|
|
91
105
|
Dropdown: import("react").FC<DropdownProps> & {
|
|
@@ -110,5 +124,9 @@ export declare const Form: import("react").FC<FormProps> & {
|
|
|
110
124
|
};
|
|
111
125
|
FilePicker: import("react").FC<FilePickerProps>;
|
|
112
126
|
Separator: () => import("react/jsx-runtime").JSX.Element;
|
|
127
|
+
LinkAccessory: ({ target, text }: {
|
|
128
|
+
target: string;
|
|
129
|
+
text: string;
|
|
130
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
113
131
|
};
|
|
114
132
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Form = void 0;
|
|
3
|
+
exports.Form = exports.DatePickerType = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const use_imperative_form_handle_1 = require("../hooks/use-imperative-form-handle");
|
|
6
6
|
const dropdown_1 = require("./dropdown");
|
|
@@ -8,14 +8,14 @@ const wrapFormItemProps = (props) => {
|
|
|
8
8
|
return {
|
|
9
9
|
...props,
|
|
10
10
|
onFocus: () => props.onFocus?.({
|
|
11
|
-
type:
|
|
11
|
+
type: "focus",
|
|
12
12
|
target: {
|
|
13
13
|
id: props.id,
|
|
14
14
|
value: (props.value ?? props.defaultValue),
|
|
15
15
|
},
|
|
16
16
|
}),
|
|
17
17
|
onBlur: () => props.onBlur?.({
|
|
18
|
-
type:
|
|
18
|
+
type: "blur",
|
|
19
19
|
target: {
|
|
20
20
|
id: props.id,
|
|
21
21
|
value: (props.value ?? props.defaultValue),
|
|
@@ -30,19 +30,41 @@ const FormRoot = ({ enableDrafts = false, actions, children, isLoading = false,
|
|
|
30
30
|
};
|
|
31
31
|
const TextField = ({ ref, ...props }) => {
|
|
32
32
|
(0, use_imperative_form_handle_1.useImperativeFormHandle)(ref);
|
|
33
|
-
return (
|
|
33
|
+
return (0, jsx_runtime_1.jsx)("text-field", { ...wrapFormItemProps(props) });
|
|
34
34
|
};
|
|
35
35
|
const PasswordField = ({ ref, ...props }) => {
|
|
36
36
|
(0, use_imperative_form_handle_1.useImperativeFormHandle)(ref);
|
|
37
37
|
return (0, jsx_runtime_1.jsx)("password-field", { ...props });
|
|
38
38
|
};
|
|
39
|
-
|
|
39
|
+
var DatePickerType;
|
|
40
|
+
(function (DatePickerType) {
|
|
41
|
+
DatePickerType["DateTime"] = "dateTime";
|
|
42
|
+
DatePickerType["Date"] = "date";
|
|
43
|
+
})(DatePickerType || (exports.DatePickerType = DatePickerType = {}));
|
|
44
|
+
const DatePickerRoot = ({ ref, onChange, ...props }) => {
|
|
40
45
|
(0, use_imperative_form_handle_1.useImperativeFormHandle)(ref);
|
|
41
|
-
|
|
46
|
+
const _onChange = onChange
|
|
47
|
+
? (newValue) => {
|
|
48
|
+
const dateObj = newValue ? new Date(newValue) : null;
|
|
49
|
+
onChange(dateObj);
|
|
50
|
+
}
|
|
51
|
+
: undefined;
|
|
52
|
+
return ((0, jsx_runtime_1.jsx)("date-picker-field", { ...wrapFormItemProps(props), onChange: _onChange }));
|
|
42
53
|
};
|
|
54
|
+
const DatePicker = Object.assign(DatePickerRoot, {
|
|
55
|
+
Type: DatePickerType,
|
|
56
|
+
isFullDay: (value) => {
|
|
57
|
+
if (!value)
|
|
58
|
+
return false;
|
|
59
|
+
return (value.getHours() === 0 &&
|
|
60
|
+
value.getMinutes() === 0 &&
|
|
61
|
+
value.getSeconds() === 0 &&
|
|
62
|
+
value.getMilliseconds() === 0);
|
|
63
|
+
},
|
|
64
|
+
});
|
|
43
65
|
const Checkbox = ({ ref, ...props }) => {
|
|
44
66
|
(0, use_imperative_form_handle_1.useImperativeFormHandle)(ref);
|
|
45
|
-
return (
|
|
67
|
+
return (0, jsx_runtime_1.jsx)("checkbox-field", { ...wrapFormItemProps(props) });
|
|
46
68
|
};
|
|
47
69
|
//FIXME: we probably need to reuse the existing dropdown in
|
|
48
70
|
// a smarter way.
|
|
@@ -53,7 +75,7 @@ const DropdownRoot = ({ ref, children, ...props }) => {
|
|
|
53
75
|
};
|
|
54
76
|
const Dropdown = Object.assign(DropdownRoot, {
|
|
55
77
|
Item: dropdown_1.Dropdown.Item,
|
|
56
|
-
Section: dropdown_1.Dropdown.Section
|
|
78
|
+
Section: dropdown_1.Dropdown.Section,
|
|
57
79
|
});
|
|
58
80
|
const TagPickerRoot = ({ children, ...props }) => {
|
|
59
81
|
return ((0, jsx_runtime_1.jsx)("tag-picker-field", { ...wrapFormItemProps(props), children: children }));
|
|
@@ -62,15 +84,15 @@ const TagPickerItem = ({ icon, ...props }) => {
|
|
|
62
84
|
return (0, jsx_runtime_1.jsx)("tag-picker-item", { ...props, icon: icon });
|
|
63
85
|
};
|
|
64
86
|
const TagPicker = Object.assign(TagPickerRoot, {
|
|
65
|
-
Item: TagPickerItem
|
|
87
|
+
Item: TagPickerItem,
|
|
66
88
|
});
|
|
67
89
|
const TextArea = ({ ref, ...props }) => {
|
|
68
90
|
(0, use_imperative_form_handle_1.useImperativeFormHandle)(ref);
|
|
69
|
-
return (
|
|
91
|
+
return (0, jsx_runtime_1.jsx)("text-area-field", { ...wrapFormItemProps(props) });
|
|
70
92
|
};
|
|
71
93
|
const FilePicker = ({ ref, ...props }) => {
|
|
72
94
|
(0, use_imperative_form_handle_1.useImperativeFormHandle)(ref);
|
|
73
|
-
return (
|
|
95
|
+
return (0, jsx_runtime_1.jsx)("file-picker-field", { ...wrapFormItemProps(props) });
|
|
74
96
|
};
|
|
75
97
|
const Description = (props) => {
|
|
76
98
|
return (0, jsx_runtime_1.jsx)("form-description", { ...props });
|
|
@@ -86,4 +108,5 @@ exports.Form = Object.assign(FormRoot, {
|
|
|
86
108
|
TagPicker,
|
|
87
109
|
FilePicker,
|
|
88
110
|
Separator: () => (0, jsx_runtime_1.jsx)("separator", {}),
|
|
111
|
+
LinkAccessory: ({ target, text }) => ((0, jsx_runtime_1.jsx)("link-accessory", { target: target, text: text })),
|
|
89
112
|
});
|
|
@@ -54,7 +54,7 @@ export declare namespace Grid {
|
|
|
54
54
|
export type Fit = GridFit;
|
|
55
55
|
export type Inset = GridInset;
|
|
56
56
|
export type ItemSize = GridItemSize;
|
|
57
|
-
export type AspectRatio = "1" | "3/2" | "2/3" | "4/3" | "3/4" | "16/9" | "9/16" |
|
|
57
|
+
export type AspectRatio = "1" | "3/2" | "2/3" | "4/3" | "3/4" | "16/9" | "9/16" | "21/9" | "9/21" | "32/9" | "9/32";
|
|
58
58
|
export namespace Item {
|
|
59
59
|
export type Props = {
|
|
60
60
|
title?: string;
|
|
@@ -24,17 +24,17 @@ var GridItemSize;
|
|
|
24
24
|
GridItemSize["Large"] = "large";
|
|
25
25
|
})(GridItemSize || (GridItemSize = {}));
|
|
26
26
|
const aspectRatioMap = {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
27
|
+
"1": 1,
|
|
28
|
+
"3/2": 3 / 2,
|
|
29
|
+
"2/3": 2 / 3,
|
|
30
|
+
"4/3": 4 / 3,
|
|
31
|
+
"3/4": 3 / 4,
|
|
32
|
+
"16/9": 16 / 9,
|
|
33
|
+
"9/16": 9 / 16,
|
|
34
|
+
"21/9": 21 / 9,
|
|
35
|
+
"9/21": 9 / 21,
|
|
36
|
+
"32/9": 32 / 9,
|
|
37
|
+
"9/32": 9 / 32,
|
|
38
38
|
};
|
|
39
39
|
var GridFit;
|
|
40
40
|
(function (GridFit) {
|
|
@@ -9,7 +9,7 @@ const react_1 = require("react");
|
|
|
9
9
|
const navigation_context_1 = __importDefault(require("./navigation-context"));
|
|
10
10
|
const bus_1 = require("../bus");
|
|
11
11
|
const View = ({ children }) => {
|
|
12
|
-
return (0, jsx_runtime_1.jsx)(
|
|
12
|
+
return (0, jsx_runtime_1.jsx)("view", { children: children });
|
|
13
13
|
};
|
|
14
14
|
const NavigationProvider = ({ root }) => {
|
|
15
15
|
const [navStack, setNavStack] = (0, react_1.useState)([root]);
|
|
@@ -24,9 +24,6 @@ const NavigationProvider = ({ root }) => {
|
|
|
24
24
|
setNavStack((cur) => [...cur, node]);
|
|
25
25
|
});
|
|
26
26
|
};
|
|
27
|
-
(0, react_1.useEffect)(() => {
|
|
28
|
-
//console.log('changed nav stack size', navStack.length);
|
|
29
|
-
}, [navStack]);
|
|
30
27
|
(0, react_1.useEffect)(() => {
|
|
31
28
|
const listener = bus_1.bus.subscribe("pop-view", () => {
|
|
32
29
|
setNavStack((cur) => cur.slice(0, -1));
|
package/dist/api/controls.js
CHANGED
|
@@ -67,10 +67,10 @@ const popToRootProtoMap = {
|
|
|
67
67
|
* @see closeWindow
|
|
68
68
|
*/
|
|
69
69
|
const showHUD = async (title, options) => {
|
|
70
|
-
bus_1.bus.turboRequest(
|
|
70
|
+
bus_1.bus.turboRequest("ui.showHud", {
|
|
71
71
|
text: title,
|
|
72
72
|
clearRootSearch: options?.clearRootSearch ?? false,
|
|
73
|
-
popToRoot: popToRootProtoMap[options?.popToRootType ?? PopToRootType.Default]
|
|
73
|
+
popToRoot: popToRootProtoMap[options?.popToRootType ?? PopToRootType.Default],
|
|
74
74
|
});
|
|
75
75
|
};
|
|
76
76
|
exports.showHUD = showHUD;
|
|
@@ -82,7 +82,7 @@ const closeMainWindow = async (options = {}) => {
|
|
|
82
82
|
const { clearRootSearch = false, popToRootType = PopToRootType.Default } = options;
|
|
83
83
|
await bus_1.bus.turboRequest("ui.closeMainWindow", {
|
|
84
84
|
clearRootSearch,
|
|
85
|
-
popToRoot: popToRootProtoMap[popToRootType]
|
|
85
|
+
popToRoot: popToRootProtoMap[popToRootType],
|
|
86
86
|
});
|
|
87
87
|
};
|
|
88
88
|
exports.closeMainWindow = closeMainWindow;
|
|
@@ -107,6 +107,8 @@ exports.getSelectedText = getSelectedText;
|
|
|
107
107
|
* Pop to the root of the navigation stack, optionally clearing the search bar.
|
|
108
108
|
*/
|
|
109
109
|
const popToRoot = async (options) => {
|
|
110
|
-
await bus_1.bus.turboRequest(
|
|
110
|
+
await bus_1.bus.turboRequest("ui.popToRoot", {
|
|
111
|
+
clearSearchBar: options?.clearSearchBar ?? false,
|
|
112
|
+
});
|
|
111
113
|
};
|
|
112
114
|
exports.popToRoot = popToRoot;
|
|
@@ -51,6 +51,10 @@ export interface Environment {
|
|
|
51
51
|
* The version of the main Raycast app
|
|
52
52
|
*/
|
|
53
53
|
raycastVersion: string;
|
|
54
|
+
/**
|
|
55
|
+
* The name of the extension owner (if any) or author, as specified in package.json
|
|
56
|
+
*/
|
|
57
|
+
ownerOrAuthorName: string;
|
|
54
58
|
/**
|
|
55
59
|
* The name of the extension, as specified in package.json
|
|
56
60
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FileInfo as ProtoFileInfo } from
|
|
1
|
+
import { FileInfo as ProtoFileInfo } from "./proto/file-search";
|
|
2
2
|
/**
|
|
3
3
|
* Access Vicinae's built-in file search functionality.
|
|
4
4
|
*
|
|
@@ -24,22 +24,22 @@ export declare namespace FileSearch {
|
|
|
24
24
|
type SearchOptions = {};
|
|
25
25
|
type FileInfo = ProtoFileInfo;
|
|
26
26
|
/**
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
27
|
+
* Search for files matching the provided query string.
|
|
28
|
+
*
|
|
29
|
+
* @param query - Search term (min. 1 character) - the shorter the query the longer the average search takes.
|
|
30
|
+
* @param options - Search configuration options
|
|
31
|
+
* @returns Promise resolving to array of matching files
|
|
32
|
+
*
|
|
33
|
+
* @remarks
|
|
34
|
+
* Uses prefix matching on filename tokens. For example:
|
|
35
|
+
* - File: "invoice-new-motherboard.pdf"
|
|
36
|
+
* - Matches: "inv", "new", "mother", "pdf"
|
|
37
|
+
* - No match: "board", "oice" (not prefixes)
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```typescript
|
|
41
|
+
* const files = await fileSearch.search('invoice');
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
44
|
function search(query: string, _?: FileSearch.SearchOptions): Promise<FileSearch.FileInfo[]>;
|
|
45
45
|
}
|