@vicinae/api 0.16.5 → 0.16.7

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 (71) hide show
  1. package/README.md +1 -1
  2. package/dist/api/ai.d.ts +4 -1
  3. package/dist/api/ai.js +3 -0
  4. package/dist/api/alert.d.ts +6 -0
  5. package/dist/api/alert.js +18 -11
  6. package/dist/api/bus.d.ts +6 -0
  7. package/dist/api/bus.js +2 -0
  8. package/dist/api/cache.d.ts +5 -0
  9. package/dist/api/cache.js +2 -0
  10. package/dist/api/clipboard.d.ts +6 -1
  11. package/dist/api/clipboard.js +6 -1
  12. package/dist/api/color.d.ts +9 -0
  13. package/dist/api/color.js +3 -0
  14. package/dist/api/components/action-pannel.d.ts +32 -20
  15. package/dist/api/components/action-pannel.js +3 -0
  16. package/dist/api/components/actions.d.ts +76 -47
  17. package/dist/api/components/actions.js +3 -0
  18. package/dist/api/components/detail.d.ts +33 -8
  19. package/dist/api/components/detail.js +3 -0
  20. package/dist/api/components/form.d.ts +33 -28
  21. package/dist/api/components/form.js +3 -0
  22. package/dist/api/components/grid.d.ts +55 -0
  23. package/dist/api/components/grid.js +12 -0
  24. package/dist/api/components/index.d.ts +1 -1
  25. package/dist/api/components/index.js +3 -1
  26. package/dist/api/components/list.d.ts +159 -16
  27. package/dist/api/components/list.js +5 -2
  28. package/dist/api/components/menu-bar.d.ts +3 -0
  29. package/dist/api/components/menu-bar.js +3 -0
  30. package/dist/api/components/metadata.d.ts +5 -1
  31. package/dist/api/components/metadata.js +13 -1
  32. package/dist/api/context/navigation-provider.d.ts +3 -0
  33. package/dist/api/context/navigation-provider.js +3 -0
  34. package/dist/api/controls.d.ts +14 -0
  35. package/dist/api/controls.js +14 -1
  36. package/dist/api/environment.d.ts +11 -0
  37. package/dist/api/environment.js +11 -0
  38. package/dist/api/file-search.d.ts +1 -0
  39. package/dist/api/file-search.js +1 -0
  40. package/dist/api/hooks/index.d.ts +0 -1
  41. package/dist/api/hooks/index.js +0 -1
  42. package/dist/api/hooks/use-imperative-form-handle.d.ts +3 -3
  43. package/dist/api/hooks/use-imperative-form-handle.js +2 -2
  44. package/dist/api/hooks/use-navigation.d.ts +6 -0
  45. package/dist/api/hooks/use-navigation.js +6 -0
  46. package/dist/api/icon.d.ts +3 -0
  47. package/dist/api/icon.js +3 -0
  48. package/dist/api/image.d.ts +11 -1
  49. package/dist/api/image.js +3 -0
  50. package/dist/api/index.d.ts +2 -2
  51. package/dist/api/index.js +5 -2
  52. package/dist/api/keyboard.d.ts +9 -0
  53. package/dist/api/keyboard.js +3 -0
  54. package/dist/api/local-storage.d.ts +8 -7
  55. package/dist/api/local-storage.js +17 -8
  56. package/dist/api/oauth.d.ts +11 -9
  57. package/dist/api/oauth.js +19 -0
  58. package/dist/api/preference.d.ts +8 -0
  59. package/dist/api/preference.js +8 -0
  60. package/dist/api/proto/wm.d.ts +11 -0
  61. package/dist/api/proto/wm.js +183 -19
  62. package/dist/api/toast.d.ts +8 -0
  63. package/dist/api/toast.js +8 -0
  64. package/dist/api/utils.d.ts +24 -2
  65. package/dist/api/utils.js +21 -2
  66. package/dist/api/window-management.d.ts +52 -4
  67. package/dist/api/window-management.js +34 -8
  68. package/package.json +3 -3
  69. package/types/jsx.d.ts +1 -1
  70. package/dist/api/hooks/use-applications.d.ts +0 -2
  71. package/dist/api/hooks/use-applications.js +0 -19
@@ -13,6 +13,7 @@ const transformWorkspace = (proto) => {
13
13
  const transformWindow = (proto) => {
14
14
  return {
15
15
  id: proto.id,
16
+ title: proto.title,
16
17
  workspaceId: proto.workspaceId,
17
18
  active: proto.active,
18
19
  bounds: {
@@ -20,36 +21,61 @@ const transformWindow = (proto) => {
20
21
  size: { width: proto.width, height: proto.height },
21
22
  },
22
23
  application: proto.app,
24
+ focus() {
25
+ return WindowManagement.focusWindow(this);
26
+ },
23
27
  };
24
28
  };
25
29
  /**
26
30
  * Access Vicinae's window management features.
27
31
  *
28
32
  * @remarks
29
- * Window management features are available to a different degree depending on what environment vicinae runs
30
- * in.
33
+ * Window management support varies a lot depending on the environment.
34
+ * Right now it is pretty well supported on almost all linux desktop environments except KDE.
31
35
  *
32
36
  * @example
33
37
  * ```typescript
34
38
  * import { WindowManagement } from '@vicinae/api';
35
39
  *
36
- * const windows = await WindowManagement.getWindows();
40
+ * const wins = await WindowManagement.getWindows();
41
+ * const browserWindow = wins.find(w => w.application?.name?.includes('firefox'));
42
+ *
43
+ * if (browserWindow) {
44
+ * await browserWindow.focus();
45
+ * }
37
46
  * ```
38
47
  *
48
+ * @category Window Management
39
49
  * @public
40
50
  */
41
51
  var WindowManagement;
42
52
  (function (WindowManagement) {
43
- async function ping() {
44
- const res = await bus_1.bus.turboRequest("wm.ping", {});
45
- return res.unwrap().ok;
46
- }
47
- WindowManagement.ping = ping;
48
53
  async function getWindows(options = {}) {
49
54
  const res = await bus_1.bus.turboRequest("wm.getWindows", options);
50
55
  return res.unwrap().windows.map(transformWindow);
51
56
  }
52
57
  WindowManagement.getWindows = getWindows;
58
+ /**
59
+ * Focus `window`.
60
+ *
61
+ * @remarks
62
+ * Window objects have a {@link Window.focus} method that can be used to achieve the same thing on a specific window directly.
63
+ *
64
+ * @param window - the window to focus. You may want to make sure this window still exists when you request focus.
65
+ *
66
+ * @return `true` if the window was focused, `false` otherwise.
67
+ * A window may not have been focused because it doesn't accept focus (e.g some layer shell surfaces)
68
+ * or simply because it doesn't exist anymore.
69
+ *
70
+ * @see {@link Window.focus}
71
+ */
72
+ async function focusWindow(window) {
73
+ const res = await bus_1.bus.turboRequest("wm.focusWindow", {
74
+ id: window.id,
75
+ });
76
+ return res.unwrap().ok;
77
+ }
78
+ WindowManagement.focusWindow = focusWindow;
53
79
  /**
54
80
  * Return the list of screens (physical and virtual) currently attached to the computer.
55
81
  */
package/package.json CHANGED
@@ -1,14 +1,13 @@
1
1
  {
2
2
  "name": "@vicinae/api",
3
- "version": "0.16.5",
3
+ "version": "0.16.7",
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
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
9
  "pack": "npm run build && npm pack",
10
- "docgen-html": "typedoc src/api/index.ts",
11
- "docgen-md": "typedoc src/api/index.ts --disableSources --readme none --plugin typedoc-plugin-markdown --out ./docs",
10
+ "docgen": "typedoc",
12
11
  "format": "biome format --write"
13
12
  },
14
13
  "bin": {
@@ -58,6 +57,7 @@
58
57
  "ts-node": "^10",
59
58
  "ts-proto": "^2.7.5",
60
59
  "typedoc": "^0.28.13",
60
+ "typedoc-github-theme": "^0.3.1",
61
61
  "typedoc-plugin-markdown": "^4.8.1",
62
62
  "typescript": "^5"
63
63
  },
package/types/jsx.d.ts CHANGED
@@ -107,7 +107,7 @@ declare module "react" {
107
107
  };
108
108
  "metadata-label": {
109
109
  title: string;
110
- text: string;
110
+ text: string | { color?: SerializedColorLike; value: string };
111
111
  icon?: SerializedImageLike;
112
112
  };
113
113
  "metadata-separator": {};
@@ -1,2 +0,0 @@
1
- import { Application } from "../utils";
2
- export declare const useApplications: () => [Application[], boolean, Error | null];
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useApplications = void 0;
4
- const react_1 = require("react");
5
- const utils_1 = require("../utils");
6
- const useApplications = () => {
7
- const [isLoading, setIsLoading] = (0, react_1.useState)(true);
8
- const [error, setError] = (0, react_1.useState)(null);
9
- const [apps, setApps] = (0, react_1.useState)([]);
10
- (0, react_1.useEffect)(() => {
11
- setIsLoading(true);
12
- (0, utils_1.getApplications)()
13
- .then(setApps)
14
- .catch(setError)
15
- .finally(() => setIsLoading(false));
16
- }, []);
17
- return [apps, isLoading, error];
18
- };
19
- exports.useApplications = useApplications;