@wox-launcher/wox-plugin 0.0.49 → 0.0.50

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 +34 -3
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -2,28 +2,54 @@ 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
+ * if this query is a shortcut expand query, this property will be origin query before expand
43
+ *
44
+ * NOTE: Only available when query type is input
45
+ */
46
+ ShortcutFrom: string;
47
+ /**
48
+ * User selected or drag-drop data, can be text or file or image etc
49
+ *
50
+ * NOTE: Only available when query type is selection
51
+ */
52
+ Selection: Selection;
27
53
  }
28
54
  export interface Result {
29
55
  Id?: string;
@@ -70,11 +96,16 @@ export interface PluginInitContext {
70
96
  API: PublicAPI;
71
97
  PluginDirectory: string;
72
98
  }
99
+ export interface ChangeQueryParam {
100
+ QueryType: string;
101
+ QueryText: string;
102
+ QuerySelection: Selection;
103
+ }
73
104
  export interface PublicAPI {
74
105
  /**
75
106
  * Change Wox query
76
107
  */
77
- ChangeQuery: (query: string) => Promise<void>;
108
+ ChangeQuery: (query: ChangeQueryParam) => Promise<void>;
78
109
  /**
79
110
  * Hide Wox
80
111
  */
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.50",
4
4
  "description": "All nodejs plugin for Wox should use types in this package",
5
5
  "repository": {
6
6
  "type": "git",