@wox-launcher/wox-plugin 0.0.89 → 0.0.90

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