@wox-launcher/wox-plugin 0.0.109 → 0.0.113

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/README.md CHANGED
@@ -139,17 +139,47 @@ Define settings for your plugin:
139
139
 
140
140
  ```typescript
141
141
  const settings: PluginSettingDefinitionItem[] = [
142
- createTextboxSetting({
143
- key: "apiKey",
144
- label: "API Key",
145
- tooltip: "Enter your API key",
146
- defaultValue: ""
147
- }),
148
- createCheckboxSetting({
149
- key: "enabled",
150
- label: "Enable Feature",
151
- defaultValue: "true"
152
- })
142
+ {
143
+ Type: "textbox",
144
+ Value: {
145
+ Key: "apiKey",
146
+ Label: "API Key",
147
+ Suffix: "",
148
+ DefaultValue: "",
149
+ Tooltip: "Enter your API key",
150
+ MaxLines: 1,
151
+ Validators: [],
152
+ Style: {
153
+ PaddingLeft: 0,
154
+ PaddingTop: 0,
155
+ PaddingRight: 0,
156
+ PaddingBottom: 0,
157
+ Width: 0,
158
+ LabelWidth: 0
159
+ }
160
+ } as PluginSettingValueTextBox,
161
+ DisabledInPlatforms: [],
162
+ IsPlatformSpecific: false
163
+ },
164
+ {
165
+ Type: "checkbox",
166
+ Value: {
167
+ Key: "enabled",
168
+ Label: "Enable Feature",
169
+ DefaultValue: "true",
170
+ Tooltip: "",
171
+ Style: {
172
+ PaddingLeft: 0,
173
+ PaddingTop: 0,
174
+ PaddingRight: 0,
175
+ PaddingBottom: 0,
176
+ Width: 0,
177
+ LabelWidth: 0
178
+ }
179
+ } as PluginSettingValueCheckBox,
180
+ DisabledInPlatforms: [],
181
+ IsPlatformSpecific: false
182
+ }
153
183
  ]
154
184
  ```
155
185
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wox-launcher/wox-plugin",
3
- "version": "0.0.109",
3
+ "version": "0.0.113",
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
@@ -558,6 +558,8 @@ export interface UpdatableResult {
558
558
  Title?: string
559
559
  /** Optional - update the subtitle */
560
560
  SubTitle?: string
561
+ /** Optional - update the icon */
562
+ Icon?: WoxImage
561
563
  /** Optional - update the tails */
562
564
  Tails?: ResultTail[]
563
565
  /** Optional - update the preview */
@@ -704,16 +706,23 @@ export interface ExecuteResultAction {
704
706
  * Name: "Create New Item",
705
707
  * Icon: { ImageType: "emoji", ImageData: "➕" },
706
708
  * Form: [
707
- * createTextboxSetting({
708
- * key: "name",
709
- * label: "Name",
710
- * defaultValue: ""
711
- * }),
712
- * createCheckboxSetting({
713
- * key: "enabled",
714
- * label: "Enable",
715
- * defaultValue: "true"
716
- * })
709
+ * {
710
+ * Key: "name",
711
+ * Label: "Name",
712
+ * Suffix: "",
713
+ * DefaultValue: "",
714
+ * Tooltip: "",
715
+ * MaxLines: 1,
716
+ * Validators: [],
717
+ * Style: {} as PluginSettingValueStyle
718
+ * } as PluginSettingValueTextBox,
719
+ * {
720
+ * Key: "enabled",
721
+ * Label: "Enable",
722
+ * DefaultValue: "true",
723
+ * Tooltip: "",
724
+ * Style: {} as PluginSettingValueStyle
725
+ * } as PluginSettingValueCheckBox
717
726
  * ],
718
727
  * OnSubmit: async (ctx, formCtx) => {
719
728
  * console.log("Name:", formCtx.Values["name"])
@@ -1,4 +1,4 @@
1
- import { Context, Platform } from "./index.js"
1
+ import { Platform } from "./index.js"
2
2
 
3
3
  /**
4
4
  * Type of plugin setting UI element.
@@ -19,7 +19,6 @@ import { Context, Platform } from "./index.js"
19
19
  */
20
20
  export type PluginSettingDefinitionType = "head" | "textbox" | "checkbox" | "select" | "label" | "newline" | "table" | "dynamic"
21
21
 
22
-
23
22
  /**
24
23
  * Visual styling properties for a setting element.
25
24
  *
@@ -69,32 +68,8 @@ export interface PluginSettingValueStyle {
69
68
 
70
69
  /**
71
70
  * Base interface for all setting value types.
72
- *
73
- * Provides common methods for key retrieval, default values,
74
- * and translation.
75
71
  */
76
- export interface PluginSettingDefinitionValue {
77
- /**
78
- * Get the setting key.
79
- *
80
- * Used to store and retrieve the setting value.
81
- *
82
- * @returns The unique key for this setting
83
- */
84
- GetKey: () => string
85
- /**
86
- * Get the default value for this setting.
87
- *
88
- * @returns The default value as a string
89
- */
90
- GetDefaultValue: () => string
91
- /**
92
- * Translate labels and messages.
93
- *
94
- * @param translator - Translation function that takes context and key
95
- */
96
- Translate: (translator: (ctx: Context, key: string) => string) => void
97
- }
72
+ export interface PluginSettingDefinitionValue {}
98
73
 
99
74
  /**
100
75
  * A single setting item in the plugin settings UI.
@@ -105,11 +80,16 @@ export interface PluginSettingDefinitionValue {
105
80
  * ```typescript
106
81
  * const setting: PluginSettingDefinitionItem = {
107
82
  * Type: "textbox",
108
- * Value: createTextboxSetting({
109
- * key: "apiKey",
110
- * label: "API Key",
111
- * defaultValue: ""
112
- * }),
83
+ * Value: {
84
+ * Key: "apiKey",
85
+ * Label: "API Key",
86
+ * Suffix: "",
87
+ * DefaultValue: "",
88
+ * Tooltip: "",
89
+ * MaxLines: 1,
90
+ * Validators: [],
91
+ * Style: {} as PluginSettingValueStyle
92
+ * } as PluginSettingValueTextBox,
113
93
  * DisabledInPlatforms: ["linux"],
114
94
  * IsPlatformSpecific: false
115
95
  * }
@@ -185,10 +165,7 @@ export interface MetadataCommand {
185
165
  * Label: "Enable Feature",
186
166
  * DefaultValue: "true",
187
167
  * Tooltip: "When enabled, the feature will be active",
188
- * Style: defaultStyle,
189
- * GetKey: () => "enabled",
190
- * GetDefaultValue: () => "true",
191
- * Translate: (translator) => {}
168
+ * Style: {} as PluginSettingValueStyle
192
169
  * }
193
170
  * ```
194
171
  */
@@ -215,6 +192,62 @@ export interface PluginSettingValueCheckBox extends PluginSettingDefinitionValue
215
192
  Style: PluginSettingValueStyle
216
193
  }
217
194
 
195
+ /**
196
+ * Textbox setting value configuration.
197
+ *
198
+ * Represents a text input field in the settings UI.
199
+ *
200
+ * @example
201
+ * ```typescript
202
+ * const textbox: PluginSettingValueTextBox = {
203
+ * Key: "apiKey",
204
+ * Label: "API Key",
205
+ * Suffix: "",
206
+ * DefaultValue: "",
207
+ * Tooltip: "Enter your API key",
208
+ * MaxLines: 1,
209
+ * Validators: [],
210
+ * Style: {} as PluginSettingValueStyle
211
+ * }
212
+ * ```
213
+ */
214
+ export interface PluginSettingValueTextBox extends PluginSettingDefinitionValue {
215
+ /**
216
+ * Unique key for storing this setting.
217
+ */
218
+ Key: string
219
+ /**
220
+ * Display label for the textbox.
221
+ */
222
+ Label: string
223
+ /**
224
+ * Suffix text displayed after the value.
225
+ */
226
+ Suffix: string
227
+ /**
228
+ * Default value.
229
+ */
230
+ DefaultValue: string
231
+ /**
232
+ * Tooltip shown on hover.
233
+ */
234
+ Tooltip: string
235
+ /**
236
+ * Max lines for the textbox. Default is 1.
237
+ */
238
+ MaxLines: number
239
+ /**
240
+ * Validation rules for the input value.
241
+ *
242
+ * All validators must be satisfied for the value to be valid.
243
+ */
244
+ Validators: PluginSettingValidator[]
245
+ /**
246
+ * Visual styling for this element.
247
+ */
248
+ Style: PluginSettingValueStyle
249
+ }
250
+
218
251
  /**
219
252
  * Dynamic setting value configuration.
220
253
  *
@@ -224,13 +257,22 @@ export interface PluginSettingValueCheckBox extends PluginSettingDefinitionValue
224
257
  * ```typescript
225
258
  * await api.OnGetDynamicSetting(ctx, (ctx, key) => {
226
259
  * if (key === "dynamicOption") {
227
- * return createTextboxSetting({
228
- * key: "dynamicOption",
229
- * label: "Dynamic Option",
230
- * defaultValue: "loaded from callback"
231
- * })
260
+ * return {
261
+ * Key: "dynamicOption",
262
+ * Label: "Dynamic Option",
263
+ * Suffix: "",
264
+ * DefaultValue: "loaded from callback",
265
+ * Tooltip: "",
266
+ * MaxLines: 1,
267
+ * Validators: [],
268
+ * Style: {} as PluginSettingValueStyle
269
+ * } as PluginSettingValueTextBox
232
270
  * }
233
- * return createLabelSetting({ content: "Unknown setting" })
271
+ * return {
272
+ * Content: "Unknown setting",
273
+ * Tooltip: "",
274
+ * Style: {} as PluginSettingValueStyle
275
+ * } as PluginSettingValueLabel
234
276
  * })
235
277
  * ```
236
278
  */
@@ -254,10 +296,7 @@ export interface PluginSettingValueDynamic extends PluginSettingDefinitionValue
254
296
  * const head: PluginSettingValueHead = {
255
297
  * Content: "API Configuration",
256
298
  * Tooltip: "Configure your API credentials",
257
- * Style: { ...defaultStyle, PaddingTop: 20 },
258
- * GetKey: () => "",
259
- * GetDefaultValue: () => "",
260
- * Translate: () => {}
299
+ * Style: { ...({} as PluginSettingValueStyle), PaddingTop: 20 }
261
300
  * }
262
301
  * ```
263
302
  */
@@ -286,10 +325,7 @@ export interface PluginSettingValueHead extends PluginSettingDefinitionValue {
286
325
  * const label: PluginSettingValueLabel = {
287
326
  * Content: "Note: API key is required for this feature to work.",
288
327
  * Tooltip: "",
289
- * Style: defaultStyle,
290
- * GetKey: () => "",
291
- * GetDefaultValue: () => "",
292
- * Translate: () => {}
328
+ * Style: {} as PluginSettingValueStyle
293
329
  * }
294
330
  * ```
295
331
  */
@@ -316,10 +352,7 @@ export interface PluginSettingValueLabel extends PluginSettingDefinitionValue {
316
352
  * @example
317
353
  * ```typescript
318
354
  * const newline: PluginSettingValueNewline = {
319
- * Style: defaultStyle,
320
- * GetKey: () => "",
321
- * GetDefaultValue: () => "",
322
- * Translate: () => {}
355
+ * Style: {} as PluginSettingValueStyle
323
356
  * }
324
357
  * ```
325
358
  */
@@ -348,10 +381,7 @@ export interface PluginSettingValueNewline extends PluginSettingDefinitionValue
348
381
  * { Label: "Light", Value: "light" }
349
382
  * ],
350
383
  * Validators: [],
351
- * Style: defaultStyle,
352
- * GetKey: () => "theme",
353
- * GetDefaultValue: () => "dark",
354
- * Translate: () => {}
384
+ * Style: {} as PluginSettingValueStyle
355
385
  * }
356
386
  * ```
357
387
  */
@@ -508,6 +538,4 @@ export interface PluginSettingValidatorIsNumber extends PluginSettingValidatorVa
508
538
  * }
509
539
  * ```
510
540
  */
511
- export interface PluginSettingValidatorNotEmpty extends PluginSettingValidatorValue {
512
-
513
- }
541
+ export interface PluginSettingValidatorNotEmpty extends PluginSettingValidatorValue {}