@wox-launcher/wox-plugin 0.0.27 → 0.0.28

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/package.json CHANGED
@@ -1,15 +1,13 @@
1
1
  {
2
2
  "name": "@wox-launcher/wox-plugin",
3
- "version": "0.0.27",
3
+ "version": "0.0.28",
4
4
  "description": "All nodejs plugin for Wox should use types in this package",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/Wox-launcher/Wox.git"
8
8
  },
9
- "type": "module",
10
- "exports": [
11
- "./src/index.ts"
12
- ],
9
+ "main": "./src/index.js",
10
+ "types": "./src/index.ts",
13
11
  "files": [
14
12
  "src"
15
13
  ],
package/src/index.js CHANGED
@@ -1 +1,35 @@
1
- export {};
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WoxImageBuilder = void 0;
4
+ exports.WoxImageBuilder = {
5
+ FromAbsolutePath: (path) => {
6
+ return {
7
+ ImageType: "AbsolutePath",
8
+ ImageData: path
9
+ };
10
+ },
11
+ FromRelativeToPluginPath: (path) => {
12
+ return {
13
+ ImageType: "RelativeToPluginPath",
14
+ ImageData: path
15
+ };
16
+ },
17
+ FromSvg: (svg) => {
18
+ return {
19
+ ImageType: "Svg",
20
+ ImageData: svg
21
+ };
22
+ },
23
+ FromBase64: (base64) => {
24
+ return {
25
+ ImageType: "Base64",
26
+ ImageData: base64
27
+ };
28
+ },
29
+ FromRemote: (url) => {
30
+ return {
31
+ ImageType: "Remote",
32
+ ImageData: url
33
+ };
34
+ }
35
+ };
package/src/index.ts CHANGED
@@ -73,4 +73,53 @@ export type WoxImageType = "AbsolutePath" | "RelativeToPluginPath" | "Svg" | "Ba
73
73
  export interface WoxImage {
74
74
  ImageType: WoxImageType;
75
75
  ImageData: string;
76
- }
76
+ }
77
+
78
+ export interface WoxImageCreator {
79
+ FromAbsolutePath(path: string): WoxImage;
80
+
81
+ FromRelativeToPluginPath(path: string): WoxImage;
82
+
83
+ FromSvg(svg: string): WoxImage;
84
+
85
+ FromBase64(base64: string): WoxImage;
86
+
87
+ FromRemote(url: string): WoxImage;
88
+ }
89
+
90
+ export const WoxImageBuilder: WoxImageCreator = {
91
+ FromAbsolutePath: (path: string) => {
92
+ return {
93
+ ImageType: "AbsolutePath",
94
+ ImageData: path
95
+ };
96
+ },
97
+
98
+ FromRelativeToPluginPath: (path: string) => {
99
+ return {
100
+ ImageType: "RelativeToPluginPath",
101
+ ImageData: path
102
+ };
103
+ },
104
+
105
+ FromSvg: (svg: string) => {
106
+ return {
107
+ ImageType: "Svg",
108
+ ImageData: svg
109
+ };
110
+ },
111
+
112
+ FromBase64: (base64: string) => {
113
+ return {
114
+ ImageType: "Base64",
115
+ ImageData: base64
116
+ };
117
+ },
118
+
119
+ FromRemote: (url: string) => {
120
+ return {
121
+ ImageType: "Remote",
122
+ ImageData: url
123
+ };
124
+ }
125
+ };