@webflow/designer-extension-typings 2.0.8 → 2.0.10
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/api.d.ts +32 -6
- package/elements-generated.d.ts +4 -0
- package/package.json +1 -1
- package/styles.d.ts +9 -0
- package/variables.d.ts +132 -13
package/api.d.ts
CHANGED
|
@@ -19,15 +19,35 @@ interface WebflowApi {
|
|
|
19
19
|
* - siteId: the unique ID of the current Webflow site.
|
|
20
20
|
* - siteName: the name of the current Webflow site.
|
|
21
21
|
* - shortName: a shortened reference to the name of the current Webflow site.
|
|
22
|
+
* - isPasswordProtected: whether the site is password protected.
|
|
23
|
+
* - isPrivateStaging: whether the site has private staging turned on or not.
|
|
24
|
+
* - domains: an array of objects representing the domains associated with the site, each containing the following properties:
|
|
25
|
+
* - url: the URL of the domain.
|
|
26
|
+
* - lastPublished: the timestamp of the last time the domain was published.
|
|
27
|
+
* - default: a boolean indicating whether the domain is the default domain for the site.
|
|
28
|
+
* - stage: the target of the publish
|
|
22
29
|
* @example
|
|
23
30
|
* ```ts
|
|
24
31
|
* const siteInfo = await webflow.getSiteInfo();
|
|
25
32
|
* console.log('Site ID:', siteInfo.siteId);
|
|
26
33
|
* console.log('Site Name:', siteInfo.siteName);
|
|
27
34
|
* console.log('Shortened Site Name:', siteInfo.shortName);
|
|
28
|
-
*
|
|
29
|
-
|
|
30
|
-
|
|
35
|
+
* console.log('Domains:', siteInfo.domains);
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
getSiteInfo(): Promise<{
|
|
39
|
+
siteId: string;
|
|
40
|
+
siteName: string;
|
|
41
|
+
shortName: string;
|
|
42
|
+
isPasswordProtected: boolean;
|
|
43
|
+
isPrivateStaging: boolean;
|
|
44
|
+
domains: Array<{
|
|
45
|
+
url: string;
|
|
46
|
+
lastPublished: string | null;
|
|
47
|
+
default: boolean;
|
|
48
|
+
stage: 'staging' | 'production';
|
|
49
|
+
}>;
|
|
50
|
+
}>;
|
|
31
51
|
/**
|
|
32
52
|
* Get the currently selected element in the Webflow Designer.
|
|
33
53
|
* @returns A promise that resolves to one of the following:
|
|
@@ -185,14 +205,20 @@ interface WebflowApi {
|
|
|
185
205
|
|
|
186
206
|
/**
|
|
187
207
|
* Creates a new style with the provided name.
|
|
188
|
-
* @param name - The name for the new style
|
|
208
|
+
* @param name - The name for the new style
|
|
209
|
+
* @param opts - Options for the new style. An object containing the following properties:
|
|
210
|
+
* - parent: A Style object representing the parent style block. Used for creating a combo class.
|
|
189
211
|
* @returns a Promise that resolves to the Style object representing the newly created style.
|
|
190
212
|
* @example
|
|
191
213
|
* ```ts
|
|
192
214
|
* const newStyle = await webflow.createStyle('myNewStyle');
|
|
215
|
+
* console.log('New style created:', newStyle.id);
|
|
216
|
+
*
|
|
217
|
+
* const comboClass = await webflow.createStyle('myNewStyle', {parent: newStyle});
|
|
218
|
+
* console.log('New combo class created: ', comboClass.id);
|
|
193
219
|
* ```
|
|
194
220
|
*/
|
|
195
|
-
createStyle(name: string): Promise<Style>;
|
|
221
|
+
createStyle(name: string, options?: {parent?: Style}): Promise<Style>;
|
|
196
222
|
/**
|
|
197
223
|
* Fetch a style by its name.
|
|
198
224
|
* @param name - The name of the style to retrieve.
|
|
@@ -322,7 +348,7 @@ interface WebflowApi {
|
|
|
322
348
|
* const collections = await webflow.getAllVariableCollections();
|
|
323
349
|
* ```
|
|
324
350
|
*/
|
|
325
|
-
getAllVariableCollections(): Promise<Array<VariableCollection
|
|
351
|
+
getAllVariableCollections(): Promise<Array<VariableCollection>>;
|
|
326
352
|
|
|
327
353
|
/**
|
|
328
354
|
* Removes the variable collection.
|
package/elements-generated.d.ts
CHANGED
|
@@ -2702,6 +2702,8 @@ interface FormFormElement
|
|
|
2702
2702
|
readonly id: FullElementId;
|
|
2703
2703
|
readonly type: 'FormForm';
|
|
2704
2704
|
readonly plugin: 'Form';
|
|
2705
|
+
getName(): Promise<null | string>;
|
|
2706
|
+
setName(name: string): Promise<null>;
|
|
2705
2707
|
}
|
|
2706
2708
|
|
|
2707
2709
|
interface FormInlineLabelElement
|
|
@@ -2806,6 +2808,8 @@ interface FormWrapperElement
|
|
|
2806
2808
|
readonly id: FullElementId;
|
|
2807
2809
|
readonly type: 'FormWrapper';
|
|
2808
2810
|
readonly plugin: 'Form';
|
|
2811
|
+
getName(): Promise<null | string>;
|
|
2812
|
+
setName(name: string): Promise<null>;
|
|
2809
2813
|
}
|
|
2810
2814
|
|
|
2811
2815
|
interface FormReCaptchaElement
|
package/package.json
CHANGED
package/styles.d.ts
CHANGED
|
@@ -83,6 +83,15 @@ interface Style {
|
|
|
83
83
|
* ```
|
|
84
84
|
*/
|
|
85
85
|
removeAllProperties(): Promise<null>;
|
|
86
|
+
/**
|
|
87
|
+
* Returns true if the style is a combo class.
|
|
88
|
+
* @example
|
|
89
|
+
* ```ts
|
|
90
|
+
* const isComboClass = await myStyle.isComboClass();
|
|
91
|
+
* console.log("Is Combo Class:", isComboClass);
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
isComboClass(): boolean;
|
|
86
95
|
}
|
|
87
96
|
|
|
88
97
|
type StyleId = string;
|
package/variables.d.ts
CHANGED
|
@@ -27,6 +27,8 @@ interface ColorVariable {
|
|
|
27
27
|
/**
|
|
28
28
|
* Set value of variable. The value must be of the same type as the value of the instantiated variable.
|
|
29
29
|
* @param value - The desired value of the variable.
|
|
30
|
+
* @param options - The configuration options for the variable.
|
|
31
|
+
* @param options.mode - The optional mode object to set the value for.
|
|
30
32
|
* @returns A Promise that resolves into a value, or if the variable is an alias - the original Variable.
|
|
31
33
|
* @example
|
|
32
34
|
* ```ts
|
|
@@ -35,9 +37,14 @@ interface ColorVariable {
|
|
|
35
37
|
* await newVariable1.set('yellow');
|
|
36
38
|
* ```
|
|
37
39
|
*/
|
|
38
|
-
set(
|
|
40
|
+
set(
|
|
41
|
+
value: ColorValue | ColorVariable,
|
|
42
|
+
options?: VariableOptions
|
|
43
|
+
): Promise<null>;
|
|
39
44
|
/**
|
|
40
45
|
* Get the variable’s value.
|
|
46
|
+
* @param options - The configuration options for the variable.
|
|
47
|
+
* @param options.mode - The optional mode object to get the value for.
|
|
41
48
|
* @returns A Promise that resolves into a value, or if the variable is an alias - the original Variable.
|
|
42
49
|
* @example
|
|
43
50
|
* ```ts
|
|
@@ -45,12 +52,13 @@ interface ColorVariable {
|
|
|
45
52
|
* console.log(await newVariable1.get());
|
|
46
53
|
* ```
|
|
47
54
|
*/
|
|
48
|
-
get(): Promise<ColorValue | ColorVariable>;
|
|
55
|
+
get(options?: VariableOptions): Promise<ColorValue | ColorVariable>;
|
|
49
56
|
/**
|
|
50
57
|
* Removes a variable from the default collection.
|
|
51
58
|
* @returns A Promise that resolves into a boolean indicating whether deleting the variable was successful or not.
|
|
52
59
|
* @example
|
|
53
60
|
* ```ts
|
|
61
|
+
* const collection = await webflow.getDefaultVariableCollection();
|
|
54
62
|
* const newVariable1 = await collection.createColorVariable('myvar4', 'red')
|
|
55
63
|
* await newVariable1.remove()
|
|
56
64
|
* ```
|
|
@@ -87,16 +95,23 @@ interface SizeVariable {
|
|
|
87
95
|
/**
|
|
88
96
|
* Set value of variable. The value must be of the same type as the value of the instantiated variable.
|
|
89
97
|
* @param value - The desired value of the variable.
|
|
98
|
+
* @param options - The configuration options for the variable.
|
|
99
|
+
* @param options.mode - The optional mode object to set the value for.
|
|
90
100
|
* @returns A Promise that resolves into a value, or if the variable is an alias - the original Variable.
|
|
91
101
|
* @example
|
|
92
102
|
* ```ts
|
|
93
|
-
* const newVariable1 = await collection.
|
|
94
|
-
* await newVariable1.set('
|
|
103
|
+
* const newVariable1 = await collection.createSizeVariable('myvar1', { unit: 'px', value: 50 });
|
|
104
|
+
* await newVariable1.set({ unit: 'px', value: 80 });
|
|
95
105
|
* ```
|
|
96
106
|
*/
|
|
97
|
-
set(
|
|
107
|
+
set(
|
|
108
|
+
value: SizeValue | SizeVariable,
|
|
109
|
+
options?: VariableOptions
|
|
110
|
+
): Promise<null>;
|
|
98
111
|
/**
|
|
99
112
|
* Get the variable’s value.
|
|
113
|
+
* @param options - The configuration options for the variable.
|
|
114
|
+
* @param options.mode - The optional mode object to get the value for.
|
|
100
115
|
* @returns A Promise that resolves into a value, or if the variable is an alias - the original Variable.
|
|
101
116
|
* @example
|
|
102
117
|
* ```ts
|
|
@@ -104,7 +119,7 @@ interface SizeVariable {
|
|
|
104
119
|
* console.log(await newVariable1.get());
|
|
105
120
|
* ```
|
|
106
121
|
*/
|
|
107
|
-
get(): Promise<SizeValue | SizeVariable>;
|
|
122
|
+
get(options?: VariableOptions): Promise<SizeValue | SizeVariable>;
|
|
108
123
|
/**
|
|
109
124
|
* Removes a variable from the default collection.
|
|
110
125
|
* @returns A Promise that resolves into a boolean indicating whether deleting the variable was successful or not.
|
|
@@ -149,6 +164,8 @@ interface NumberVariable {
|
|
|
149
164
|
/**
|
|
150
165
|
* Set the value of the variable. The value must be of the same type as the value of the instantiated variable.
|
|
151
166
|
* @param value - The desired value of the variable.
|
|
167
|
+
* @param options - The configuration options for the variable.
|
|
168
|
+
* @param options.mode - The optional mode object to set the value for.
|
|
152
169
|
* @returns A Promise that resolves once the value is successfully set.
|
|
153
170
|
* @example
|
|
154
171
|
* ```ts
|
|
@@ -156,10 +173,15 @@ interface NumberVariable {
|
|
|
156
173
|
* await newVariable.set(200);
|
|
157
174
|
* ```
|
|
158
175
|
*/
|
|
159
|
-
set(
|
|
176
|
+
set(
|
|
177
|
+
value: NumberValue | NumberVariable,
|
|
178
|
+
options?: VariableOptions
|
|
179
|
+
): Promise<null>;
|
|
160
180
|
|
|
161
181
|
/**
|
|
162
182
|
* Get the variable’s value.
|
|
183
|
+
* @param options - The configuration options for the variable.
|
|
184
|
+
* @param options.mode - The optional mode object to get the value for.
|
|
163
185
|
* @returns A Promise that resolves into the variable's number value, or if the variable is an alias - the original Variable.
|
|
164
186
|
* @example
|
|
165
187
|
* ```ts
|
|
@@ -167,7 +189,7 @@ interface NumberVariable {
|
|
|
167
189
|
* console.log(await newVariable.get());
|
|
168
190
|
* ```
|
|
169
191
|
*/
|
|
170
|
-
get(): Promise<NumberValue | NumberVariable>;
|
|
192
|
+
get(options?: VariableOptions): Promise<NumberValue | NumberVariable>;
|
|
171
193
|
|
|
172
194
|
/**
|
|
173
195
|
* Removes the variable from the default collection.
|
|
@@ -212,6 +234,8 @@ interface PercentageVariable {
|
|
|
212
234
|
/**
|
|
213
235
|
* Set the value of the variable. The value must be of the same type as the value of the instantiated variable.
|
|
214
236
|
* @param value - The desired value of the variable.
|
|
237
|
+
* @param options - The configuration options for the variable.
|
|
238
|
+
* @param options.mode - The optional mode object to set the value for.
|
|
215
239
|
* @returns A Promise that resolves once the value is successfully set.
|
|
216
240
|
* @example
|
|
217
241
|
* ```ts
|
|
@@ -219,10 +243,15 @@ interface PercentageVariable {
|
|
|
219
243
|
* await newVariable.set(50);
|
|
220
244
|
* ```
|
|
221
245
|
*/
|
|
222
|
-
set(
|
|
246
|
+
set(
|
|
247
|
+
value: PercentageValue | PercentageVariable,
|
|
248
|
+
options?: VariableOptions
|
|
249
|
+
): Promise<null>;
|
|
223
250
|
|
|
224
251
|
/**
|
|
225
252
|
* Get the variable’s value.
|
|
253
|
+
* @param options - The configuration options for the variable.
|
|
254
|
+
* @param options.mode - The optional mode object to get the value for.
|
|
226
255
|
* @returns A Promise that resolves into the variable's value, or if the variable is an alias - the original Variable.
|
|
227
256
|
* @example
|
|
228
257
|
* ```ts
|
|
@@ -230,7 +259,7 @@ interface PercentageVariable {
|
|
|
230
259
|
* console.log(await newVariable.get());
|
|
231
260
|
* ```
|
|
232
261
|
*/
|
|
233
|
-
get(): Promise<PercentageValue | PercentageVariable>;
|
|
262
|
+
get(options?: VariableOptions): Promise<PercentageValue | PercentageVariable>;
|
|
234
263
|
|
|
235
264
|
/**
|
|
236
265
|
* Removes the variable from the default collection.
|
|
@@ -273,6 +302,8 @@ interface FontFamilyVariable {
|
|
|
273
302
|
/**
|
|
274
303
|
* Set value of variable. The value must be of the same type as the value of the instantiated variable.
|
|
275
304
|
* @param value - The desired value of the variable.
|
|
305
|
+
* @param options - The configuration options for the variable.
|
|
306
|
+
* @param options.mode - The optional mode object to set the value for.
|
|
276
307
|
* @returns A Promise that resolves into a value, or if the variable is an alias - the original Variable.
|
|
277
308
|
* @example
|
|
278
309
|
* ```ts
|
|
@@ -280,9 +311,14 @@ interface FontFamilyVariable {
|
|
|
280
311
|
* await newVariable1.set('yellow');
|
|
281
312
|
* ```
|
|
282
313
|
*/
|
|
283
|
-
set(
|
|
314
|
+
set(
|
|
315
|
+
value: FontFamilyValue | FontFamilyVariable,
|
|
316
|
+
options?: VariableOptions
|
|
317
|
+
): Promise<null>;
|
|
284
318
|
/**
|
|
285
319
|
* Get the variable’s value.
|
|
320
|
+
* @param options - The configuration options for the variable.
|
|
321
|
+
* @param options.mode - The optional mode object to get the value for.
|
|
286
322
|
* @returns A Promise that resolves into a value, or if the variable is an alias - the original Variable.
|
|
287
323
|
* @example
|
|
288
324
|
* ```ts
|
|
@@ -290,7 +326,7 @@ interface FontFamilyVariable {
|
|
|
290
326
|
* console.log(await newVariable1.get());
|
|
291
327
|
* ```
|
|
292
328
|
*/
|
|
293
|
-
get(): Promise<FontFamilyValue | FontFamilyVariable>;
|
|
329
|
+
get(options?: VariableOptions): Promise<FontFamilyValue | FontFamilyVariable>;
|
|
294
330
|
/**
|
|
295
331
|
* Removes a variable from the default collection.
|
|
296
332
|
* @returns A Promise that resolves into a boolean indicating whether deleting the variable was successful or not.
|
|
@@ -347,8 +383,88 @@ interface VariableCollection {
|
|
|
347
383
|
* ```
|
|
348
384
|
*/
|
|
349
385
|
setName(newName: string): Promise<null>;
|
|
386
|
+
/**
|
|
387
|
+
* Creates a new variable mode.
|
|
388
|
+
* @param name - The desired name of the variable mode.
|
|
389
|
+
* @returns A Promise that resolves into the new variable mode.
|
|
390
|
+
* @example
|
|
391
|
+
* ```ts
|
|
392
|
+
* const collection = await webflow.getDefaultVariableCollection();
|
|
393
|
+
* const mode = await collection.createVariableMode('My Mode');
|
|
394
|
+
* ```
|
|
395
|
+
*/
|
|
396
|
+
createVariableMode(name: string): Promise<VariableMode>;
|
|
397
|
+
/**
|
|
398
|
+
* Gets a variable mode by id.
|
|
399
|
+
* @param id - The id of the variable mode.
|
|
400
|
+
* @returns A Promise that resolves into the variable mode.
|
|
401
|
+
* @example
|
|
402
|
+
* ```ts
|
|
403
|
+
* const collection = await webflow.getDefaultVariableCollection();
|
|
404
|
+
* const mode = await collection.getVariableModeById('modeId');
|
|
405
|
+
* ```
|
|
406
|
+
*/
|
|
407
|
+
getVariableModeById(id: VariableModeId): Promise<null | VariableMode>;
|
|
408
|
+
/**
|
|
409
|
+
* Gets a variable mode by name.
|
|
410
|
+
* @param name - The name of the variable mode.
|
|
411
|
+
* @returns A Promise that resolves into the variable mode.
|
|
412
|
+
* @example
|
|
413
|
+
* ```ts
|
|
414
|
+
* const collection = await webflow.getDefaultVariableCollection();
|
|
415
|
+
* const mode = await collection.getVariableModeByName('modeName');
|
|
416
|
+
* ```
|
|
417
|
+
*/
|
|
418
|
+
getVariableModeByName(name: string): Promise<null | VariableMode>;
|
|
419
|
+
/**
|
|
420
|
+
* Gets all variable modes.
|
|
421
|
+
* @returns A Promise that resolves into an array of variable modes.
|
|
422
|
+
* @example
|
|
423
|
+
* ```ts
|
|
424
|
+
* const collection = await webflow.getDefaultVariableCollection();
|
|
425
|
+
* const modes = await collection.getAllVariableModes();
|
|
426
|
+
* ```
|
|
427
|
+
*/
|
|
428
|
+
getAllVariableModes(): Promise<Array<VariableMode>>;
|
|
350
429
|
}
|
|
351
430
|
|
|
431
|
+
interface VariableMode {
|
|
432
|
+
readonly id: VariableModeId;
|
|
433
|
+
/**
|
|
434
|
+
* Gets the name of the variable mode.
|
|
435
|
+
* @returns A Promise that resolves into the variable mode's name.
|
|
436
|
+
* @example
|
|
437
|
+
* ```ts
|
|
438
|
+
* const collection = await webflow.getDefaultVariableCollection();
|
|
439
|
+
* const mode = await collection.createVariableMode('My Mode')
|
|
440
|
+
* const modeName = await mode.getName();
|
|
441
|
+
* ```
|
|
442
|
+
*/
|
|
443
|
+
getName(): Promise<string>;
|
|
444
|
+
/**
|
|
445
|
+
* Removes the variable mode from the collection.
|
|
446
|
+
* @returns A Promise that resolves into a boolean indicating whether deleting the variable was successful.
|
|
447
|
+
* @example
|
|
448
|
+
* ```ts
|
|
449
|
+
* const mode = await collection.createVariableMode('My Mode')
|
|
450
|
+
* await mode.remove();
|
|
451
|
+
* ```
|
|
452
|
+
*/
|
|
453
|
+
remove(): Promise<boolean>;
|
|
454
|
+
/**
|
|
455
|
+
* Sets the name of the variable mode.
|
|
456
|
+
* @param name - The desired name of the variable mode.
|
|
457
|
+
* @returns A Promise that resolves once the name is successfully set.
|
|
458
|
+
* @example
|
|
459
|
+
* ```ts
|
|
460
|
+
* const mode = await collection.createVariableMode('My Mode')
|
|
461
|
+
* await mode.setName('My New Mode');
|
|
462
|
+
* ```
|
|
463
|
+
*/
|
|
464
|
+
setName(name: string): Promise<null>;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
type VariableModeId = string;
|
|
352
468
|
type VariableCollectionId = string;
|
|
353
469
|
type VariableId = string;
|
|
354
470
|
type ColorValue = string;
|
|
@@ -356,7 +472,6 @@ type SizeValue = {value: number; unit: SizeUnit};
|
|
|
356
472
|
type FontFamilyValue = string;
|
|
357
473
|
type NumberValue = number;
|
|
358
474
|
type PercentageValue = number;
|
|
359
|
-
|
|
360
475
|
type SizeUnit =
|
|
361
476
|
| 'px'
|
|
362
477
|
| 'em'
|
|
@@ -372,3 +487,7 @@ type SizeUnit =
|
|
|
372
487
|
| 'vmax'
|
|
373
488
|
| 'vmin'
|
|
374
489
|
| 'ch';
|
|
490
|
+
type VariableOptions = {
|
|
491
|
+
/** The mode to get/set the variable value for. */
|
|
492
|
+
mode?: VariableMode;
|
|
493
|
+
};
|