@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
@@ -1,4 +1,4 @@
1
- import { Image } from "./image";
1
+ import type { Image } from "./image";
2
2
  /**
3
3
  * @category Alert
4
4
  */
package/dist/api/alert.js CHANGED
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.confirmAlert = exports.Alert = void 0;
4
- const bus_1 = require("./bus");
5
- const image_1 = require("./image");
6
- const ui_1 = require("./proto/ui");
4
+ const client_1 = require("./client");
7
5
  /**
8
6
  * @category Alert
9
7
  */
@@ -17,9 +15,9 @@ var Alert;
17
15
  })(ActionStyle = Alert.ActionStyle || (Alert.ActionStyle = {}));
18
16
  })(Alert || (exports.Alert = Alert = {}));
19
17
  const styleMap = {
20
- [Alert.ActionStyle.Default]: ui_1.ConfirmAlertActionStyle.Default,
21
- [Alert.ActionStyle.Destructive]: ui_1.ConfirmAlertActionStyle.Destructive,
22
- [Alert.ActionStyle.Cancel]: ui_1.ConfirmAlertActionStyle.Cancel,
18
+ [Alert.ActionStyle.Default]: "Default",
19
+ [Alert.ActionStyle.Destructive]: "Destructive",
20
+ [Alert.ActionStyle.Cancel]: "Cancel",
23
21
  };
24
22
  /**
25
23
  * Display a confirmation dialog with a cancel and confirm options.
@@ -41,10 +39,10 @@ const styleMap = {
41
39
  */
42
40
  const confirmAlert = async (options) => {
43
41
  return new Promise((resolve) => {
44
- const req = ui_1.ConfirmAlertRequest.create({
42
+ (0, client_1.getClient)().UI.confirmAlert({
45
43
  title: options.title,
46
44
  description: options.message ?? "Are you sure?",
47
- icon: options.icon && (0, image_1.serializeProtoImage)(options.icon),
45
+ //icon: options.icon && serializeProtoImage(options.icon),
48
46
  rememberUserChoice: false,
49
47
  primaryAction: {
50
48
  title: options.primaryAction?.title ?? "Confirm",
@@ -54,17 +52,14 @@ const confirmAlert = async (options) => {
54
52
  title: options.dismissAction?.title ?? "Cancel",
55
53
  style: styleMap[options.dismissAction?.style ?? Alert.ActionStyle.Cancel],
56
54
  },
57
- });
58
- bus_1.bus.request("ui.confirmAlert", req).then((res) => {
59
- if (!res.ok)
60
- return false;
61
- if (res.value.confirmed) {
55
+ }).then((confirmed) => {
56
+ if (confirmed) {
62
57
  options.primaryAction?.onAction?.();
63
58
  }
64
59
  else {
65
60
  options.dismissAction?.onAction?.();
66
61
  }
67
- resolve(res.value.confirmed);
62
+ resolve(confirmed);
68
63
  });
69
64
  });
70
65
  };
@@ -0,0 +1,7 @@
1
+ import type { Client } from "./proto/api";
2
+ /**
3
+ * Client used to access vicinae capabilities from the extension runtime.
4
+ * Always use this function instead of caching the client at module load time,
5
+ * as the client is only initialized after the extension command is activated.
6
+ */
7
+ export declare const getClient: () => Client;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getClient = void 0;
4
+ const globals_1 = require("./globals");
5
+ /**
6
+ * Client used to access vicinae capabilities from the extension runtime.
7
+ * Always use this function instead of caching the client at module load time,
8
+ * as the client is only initialized after the extension command is activated.
9
+ */
10
+ const getClient = () => (0, globals_1.getGlobal)().client;
11
+ exports.getClient = getClient;
@@ -1,4 +1,4 @@
1
- import { PathLike } from "fs";
1
+ import type { PathLike } from "node:fs";
2
2
  /**
3
3
  * Access system clipboard and clipboard history features.
4
4
  *
@@ -14,7 +14,7 @@ export declare namespace Clipboard {
14
14
  text?: string;
15
15
  };
16
16
  type ReadContent = {
17
- text: string;
17
+ text?: string;
18
18
  file?: string;
19
19
  html?: string;
20
20
  };
@@ -42,9 +42,7 @@ export declare namespace Clipboard {
42
42
  * const { text, html, file } = await Clipboard.read();
43
43
  * ```
44
44
  */
45
- function read(options?: {
46
- offset?: number;
47
- }): Promise<Clipboard.ReadContent>;
45
+ function read(): Promise<Clipboard.ReadContent>;
48
46
  /**
49
47
  * Read the text representation of the current clipboard data. If the data is not text at all, this
50
48
  * returns an empty string.
@@ -55,9 +53,7 @@ export declare namespace Clipboard {
55
53
  * const text = await Clipboard.readText();
56
54
  * ```
57
55
  */
58
- function readText(options?: {
59
- offset?: number;
60
- }): Promise<string>;
56
+ function readText(): Promise<string>;
61
57
  /**
62
58
  * Clear the current clipboard content.
63
59
  */
@@ -1,8 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Clipboard = void 0;
4
- const bus_1 = require("./bus");
5
- const clipboard_1 = require("./proto/clipboard");
4
+ const client_1 = require("./client");
6
5
  /**
7
6
  * Access system clipboard and clipboard history features.
8
7
  *
@@ -11,16 +10,17 @@ const clipboard_1 = require("./proto/clipboard");
11
10
  var Clipboard;
12
11
  (function (Clipboard) {
13
12
  function mapContent(content) {
14
- let ct = clipboard_1.ClipboardContent.create();
13
+ let ct = {};
15
14
  if (typeof content !== "object") {
16
15
  ct.text = `${content}`;
17
16
  }
18
17
  else {
19
18
  if (content["file"]) {
20
- ct.path = { path: content["file"] };
19
+ ct.path = content["file"];
21
20
  }
22
21
  else if (content["html"]) {
23
- ct.html = { html: content["html"], text: content["text"] };
22
+ ct.html = content["html"];
23
+ ct.text = content["text"];
24
24
  }
25
25
  else {
26
26
  ct.text = content["text"];
@@ -34,9 +34,8 @@ var Clipboard;
34
34
  * does not get indexed by the Vicinae clipboard manager.
35
35
  */
36
36
  async function copy(text, options = {}) {
37
- await bus_1.bus.request("clipboard.copy", {
38
- content: mapContent(text),
39
- options: { concealed: options.concealed ?? false },
37
+ await (0, client_1.getClient)().Clipboard.copy(mapContent(text), {
38
+ concealed: options.concealed ?? false,
40
39
  });
41
40
  }
42
41
  Clipboard.copy = copy;
@@ -47,9 +46,7 @@ var Clipboard;
47
46
  * clipboard copy.
48
47
  */
49
48
  async function paste(text) {
50
- await bus_1.bus.request("clipboard.paste", {
51
- content: mapContent(text),
52
- });
49
+ await (0, client_1.getClient)().Clipboard.paste(mapContent(text));
53
50
  }
54
51
  Clipboard.paste = paste;
55
52
  /**
@@ -60,9 +57,8 @@ var Clipboard;
60
57
  * const { text, html, file } = await Clipboard.read();
61
58
  * ```
62
59
  */
63
- async function read(options) {
64
- const res = await bus_1.bus.request("clipboard.readContent", {});
65
- return res.unwrap().content;
60
+ async function read() {
61
+ return (0, client_1.getClient)().Clipboard.readContent();
66
62
  }
67
63
  Clipboard.read = read;
68
64
  /**
@@ -75,16 +71,15 @@ var Clipboard;
75
71
  * const text = await Clipboard.readText();
76
72
  * ```
77
73
  */
78
- async function readText(options) {
79
- const { text } = await read(options);
80
- return text;
74
+ async function readText() {
75
+ return read().then((r) => r.text ?? "");
81
76
  }
82
77
  Clipboard.readText = readText;
83
78
  /**
84
79
  * Clear the current clipboard content.
85
80
  */
86
81
  async function clear() {
87
- await bus_1.bus.request("clipboard.clear", {});
82
+ await (0, client_1.getClient)().Clipboard.clear();
88
83
  }
89
84
  Clipboard.clear = clear;
90
85
  })(Clipboard || (exports.Clipboard = Clipboard = {}));
@@ -1,14 +1,9 @@
1
- import * as ui from "./proto/ui";
2
- type DynamicColor = {
3
- dark: string;
4
- light: string;
5
- adjustContrast?: boolean;
6
- };
1
+ import type * as api from "./proto/api";
7
2
  /**
8
3
  * @category Colors
9
4
  */
10
5
  export declare namespace Color {
11
- type Dynamic = DynamicColor;
6
+ type Dynamic = api.DynamicColor;
12
7
  type Raw = string;
13
8
  }
14
9
  /**
@@ -29,6 +24,5 @@ export declare enum Color {
29
24
  * @category Colors
30
25
  */
31
26
  export type ColorLike = Color.Dynamic | Color.Raw | Color;
32
- export type SerializedColorLike = ui.ColorLike;
33
- export declare const serializeColorLike: (color: ColorLike) => SerializedColorLike;
34
- export {};
27
+ export type SerializedColorLike = api.ColorLike;
28
+ export declare const serializeColorLike: (color: ColorLike) => api.ColorLike;
package/dist/api/color.js CHANGED
@@ -1,40 +1,6 @@
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.serializeColorLike = exports.Color = void 0;
37
- const ui = __importStar(require("./proto/ui"));
38
4
  /**
39
5
  * @category Colors
40
6
  */
@@ -51,20 +17,15 @@ var Color;
51
17
  Color["SecondaryText"] = "secondary-text";
52
18
  })(Color || (exports.Color = Color = {}));
53
19
  const serializeColorLike = (color) => {
54
- const colorLike = ui.ColorLike.create();
55
20
  if (typeof color === "string") {
56
- colorLike.raw = color;
21
+ return { raw: color };
57
22
  }
58
- else {
59
- // It's a DynamicColor
60
- const dynamicColor = ui.DynamicColor.create();
61
- dynamicColor.light = color.light;
62
- dynamicColor.dark = color.dark;
63
- if (color.adjustContrast !== undefined) {
64
- dynamicColor.adjustContrast = color.adjustContrast;
65
- }
66
- colorLike.dynamic = dynamicColor;
67
- }
68
- return colorLike;
23
+ return {
24
+ dynamic: {
25
+ light: color.light,
26
+ dark: color.dark,
27
+ adjustContrast: color.adjustContrast,
28
+ },
29
+ };
69
30
  };
70
31
  exports.serializeColorLike = serializeColorLike;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.updateCommandMetadata = updateCommandMetadata;
4
- const bus_1 = require("./bus");
4
+ const client_1 = require("./client");
5
5
  /**
6
6
  * Update the values of properties declared in the manifest of the current command.
7
7
  * Currently only `subtitle` is supported. Pass `null` to clear the custom subtitle.
@@ -9,9 +9,7 @@ const bus_1 = require("./bus");
9
9
  * Raycast API: https://developers.raycast.com/api-reference/command#updatecommandmetadata
10
10
  */
11
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.request("command.updateCommandMetadata", payload);
12
+ await (0, client_1.getClient)().Command.updateCommandMetadata({
13
+ subtitle: metadata.subtitle ?? undefined,
14
+ });
17
15
  }
@@ -1,41 +1,7 @@
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.popToRoot = exports.getSelectedText = exports.clearSearchBar = exports.closeMainWindow = exports.showHUD = exports.PopToRootType = void 0;
37
- const bus_1 = require("./bus");
38
- const ui = __importStar(require("./proto/ui"));
4
+ const client_1 = require("./client");
39
5
  /**
40
6
  * @category Launcher Window
41
7
  */
@@ -56,9 +22,9 @@ var PopToRootType;
56
22
  PopToRootType["Suspended"] = "suspended";
57
23
  })(PopToRootType || (exports.PopToRootType = PopToRootType = {}));
58
24
  const popToRootProtoMap = {
59
- [PopToRootType.Default]: ui.PopToRootType.PopToRootDefault,
60
- [PopToRootType.Immediate]: ui.PopToRootType.PopToRootImmediate,
61
- [PopToRootType.Suspended]: ui.PopToRootType.PopToRootSuspended,
25
+ [PopToRootType.Default]: "Default",
26
+ [PopToRootType.Immediate]: "Immediate",
27
+ [PopToRootType.Suspended]: "Suspended",
62
28
  };
63
29
  /**
64
30
  * Close the window and show a small HUD where the window was previously opened.
@@ -71,11 +37,7 @@ const popToRootProtoMap = {
71
37
  * @category Launcher Window
72
38
  */
73
39
  const showHUD = async (title, options) => {
74
- bus_1.bus.request("ui.showHud", {
75
- text: title,
76
- clearRootSearch: options?.clearRootSearch ?? false,
77
- popToRoot: popToRootProtoMap[options?.popToRootType ?? PopToRootType.Default],
78
- });
40
+ (0, client_1.getClient)().UI.showHud(title, options?.clearRootSearch ?? false, popToRootProtoMap[options?.popToRootType ?? PopToRootType.Default]);
79
41
  };
80
42
  exports.showHUD = showHUD;
81
43
  /**
@@ -86,17 +48,14 @@ exports.showHUD = showHUD;
86
48
  */
87
49
  const closeMainWindow = async (options = {}) => {
88
50
  const { clearRootSearch = false, popToRootType = PopToRootType.Default } = options;
89
- await bus_1.bus.request("ui.closeMainWindow", {
90
- clearRootSearch,
91
- popToRoot: popToRootProtoMap[popToRootType],
92
- });
51
+ await (0, client_1.getClient)().UI.closeMainWindow(clearRootSearch, popToRootProtoMap[popToRootType]);
93
52
  };
94
53
  exports.closeMainWindow = closeMainWindow;
95
54
  /**
96
55
  * @category Launcher Window
97
56
  */
98
57
  const clearSearchBar = async () => {
99
- await bus_1.bus.request("ui.setSearchText", { text: "" });
58
+ await (0, client_1.getClient)().UI.setSearchText("");
100
59
  };
101
60
  exports.clearSearchBar = clearSearchBar;
102
61
  /**
@@ -107,11 +66,7 @@ exports.clearSearchBar = clearSearchBar;
107
66
  * @category Launcher Window
108
67
  */
109
68
  const getSelectedText = async () => {
110
- const response = await bus_1.bus.request("ui.getSelectedText", {});
111
- if (!response.ok) {
112
- throw new Error(`Failed to get selected text`);
113
- }
114
- return response.value.text;
69
+ return (0, client_1.getClient)().UI.getSelectedText();
115
70
  };
116
71
  exports.getSelectedText = getSelectedText;
117
72
  /**
@@ -120,8 +75,6 @@ exports.getSelectedText = getSelectedText;
120
75
  * @category Launcher Window
121
76
  */
122
77
  const popToRoot = async (options) => {
123
- await bus_1.bus.request("ui.popToRoot", {
124
- clearSearchBar: options?.clearSearchBar ?? false,
125
- });
78
+ await (0, client_1.getClient)().UI.popToRoot(options?.clearSearchBar ?? false);
126
79
  };
127
80
  exports.popToRoot = popToRoot;
@@ -131,15 +131,4 @@ export interface Environment {
131
131
  */
132
132
  isRaycast: boolean;
133
133
  }
134
- /**
135
- * General information about the running extension command, the vicinae version, the capabilities of
136
- * the system we are running on, etc...
137
- *
138
- * @example
139
- * ```typescript
140
- * import { environment } from '@vicinae/api';
141
- *
142
- * console.log({ environment });
143
- * ```
144
- */
145
134
  export declare const environment: Environment;
@@ -23,4 +23,5 @@ var LaunchType;
23
23
  * console.log({ environment });
24
24
  * ```
25
25
  */
26
- exports.environment = globalThis.vicinae.environ;
26
+ const globals_1 = require("./globals");
27
+ exports.environment = (0, globals_1.getGlobal)().environ;
@@ -1,4 +1,4 @@
1
- import { FileInfo as ProtoFileInfo } from "./proto/file-search";
1
+ import type * as api from "./proto/api";
2
2
  /**
3
3
  * Access Vicinae's built-in file search functionality.
4
4
  *
@@ -22,8 +22,7 @@ export declare namespace FileSearch {
22
22
  /**
23
23
  * For now we provide no options, but in the future we will implement mime type and file type filtering.
24
24
  * */
25
- type SearchOptions = {};
26
- type FileInfo = ProtoFileInfo;
25
+ type FileInfo = api.FileInfo;
27
26
  /**
28
27
  * Search for files matching the provided query string.
29
28
  *
@@ -42,5 +41,5 @@ export declare namespace FileSearch {
42
41
  * const files = await fileSearch.search('invoice');
43
42
  * ```
44
43
  */
45
- function search(query: string, _?: FileSearch.SearchOptions): Promise<FileSearch.FileInfo[]>;
44
+ function search(query: string): Promise<FileSearch.FileInfo[]>;
46
45
  }
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FileSearch = void 0;
4
- const bus_1 = require("./bus");
4
+ const client_1 = require("./client");
5
5
  /**
6
6
  * Access Vicinae's built-in file search functionality.
7
7
  *
@@ -23,6 +23,9 @@ const bus_1 = require("./bus");
23
23
  */
24
24
  var FileSearch;
25
25
  (function (FileSearch) {
26
+ /**
27
+ * For now we provide no options, but in the future we will implement mime type and file type filtering.
28
+ * */
26
29
  /**
27
30
  * Search for files matching the provided query string.
28
31
  *
@@ -41,9 +44,8 @@ var FileSearch;
41
44
  * const files = await fileSearch.search('invoice');
42
45
  * ```
43
46
  */
44
- async function search(query, _ = {}) {
45
- const res = await bus_1.bus.request("fileSearch.search", { query });
46
- return res.unwrap().files;
47
+ async function search(query) {
48
+ return (0, client_1.getClient)().FileSearch.search(query);
47
49
  }
48
50
  FileSearch.search = search;
49
51
  })(FileSearch || (exports.FileSearch = FileSearch = {}));
@@ -0,0 +1,9 @@
1
+ import type React from "react";
2
+ import type { Environment } from "./environment";
3
+ export interface VicinaGlobal {
4
+ client: any;
5
+ environ: Environment;
6
+ preferences: any;
7
+ navigationContext: React.Context<any>;
8
+ }
9
+ export declare const getGlobal: () => VicinaGlobal;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getGlobal = void 0;
4
+ const getGlobal = () => globalThis.vicinae;
5
+ exports.getGlobal = getGlobal;
@@ -1,3 +1,3 @@
1
+ import { type Ref } from "react";
1
2
  import type { Form } from "../components/form";
2
- import type { Ref } from "react";
3
3
  export declare const useImperativeFormHandle: (ref?: Ref<Form.ItemReference>) => [string];
@@ -2,21 +2,24 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useImperativeFormHandle = void 0;
4
4
  const react_1 = require("react");
5
- const bus_1 = require("../bus");
6
5
  const node_crypto_1 = require("node:crypto");
7
6
  const useImperativeFormHandle = (ref) => {
8
7
  const handleId = (0, react_1.useRef)((0, node_crypto_1.randomUUID)());
9
8
  (0, react_1.useImperativeHandle)(ref, () => {
10
9
  return {
11
10
  focus: () => {
12
- bus_1.bus.emit(handleId.current, {
11
+ /*
12
+ bus.emit(handleId.current, {
13
13
  type: "focus",
14
14
  });
15
+ */
15
16
  },
16
17
  reset: () => {
17
- bus_1.bus.emit(handleId.current, {
18
+ /*
19
+ bus.emit(handleId.current, {
18
20
  type: "reset",
19
21
  });
22
+ */
20
23
  },
21
24
  };
22
25
  }, []);
@@ -5,6 +5,6 @@
5
5
  * @category Navigation
6
6
  */
7
7
  export declare const useNavigation: () => {
8
- push: (node: import("react").ReactNode) => void;
9
- pop: () => void;
8
+ push: any;
9
+ pop: any;
10
10
  };
@@ -1,11 +1,8 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.useNavigation = void 0;
7
4
  const react_1 = require("react");
8
- const navigation_context_1 = __importDefault(require("../context/navigation-context"));
5
+ const globals_1 = require("../globals");
9
6
  /**
10
7
  * A React hook that lets you access methods to push and pop views
11
8
  * on the navigation stack.
@@ -13,7 +10,7 @@ const navigation_context_1 = __importDefault(require("../context/navigation-cont
13
10
  * @category Navigation
14
11
  */
15
12
  const useNavigation = () => {
16
- const { push, pop } = (0, react_1.useContext)(navigation_context_1.default);
13
+ const { push, pop } = (0, react_1.useContext)((0, globals_1.getGlobal)().navigationContext);
17
14
  return { push, pop };
18
15
  };
19
16
  exports.useNavigation = useNavigation;
@@ -1,6 +1,6 @@
1
1
  import { type ColorLike } from "./color";
2
- import type { Icon } from "./icon";
3
- import * as ui from "./proto/ui";
2
+ import { Icon } from "./icon";
3
+ import type * as api from "./proto/api";
4
4
  /**
5
5
  * Representation of an image, renderable everywhere Vicine expects them.
6
6
  * @category Image
@@ -15,7 +15,7 @@ export type Image = {
15
15
  * @category Image
16
16
  */
17
17
  export type ImageLike = Image.ImageLike;
18
- export type SerializedImageLike = URL | Image.Asset | Icon | ui.Image | Image.ThemedImage;
18
+ export type SerializedImageLike = URL | Image.Asset | Icon | api.Image | Image.ThemedImage;
19
19
  /**
20
20
  * @category Image
21
21
  */
@@ -37,4 +37,4 @@ export declare namespace Image {
37
37
  RoundedRectangle = "roundedRectangle"
38
38
  }
39
39
  }
40
- export declare const serializeProtoImage: (image: ImageLike) => ui.Image;
40
+ export declare const serializeProtoImage: (image: ImageLike) => api.Image;