@wox-launcher/wox-plugin 0.0.89 → 0.0.91

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 +36 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wox-launcher/wox-plugin",
3
- "version": "0.0.89",
3
+ "version": "0.0.91",
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
@@ -258,6 +258,15 @@ export interface ChangeQueryParam {
258
258
  QuerySelection?: Selection
259
259
  }
260
260
 
261
+ export interface RefreshQueryOption {
262
+ /**
263
+ * Controls whether to maintain the previously selected item index after refresh.
264
+ * When true, the user's current selection index in the results list is preserved.
265
+ * When false, the selection resets to the first item (index 0).
266
+ */
267
+ PreserveSelectedIndex: boolean
268
+ }
269
+
261
270
  export interface PublicAPI {
262
271
  /**
263
272
  * Change Wox query
@@ -460,6 +469,33 @@ export interface PublicAPI {
460
469
  * @returns Promise<boolean> True if updated successfully, false if result no longer visible
461
470
  */
462
471
  UpdateResultAction: (ctx: Context, action: UpdatableResultAction) => Promise<boolean>
472
+
473
+ /**
474
+ * Re-execute the current query with the existing query text.
475
+ * This is useful when plugin data changes and you want to update the displayed results.
476
+ *
477
+ * Example - Refresh after marking item as favorite:
478
+ * ```typescript
479
+ * Action: async (actionContext) => {
480
+ * markAsFavorite(item)
481
+ * // Refresh query and preserve user's current selection
482
+ * await api.RefreshQuery(ctx, { PreserveSelectedIndex: true })
483
+ * }
484
+ * ```
485
+ *
486
+ * Example - Refresh after deleting item:
487
+ * ```typescript
488
+ * Action: async (actionContext) => {
489
+ * deleteItem(item)
490
+ * // Refresh query and reset to first item
491
+ * await api.RefreshQuery(ctx, { PreserveSelectedIndex: false })
492
+ * }
493
+ * ```
494
+ *
495
+ * @param ctx Context
496
+ * @param option RefreshQueryOption to control refresh behavior
497
+ */
498
+ RefreshQuery: (ctx: Context, option: RefreshQueryOption) => Promise<void>
463
499
  }
464
500
 
465
501
  export type WoxImageType = "absolute" | "relative" | "base64" | "svg" | "url" | "emoji" | "lottie"