@vicinae/api 0.20.9 → 0.20.10

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.
Files changed (76) hide show
  1. package/dist/api/alert.d.ts +1 -1
  2. package/dist/api/alert.js +9 -14
  3. package/dist/api/client.d.ts +7 -0
  4. package/dist/api/client.js +11 -0
  5. package/dist/api/clipboard.d.ts +4 -8
  6. package/dist/api/clipboard.js +13 -18
  7. package/dist/api/color.d.ts +4 -10
  8. package/dist/api/color.js +8 -47
  9. package/dist/api/command.js +4 -6
  10. package/dist/api/controls.js +9 -56
  11. package/dist/api/environment.d.ts +0 -11
  12. package/dist/api/environment.js +2 -1
  13. package/dist/api/file-search.d.ts +3 -4
  14. package/dist/api/file-search.js +6 -4
  15. package/dist/api/globals.d.ts +9 -0
  16. package/dist/api/globals.js +5 -0
  17. package/dist/api/hooks/use-imperative-form-handle.d.ts +1 -1
  18. package/dist/api/hooks/use-imperative-form-handle.js +6 -3
  19. package/dist/api/hooks/use-navigation.d.ts +2 -2
  20. package/dist/api/hooks/use-navigation.js +2 -5
  21. package/dist/api/image.d.ts +4 -4
  22. package/dist/api/image.js +12 -51
  23. package/dist/api/index.d.ts +0 -2
  24. package/dist/api/index.js +0 -2
  25. package/dist/api/local-storage.js +7 -14
  26. package/dist/api/oauth.d.ts +1 -1
  27. package/dist/api/oauth.js +7 -15
  28. package/dist/api/preference.d.ts +2 -4
  29. package/dist/api/preference.js +10 -6
  30. package/dist/api/proto/api.d.ts +240 -0
  31. package/dist/api/proto/api.js +271 -0
  32. package/dist/api/toast.js +7 -77
  33. package/dist/api/utils.d.ts +6 -2
  34. package/dist/api/utils.js +9 -26
  35. package/dist/api/window-management.d.ts +3 -5
  36. package/dist/api/window-management.js +14 -27
  37. package/dist/schemas/manifest.d.ts +3 -3
  38. package/package.json +1 -4
  39. package/dist/api/bus.d.ts +0 -125
  40. package/dist/api/bus.js +0 -201
  41. package/dist/api/context/index.d.ts +0 -1
  42. package/dist/api/context/index.js +0 -17
  43. package/dist/api/context/navigation-context.d.ts +0 -7
  44. package/dist/api/context/navigation-context.js +0 -12
  45. package/dist/api/context/navigation-provider.d.ts +0 -7
  46. package/dist/api/context/navigation-provider.js +0 -58
  47. package/dist/api/hooks.d.ts +0 -1
  48. package/dist/api/hooks.js +0 -30
  49. package/dist/api/proto/application.d.ts +0 -79
  50. package/dist/api/proto/application.js +0 -826
  51. package/dist/api/proto/clipboard.d.ts +0 -88
  52. package/dist/api/proto/clipboard.js +0 -929
  53. package/dist/api/proto/command.d.ts +0 -35
  54. package/dist/api/proto/command.js +0 -182
  55. package/dist/api/proto/common.d.ts +0 -28
  56. package/dist/api/proto/common.js +0 -102
  57. package/dist/api/proto/extension.d.ts +0 -106
  58. package/dist/api/proto/extension.js +0 -1122
  59. package/dist/api/proto/file-search.d.ts +0 -42
  60. package/dist/api/proto/file-search.js +0 -290
  61. package/dist/api/proto/google/protobuf/struct.d.ts +0 -107
  62. package/dist/api/proto/google/protobuf/struct.js +0 -456
  63. package/dist/api/proto/ipc.d.ts +0 -64
  64. package/dist/api/proto/ipc.js +0 -604
  65. package/dist/api/proto/manager.d.ts +0 -87
  66. package/dist/api/proto/manager.js +0 -776
  67. package/dist/api/proto/oauth.d.ts +0 -97
  68. package/dist/api/proto/oauth.js +0 -994
  69. package/dist/api/proto/storage.d.ts +0 -80
  70. package/dist/api/proto/storage.js +0 -804
  71. package/dist/api/proto/ui.d.ts +0 -208
  72. package/dist/api/proto/ui.js +0 -2316
  73. package/dist/api/proto/wlr-clipboard.d.ts +0 -30
  74. package/dist/api/proto/wlr-clipboard.js +0 -158
  75. package/dist/api/proto/wm.d.ts +0 -142
  76. package/dist/api/proto/wm.js +0 -1714
@@ -0,0 +1,271 @@
1
+ "use strict";
2
+ // generated by vicinae figura codegen - do not edit manually
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.Client = exports.RpcTransport = void 0;
5
+ class RpcTransport {
6
+ transport;
7
+ constructor(transport) {
8
+ this.transport = transport;
9
+ }
10
+ dispatchMessage(data) {
11
+ const msg = JSON.parse(data);
12
+ if (msg.id !== undefined) {
13
+ const handler = this.requestMap.get(msg.id);
14
+ if (handler) {
15
+ if (msg.error)
16
+ handler.reject(msg.error);
17
+ else
18
+ handler.resolve(msg.result);
19
+ this.requestMap.delete(msg.id);
20
+ }
21
+ }
22
+ if (msg.id === undefined && msg.method) {
23
+ for (const cb of this.handlers.get(msg.method) ?? []) {
24
+ cb(msg.params);
25
+ }
26
+ }
27
+ }
28
+ request(method, params) {
29
+ const id = this.id++;
30
+ const promise = new Promise((resolve, reject) => {
31
+ this.requestMap.set(id, { resolve: (msg) => resolve(msg), reject });
32
+ });
33
+ this.sendMessage({ jsonrpc: '2.0', id, method, params });
34
+ return promise;
35
+ }
36
+ subscribe(method, cb) {
37
+ const handlers = this.handlers.get(method);
38
+ if (handlers)
39
+ handlers.push(cb);
40
+ else
41
+ this.handlers.set(method, [cb]);
42
+ return {
43
+ unsubscribe: () => {
44
+ const handlers = this.handlers.get(method);
45
+ if (handlers) {
46
+ handlers.splice(handlers.indexOf(cb), 1);
47
+ }
48
+ },
49
+ };
50
+ }
51
+ sendMessage(msg) {
52
+ this.transport.send(JSON.stringify(msg));
53
+ }
54
+ id = 1;
55
+ requestMap = new Map;
56
+ handlers = new Map;
57
+ }
58
+ exports.RpcTransport = RpcTransport;
59
+ ;
60
+ class ApplicationService {
61
+ transport;
62
+ constructor(transport) {
63
+ this.transport = transport;
64
+ }
65
+ list(target) {
66
+ return this.transport.request("Application/list", { target });
67
+ }
68
+ open(target, appId) {
69
+ return this.transport.request("Application/open", { target, appId });
70
+ }
71
+ getDefault(target) {
72
+ return this.transport.request("Application/getDefault", { target });
73
+ }
74
+ showInFileBrowser(target, select) {
75
+ return this.transport.request("Application/showInFileBrowser", { target, select });
76
+ }
77
+ runInTerminal(opts) {
78
+ return this.transport.request("Application/runInTerminal", { opts });
79
+ }
80
+ }
81
+ class UIService {
82
+ transport;
83
+ constructor(transport) {
84
+ this.transport = transport;
85
+ }
86
+ render(json) {
87
+ return this.transport.request("UI/render", { json });
88
+ }
89
+ showToast(id, title, message, style) {
90
+ return this.transport.request("UI/showToast", { id, title, message, style });
91
+ }
92
+ updateToast(id, title) {
93
+ return this.transport.request("UI/updateToast", { id, title });
94
+ }
95
+ hideToast(id) {
96
+ return this.transport.request("UI/hideToast", { id });
97
+ }
98
+ showHud(text, clear_root, popToRoot) {
99
+ return this.transport.request("UI/showHud", { text, clear_root, popToRoot });
100
+ }
101
+ closeMainWindow(clearRoot, popToRoot) {
102
+ return this.transport.request("UI/closeMainWindow", { clearRoot, popToRoot });
103
+ }
104
+ popToRoot(clearSearchBar) {
105
+ return this.transport.request("UI/popToRoot", { clearSearchBar });
106
+ }
107
+ confirmAlert(payload) {
108
+ return this.transport.request("UI/confirmAlert", { payload });
109
+ }
110
+ pushView() {
111
+ return this.transport.request("UI/pushView", {});
112
+ }
113
+ popView() {
114
+ return this.transport.request("UI/popView", {});
115
+ }
116
+ setSearchText(text) {
117
+ return this.transport.request("UI/setSearchText", { text });
118
+ }
119
+ getSelectedText() {
120
+ return this.transport.request("UI/getSelectedText", {});
121
+ }
122
+ viewPoped(handler) {
123
+ return this.transport.subscribe("UI/viewPoped", (msg) => handler());
124
+ }
125
+ viewPushed(handler) {
126
+ return this.transport.subscribe("UI/viewPushed", (msg) => handler());
127
+ }
128
+ }
129
+ class WindowManagementService {
130
+ transport;
131
+ constructor(transport) {
132
+ this.transport = transport;
133
+ }
134
+ focusWindow(winId) {
135
+ return this.transport.request("WindowManagement/focusWindow", { winId });
136
+ }
137
+ getActiveWindow() {
138
+ return this.transport.request("WindowManagement/getActiveWindow", {});
139
+ }
140
+ getActiveWorkspace() {
141
+ return this.transport.request("WindowManagement/getActiveWorkspace", {});
142
+ }
143
+ getWindows(workspaceId) {
144
+ return this.transport.request("WindowManagement/getWindows", { workspaceId });
145
+ }
146
+ getScreens() {
147
+ return this.transport.request("WindowManagement/getScreens", {});
148
+ }
149
+ getWorkspaces() {
150
+ return this.transport.request("WindowManagement/getWorkspaces", {});
151
+ }
152
+ setWindowBounds(winId, bounds) {
153
+ return this.transport.request("WindowManagement/setWindowBounds", { winId, bounds });
154
+ }
155
+ }
156
+ class ClipboardService {
157
+ transport;
158
+ constructor(transport) {
159
+ this.transport = transport;
160
+ }
161
+ copy(content, options) {
162
+ return this.transport.request("Clipboard/copy", { content, options });
163
+ }
164
+ paste(content) {
165
+ return this.transport.request("Clipboard/paste", { content });
166
+ }
167
+ clear() {
168
+ return this.transport.request("Clipboard/clear", {});
169
+ }
170
+ readContent() {
171
+ return this.transport.request("Clipboard/readContent", {});
172
+ }
173
+ }
174
+ class StorageService {
175
+ transport;
176
+ constructor(transport) {
177
+ this.transport = transport;
178
+ }
179
+ get(key) {
180
+ return this.transport.request("Storage/get", { key });
181
+ }
182
+ set(key, value) {
183
+ return this.transport.request("Storage/set", { key, value });
184
+ }
185
+ remove(key) {
186
+ return this.transport.request("Storage/remove", { key });
187
+ }
188
+ clear() {
189
+ return this.transport.request("Storage/clear", {});
190
+ }
191
+ list() {
192
+ return this.transport.request("Storage/list", {});
193
+ }
194
+ }
195
+ class FileSearchService {
196
+ transport;
197
+ constructor(transport) {
198
+ this.transport = transport;
199
+ }
200
+ search(q) {
201
+ return this.transport.request("FileSearch/search", { q });
202
+ }
203
+ }
204
+ class CommandService {
205
+ transport;
206
+ constructor(transport) {
207
+ this.transport = transport;
208
+ }
209
+ updateCommandMetadata(payload) {
210
+ return this.transport.request("Command/updateCommandMetadata", { payload });
211
+ }
212
+ openExtensionPreferences() {
213
+ return this.transport.request("Command/openExtensionPreferences", {});
214
+ }
215
+ openCommandPreferences() {
216
+ return this.transport.request("Command/openCommandPreferences", {});
217
+ }
218
+ }
219
+ class OAuthService {
220
+ transport;
221
+ constructor(transport) {
222
+ this.transport = transport;
223
+ }
224
+ authorize(payload) {
225
+ return this.transport.request("OAuth/authorize", { payload });
226
+ }
227
+ getTokens(id) {
228
+ return this.transport.request("OAuth/getTokens", { id });
229
+ }
230
+ setTokens(payload) {
231
+ return this.transport.request("OAuth/setTokens", { payload });
232
+ }
233
+ removeTokens(id) {
234
+ return this.transport.request("OAuth/removeTokens", { id });
235
+ }
236
+ }
237
+ class EventCoreService {
238
+ transport;
239
+ constructor(transport) {
240
+ this.transport = transport;
241
+ }
242
+ handlerActivated(handler) {
243
+ return this.transport.subscribe("EventCore/handlerActivated", (msg) => handler(msg.id, msg.args));
244
+ }
245
+ }
246
+ class Client {
247
+ transport;
248
+ constructor(transport) {
249
+ this.transport = transport;
250
+ this.Application = new ApplicationService(this.transport);
251
+ this.UI = new UIService(this.transport);
252
+ this.WindowManagement = new WindowManagementService(this.transport);
253
+ this.Clipboard = new ClipboardService(this.transport);
254
+ this.Storage = new StorageService(this.transport);
255
+ this.FileSearch = new FileSearchService(this.transport);
256
+ this.Command = new CommandService(this.transport);
257
+ this.OAuth = new OAuthService(this.transport);
258
+ this.EventCore = new EventCoreService(this.transport);
259
+ }
260
+ route(msg) { this.transport.dispatchMessage(msg); }
261
+ Application;
262
+ UI;
263
+ WindowManagement;
264
+ Clipboard;
265
+ Storage;
266
+ FileSearch;
267
+ Command;
268
+ OAuth;
269
+ EventCore;
270
+ }
271
+ exports.Client = Client;
package/dist/api/toast.js CHANGED
@@ -1,42 +1,8 @@
1
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
2
  Object.defineProperty(exports, "__esModule", { value: true });
36
3
  exports.showToast = exports.Toast = void 0;
37
4
  const node_crypto_1 = require("node:crypto");
38
- const bus_1 = require("./bus");
39
- const ui = __importStar(require("./proto/ui"));
5
+ const client_1 = require("./client");
40
6
  /**
41
7
  * A Toast with a certain style, title, and message.
42
8
  *
@@ -62,9 +28,9 @@ class Toast {
62
28
  callbacks = {};
63
29
  id;
64
30
  styleMap = {
65
- [Toast.Style.Success]: ui.ToastStyle.Success,
66
- [Toast.Style.Failure]: ui.ToastStyle.Error,
67
- [Toast.Style.Animated]: ui.ToastStyle.Dynamic,
31
+ [Toast.Style.Success]: "Success",
32
+ [Toast.Style.Failure]: "Error",
33
+ [Toast.Style.Animated]: "Dynamic",
68
34
  };
69
35
  /**
70
36
  * Deprecated - Use `showToast` instead
@@ -141,12 +107,7 @@ class Toast {
141
107
  }
142
108
  */
143
109
  async update() {
144
- await bus_1.bus.request("ui.showToast", {
145
- id: this.id,
146
- title: this.title,
147
- message: this.message ?? '',
148
- style: this.styleMap[this.style],
149
- });
110
+ await (0, client_1.getClient)().UI.showToast(this.id, this.title, this.message ?? "", this.styleMap[this.style]);
150
111
  }
151
112
  /**
152
113
  * Shows the Toast.
@@ -154,38 +115,7 @@ class Toast {
154
115
  * @returns A Promise that resolves when the toast is shown.
155
116
  */
156
117
  async show() {
157
- const payload = {
158
- title: this.options.title,
159
- message: this.options.message,
160
- style: this.options.style,
161
- };
162
- /*
163
- if (this.options.primaryAction && this.callbacks.primary) {
164
- const { title, shortcut } = this.options.primaryAction;
165
-
166
- payload.primaryAction = {
167
- title,
168
- shortcut,
169
- onAction: this.callbacks.primary,
170
- };
171
- }
172
-
173
- if (this.options.secondaryAction && this.callbacks.secondary) {
174
- const { title, shortcut } = this.options.secondaryAction;
175
-
176
- payload.secondaryAction = {
177
- title,
178
- shortcut,
179
- onAction: this.callbacks.secondary,
180
- };
181
- }
182
- */
183
- await bus_1.bus.request("ui.showToast", {
184
- id: this.id,
185
- title: payload.title,
186
- message: payload.message ?? '',
187
- style: this.styleMap[payload.style ?? Toast.Style.Success],
188
- });
118
+ this.update();
189
119
  }
190
120
  /**
191
121
  * Hides the Toast.
@@ -193,7 +123,7 @@ class Toast {
193
123
  * @returns A Promise that resolves when toast is hidden.
194
124
  */
195
125
  async hide() {
196
- await bus_1.bus.request("ui.hideToast", { id: this.id });
126
+ await (0, client_1.getClient)().UI.hideToast(this.id);
197
127
  }
198
128
  }
199
129
  exports.Toast = Toast;
@@ -1,5 +1,5 @@
1
1
  import type { PathLike } from "node:fs";
2
- import type { Application } from "./proto/application";
2
+ import type { Application } from "./proto/api";
3
3
  /**
4
4
  @ignore - we should probably move this to raycast compat, I don't think we want that.
5
5
  */
@@ -34,6 +34,10 @@ export type RunInTerminalOptions = {
34
34
  * @see WindowManagement
35
35
  */
36
36
  title?: string;
37
+ /**
38
+ * Sets the current working directory for the terminal program.
39
+ */
40
+ workingDirectory?: string;
37
41
  };
38
42
  /**
39
43
  * @category System
@@ -80,4 +84,4 @@ export declare const getDefaultApplication: (path: string) => Promise<Applicatio
80
84
  * @category System
81
85
  */
82
86
  export declare const showInFileBrowser: (path: PathLike, options?: ShowInFileBrowserOptions) => Promise<void>;
83
- export { Application } from "./proto/application";
87
+ export type { Application } from "./proto/api";
package/dist/api/utils.js CHANGED
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Application = exports.showInFileBrowser = exports.getDefaultApplication = exports.getApplications = exports.getFrontmostApplication = exports.open = exports.runInTerminal = exports.trash = void 0;
3
+ exports.showInFileBrowser = exports.getDefaultApplication = exports.getApplications = exports.getFrontmostApplication = exports.open = exports.runInTerminal = exports.trash = void 0;
4
4
  const promises_1 = require("node:fs/promises");
5
- const bus_1 = require("./bus");
6
5
  const window_management_1 = require("./window-management");
6
+ const client_1 = require("./client");
7
7
  /**
8
8
  @ignore - we should probably move this to raycast compat, I don't think we want that.
9
9
  */
@@ -29,12 +29,13 @@ exports.trash = trash;
29
29
  * @category System
30
30
  */
31
31
  const runInTerminal = async (args, options = {}) => {
32
- const { hold = false, appId, title } = options;
33
- await bus_1.bus.request("app.runInTerminal", {
32
+ const { hold = false, appId, title, workingDirectory } = options;
33
+ await (0, client_1.getClient)().Application.runInTerminal({
34
34
  cmdline: args,
35
35
  hold,
36
36
  appId,
37
37
  title,
38
+ workingDirectory,
38
39
  });
39
40
  };
40
41
  exports.runInTerminal = runInTerminal;
@@ -51,10 +52,7 @@ const open = async (target, app) => {
51
52
  appId = app.id;
52
53
  }
53
54
  }
54
- await bus_1.bus.request("app.open", {
55
- target,
56
- appId,
57
- });
55
+ await (0, client_1.getClient)().Application.open(target, appId);
58
56
  };
59
57
  exports.open = open;
60
58
  /**
@@ -72,35 +70,20 @@ exports.getFrontmostApplication = getFrontmostApplication;
72
70
  * @category System
73
71
  */
74
72
  const getApplications = async (target) => {
75
- const res = await bus_1.bus.request("app.list", { target });
76
- return res.unwrap().apps;
73
+ return (0, client_1.getClient)().Application.list(target);
77
74
  };
78
75
  exports.getApplications = getApplications;
79
76
  /**
80
77
  * @category System
81
78
  */
82
79
  const getDefaultApplication = async (path) => {
83
- const res = await bus_1.bus.request("app.getDefault", { target: path });
84
- const app = res.unwrap().app;
85
- if (!app)
86
- throw new Error(`No default application for target ${path}`);
87
- return app;
80
+ return (0, client_1.getClient)().Application.getDefault(path);
88
81
  };
89
82
  exports.getDefaultApplication = getDefaultApplication;
90
83
  /**
91
84
  * @category System
92
85
  */
93
86
  const showInFileBrowser = async (path, options = {}) => {
94
- if (options.select) {
95
- await bus_1.bus.request("app.showInFileBrowser", {
96
- target: path.toString(),
97
- select: true,
98
- });
99
- return;
100
- }
101
- const fileBrowser = await (0, exports.getDefaultApplication)("inode/directory"); // FIXME: we may want something more robust
102
- await (0, exports.open)(path.toString(), fileBrowser);
87
+ await (0, client_1.getClient)().Application.showInFileBrowser(path.toString(), options.select ?? true);
103
88
  };
104
89
  exports.showInFileBrowser = showInFileBrowser;
105
- var application_1 = require("./proto/application");
106
- Object.defineProperty(exports, "Application", { enumerable: true, get: function () { return application_1.Application; } });
@@ -1,5 +1,4 @@
1
- import { Application } from "./proto/application";
2
- import * as wm from "./proto/wm";
1
+ import type * as api from "./proto/api";
3
2
  /**
4
3
  * Access Vicinae's window management features.
5
4
  *
@@ -53,7 +52,7 @@ export declare namespace WindowManagement {
53
52
  /**
54
53
  * The application this window belongs to, if any.
55
54
  */
56
- application?: Application;
55
+ application?: api.Application;
57
56
  /**
58
57
  * Request that the window manager focuses this window.
59
58
  * @see {@link focusWindow}
@@ -98,7 +97,7 @@ export declare namespace WindowManagement {
98
97
  };
99
98
  };
100
99
  };
101
- function getWindows(options?: wm.GetWindowsRequest): Promise<WindowManagement.Window[]>;
100
+ function getWindows(workspaceId?: string): Promise<WindowManagement.Window[]>;
102
101
  /**
103
102
  * Focus `window`.
104
103
  *
@@ -121,6 +120,5 @@ export declare namespace WindowManagement {
121
120
  function getActiveWorkspace(): Promise<WindowManagement.Workspace>;
122
121
  function getWorkspaces(): Promise<WindowManagement.Workspace[]>;
123
122
  function getWindowsOnActiveWorkspace(): Promise<WindowManagement.Window[]>;
124
- function setWindowBounds(payload: wm.SetWindowBoundsRequest): Promise<void>;
125
123
  function getActiveWindow(): Promise<WindowManagement.Window>;
126
124
  }
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.WindowManagement = void 0;
4
- const bus_1 = require("./bus");
4
+ const client_1 = require("./client");
5
5
  const transformWorkspace = (proto) => {
6
6
  return {
7
7
  id: proto.id,
@@ -17,8 +17,8 @@ const transformWindow = (proto) => {
17
17
  workspaceId: proto.workspaceId,
18
18
  active: proto.active,
19
19
  bounds: {
20
- position: { x: proto.x, y: proto.y },
21
- size: { width: proto.width, height: proto.height },
20
+ position: { x: proto.bounds.x, y: proto.bounds.y },
21
+ size: { width: proto.bounds.width, height: proto.bounds.height },
22
22
  },
23
23
  application: proto.app,
24
24
  focus() {
@@ -50,9 +50,8 @@ const transformWindow = (proto) => {
50
50
  */
51
51
  var WindowManagement;
52
52
  (function (WindowManagement) {
53
- async function getWindows(options = {}) {
54
- const res = await bus_1.bus.request("wm.getWindows", options);
55
- return res.unwrap().windows.map(transformWindow);
53
+ async function getWindows(workspaceId) {
54
+ return (0, client_1.getClient)().WindowManagement.getWindows(workspaceId).then((wins) => wins.map(transformWindow));
56
55
  }
57
56
  WindowManagement.getWindows = getWindows;
58
57
  /**
@@ -70,51 +69,39 @@ var WindowManagement;
70
69
  * @see {@link Window.focus}
71
70
  */
72
71
  async function focusWindow(window) {
73
- const res = await bus_1.bus.request("wm.focusWindow", {
74
- id: window.id,
75
- });
76
- return res.unwrap().ok;
72
+ return (0, client_1.getClient)().WindowManagement.focusWindow(window.id);
77
73
  }
78
74
  WindowManagement.focusWindow = focusWindow;
79
75
  /**
80
76
  * Return the list of screens (physical and virtual) currently attached to the computer.
81
77
  */
82
78
  async function getScreens() {
83
- const res = await bus_1.bus.request("wm.getScreens", {});
84
- return res.unwrap().screens.map((sc) => ({
79
+ return (0, client_1.getClient)().WindowManagement.getScreens().then((screens) => screens.map((sc) => ({
85
80
  name: sc.name,
86
81
  make: sc.make,
87
82
  model: sc.model,
88
83
  serial: sc.serial,
89
84
  bounds: {
90
- position: { x: sc.x, y: sc.y },
91
- size: { width: sc.width, height: sc.height },
85
+ position: { x: sc.bounds.x, y: sc.bounds.y },
86
+ size: { width: sc.bounds.width, height: sc.bounds.height },
92
87
  },
93
- }));
88
+ })));
94
89
  }
95
90
  WindowManagement.getScreens = getScreens;
96
91
  async function getActiveWorkspace() {
97
- const res = await bus_1.bus.request("wm.getActiveWorkspace", {});
98
- return transformWorkspace(res.unwrap().workspace);
92
+ return (0, client_1.getClient)().WindowManagement.getActiveWorkspace().then(transformWorkspace);
99
93
  }
100
94
  WindowManagement.getActiveWorkspace = getActiveWorkspace;
101
95
  async function getWorkspaces() {
102
- const res = await bus_1.bus.request("wm.getWorkspaces", {});
103
- return res.unwrap().workspaces.map(transformWorkspace);
96
+ return (0, client_1.getClient)().WindowManagement.getWorkspaces().then((workspaces) => workspaces.map(transformWorkspace));
104
97
  }
105
98
  WindowManagement.getWorkspaces = getWorkspaces;
106
99
  async function getWindowsOnActiveWorkspace() {
107
- const workspace = await getActiveWorkspace();
108
- return getWindows({ workspaceId: workspace.id });
100
+ return (0, client_1.getClient)().WindowManagement.getActiveWorkspace().then((ws) => getWindows(ws.id));
109
101
  }
110
102
  WindowManagement.getWindowsOnActiveWorkspace = getWindowsOnActiveWorkspace;
111
- async function setWindowBounds(payload) {
112
- await bus_1.bus.request("wm.setWindowBounds", payload);
113
- }
114
- WindowManagement.setWindowBounds = setWindowBounds;
115
103
  async function getActiveWindow() {
116
- const res = await bus_1.bus.request("wm.getActiveWindow", {});
117
- return transformWindow(res.unwrap().window);
104
+ return (0, client_1.getClient)().WindowManagement.getActiveWindow().then(transformWindow);
118
105
  }
119
106
  WindowManagement.getActiveWindow = getActiveWindow;
120
107
  })(WindowManagement || (exports.WindowManagement = WindowManagement = {}));
@@ -28,9 +28,9 @@ declare const _default: z.ZodObject<{
28
28
  commands: z.ZodArray<z.ZodObject<{
29
29
  icon: z.ZodOptional<z.ZodString>;
30
30
  mode: z.ZodEnum<{
31
- "menu-bar": "menu-bar";
32
- view: "view";
33
31
  "no-view": "no-view";
32
+ view: "view";
33
+ "menu-bar": "menu-bar";
34
34
  }>;
35
35
  name: z.ZodString;
36
36
  title: z.ZodString;
@@ -315,7 +315,6 @@ declare const _default: z.ZodObject<{
315
315
  required: z.ZodBoolean;
316
316
  }, z.core.$strict>], "type">>>;
317
317
  categories: z.ZodOptional<z.ZodArray<z.ZodEnum<{
318
- Web: "Web";
319
318
  Applications: "Applications";
320
319
  Communication: "Communication";
321
320
  Data: "Data";
@@ -329,6 +328,7 @@ declare const _default: z.ZodObject<{
329
328
  Productivity: "Productivity";
330
329
  Security: "Security";
331
330
  System: "System";
331
+ Web: "Web";
332
332
  Other: "Other";
333
333
  }>>>;
334
334
  contributors: z.ZodOptional<z.ZodArray<z.ZodString>>;
package/package.json CHANGED
@@ -1,11 +1,10 @@
1
1
  {
2
2
  "name": "@vicinae/api",
3
- "version": "0.20.9",
3
+ "version": "0.20.10",
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
- "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
8
  "pack": "npm run build && npm pack",
10
9
  "docgen": "typedoc",
11
10
  "format": "biome format --write"
@@ -45,7 +44,6 @@
45
44
  },
46
45
  "devDependencies": {
47
46
  "@biomejs/biome": "2.3.2",
48
- "@bufbuild/protobuf": "^2.7.0",
49
47
  "@oclif/test": "^4",
50
48
  "@types/chai": "^4",
51
49
  "@types/mocha": "^10",
@@ -54,7 +52,6 @@
54
52
  "oclif": "^4",
55
53
  "shx": "^0.3.3",
56
54
  "ts-node": "^10",
57
- "ts-proto": "^2.7.5",
58
55
  "typedoc": "^0.28.13",
59
56
  "typedoc-github-theme": "^0.3.1",
60
57
  "typedoc-plugin-markdown": "^4.8.1",