@wox-launcher/wox-plugin 0.0.100 → 0.0.103

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/package.json +1 -1
  2. package/types/index.d.ts +27 -11
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wox-launcher/wox-plugin",
3
- "version": "0.0.100",
3
+ "version": "0.0.103",
4
4
  "description": "All nodejs plugin for Wox should use types in this package",
5
5
  "repository": {
6
6
  "type": "git",
package/types/index.d.ts CHANGED
@@ -40,6 +40,10 @@ export interface QueryEnv {
40
40
  }
41
41
 
42
42
  export interface Query {
43
+ /**
44
+ * Query id passed from UI to correlate async updates.
45
+ */
46
+ Id: string
43
47
  /**
44
48
  * By default, Wox will only pass input query to plugin.
45
49
  * plugin author need to enable MetadataFeatureQuerySelection feature to handle selection query
@@ -171,7 +175,7 @@ export interface ExecuteResultAction {
171
175
  * If true, Wox will not hide after user select this result
172
176
  */
173
177
  PreventHideAfterAction?: boolean
174
- Action: (actionContext: ActionContext) => Promise<void>
178
+ Action: (ctx: Context, actionContext: ActionContext) => Promise<void>
175
179
  /**
176
180
  * Hotkey to trigger this action. E.g. "ctrl+Shift+Space", "Ctrl+1", "Command+K"
177
181
  * Case insensitive, space insensitive
@@ -203,7 +207,7 @@ export interface FormResultAction {
203
207
  */
204
208
  PreventHideAfterAction?: boolean
205
209
  Form: PluginSettingDefinitionItem[]
206
- OnSubmit: (actionContext: FormActionContext) => Promise<void>
210
+ OnSubmit: (ctx: Context, actionContext: FormActionContext) => Promise<void>
207
211
  /**
208
212
  * Hotkey to trigger this action. E.g. "ctrl+Shift+Space", "Ctrl+1", "Command+K"
209
213
  * Case insensitive, space insensitive
@@ -329,22 +333,22 @@ export interface PublicAPI {
329
333
  /**
330
334
  * Register setting changed callback
331
335
  */
332
- OnSettingChanged: (ctx: Context, callback: (key: string, value: string) => void) => Promise<void>
336
+ OnSettingChanged: (ctx: Context, callback: (ctx: Context, key: string, value: string) => void) => Promise<void>
333
337
 
334
338
  /**
335
339
  * Get dynamic setting definition
336
340
  */
337
- OnGetDynamicSetting: (ctx: Context, callback: (key: string) => PluginSettingDefinitionItem) => Promise<void>
341
+ OnGetDynamicSetting: (ctx: Context, callback: (ctx: Context, key: string) => PluginSettingDefinitionItem) => Promise<void>
338
342
 
339
343
  /**
340
344
  * Register deep link callback
341
345
  */
342
- OnDeepLink: (ctx: Context, callback: (arguments: MapString) => void) => Promise<void>
346
+ OnDeepLink: (ctx: Context, callback: (ctx: Context, arguments: MapString) => void) => Promise<void>
343
347
 
344
348
  /**
345
349
  * Register on load event
346
350
  */
347
- OnUnload: (ctx: Context, callback: () => Promise<void>) => Promise<void>
351
+ OnUnload: (ctx: Context, callback: (ctx: Context) => Promise<void>) => Promise<void>
348
352
 
349
353
  /**
350
354
  * Register query commands
@@ -362,7 +366,7 @@ export interface PublicAPI {
362
366
  * @param callback Callback function that takes MRUData and returns Result or null
363
367
  * Return null if the MRU data is no longer valid
364
368
  */
365
- OnMRURestore: (ctx: Context, callback: (mruData: MRUData) => Promise<Result | null>) => Promise<void>
369
+ OnMRURestore: (ctx: Context, callback: (ctx: Context, mruData: MRUData) => Promise<Result | null>) => Promise<void>
366
370
 
367
371
  /**
368
372
  * Get the current state of a result that is displayed in the UI.
@@ -376,7 +380,7 @@ export interface PublicAPI {
376
380
  * Example:
377
381
  * ```typescript
378
382
  * // In an action handler
379
- * Action: async (actionContext) => {
383
+ * Action: async (ctx, actionContext) => {
380
384
  * // Get current result state
381
385
  * const updatableResult = await api.GetUpdatableResult(ctx, actionContext.ResultId)
382
386
  * if (updatableResult === null) {
@@ -413,7 +417,7 @@ export interface PublicAPI {
413
417
  * Example:
414
418
  * ```typescript
415
419
  * // In an action handler
416
- * Action: async (actionContext) => {
420
+ * Action: async (ctx, actionContext) => {
417
421
  * // Update only the title
418
422
  * const success = await api.UpdateResult(ctx, {
419
423
  * Id: actionContext.ResultId,
@@ -435,13 +439,25 @@ export interface PublicAPI {
435
439
  */
436
440
  UpdateResult: (ctx: Context, result: UpdatableResult) => Promise<boolean>
437
441
 
442
+ /**
443
+ * Push additional results for the current query.
444
+ *
445
+ * Returns true if UI accepted the results (query still active),
446
+ * false if query is no longer active.
447
+ *
448
+ * @param ctx Context
449
+ * @param query Current query
450
+ * @param results Results to append
451
+ */
452
+ PushResults: (ctx: Context, query: Query, results: Result[]) => Promise<boolean>
453
+
438
454
  /**
439
455
  * Re-execute the current query with the existing query text.
440
456
  * This is useful when plugin data changes and you want to update the displayed results.
441
457
  *
442
458
  * Example - Refresh after marking item as favorite:
443
459
  * ```typescript
444
- * Action: async (actionContext) => {
460
+ * Action: async (ctx, actionContext) => {
445
461
  * markAsFavorite(item)
446
462
  * // Refresh query and preserve user's current selection
447
463
  * await api.RefreshQuery(ctx, { PreserveSelectedIndex: true })
@@ -450,7 +466,7 @@ export interface PublicAPI {
450
466
  *
451
467
  * Example - Refresh after deleting item:
452
468
  * ```typescript
453
- * Action: async (actionContext) => {
469
+ * Action: async (ctx, actionContext) => {
454
470
  * deleteItem(item)
455
471
  * // Refresh query and reset to first item
456
472
  * await api.RefreshQuery(ctx, { PreserveSelectedIndex: false })