@vicinae/api 0.21.1 → 0.21.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.
@@ -11,11 +11,18 @@ export type Image = {
11
11
  tintColor?: ColorLike | undefined | null;
12
12
  mask?: Image.Mask | undefined | null;
13
13
  };
14
+ /**
15
+ * Renders the system icon associated with the given file path.
16
+ * @category Image
17
+ */
18
+ type FileIcon = {
19
+ fileIcon: string;
20
+ };
14
21
  /**
15
22
  * @category Image
16
23
  */
17
24
  export type ImageLike = Image.ImageLike;
18
- export type SerializedImageLike = URL | Image.Asset | Icon | api.Image | Image.ThemedImage;
25
+ export type SerializedImageLike = URL | Image.Asset | Icon | api.Image | Image.ThemedImage | FileIcon;
19
26
  /**
20
27
  * @category Image
21
28
  */
@@ -31,10 +38,11 @@ export declare namespace Image {
31
38
  light: URL | Asset;
32
39
  dark: URL | Asset;
33
40
  };
34
- type ImageLike = URL | Image.Asset | Icon | Image | Image.ThemedImage;
41
+ type ImageLike = URL | Image.Asset | Icon | Image | Image.ThemedImage | FileIcon;
35
42
  enum Mask {
36
43
  Circle = "circle",
37
44
  RoundedRectangle = "roundedRectangle"
38
45
  }
39
46
  }
40
47
  export declare const serializeProtoImage: (image: ImageLike) => api.Image;
48
+ export {};
package/dist/api/image.js CHANGED
@@ -14,6 +14,9 @@ var Image;
14
14
  Mask["RoundedRectangle"] = "roundedRectangle";
15
15
  })(Mask = Image.Mask || (Image.Mask = {}));
16
16
  })(Image || (exports.Image = Image = {}));
17
+ const isFileIcon = (v) => typeof v === "object" &&
18
+ v !== null &&
19
+ typeof v.fileIcon === "string";
17
20
  const maskMap = {
18
21
  [Image.Mask.Circle]: "Circle",
19
22
  [Image.Mask.RoundedRectangle]: "RoundedRectangle",
@@ -31,6 +34,9 @@ const serializeProtoImage = (image) => {
31
34
  if (image instanceof URL || typeof image === "string") {
32
35
  return { source: { raw: image.toString() } };
33
36
  }
37
+ if (isFileIcon(image)) {
38
+ return { fileIcon: image.fileIcon };
39
+ }
34
40
  const img = image;
35
41
  // img.source should technically not be null, but it somehow still happens at times with some
36
42
  // raycast extensions
@@ -50,10 +50,11 @@ export type ColorLike = {
50
50
  dynamic?: DynamicColor;
51
51
  };
52
52
  export type Image = {
53
- source: ImageSource;
53
+ source?: ImageSource;
54
54
  fallback?: ImageSource;
55
55
  mask?: ImageMask;
56
56
  tintColor?: ColorLike;
57
+ fileIcon?: string;
57
58
  };
58
59
  export type ConfirmAlertAction = {
59
60
  title: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vicinae/api",
3
- "version": "0.21.1",
3
+ "version": "0.21.2",
4
4
  "description": "TypeScript SDK to build Vicinae extensions",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",