@webflow/designer-extension-typings 2.0.9 → 2.0.11
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 +9 -3
- package/elements-generated.d.ts +20 -0
- package/elements.d.ts +12 -0
- package/package.json +1 -1
- package/styles.d.ts +9 -0
- package/variables.d.ts +132 -13
package/api.d.ts
CHANGED
|
@@ -205,14 +205,20 @@ interface WebflowApi {
|
|
|
205
205
|
|
|
206
206
|
/**
|
|
207
207
|
* Creates a new style with the provided name.
|
|
208
|
-
* @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.
|
|
209
211
|
* @returns a Promise that resolves to the Style object representing the newly created style.
|
|
210
212
|
* @example
|
|
211
213
|
* ```ts
|
|
212
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);
|
|
213
219
|
* ```
|
|
214
220
|
*/
|
|
215
|
-
createStyle(name: string): Promise<Style>;
|
|
221
|
+
createStyle(name: string, options?: {parent?: Style}): Promise<Style>;
|
|
216
222
|
/**
|
|
217
223
|
* Fetch a style by its name.
|
|
218
224
|
* @param name - The name of the style to retrieve.
|
|
@@ -342,7 +348,7 @@ interface WebflowApi {
|
|
|
342
348
|
* const collections = await webflow.getAllVariableCollections();
|
|
343
349
|
* ```
|
|
344
350
|
*/
|
|
345
|
-
getAllVariableCollections(): Promise<Array<VariableCollection
|
|
351
|
+
getAllVariableCollections(): Promise<Array<VariableCollection>>;
|
|
346
352
|
|
|
347
353
|
/**
|
|
348
354
|
* Removes the variable collection.
|
package/elements-generated.d.ts
CHANGED
|
@@ -2663,6 +2663,8 @@ interface FormCheckboxInputElement
|
|
|
2663
2663
|
readonly id: FullElementId;
|
|
2664
2664
|
readonly type: 'FormCheckboxInput';
|
|
2665
2665
|
readonly plugin: 'Form';
|
|
2666
|
+
getRequired(): Promise<boolean>;
|
|
2667
|
+
setRequired(value: boolean): Promise<null>;
|
|
2666
2668
|
}
|
|
2667
2669
|
|
|
2668
2670
|
interface FormCheckboxWrapperElement
|
|
@@ -2702,6 +2704,10 @@ interface FormFormElement
|
|
|
2702
2704
|
readonly id: FullElementId;
|
|
2703
2705
|
readonly type: 'FormForm';
|
|
2704
2706
|
readonly plugin: 'Form';
|
|
2707
|
+
getName(): Promise<string>;
|
|
2708
|
+
setName(name: string): Promise<null>;
|
|
2709
|
+
getSettings(): Promise<FormSettings>;
|
|
2710
|
+
setSettings(settings: Partial<FormSettings>): Promise<null>;
|
|
2705
2711
|
}
|
|
2706
2712
|
|
|
2707
2713
|
interface FormInlineLabelElement
|
|
@@ -2728,6 +2734,8 @@ interface FormRadioInputElement
|
|
|
2728
2734
|
readonly id: FullElementId;
|
|
2729
2735
|
readonly type: 'FormRadioInput';
|
|
2730
2736
|
readonly plugin: 'Form';
|
|
2737
|
+
getRequired(): Promise<boolean>;
|
|
2738
|
+
setRequired(value: boolean): Promise<null>;
|
|
2731
2739
|
}
|
|
2732
2740
|
|
|
2733
2741
|
interface FormRadioWrapperElement
|
|
@@ -2754,6 +2762,8 @@ interface FormSelectElement
|
|
|
2754
2762
|
readonly id: FullElementId;
|
|
2755
2763
|
readonly type: 'FormSelect';
|
|
2756
2764
|
readonly plugin: 'Form';
|
|
2765
|
+
getRequired(): Promise<boolean>;
|
|
2766
|
+
setRequired(value: boolean): Promise<null>;
|
|
2757
2767
|
}
|
|
2758
2768
|
|
|
2759
2769
|
interface FormSuccessMessageElement
|
|
@@ -2780,6 +2790,8 @@ interface FormTextareaElement
|
|
|
2780
2790
|
readonly id: FullElementId;
|
|
2781
2791
|
readonly type: 'FormTextarea';
|
|
2782
2792
|
readonly plugin: 'Form';
|
|
2793
|
+
getRequired(): Promise<boolean>;
|
|
2794
|
+
setRequired(value: boolean): Promise<null>;
|
|
2783
2795
|
}
|
|
2784
2796
|
|
|
2785
2797
|
interface FormTextInputElement
|
|
@@ -2793,6 +2805,8 @@ interface FormTextInputElement
|
|
|
2793
2805
|
readonly id: FullElementId;
|
|
2794
2806
|
readonly type: 'FormTextInput';
|
|
2795
2807
|
readonly plugin: 'Form';
|
|
2808
|
+
getRequired(): Promise<boolean>;
|
|
2809
|
+
setRequired(value: boolean): Promise<null>;
|
|
2796
2810
|
}
|
|
2797
2811
|
|
|
2798
2812
|
interface FormWrapperElement
|
|
@@ -2806,6 +2820,10 @@ interface FormWrapperElement
|
|
|
2806
2820
|
readonly id: FullElementId;
|
|
2807
2821
|
readonly type: 'FormWrapper';
|
|
2808
2822
|
readonly plugin: 'Form';
|
|
2823
|
+
getName(): Promise<string>;
|
|
2824
|
+
setName(name: string): Promise<null>;
|
|
2825
|
+
getSettings(): Promise<FormSettings>;
|
|
2826
|
+
setSettings(settings: Partial<FormSettings>): Promise<null>;
|
|
2809
2827
|
}
|
|
2810
2828
|
|
|
2811
2829
|
interface FormReCaptchaElement
|
|
@@ -2832,6 +2850,8 @@ interface FormFileUploadWrapperElement
|
|
|
2832
2850
|
readonly id: FullElementId;
|
|
2833
2851
|
readonly type: 'FormFileUploadWrapper';
|
|
2834
2852
|
readonly plugin: 'Form';
|
|
2853
|
+
getRequired(): Promise<boolean>;
|
|
2854
|
+
setRequired(value: boolean): Promise<null>;
|
|
2835
2855
|
}
|
|
2836
2856
|
|
|
2837
2857
|
interface FormFileUploadDefaultElement
|
package/elements.d.ts
CHANGED
|
@@ -8,3 +8,15 @@ type NamedValue = {
|
|
|
8
8
|
name: string;
|
|
9
9
|
value: string;
|
|
10
10
|
};
|
|
11
|
+
|
|
12
|
+
type FormState = 'normal' | 'success' | 'error';
|
|
13
|
+
|
|
14
|
+
type FormMethod = 'get' | 'post';
|
|
15
|
+
|
|
16
|
+
type FormSettings = {
|
|
17
|
+
state: FormState;
|
|
18
|
+
name: string;
|
|
19
|
+
redirect: string;
|
|
20
|
+
action: string;
|
|
21
|
+
method: FormMethod;
|
|
22
|
+
};
|
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
|
+
};
|