@vicinae/api 0.16.2 → 0.16.3
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/dist/api/color.d.ts +2 -1
- package/dist/api/color.js +48 -3
- package/dist/api/components/action-pannel.d.ts +3 -3
- package/dist/api/components/action-pannel.js +4 -2
- package/dist/api/components/actions.d.ts +1 -1
- package/dist/api/components/actions.js +7 -1
- package/dist/api/components/dropdown.d.ts +1 -1
- package/dist/api/components/dropdown.js +3 -1
- package/dist/api/components/empty-view.js +4 -2
- package/dist/api/components/form.d.ts +1 -1
- package/dist/api/components/form.js +3 -1
- package/dist/api/components/grid.d.ts +8 -19
- package/dist/api/components/grid.js +32 -2
- package/dist/api/components/list.d.ts +22 -3
- package/dist/api/components/list.js +49 -2
- package/dist/api/components/metadata.d.ts +1 -1
- package/dist/api/components/metadata.js +5 -1
- package/dist/api/components/tag.d.ts +2 -2
- package/dist/api/components/tag.js +4 -3
- package/dist/api/image.d.ts +7 -5
- package/dist/api/image.js +4 -0
- package/dist/api/proto/daemon.d.ts +4 -1
- package/dist/api/proto/daemon.js +71 -16
- package/dist/api/proto/ui.d.ts +12 -1
- package/dist/api/proto/ui.js +164 -9
- package/dist/commands/build/index.js +5 -2
- package/dist/commands/develop/index.js +7 -2
- package/dist/schemas/manifest.d.ts +254 -4
- package/dist/schemas/manifest.js +202 -4
- package/dist/utils/extension-types.d.ts +14 -0
- package/dist/utils/extension-types.js +162 -0
- package/package.json +1 -1
- package/types/jsx.d.ts +41 -32
|
@@ -38,8 +38,104 @@ declare const _default: z.ZodObject<{
|
|
|
38
38
|
subtitle: z.ZodOptional<z.ZodString>;
|
|
39
39
|
description: z.ZodString;
|
|
40
40
|
interval: z.ZodOptional<z.ZodString>;
|
|
41
|
-
preferences: z.ZodOptional<z.
|
|
42
|
-
|
|
41
|
+
preferences: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
42
|
+
type: z.ZodLiteral<"textfield">;
|
|
43
|
+
placeholder: z.ZodOptional<z.ZodString>;
|
|
44
|
+
default: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
45
|
+
macOS: z.ZodOptional<z.ZodString>;
|
|
46
|
+
Windows: z.ZodOptional<z.ZodString>;
|
|
47
|
+
}, z.core.$strip>]>>;
|
|
48
|
+
name: z.ZodString;
|
|
49
|
+
title: z.ZodString;
|
|
50
|
+
description: z.ZodString;
|
|
51
|
+
required: z.ZodBoolean;
|
|
52
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
53
|
+
type: z.ZodLiteral<"password">;
|
|
54
|
+
placeholder: z.ZodOptional<z.ZodString>;
|
|
55
|
+
default: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
56
|
+
macOS: z.ZodOptional<z.ZodString>;
|
|
57
|
+
Windows: z.ZodOptional<z.ZodString>;
|
|
58
|
+
}, z.core.$strip>]>>;
|
|
59
|
+
name: z.ZodString;
|
|
60
|
+
title: z.ZodString;
|
|
61
|
+
description: z.ZodString;
|
|
62
|
+
required: z.ZodBoolean;
|
|
63
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
64
|
+
type: z.ZodLiteral<"checkbox">;
|
|
65
|
+
label: z.ZodString;
|
|
66
|
+
default: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
|
|
67
|
+
macOS: z.ZodOptional<z.ZodBoolean>;
|
|
68
|
+
Windows: z.ZodOptional<z.ZodBoolean>;
|
|
69
|
+
}, z.core.$strip>]>>;
|
|
70
|
+
name: z.ZodString;
|
|
71
|
+
title: z.ZodString;
|
|
72
|
+
description: z.ZodString;
|
|
73
|
+
required: z.ZodBoolean;
|
|
74
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
75
|
+
type: z.ZodLiteral<"dropdown">;
|
|
76
|
+
data: z.ZodArray<z.ZodObject<{
|
|
77
|
+
title: z.ZodString;
|
|
78
|
+
value: z.ZodString;
|
|
79
|
+
}, z.core.$strip>>;
|
|
80
|
+
default: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
81
|
+
macOS: z.ZodOptional<z.ZodString>;
|
|
82
|
+
Windows: z.ZodOptional<z.ZodString>;
|
|
83
|
+
}, z.core.$strip>]>>;
|
|
84
|
+
name: z.ZodString;
|
|
85
|
+
title: z.ZodString;
|
|
86
|
+
description: z.ZodString;
|
|
87
|
+
required: z.ZodBoolean;
|
|
88
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
89
|
+
type: z.ZodLiteral<"appPicker">;
|
|
90
|
+
default: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
91
|
+
macOS: z.ZodOptional<z.ZodString>;
|
|
92
|
+
Windows: z.ZodOptional<z.ZodString>;
|
|
93
|
+
}, z.core.$strip>]>>;
|
|
94
|
+
name: z.ZodString;
|
|
95
|
+
title: z.ZodString;
|
|
96
|
+
description: z.ZodString;
|
|
97
|
+
required: z.ZodBoolean;
|
|
98
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
99
|
+
type: z.ZodLiteral<"file">;
|
|
100
|
+
default: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
101
|
+
macOS: z.ZodOptional<z.ZodString>;
|
|
102
|
+
Windows: z.ZodOptional<z.ZodString>;
|
|
103
|
+
}, z.core.$strip>]>>;
|
|
104
|
+
name: z.ZodString;
|
|
105
|
+
title: z.ZodString;
|
|
106
|
+
description: z.ZodString;
|
|
107
|
+
required: z.ZodBoolean;
|
|
108
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
109
|
+
type: z.ZodLiteral<"directory">;
|
|
110
|
+
default: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
111
|
+
macOS: z.ZodOptional<z.ZodString>;
|
|
112
|
+
Windows: z.ZodOptional<z.ZodString>;
|
|
113
|
+
}, z.core.$strip>]>>;
|
|
114
|
+
name: z.ZodString;
|
|
115
|
+
title: z.ZodString;
|
|
116
|
+
description: z.ZodString;
|
|
117
|
+
required: z.ZodBoolean;
|
|
118
|
+
}, z.core.$strict>], "type">>>;
|
|
119
|
+
arguments: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
120
|
+
type: z.ZodLiteral<"text">;
|
|
121
|
+
name: z.ZodString;
|
|
122
|
+
placeholder: z.ZodString;
|
|
123
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
124
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
125
|
+
type: z.ZodLiteral<"password">;
|
|
126
|
+
name: z.ZodString;
|
|
127
|
+
placeholder: z.ZodString;
|
|
128
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
129
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
130
|
+
type: z.ZodLiteral<"dropdown">;
|
|
131
|
+
data: z.ZodArray<z.ZodObject<{
|
|
132
|
+
title: z.ZodString;
|
|
133
|
+
value: z.ZodString;
|
|
134
|
+
}, z.core.$strip>>;
|
|
135
|
+
name: z.ZodString;
|
|
136
|
+
placeholder: z.ZodString;
|
|
137
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
138
|
+
}, z.core.$strict>], "type">>>;
|
|
43
139
|
disabledByDefault: z.ZodOptional<z.ZodBoolean>;
|
|
44
140
|
}, z.core.$catchall<z.ZodAny>>>;
|
|
45
141
|
tools: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -52,7 +148,84 @@ declare const _default: z.ZodObject<{
|
|
|
52
148
|
"AI attachment provider": "AI attachment provider";
|
|
53
149
|
"AI tool": "AI tool";
|
|
54
150
|
}>>>;
|
|
55
|
-
preferences: z.ZodOptional<z.
|
|
151
|
+
preferences: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
152
|
+
type: z.ZodLiteral<"textfield">;
|
|
153
|
+
placeholder: z.ZodOptional<z.ZodString>;
|
|
154
|
+
default: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
155
|
+
macOS: z.ZodOptional<z.ZodString>;
|
|
156
|
+
Windows: z.ZodOptional<z.ZodString>;
|
|
157
|
+
}, z.core.$strip>]>>;
|
|
158
|
+
name: z.ZodString;
|
|
159
|
+
title: z.ZodString;
|
|
160
|
+
description: z.ZodString;
|
|
161
|
+
required: z.ZodBoolean;
|
|
162
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
163
|
+
type: z.ZodLiteral<"password">;
|
|
164
|
+
placeholder: z.ZodOptional<z.ZodString>;
|
|
165
|
+
default: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
166
|
+
macOS: z.ZodOptional<z.ZodString>;
|
|
167
|
+
Windows: z.ZodOptional<z.ZodString>;
|
|
168
|
+
}, z.core.$strip>]>>;
|
|
169
|
+
name: z.ZodString;
|
|
170
|
+
title: z.ZodString;
|
|
171
|
+
description: z.ZodString;
|
|
172
|
+
required: z.ZodBoolean;
|
|
173
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
174
|
+
type: z.ZodLiteral<"checkbox">;
|
|
175
|
+
label: z.ZodString;
|
|
176
|
+
default: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
|
|
177
|
+
macOS: z.ZodOptional<z.ZodBoolean>;
|
|
178
|
+
Windows: z.ZodOptional<z.ZodBoolean>;
|
|
179
|
+
}, z.core.$strip>]>>;
|
|
180
|
+
name: z.ZodString;
|
|
181
|
+
title: z.ZodString;
|
|
182
|
+
description: z.ZodString;
|
|
183
|
+
required: z.ZodBoolean;
|
|
184
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
185
|
+
type: z.ZodLiteral<"dropdown">;
|
|
186
|
+
data: z.ZodArray<z.ZodObject<{
|
|
187
|
+
title: z.ZodString;
|
|
188
|
+
value: z.ZodString;
|
|
189
|
+
}, z.core.$strip>>;
|
|
190
|
+
default: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
191
|
+
macOS: z.ZodOptional<z.ZodString>;
|
|
192
|
+
Windows: z.ZodOptional<z.ZodString>;
|
|
193
|
+
}, z.core.$strip>]>>;
|
|
194
|
+
name: z.ZodString;
|
|
195
|
+
title: z.ZodString;
|
|
196
|
+
description: z.ZodString;
|
|
197
|
+
required: z.ZodBoolean;
|
|
198
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
199
|
+
type: z.ZodLiteral<"appPicker">;
|
|
200
|
+
default: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
201
|
+
macOS: z.ZodOptional<z.ZodString>;
|
|
202
|
+
Windows: z.ZodOptional<z.ZodString>;
|
|
203
|
+
}, z.core.$strip>]>>;
|
|
204
|
+
name: z.ZodString;
|
|
205
|
+
title: z.ZodString;
|
|
206
|
+
description: z.ZodString;
|
|
207
|
+
required: z.ZodBoolean;
|
|
208
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
209
|
+
type: z.ZodLiteral<"file">;
|
|
210
|
+
default: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
211
|
+
macOS: z.ZodOptional<z.ZodString>;
|
|
212
|
+
Windows: z.ZodOptional<z.ZodString>;
|
|
213
|
+
}, z.core.$strip>]>>;
|
|
214
|
+
name: z.ZodString;
|
|
215
|
+
title: z.ZodString;
|
|
216
|
+
description: z.ZodString;
|
|
217
|
+
required: z.ZodBoolean;
|
|
218
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
219
|
+
type: z.ZodLiteral<"directory">;
|
|
220
|
+
default: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
221
|
+
macOS: z.ZodOptional<z.ZodString>;
|
|
222
|
+
Windows: z.ZodOptional<z.ZodString>;
|
|
223
|
+
}, z.core.$strip>]>>;
|
|
224
|
+
name: z.ZodString;
|
|
225
|
+
title: z.ZodString;
|
|
226
|
+
description: z.ZodString;
|
|
227
|
+
required: z.ZodBoolean;
|
|
228
|
+
}, z.core.$strict>], "type">>>;
|
|
56
229
|
}, z.core.$catchall<z.ZodAny>>>>;
|
|
57
230
|
ai: z.ZodOptional<z.ZodObject<{
|
|
58
231
|
instructions: z.ZodOptional<z.ZodString>;
|
|
@@ -63,7 +236,84 @@ declare const _default: z.ZodObject<{
|
|
|
63
236
|
}, z.core.$strip>>;
|
|
64
237
|
keywords: z.ZodOptional<z.ZodAny>;
|
|
65
238
|
description: z.ZodString;
|
|
66
|
-
preferences: z.ZodOptional<z.
|
|
239
|
+
preferences: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
240
|
+
type: z.ZodLiteral<"textfield">;
|
|
241
|
+
placeholder: z.ZodOptional<z.ZodString>;
|
|
242
|
+
default: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
243
|
+
macOS: z.ZodOptional<z.ZodString>;
|
|
244
|
+
Windows: z.ZodOptional<z.ZodString>;
|
|
245
|
+
}, z.core.$strip>]>>;
|
|
246
|
+
name: z.ZodString;
|
|
247
|
+
title: z.ZodString;
|
|
248
|
+
description: z.ZodString;
|
|
249
|
+
required: z.ZodBoolean;
|
|
250
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
251
|
+
type: z.ZodLiteral<"password">;
|
|
252
|
+
placeholder: z.ZodOptional<z.ZodString>;
|
|
253
|
+
default: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
254
|
+
macOS: z.ZodOptional<z.ZodString>;
|
|
255
|
+
Windows: z.ZodOptional<z.ZodString>;
|
|
256
|
+
}, z.core.$strip>]>>;
|
|
257
|
+
name: z.ZodString;
|
|
258
|
+
title: z.ZodString;
|
|
259
|
+
description: z.ZodString;
|
|
260
|
+
required: z.ZodBoolean;
|
|
261
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
262
|
+
type: z.ZodLiteral<"checkbox">;
|
|
263
|
+
label: z.ZodString;
|
|
264
|
+
default: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
|
|
265
|
+
macOS: z.ZodOptional<z.ZodBoolean>;
|
|
266
|
+
Windows: z.ZodOptional<z.ZodBoolean>;
|
|
267
|
+
}, z.core.$strip>]>>;
|
|
268
|
+
name: z.ZodString;
|
|
269
|
+
title: z.ZodString;
|
|
270
|
+
description: z.ZodString;
|
|
271
|
+
required: z.ZodBoolean;
|
|
272
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
273
|
+
type: z.ZodLiteral<"dropdown">;
|
|
274
|
+
data: z.ZodArray<z.ZodObject<{
|
|
275
|
+
title: z.ZodString;
|
|
276
|
+
value: z.ZodString;
|
|
277
|
+
}, z.core.$strip>>;
|
|
278
|
+
default: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
279
|
+
macOS: z.ZodOptional<z.ZodString>;
|
|
280
|
+
Windows: z.ZodOptional<z.ZodString>;
|
|
281
|
+
}, z.core.$strip>]>>;
|
|
282
|
+
name: z.ZodString;
|
|
283
|
+
title: z.ZodString;
|
|
284
|
+
description: z.ZodString;
|
|
285
|
+
required: z.ZodBoolean;
|
|
286
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
287
|
+
type: z.ZodLiteral<"appPicker">;
|
|
288
|
+
default: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
289
|
+
macOS: z.ZodOptional<z.ZodString>;
|
|
290
|
+
Windows: z.ZodOptional<z.ZodString>;
|
|
291
|
+
}, z.core.$strip>]>>;
|
|
292
|
+
name: z.ZodString;
|
|
293
|
+
title: z.ZodString;
|
|
294
|
+
description: z.ZodString;
|
|
295
|
+
required: z.ZodBoolean;
|
|
296
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
297
|
+
type: z.ZodLiteral<"file">;
|
|
298
|
+
default: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
299
|
+
macOS: z.ZodOptional<z.ZodString>;
|
|
300
|
+
Windows: z.ZodOptional<z.ZodString>;
|
|
301
|
+
}, z.core.$strip>]>>;
|
|
302
|
+
name: z.ZodString;
|
|
303
|
+
title: z.ZodString;
|
|
304
|
+
description: z.ZodString;
|
|
305
|
+
required: z.ZodBoolean;
|
|
306
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
307
|
+
type: z.ZodLiteral<"directory">;
|
|
308
|
+
default: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
309
|
+
macOS: z.ZodOptional<z.ZodString>;
|
|
310
|
+
Windows: z.ZodOptional<z.ZodString>;
|
|
311
|
+
}, z.core.$strip>]>>;
|
|
312
|
+
name: z.ZodString;
|
|
313
|
+
title: z.ZodString;
|
|
314
|
+
description: z.ZodString;
|
|
315
|
+
required: z.ZodBoolean;
|
|
316
|
+
}, z.core.$strict>], "type">>>;
|
|
67
317
|
categories: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
68
318
|
Web: "Web";
|
|
69
319
|
Applications: "Applications";
|
package/dist/schemas/manifest.js
CHANGED
|
@@ -1,6 +1,204 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const zod_1 = require("zod");
|
|
4
|
+
// Preference schema for extension and command preferences
|
|
5
|
+
const preferenceBase = {
|
|
6
|
+
name: zod_1.z.string().min(1).describe("A unique id for the preference."),
|
|
7
|
+
title: zod_1.z
|
|
8
|
+
.string()
|
|
9
|
+
.describe("The display name of the preference shown in Raycast preferences. For 'checkbox', 'textfield' and 'password', it is shown as a section title above the respective input element. If you want to group multiple checkboxes into a single section, set the 'title' of the first checkbox and leave the 'title' of the other checkboxes empty."),
|
|
10
|
+
description: zod_1.z
|
|
11
|
+
.string()
|
|
12
|
+
.describe("It helps users understand what the preference does. It will be displayed as a tooltip when hovering over it."),
|
|
13
|
+
required: zod_1.z
|
|
14
|
+
.boolean()
|
|
15
|
+
.describe("Indicates whether the value is required and must be entered by the user before the extension is usable."),
|
|
16
|
+
};
|
|
17
|
+
const preferenceSchema = zod_1.z.discriminatedUnion("type", [
|
|
18
|
+
// textfield preference
|
|
19
|
+
zod_1.z
|
|
20
|
+
.object({
|
|
21
|
+
...preferenceBase,
|
|
22
|
+
type: zod_1.z.literal("textfield"),
|
|
23
|
+
placeholder: zod_1.z
|
|
24
|
+
.string()
|
|
25
|
+
.describe("Text displayed in the preference's field when no value has been input.")
|
|
26
|
+
.optional(),
|
|
27
|
+
default: zod_1.z
|
|
28
|
+
.union([
|
|
29
|
+
zod_1.z.string(),
|
|
30
|
+
zod_1.z.object({
|
|
31
|
+
macOS: zod_1.z.string().optional(),
|
|
32
|
+
Windows: zod_1.z.string().optional(),
|
|
33
|
+
}),
|
|
34
|
+
])
|
|
35
|
+
.describe("The optional default value for the field. For textfields, this is a string value. Additionally, you can specify a different value per platform by passing an object: { 'macOS': ..., 'Windows': ... }.")
|
|
36
|
+
.optional(),
|
|
37
|
+
})
|
|
38
|
+
.strict(),
|
|
39
|
+
// password preference
|
|
40
|
+
zod_1.z
|
|
41
|
+
.object({
|
|
42
|
+
...preferenceBase,
|
|
43
|
+
type: zod_1.z.literal("password"),
|
|
44
|
+
placeholder: zod_1.z
|
|
45
|
+
.string()
|
|
46
|
+
.describe("Text displayed in the preference's field when no value has been input.")
|
|
47
|
+
.optional(),
|
|
48
|
+
default: zod_1.z
|
|
49
|
+
.union([
|
|
50
|
+
zod_1.z.string(),
|
|
51
|
+
zod_1.z.object({
|
|
52
|
+
macOS: zod_1.z.string().optional(),
|
|
53
|
+
Windows: zod_1.z.string().optional(),
|
|
54
|
+
}),
|
|
55
|
+
])
|
|
56
|
+
.describe("The optional default value for the field. For passwords, this is a string value. Additionally, you can specify a different value per platform by passing an object: { 'macOS': ..., 'Windows': ... }.")
|
|
57
|
+
.optional(),
|
|
58
|
+
})
|
|
59
|
+
.strict(),
|
|
60
|
+
// checkbox preference
|
|
61
|
+
zod_1.z
|
|
62
|
+
.object({
|
|
63
|
+
...preferenceBase,
|
|
64
|
+
type: zod_1.z.literal("checkbox"),
|
|
65
|
+
label: zod_1.z
|
|
66
|
+
.string()
|
|
67
|
+
.min(1)
|
|
68
|
+
.describe("The label of the checkbox. Shown next to the checkbox."),
|
|
69
|
+
default: zod_1.z
|
|
70
|
+
.union([
|
|
71
|
+
zod_1.z.boolean(),
|
|
72
|
+
zod_1.z.object({
|
|
73
|
+
macOS: zod_1.z.boolean().optional(),
|
|
74
|
+
Windows: zod_1.z.boolean().optional(),
|
|
75
|
+
}),
|
|
76
|
+
])
|
|
77
|
+
.describe("The optional default value for the field. For checkboxes, this is a boolean value. Additionally, you can specify a different value per platform by passing an object: { 'macOS': ..., 'Windows': ... }.")
|
|
78
|
+
.optional(),
|
|
79
|
+
})
|
|
80
|
+
.strict(),
|
|
81
|
+
// dropdown preference
|
|
82
|
+
zod_1.z
|
|
83
|
+
.object({
|
|
84
|
+
...preferenceBase,
|
|
85
|
+
type: zod_1.z.literal("dropdown"),
|
|
86
|
+
data: zod_1.z
|
|
87
|
+
.array(zod_1.z.object({
|
|
88
|
+
title: zod_1.z.string(),
|
|
89
|
+
value: zod_1.z.string(),
|
|
90
|
+
}))
|
|
91
|
+
.min(1)
|
|
92
|
+
.describe("An array of objects with 'title' and 'value' properties, e.g.: [{'title': 'Item 1', 'value': '1'}]"),
|
|
93
|
+
default: zod_1.z
|
|
94
|
+
.union([
|
|
95
|
+
zod_1.z.string(),
|
|
96
|
+
zod_1.z.object({
|
|
97
|
+
macOS: zod_1.z.string().optional(),
|
|
98
|
+
Windows: zod_1.z.string().optional(),
|
|
99
|
+
}),
|
|
100
|
+
])
|
|
101
|
+
.describe("The optional default value for the field. For dropdowns, this is the value of an object in the data array. Additionally, you can specify a different value per platform by passing an object: { 'macOS': ..., 'Windows': ... }.")
|
|
102
|
+
.optional(),
|
|
103
|
+
})
|
|
104
|
+
.strict(),
|
|
105
|
+
// appPicker preference
|
|
106
|
+
zod_1.z
|
|
107
|
+
.object({
|
|
108
|
+
...preferenceBase,
|
|
109
|
+
type: zod_1.z.literal("appPicker"),
|
|
110
|
+
default: zod_1.z
|
|
111
|
+
.union([
|
|
112
|
+
zod_1.z.string(),
|
|
113
|
+
zod_1.z.object({
|
|
114
|
+
macOS: zod_1.z.string().optional(),
|
|
115
|
+
Windows: zod_1.z.string().optional(),
|
|
116
|
+
}),
|
|
117
|
+
])
|
|
118
|
+
.describe("The optional default value for the field. For appPickers, this is an application name, bundle ID or path. Additionally, you can specify a different value per platform by passing an object: { 'macOS': ..., 'Windows': ... }.")
|
|
119
|
+
.optional(),
|
|
120
|
+
})
|
|
121
|
+
.strict(),
|
|
122
|
+
// file preference
|
|
123
|
+
zod_1.z
|
|
124
|
+
.object({
|
|
125
|
+
...preferenceBase,
|
|
126
|
+
type: zod_1.z.literal("file"),
|
|
127
|
+
default: zod_1.z
|
|
128
|
+
.union([
|
|
129
|
+
zod_1.z.string(),
|
|
130
|
+
zod_1.z.object({
|
|
131
|
+
macOS: zod_1.z.string().optional(),
|
|
132
|
+
Windows: zod_1.z.string().optional(),
|
|
133
|
+
}),
|
|
134
|
+
])
|
|
135
|
+
.describe("The optional default value for the field. For file preferences, this is a file path. Additionally, you can specify a different value per platform by passing an object: { 'macOS': ..., 'Windows': ... }.")
|
|
136
|
+
.optional(),
|
|
137
|
+
})
|
|
138
|
+
.strict(),
|
|
139
|
+
// directory preference
|
|
140
|
+
zod_1.z
|
|
141
|
+
.object({
|
|
142
|
+
...preferenceBase,
|
|
143
|
+
type: zod_1.z.literal("directory"),
|
|
144
|
+
default: zod_1.z
|
|
145
|
+
.union([
|
|
146
|
+
zod_1.z.string(),
|
|
147
|
+
zod_1.z.object({
|
|
148
|
+
macOS: zod_1.z.string().optional(),
|
|
149
|
+
Windows: zod_1.z.string().optional(),
|
|
150
|
+
}),
|
|
151
|
+
])
|
|
152
|
+
.describe("The optional default value for the field. For directory preferences, this is a directory path. Additionally, you can specify a different value per platform by passing an object: { 'macOS': ..., 'Windows': ... }.")
|
|
153
|
+
.optional(),
|
|
154
|
+
})
|
|
155
|
+
.strict(),
|
|
156
|
+
]);
|
|
157
|
+
// Argument schema for command arguments
|
|
158
|
+
const argumentBase = {
|
|
159
|
+
name: zod_1.z
|
|
160
|
+
.string()
|
|
161
|
+
.min(1)
|
|
162
|
+
.describe("A unique id for the argument. This value will be used to as the key in the object passed as top-level prop."),
|
|
163
|
+
placeholder: zod_1.z
|
|
164
|
+
.string()
|
|
165
|
+
.min(1)
|
|
166
|
+
.describe("Placeholder for the argument's input field."),
|
|
167
|
+
required: zod_1.z
|
|
168
|
+
.boolean()
|
|
169
|
+
.describe("Indicates whether the value is required and must be entered by the user before the command is opened. Default value for this is 'false'.")
|
|
170
|
+
.optional(),
|
|
171
|
+
};
|
|
172
|
+
const argumentSchema = zod_1.z.discriminatedUnion("type", [
|
|
173
|
+
// text argument
|
|
174
|
+
zod_1.z
|
|
175
|
+
.object({
|
|
176
|
+
...argumentBase,
|
|
177
|
+
type: zod_1.z.literal("text"),
|
|
178
|
+
})
|
|
179
|
+
.strict(),
|
|
180
|
+
// password argument
|
|
181
|
+
zod_1.z
|
|
182
|
+
.object({
|
|
183
|
+
...argumentBase,
|
|
184
|
+
type: zod_1.z.literal("password"),
|
|
185
|
+
})
|
|
186
|
+
.strict(),
|
|
187
|
+
// dropdown argument
|
|
188
|
+
zod_1.z
|
|
189
|
+
.object({
|
|
190
|
+
...argumentBase,
|
|
191
|
+
type: zod_1.z.literal("dropdown"),
|
|
192
|
+
data: zod_1.z
|
|
193
|
+
.array(zod_1.z.object({
|
|
194
|
+
title: zod_1.z.string(),
|
|
195
|
+
value: zod_1.z.string(),
|
|
196
|
+
}))
|
|
197
|
+
.min(1)
|
|
198
|
+
.describe("An array of objects with 'title' and 'value' properties, e.g.: [{'title': 'Item 1', 'value': '1'}]"),
|
|
199
|
+
})
|
|
200
|
+
.strict(),
|
|
201
|
+
]);
|
|
4
202
|
exports.default = zod_1.z.object({
|
|
5
203
|
icon: zod_1.z
|
|
6
204
|
.string()
|
|
@@ -107,11 +305,11 @@ exports.default = zod_1.z.object({
|
|
|
107
305
|
.describe("The value specifies that a no-view or menu-bar command should be launched in the background every X seconds (s), minutes (m), hours (h) or days (d). Examples: 90s, 1m, 12h, 1d. The minimum value is 10 seconds (10s).")
|
|
108
306
|
.optional(),
|
|
109
307
|
preferences: zod_1.z
|
|
110
|
-
.
|
|
308
|
+
.array(preferenceSchema)
|
|
111
309
|
.describe('Commands can optionally contribute preferences that are shown in Vicinae Preferences > Extensions when selecting the command. You can use preferences for configuration values and passwords or personal access tokens. Commands automatically "inherit" extension preferences and can also override entries with the same `name`.')
|
|
112
310
|
.optional(),
|
|
113
311
|
arguments: zod_1.z
|
|
114
|
-
.
|
|
312
|
+
.array(argumentSchema)
|
|
115
313
|
.describe("An optional array of arguments that are requested from user when the command is called")
|
|
116
314
|
.optional(),
|
|
117
315
|
disabledByDefault: zod_1.z
|
|
@@ -155,7 +353,7 @@ exports.default = zod_1.z.object({
|
|
|
155
353
|
.describe("Limits the tool to the specified functionalities. If not specified, the tool can be used in any context (if it matches the requirements for each of them).")
|
|
156
354
|
.optional(),
|
|
157
355
|
preferences: zod_1.z
|
|
158
|
-
.
|
|
356
|
+
.array(preferenceSchema)
|
|
159
357
|
.describe('Tools can optionally contribute preferences that are shown in Vicinae Preferences > Extensions when selecting the AI Extension item. You can use preferences for configuration values and passwords or personal access tokens. Tools automatically "inherit" extension preferences and can also override entries with the same `name`.')
|
|
160
358
|
.optional(),
|
|
161
359
|
})
|
|
@@ -191,7 +389,7 @@ exports.default = zod_1.z.object({
|
|
|
191
389
|
.max(2048)
|
|
192
390
|
.describe("It helps users understand what the extension does. It will be displayed in the Store and in Preferences."),
|
|
193
391
|
preferences: zod_1.z
|
|
194
|
-
.
|
|
392
|
+
.array(preferenceSchema)
|
|
195
393
|
.describe("Extensions can contribute preferences that are shown in Vicinae Preferences > Extensions. You can use preferences for configuration values and passwords or personal access tokens.")
|
|
196
394
|
.optional(),
|
|
197
395
|
categories: zod_1.z
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { z } from "zod";
|
|
2
|
+
import type ManifestSchema from "../schemas/manifest.js";
|
|
3
|
+
type Manifest = z.infer<typeof ManifestSchema>;
|
|
4
|
+
/**
|
|
5
|
+
* Generates and updates the extension types file in the specified directory
|
|
6
|
+
*/
|
|
7
|
+
export declare function updateExtensionTypes(manifest: Manifest, outDir: string): {
|
|
8
|
+
envPath: string;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Generates TypeScript type definitions from a manifest (package.json)
|
|
12
|
+
*/
|
|
13
|
+
export declare function createExtensionTypes(manifest: Manifest): string;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateExtensionTypes = updateExtensionTypes;
|
|
4
|
+
exports.createExtensionTypes = createExtensionTypes;
|
|
5
|
+
const node_fs_1 = require("node:fs");
|
|
6
|
+
const node_path_1 = require("node:path");
|
|
7
|
+
/**
|
|
8
|
+
* Generates and updates the extension types file in the specified directory
|
|
9
|
+
*/
|
|
10
|
+
function updateExtensionTypes(manifest, outDir) {
|
|
11
|
+
const content = createExtensionTypes(manifest);
|
|
12
|
+
const envPath = (0, node_path_1.join)(outDir, "vicinae-env.d.ts");
|
|
13
|
+
(0, node_fs_1.writeFileSync)(envPath, content);
|
|
14
|
+
return { envPath };
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Generates TypeScript type definitions from a manifest (package.json)
|
|
18
|
+
*/
|
|
19
|
+
function createExtensionTypes(manifest) {
|
|
20
|
+
const extPrefs = generateExtensionPreferences(manifest);
|
|
21
|
+
const cmdPrefs = generateCommandPreferences(manifest);
|
|
22
|
+
const argTypes = generateCommandArguments(manifest);
|
|
23
|
+
return `
|
|
24
|
+
/// <reference types="@vicinae/api">
|
|
25
|
+
|
|
26
|
+
/*
|
|
27
|
+
* This file is auto-generated from the extension's manifest.
|
|
28
|
+
* Do not modify manually. Instead, update the \`package.json\` file.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
type ExtensionPreferences = {
|
|
32
|
+
${extPrefs}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
declare type Preferences = ExtensionPreferences
|
|
36
|
+
|
|
37
|
+
declare namespace Preferences {
|
|
38
|
+
${cmdPrefs}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
declare namespace Arguments {
|
|
42
|
+
${argTypes}
|
|
43
|
+
}
|
|
44
|
+
`.trim();
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Generates TypeScript type definitions for extension preferences
|
|
48
|
+
*/
|
|
49
|
+
function generateExtensionPreferences(manifest) {
|
|
50
|
+
if (!manifest.preferences) {
|
|
51
|
+
return "";
|
|
52
|
+
}
|
|
53
|
+
const extPrefs = [];
|
|
54
|
+
for (const pref of manifest.preferences) {
|
|
55
|
+
let prefText = generateDocComment(pref.title, pref.description);
|
|
56
|
+
if (prefText) {
|
|
57
|
+
prefText += "\n\t";
|
|
58
|
+
}
|
|
59
|
+
prefText += `"${pref.name}"${pref.required ? "?" : ""}: ${getPreferenceType(pref)};`;
|
|
60
|
+
extPrefs.push(prefText);
|
|
61
|
+
}
|
|
62
|
+
return extPrefs.join("\n").trim();
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Generates a JSDoc comment string for a preference or argument
|
|
66
|
+
*/
|
|
67
|
+
function generateDocComment(title, description) {
|
|
68
|
+
if (!title && !description) {
|
|
69
|
+
return "";
|
|
70
|
+
}
|
|
71
|
+
const content = [title, description].filter(Boolean).join(" - ");
|
|
72
|
+
return `\n\t/** ${content.trim()} */`;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Generates a TypeScript type string for a preference value
|
|
76
|
+
*/
|
|
77
|
+
function getPreferenceType(pref) {
|
|
78
|
+
if (pref.type === "checkbox") {
|
|
79
|
+
return "boolean";
|
|
80
|
+
}
|
|
81
|
+
if (pref.type === "dropdown" &&
|
|
82
|
+
Array.isArray(pref.data) &&
|
|
83
|
+
pref.data.length > 0) {
|
|
84
|
+
// Build a union type from the 'value' fields for dropdowns
|
|
85
|
+
const unionValues = pref.data
|
|
86
|
+
.map((option) => typeof option.value === "string" ? `"${option.value}"` : undefined)
|
|
87
|
+
.filter((v) => !!v)
|
|
88
|
+
.join(" | ");
|
|
89
|
+
return unionValues || "string";
|
|
90
|
+
}
|
|
91
|
+
return "string";
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Generates TypeScript type definitions for command preferences
|
|
95
|
+
*/
|
|
96
|
+
function generateCommandPreferences(manifest) {
|
|
97
|
+
const cmdPrefs = [];
|
|
98
|
+
for (const cmd of manifest.commands) {
|
|
99
|
+
const prefix = generateDocComment(`Command: ${cmd.title}`) +
|
|
100
|
+
`\n\texport type ${toPascalCase(cmd.name)} = ExtensionPreferences & {`;
|
|
101
|
+
const prefs = [];
|
|
102
|
+
for (const pref of cmd.preferences ?? []) {
|
|
103
|
+
let prefText = "";
|
|
104
|
+
const docComment = generateDocComment(pref.title, pref.description);
|
|
105
|
+
if (docComment) {
|
|
106
|
+
prefText = `\n\t\t${docComment.trim()}\n\t\t`;
|
|
107
|
+
}
|
|
108
|
+
prefText += `"${pref.name}"${pref.required ? "?" : ""}: ${getPreferenceType(pref)};`;
|
|
109
|
+
prefs.push(prefText);
|
|
110
|
+
}
|
|
111
|
+
cmdPrefs.push(`${prefix}\n\t\t${prefs.join("\n").trim()}\n\t}`);
|
|
112
|
+
}
|
|
113
|
+
return cmdPrefs.join("\n").trim();
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Generates TypeScript type definitions for command arguments
|
|
117
|
+
*/
|
|
118
|
+
function generateCommandArguments(manifest) {
|
|
119
|
+
const cmdArgs = [];
|
|
120
|
+
for (const cmd of manifest.commands) {
|
|
121
|
+
const prefix = generateDocComment(`Command: ${cmd.title}`) +
|
|
122
|
+
`\n\texport type ${toPascalCase(cmd.name)} = {`;
|
|
123
|
+
const args = [];
|
|
124
|
+
for (const arg of cmd.arguments ?? []) {
|
|
125
|
+
const docComment = generateDocComment(arg.placeholder);
|
|
126
|
+
let argText = `\n\t\t${docComment.trim()}\n\t\t`;
|
|
127
|
+
argText += `"${arg.name}"${arg.required ? "?" : ""}: ${getArgumentType(arg)}`;
|
|
128
|
+
args.push(argText);
|
|
129
|
+
}
|
|
130
|
+
cmdArgs.push(`${prefix}\n\t\t${args.join("\n").trim()}\n\t}`);
|
|
131
|
+
}
|
|
132
|
+
return cmdArgs.join("\n").trim();
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Generates a TypeScript type string for an argument value
|
|
136
|
+
*/
|
|
137
|
+
function getArgumentType(arg) {
|
|
138
|
+
if (arg.type === "dropdown" &&
|
|
139
|
+
Array.isArray(arg.data) &&
|
|
140
|
+
arg.data.length > 0) {
|
|
141
|
+
// Build a union type from the 'value' fields
|
|
142
|
+
const unionValues = arg.data
|
|
143
|
+
.map((option) => typeof option.value === "string" ? `"${option.value}"` : undefined)
|
|
144
|
+
.filter((v) => !!v)
|
|
145
|
+
.join(" | ");
|
|
146
|
+
if (unionValues) {
|
|
147
|
+
return unionValues;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return "string";
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Converts a string to PascalCase
|
|
154
|
+
*/
|
|
155
|
+
function toPascalCase(str) {
|
|
156
|
+
return str
|
|
157
|
+
.replace(/([a-z])([A-Z])/g, "$1 $2") // Splits camelCase words into separate words
|
|
158
|
+
.replace(/[-_]+|[^\p{L}\p{N}]/gu, " ") // Replaces dashes, underscores, and special characters with spaces
|
|
159
|
+
.toLowerCase() // Converts the entire string to lowercase
|
|
160
|
+
.replace(/(?:^|\s)(\p{L})/gu, (_, letter) => letter.toUpperCase()) // Capitalizes the first letter of each word
|
|
161
|
+
.replace(/\s+/g, ""); // Removes all spaces
|
|
162
|
+
}
|