@wox-launcher/wox-plugin 0.0.49 → 0.0.51

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 (2) hide show
  1. package/dist/index.d.ts +28 -3
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -2,28 +2,48 @@ export interface Plugin {
2
2
  init: (context: PluginInitContext) => Promise<void>;
3
3
  query: (query: Query) => Promise<Result[]>;
4
4
  }
5
+ export interface Selection {
6
+ Type: "text" | "file";
7
+ Text: string;
8
+ FilePaths: string[];
9
+ }
5
10
  export interface Query {
6
11
  /**
7
- * Type of a query.
12
+ * By default, Wox will only pass input query to plugin.
13
+ * plugin author need to enable MetadataFeatureQuerySelection feature to handle selection query
8
14
  */
9
- Type: "text" | "file";
15
+ Type: "input" | "selection";
10
16
  /**
11
17
  * Raw query, this includes trigger keyword if it has
12
18
  * We didn't recommend use this property directly. You should always use Search property.
19
+ *
20
+ * NOTE: Only available when query type is input
13
21
  */
14
22
  RawQuery: string;
15
23
  /**
16
24
  * Trigger keyword of a query. It can be empty if user is using global trigger keyword.
25
+ *
26
+ * NOTE: Only available when query type is input
17
27
  */
18
28
  TriggerKeyword?: string;
19
29
  /**
20
30
  * Command part of a query.
31
+ *
32
+ * NOTE: Only available when query type is input
21
33
  */
22
34
  Command?: string;
23
35
  /**
24
36
  * Search part of a query.
37
+ *
38
+ * NOTE: Only available when query type is input
25
39
  */
26
40
  Search: string;
41
+ /**
42
+ * User selected or drag-drop data, can be text or file or image etc
43
+ *
44
+ * NOTE: Only available when query type is selection
45
+ */
46
+ Selection: Selection;
27
47
  }
28
48
  export interface Result {
29
49
  Id?: string;
@@ -70,11 +90,16 @@ export interface PluginInitContext {
70
90
  API: PublicAPI;
71
91
  PluginDirectory: string;
72
92
  }
93
+ export interface ChangeQueryParam {
94
+ QueryType: "input" | "selection";
95
+ QueryText?: string;
96
+ QuerySelection?: Selection;
97
+ }
73
98
  export interface PublicAPI {
74
99
  /**
75
100
  * Change Wox query
76
101
  */
77
- ChangeQuery: (query: string) => Promise<void>;
102
+ ChangeQuery: (query: ChangeQueryParam) => Promise<void>;
78
103
  /**
79
104
  * Hide Wox
80
105
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wox-launcher/wox-plugin",
3
- "version": "0.0.49",
3
+ "version": "0.0.51",
4
4
  "description": "All nodejs plugin for Wox should use types in this package",
5
5
  "repository": {
6
6
  "type": "git",