@wox-launcher/wox-plugin 0.0.88 → 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.
- package/package.json +1 -1
- package/types/index.d.ts +51 -9
package/package.json
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -135,7 +135,7 @@ export interface ResultTail {
|
|
|
135
135
|
* })
|
|
136
136
|
* ```
|
|
137
137
|
*/
|
|
138
|
-
export interface
|
|
138
|
+
export interface UpdatableResult {
|
|
139
139
|
/** Required - identifies which result to update */
|
|
140
140
|
Id: string
|
|
141
141
|
/** Optional - update the title */
|
|
@@ -177,7 +177,7 @@ export interface UpdateableResult {
|
|
|
177
177
|
* })
|
|
178
178
|
* ```
|
|
179
179
|
*/
|
|
180
|
-
export interface
|
|
180
|
+
export interface UpdatableResultAction {
|
|
181
181
|
/** Required - identifies which result contains the action */
|
|
182
182
|
ResultId: string
|
|
183
183
|
/** Required - identifies which action to update */
|
|
@@ -214,6 +214,10 @@ export interface ResultAction {
|
|
|
214
214
|
* If IsDefault is true, Hotkey will be set to enter key by default
|
|
215
215
|
*/
|
|
216
216
|
Hotkey?: string
|
|
217
|
+
/**
|
|
218
|
+
* Additional data associate with this action, can be retrieved later
|
|
219
|
+
*/
|
|
220
|
+
ContextData?: string
|
|
217
221
|
}
|
|
218
222
|
|
|
219
223
|
export interface ActionContext {
|
|
@@ -252,6 +256,16 @@ export interface ChangeQueryParam {
|
|
|
252
256
|
QueryType: "input" | "selection"
|
|
253
257
|
QueryText?: string
|
|
254
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
|
|
255
269
|
}
|
|
256
270
|
|
|
257
271
|
export interface PublicAPI {
|
|
@@ -345,7 +359,7 @@ export interface PublicAPI {
|
|
|
345
359
|
/**
|
|
346
360
|
* Get the current state of a result that is displayed in the UI.
|
|
347
361
|
*
|
|
348
|
-
* Returns
|
|
362
|
+
* Returns UpdatableResult with current values if the result is still visible.
|
|
349
363
|
* Returns null if the result is no longer visible.
|
|
350
364
|
*
|
|
351
365
|
* Note: System actions and tails (like favorite icon) are automatically filtered out.
|
|
@@ -372,9 +386,9 @@ export interface PublicAPI {
|
|
|
372
386
|
*
|
|
373
387
|
* @param ctx Context
|
|
374
388
|
* @param resultId ID of the result to get
|
|
375
|
-
* @returns Promise<
|
|
389
|
+
* @returns Promise<UpdatableResult | null> Current result state, or null if not visible
|
|
376
390
|
*/
|
|
377
|
-
GetUpdatableResult: (ctx: Context, resultId: string) => Promise<
|
|
391
|
+
GetUpdatableResult: (ctx: Context, resultId: string) => Promise<UpdatableResult | null>
|
|
378
392
|
|
|
379
393
|
/**
|
|
380
394
|
* Update a query result that is currently displayed in the UI.
|
|
@@ -408,10 +422,10 @@ export interface PublicAPI {
|
|
|
408
422
|
* ```
|
|
409
423
|
*
|
|
410
424
|
* @param ctx Context
|
|
411
|
-
* @param result
|
|
425
|
+
* @param result UpdatableResult with Id (required) and optional fields to update
|
|
412
426
|
* @returns Promise<boolean> True if updated successfully, false if result no longer visible
|
|
413
427
|
*/
|
|
414
|
-
UpdateResult: (ctx: Context, result:
|
|
428
|
+
UpdateResult: (ctx: Context, result: UpdatableResult) => Promise<boolean>
|
|
415
429
|
|
|
416
430
|
/**
|
|
417
431
|
* Update a single action within a query result that is currently displayed in the UI.
|
|
@@ -452,10 +466,38 @@ export interface PublicAPI {
|
|
|
452
466
|
* ```
|
|
453
467
|
*
|
|
454
468
|
* @param ctx Context
|
|
455
|
-
* @param action
|
|
469
|
+
* @param action UpdatableResultAction with ResultId, ActionId (required) and optional fields to update
|
|
456
470
|
* @returns Promise<boolean> True if updated successfully, false if result no longer visible
|
|
457
471
|
*/
|
|
458
|
-
UpdateResultAction: (ctx: Context, action:
|
|
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>
|
|
459
501
|
}
|
|
460
502
|
|
|
461
503
|
export type WoxImageType = "absolute" | "relative" | "base64" | "svg" | "url" | "emoji" | "lottie"
|