@vicinae/api 0.15.7 → 0.16.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/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 +3 -2
- package/dist/api/cache.js +14 -9
- package/dist/api/clipboard.js +2 -2
- package/dist/api/command.d.ts +9 -0
- package/dist/api/command.js +17 -0
- package/dist/api/components/action-pannel.js +1 -1
- package/dist/api/components/actions.d.ts +12 -0
- package/dist/api/components/actions.js +19 -1
- package/dist/api/components/dropdown.js +2 -2
- package/dist/api/components/form.d.ts +4 -0
- package/dist/api/components/form.js +21 -9
- package/dist/api/components/grid.d.ts +14 -1
- package/dist/api/components/grid.js +31 -12
- package/dist/api/controls.js +6 -4
- package/dist/api/file-search.d.ts +18 -18
- package/dist/api/file-search.js +18 -19
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.js +1 -0
- 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/preference.js +2 -2
- package/dist/api/proto/command.d.ts +35 -0
- package/dist/api/proto/command.js +182 -0
- package/dist/api/proto/extension.d.ts +17 -14
- package/dist/api/proto/extension.js +37 -0
- package/dist/api/utils.js +1 -1
- package/dist/api/window-management.d.ts +2 -2
- package/dist/api/window-management.js +12 -10
- package/dist/commands/develop/index.js +13 -11
- package/dist/commands/lint/index.d.ts +10 -0
- package/dist/commands/lint/index.js +46 -0
- package/dist/schemas/manifest.d.ts +18 -2
- package/dist/schemas/manifest.js +20 -2
- package/package.json +73 -76
- package/types/jsx.d.ts +177 -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
|
@@ -57,6 +57,7 @@ type EndpointMapping = {
|
|
|
57
57
|
"wm.setWindowBounds": "wm.setWindowBounds";
|
|
58
58
|
"fileSearch.search": "fileSearch.search";
|
|
59
59
|
"ui.popToRoot": "ui.popToRoot";
|
|
60
|
+
"command.updateCommandMetadata": "command.updateCommandMetadata";
|
|
60
61
|
"storage.get": "storage.get";
|
|
61
62
|
"storage.set": "storage.set";
|
|
62
63
|
"storage.remove": "storage.remove";
|
|
@@ -93,11 +94,11 @@ declare class Bus {
|
|
|
93
94
|
};
|
|
94
95
|
emit(action: string, data: Record<string, any>): void;
|
|
95
96
|
sendMessage(message: ipc.ExtensionMessage): void;
|
|
96
|
-
addEventHandler(cb: EventListenerInfo[
|
|
97
|
+
addEventHandler(cb: EventListenerInfo["callback"]): {
|
|
97
98
|
id: string;
|
|
98
99
|
unsubscribe: () => void;
|
|
99
100
|
};
|
|
100
|
-
replaceEventHandler(id: string, handler: EventListenerInfo[
|
|
101
|
+
replaceEventHandler(id: string, handler: EventListenerInfo["callback"]): void;
|
|
101
102
|
removeEventHandler(id: string): void;
|
|
102
103
|
private request2;
|
|
103
104
|
}
|
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.
|
|
@@ -80,7 +80,7 @@ class Cache {
|
|
|
80
80
|
let newTotalSize = this.index.size + data.length - (info?.size ?? 0);
|
|
81
81
|
if (newTotalSize > this.capacity) {
|
|
82
82
|
this.popLRU();
|
|
83
|
-
return this.set(key, data); // FIXME: get rid of recursion
|
|
83
|
+
return this.set(key, data); // FIXME: get rid of recursion
|
|
84
84
|
}
|
|
85
85
|
this.index.size = newTotalSize;
|
|
86
86
|
this.index.keys[key] = { size: data.length };
|
|
@@ -131,22 +131,22 @@ class Cache {
|
|
|
131
131
|
return this.dataPath(this.keyHash(key));
|
|
132
132
|
}
|
|
133
133
|
readKeyData(key) {
|
|
134
|
-
return (0, node_fs_1.readFileSync)(this.keyDataPath(key),
|
|
134
|
+
return (0, node_fs_1.readFileSync)(this.keyDataPath(key), "utf8");
|
|
135
135
|
}
|
|
136
136
|
writeKeyData(key, data) {
|
|
137
137
|
(0, node_fs_1.writeFileSync)(this.keyDataPath(key), data);
|
|
138
138
|
}
|
|
139
139
|
keyHash(key) {
|
|
140
|
-
return (0, node_crypto_1.hash)(
|
|
140
|
+
return (0, node_crypto_1.hash)("md5", key);
|
|
141
141
|
}
|
|
142
142
|
get dataDir() {
|
|
143
|
-
return node_path_1.default.join(this.storageDir,
|
|
143
|
+
return node_path_1.default.join(this.storageDir, "data");
|
|
144
144
|
}
|
|
145
145
|
dataPath(id) {
|
|
146
146
|
return node_path_1.default.join(this.dataDir, id);
|
|
147
147
|
}
|
|
148
148
|
get indexPath() {
|
|
149
|
-
return node_path_1.default.join(this.storageDir,
|
|
149
|
+
return node_path_1.default.join(this.storageDir, "index.json");
|
|
150
150
|
}
|
|
151
151
|
updateLRU(key) {
|
|
152
152
|
const idx = this.index.lru.findIndex((entry) => key == entry.key);
|
|
@@ -172,7 +172,12 @@ class Cache {
|
|
|
172
172
|
return true;
|
|
173
173
|
}
|
|
174
174
|
initIndex() {
|
|
175
|
-
const index = {
|
|
175
|
+
const index = {
|
|
176
|
+
revision: this.revision,
|
|
177
|
+
keys: {},
|
|
178
|
+
size: 0,
|
|
179
|
+
lru: [],
|
|
180
|
+
};
|
|
176
181
|
(0, node_fs_1.mkdirSync)(this.dataDir, { recursive: true });
|
|
177
182
|
const indexPath = node_path_1.default.join(this.storageDir, "index.json");
|
|
178
183
|
(0, node_fs_1.writeFileSync)(indexPath, JSON.stringify(index, null, 2));
|
|
@@ -182,7 +187,7 @@ class Cache {
|
|
|
182
187
|
const indexPath = node_path_1.default.join(this.storageDir, "index.json");
|
|
183
188
|
if (!(0, node_fs_1.existsSync)(indexPath))
|
|
184
189
|
return null;
|
|
185
|
-
return JSON.parse((0, node_fs_1.readFileSync)(indexPath,
|
|
190
|
+
return JSON.parse((0, node_fs_1.readFileSync)(indexPath, "utf8"));
|
|
186
191
|
}
|
|
187
192
|
removeCacheDirectory() {
|
|
188
193
|
(0, node_fs_1.rmSync)(this.dataDir, { recursive: true, force: true });
|
|
@@ -199,7 +204,7 @@ class Cache {
|
|
|
199
204
|
* If we want to change the way the data is stored we just change this,
|
|
200
205
|
* which will force a full cache clear and use the new format.
|
|
201
206
|
*/
|
|
202
|
-
revision =
|
|
207
|
+
revision = "1";
|
|
203
208
|
capacity;
|
|
204
209
|
subscribers = [];
|
|
205
210
|
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 = {}));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Update the values of properties declared in the manifest of the current command.
|
|
3
|
+
* Currently only `subtitle` is supported. Pass `null` to clear the custom subtitle.
|
|
4
|
+
*
|
|
5
|
+
* Raycast API: https://developers.raycast.com/api-reference/command#updatecommandmetadata
|
|
6
|
+
*/
|
|
7
|
+
export declare function updateCommandMetadata(metadata: {
|
|
8
|
+
subtitle?: string | null;
|
|
9
|
+
}): Promise<void>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateCommandMetadata = updateCommandMetadata;
|
|
4
|
+
const bus_1 = require("./bus");
|
|
5
|
+
/**
|
|
6
|
+
* Update the values of properties declared in the manifest of the current command.
|
|
7
|
+
* Currently only `subtitle` is supported. Pass `null` to clear the custom subtitle.
|
|
8
|
+
*
|
|
9
|
+
* Raycast API: https://developers.raycast.com/api-reference/command#updatecommandmetadata
|
|
10
|
+
*/
|
|
11
|
+
async function updateCommandMetadata(metadata) {
|
|
12
|
+
const payload = {};
|
|
13
|
+
if (Object.prototype.hasOwnProperty.call(metadata, "subtitle")) {
|
|
14
|
+
payload.subtitle = metadata.subtitle ?? undefined;
|
|
15
|
+
}
|
|
16
|
+
await bus_1.bus.turboRequest("command.updateCommandMetadata", payload);
|
|
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,
|
|
@@ -4,6 +4,7 @@ import { ImageLike } from "../image";
|
|
|
4
4
|
import { Keyboard } from "../keyboard";
|
|
5
5
|
import { Application } from "../utils";
|
|
6
6
|
import { Form } from "./form";
|
|
7
|
+
import { Icon } from "../icon";
|
|
7
8
|
export type BaseActionProps = {
|
|
8
9
|
title: string;
|
|
9
10
|
icon?: ImageLike;
|
|
@@ -43,6 +44,16 @@ export type ActionSubmitFormProps = Omit<BaseActionProps, "title"> & {
|
|
|
43
44
|
onSubmit: (input: Form.Values) => boolean | void | Promise<boolean | void>;
|
|
44
45
|
title?: string;
|
|
45
46
|
};
|
|
47
|
+
export type Quicklink = {
|
|
48
|
+
name?: string;
|
|
49
|
+
link: string;
|
|
50
|
+
application?: string | Application;
|
|
51
|
+
icon?: Icon;
|
|
52
|
+
};
|
|
53
|
+
export type ActionCreateQuicklinkProps = Omit<BaseActionProps, "title"> & {
|
|
54
|
+
title?: string;
|
|
55
|
+
quicklink: Quicklink;
|
|
56
|
+
};
|
|
46
57
|
export declare const Action: React.FC<ActionProps> & {
|
|
47
58
|
CopyToClipboard: React.FC<CopyToClipboardProps>;
|
|
48
59
|
Push: React.FC<ActionPushProps>;
|
|
@@ -50,6 +61,7 @@ export declare const Action: React.FC<ActionProps> & {
|
|
|
50
61
|
Paste: React.FC<ActionPasteProps>;
|
|
51
62
|
SubmitForm: React.FC<ActionSubmitFormProps>;
|
|
52
63
|
OpenInBrowser: React.FC<ActionOpenInBrowserProps>;
|
|
64
|
+
CreateQuicklink: React.FC<ActionCreateQuicklinkProps>;
|
|
53
65
|
Style: {
|
|
54
66
|
Regular: "regular";
|
|
55
67
|
Destructive: "destructive";
|
|
@@ -45,7 +45,24 @@ const SubmitForm = ({ title = "Submit", ...props }) => {
|
|
|
45
45
|
const nativeProps = {
|
|
46
46
|
...props,
|
|
47
47
|
title,
|
|
48
|
-
onAction: () => { }
|
|
48
|
+
onAction: () => { },
|
|
49
|
+
};
|
|
50
|
+
return (0, jsx_runtime_1.jsx)("action", { ...nativeProps });
|
|
51
|
+
};
|
|
52
|
+
const CreateQuicklink = ({ title = "Create Quicklink", quicklink, ...props }) => {
|
|
53
|
+
const nativeProps = {
|
|
54
|
+
...props,
|
|
55
|
+
title,
|
|
56
|
+
type: "create-quicklink",
|
|
57
|
+
quicklink: {
|
|
58
|
+
link: quicklink.link,
|
|
59
|
+
name: quicklink.name,
|
|
60
|
+
application: typeof quicklink.application === "string"
|
|
61
|
+
? quicklink.application
|
|
62
|
+
: quicklink.application?.name,
|
|
63
|
+
icon: quicklink.icon,
|
|
64
|
+
},
|
|
65
|
+
onAction: () => { },
|
|
49
66
|
};
|
|
50
67
|
return (0, jsx_runtime_1.jsx)("action", { ...nativeProps });
|
|
51
68
|
};
|
|
@@ -56,6 +73,7 @@ exports.Action = Object.assign(ActionRoot, {
|
|
|
56
73
|
Paste,
|
|
57
74
|
SubmitForm,
|
|
58
75
|
OpenInBrowser,
|
|
76
|
+
CreateQuicklink,
|
|
59
77
|
Style: {
|
|
60
78
|
Regular: "regular",
|
|
61
79
|
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 });
|
|
@@ -110,5 +110,9 @@ export declare const Form: import("react").FC<FormProps> & {
|
|
|
110
110
|
};
|
|
111
111
|
FilePicker: import("react").FC<FilePickerProps>;
|
|
112
112
|
Separator: () => import("react/jsx-runtime").JSX.Element;
|
|
113
|
+
LinkAccessory: ({ target, text }: {
|
|
114
|
+
target: string;
|
|
115
|
+
text: string;
|
|
116
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
113
117
|
};
|
|
114
118
|
export {};
|
|
@@ -5,11 +5,22 @@ 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");
|
|
7
7
|
const wrapFormItemProps = (props) => {
|
|
8
|
-
// TODO: pass the current value in the event
|
|
9
8
|
return {
|
|
10
9
|
...props,
|
|
11
|
-
onFocus: () => props.onFocus?.({
|
|
12
|
-
|
|
10
|
+
onFocus: () => props.onFocus?.({
|
|
11
|
+
type: "focus",
|
|
12
|
+
target: {
|
|
13
|
+
id: props.id,
|
|
14
|
+
value: (props.value ?? props.defaultValue),
|
|
15
|
+
},
|
|
16
|
+
}),
|
|
17
|
+
onBlur: () => props.onBlur?.({
|
|
18
|
+
type: "blur",
|
|
19
|
+
target: {
|
|
20
|
+
id: props.id,
|
|
21
|
+
value: (props.value ?? props.defaultValue),
|
|
22
|
+
},
|
|
23
|
+
}),
|
|
13
24
|
};
|
|
14
25
|
};
|
|
15
26
|
const FormRoot = ({ enableDrafts = false, actions, children, isLoading = false, navigationTitle, searchBarAccessory, }) => {
|
|
@@ -19,7 +30,7 @@ const FormRoot = ({ enableDrafts = false, actions, children, isLoading = false,
|
|
|
19
30
|
};
|
|
20
31
|
const TextField = ({ ref, ...props }) => {
|
|
21
32
|
(0, use_imperative_form_handle_1.useImperativeFormHandle)(ref);
|
|
22
|
-
return (
|
|
33
|
+
return (0, jsx_runtime_1.jsx)("text-field", { ...wrapFormItemProps(props) });
|
|
23
34
|
};
|
|
24
35
|
const PasswordField = ({ ref, ...props }) => {
|
|
25
36
|
(0, use_imperative_form_handle_1.useImperativeFormHandle)(ref);
|
|
@@ -31,7 +42,7 @@ const DatePicker = ({ ref, ...props }) => {
|
|
|
31
42
|
};
|
|
32
43
|
const Checkbox = ({ ref, ...props }) => {
|
|
33
44
|
(0, use_imperative_form_handle_1.useImperativeFormHandle)(ref);
|
|
34
|
-
return (
|
|
45
|
+
return (0, jsx_runtime_1.jsx)("checkbox-field", { ...wrapFormItemProps(props) });
|
|
35
46
|
};
|
|
36
47
|
//FIXME: we probably need to reuse the existing dropdown in
|
|
37
48
|
// a smarter way.
|
|
@@ -42,7 +53,7 @@ const DropdownRoot = ({ ref, children, ...props }) => {
|
|
|
42
53
|
};
|
|
43
54
|
const Dropdown = Object.assign(DropdownRoot, {
|
|
44
55
|
Item: dropdown_1.Dropdown.Item,
|
|
45
|
-
Section: dropdown_1.Dropdown.Section
|
|
56
|
+
Section: dropdown_1.Dropdown.Section,
|
|
46
57
|
});
|
|
47
58
|
const TagPickerRoot = ({ children, ...props }) => {
|
|
48
59
|
return ((0, jsx_runtime_1.jsx)("tag-picker-field", { ...wrapFormItemProps(props), children: children }));
|
|
@@ -51,15 +62,15 @@ const TagPickerItem = ({ icon, ...props }) => {
|
|
|
51
62
|
return (0, jsx_runtime_1.jsx)("tag-picker-item", { ...props, icon: icon });
|
|
52
63
|
};
|
|
53
64
|
const TagPicker = Object.assign(TagPickerRoot, {
|
|
54
|
-
Item: TagPickerItem
|
|
65
|
+
Item: TagPickerItem,
|
|
55
66
|
});
|
|
56
67
|
const TextArea = ({ ref, ...props }) => {
|
|
57
68
|
(0, use_imperative_form_handle_1.useImperativeFormHandle)(ref);
|
|
58
|
-
return (
|
|
69
|
+
return (0, jsx_runtime_1.jsx)("text-area-field", { ...wrapFormItemProps(props) });
|
|
59
70
|
};
|
|
60
71
|
const FilePicker = ({ ref, ...props }) => {
|
|
61
72
|
(0, use_imperative_form_handle_1.useImperativeFormHandle)(ref);
|
|
62
|
-
return (
|
|
73
|
+
return (0, jsx_runtime_1.jsx)("file-picker-field", { ...wrapFormItemProps(props) });
|
|
63
74
|
};
|
|
64
75
|
const Description = (props) => {
|
|
65
76
|
return (0, jsx_runtime_1.jsx)("form-description", { ...props });
|
|
@@ -75,4 +86,5 @@ exports.Form = Object.assign(FormRoot, {
|
|
|
75
86
|
TagPicker,
|
|
76
87
|
FilePicker,
|
|
77
88
|
Separator: () => (0, jsx_runtime_1.jsx)("separator", {}),
|
|
89
|
+
LinkAccessory: ({ target, text }) => ((0, jsx_runtime_1.jsx)("link-accessory", { target: target, text: text })),
|
|
78
90
|
});
|
|
@@ -2,10 +2,20 @@ import React, { ReactNode } from "react";
|
|
|
2
2
|
import { Image, ImageLike } from "../image";
|
|
3
3
|
import { Color, ColorLike } from "../color";
|
|
4
4
|
declare enum GridInset {
|
|
5
|
+
Zero = "zero",
|
|
5
6
|
Small = "small",
|
|
6
7
|
Medium = "medium",
|
|
7
8
|
Large = "large"
|
|
8
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* Enum representing the number of items that should be displayed on a single row.
|
|
12
|
+
* @deprecated - use `columns` instead.
|
|
13
|
+
*/
|
|
14
|
+
declare enum GridItemSize {
|
|
15
|
+
Small = "small",// Fits 8 items per row.
|
|
16
|
+
Medium = "medium",// Fits 5 items per row.
|
|
17
|
+
Large = "large"
|
|
18
|
+
}
|
|
9
19
|
declare enum GridFit {
|
|
10
20
|
Contain = "contain",
|
|
11
21
|
Fill = "fill"
|
|
@@ -13,6 +23,7 @@ declare enum GridFit {
|
|
|
13
23
|
export declare namespace Grid {
|
|
14
24
|
type BaseSection = {
|
|
15
25
|
inset?: GridInset;
|
|
26
|
+
itemSize?: GridItemSize;
|
|
16
27
|
columns?: number;
|
|
17
28
|
fit?: GridFit;
|
|
18
29
|
aspectRatio?: Grid.AspectRatio;
|
|
@@ -42,7 +53,8 @@ export declare namespace Grid {
|
|
|
42
53
|
}
|
|
43
54
|
export type Fit = GridFit;
|
|
44
55
|
export type Inset = GridInset;
|
|
45
|
-
export type
|
|
56
|
+
export type ItemSize = GridItemSize;
|
|
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";
|
|
46
58
|
export namespace Item {
|
|
47
59
|
export type Props = {
|
|
48
60
|
title?: string;
|
|
@@ -110,6 +122,7 @@ export declare const Grid: React.FC<Grid.Props> & {
|
|
|
110
122
|
};
|
|
111
123
|
Fit: typeof GridFit;
|
|
112
124
|
Inset: typeof GridInset;
|
|
125
|
+
ItemSize: typeof GridItemSize;
|
|
113
126
|
Item: React.FC<Grid.Item.Props>;
|
|
114
127
|
};
|
|
115
128
|
export {};
|
|
@@ -8,33 +8,51 @@ const empty_view_1 = require("./empty-view");
|
|
|
8
8
|
const dropdown_1 = require("./dropdown");
|
|
9
9
|
var GridInset;
|
|
10
10
|
(function (GridInset) {
|
|
11
|
+
GridInset["Zero"] = "zero";
|
|
11
12
|
GridInset["Small"] = "small";
|
|
12
13
|
GridInset["Medium"] = "medium";
|
|
13
14
|
GridInset["Large"] = "large";
|
|
14
15
|
})(GridInset || (GridInset = {}));
|
|
16
|
+
/**
|
|
17
|
+
* Enum representing the number of items that should be displayed on a single row.
|
|
18
|
+
* @deprecated - use `columns` instead.
|
|
19
|
+
*/
|
|
20
|
+
var GridItemSize;
|
|
21
|
+
(function (GridItemSize) {
|
|
22
|
+
GridItemSize["Small"] = "small";
|
|
23
|
+
GridItemSize["Medium"] = "medium";
|
|
24
|
+
GridItemSize["Large"] = "large";
|
|
25
|
+
})(GridItemSize || (GridItemSize = {}));
|
|
15
26
|
const aspectRatioMap = {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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,
|
|
27
38
|
};
|
|
28
39
|
var GridFit;
|
|
29
40
|
(function (GridFit) {
|
|
30
41
|
GridFit["Contain"] = "contain";
|
|
31
42
|
GridFit["Fill"] = "fill";
|
|
32
43
|
})(GridFit || (GridFit = {}));
|
|
33
|
-
const GridRoot = ({ searchBarAccessory, children, actions, inset, fit = GridFit.Contain, aspectRatio = "1", ...props }) => {
|
|
44
|
+
const GridRoot = ({ searchBarAccessory, children, actions, inset, itemSize, fit = GridFit.Contain, aspectRatio = "1", ...props }) => {
|
|
34
45
|
if (typeof props.enableFiltering === "boolean" &&
|
|
35
46
|
typeof props.filtering === "undefined") {
|
|
36
47
|
props.filtering = props.enableFiltering;
|
|
37
48
|
}
|
|
49
|
+
if (props.columns === undefined && itemSize) {
|
|
50
|
+
props.columns = {
|
|
51
|
+
[GridItemSize.Small]: 8,
|
|
52
|
+
[GridItemSize.Medium]: 5,
|
|
53
|
+
[GridItemSize.Large]: 3,
|
|
54
|
+
}[itemSize];
|
|
55
|
+
}
|
|
38
56
|
return ((0, jsx_runtime_1.jsxs)("grid", { fit: fit, inset: inset, aspectRatio: aspectRatioMap[aspectRatio], ...props, children: [searchBarAccessory, children, actions] }));
|
|
39
57
|
};
|
|
40
58
|
const GridItem = ({ detail, actions, ...props }) => {
|
|
@@ -56,5 +74,6 @@ exports.Grid = Object.assign(GridRoot, {
|
|
|
56
74
|
Dropdown: dropdown_1.Dropdown,
|
|
57
75
|
Fit: GridFit,
|
|
58
76
|
Inset: GridInset,
|
|
77
|
+
ItemSize: GridItemSize,
|
|
59
78
|
Item: Object.assign(GridItem, {}),
|
|
60
79
|
});
|
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;
|
|
@@ -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
|
}
|
package/dist/api/file-search.js
CHANGED
|
@@ -23,27 +23,26 @@ const bus_1 = require("./bus");
|
|
|
23
23
|
var FileSearch;
|
|
24
24
|
(function (FileSearch) {
|
|
25
25
|
/**
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
26
|
+
* Search for files matching the provided query string.
|
|
27
|
+
*
|
|
28
|
+
* @param query - Search term (min. 1 character) - the shorter the query the longer the average search takes.
|
|
29
|
+
* @param options - Search configuration options
|
|
30
|
+
* @returns Promise resolving to array of matching files
|
|
31
|
+
*
|
|
32
|
+
* @remarks
|
|
33
|
+
* Uses prefix matching on filename tokens. For example:
|
|
34
|
+
* - File: "invoice-new-motherboard.pdf"
|
|
35
|
+
* - Matches: "inv", "new", "mother", "pdf"
|
|
36
|
+
* - No match: "board", "oice" (not prefixes)
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```typescript
|
|
40
|
+
* const files = await fileSearch.search('invoice');
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
43
|
async function search(query, _ = {}) {
|
|
44
|
-
const res = await bus_1.bus.turboRequest(
|
|
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
48
|
})(FileSearch || (exports.FileSearch = FileSearch = {}));
|
|
49
|
-
;
|
package/dist/api/index.d.ts
CHANGED
package/dist/api/index.js
CHANGED
package/dist/api/keyboard.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export type KeyEquivalent = "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i"
|
|
|
2
2
|
export type KeyModifier = "cmd" | "ctrl" | "opt" | "shift";
|
|
3
3
|
export declare namespace Keyboard {
|
|
4
4
|
namespace Shortcut {
|
|
5
|
-
type Common =
|
|
5
|
+
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";
|
|
6
6
|
const Common: {
|
|
7
7
|
Copy: string;
|
|
8
8
|
CopyDeeplink: string;
|