@webflow/designer-extension-typings 2.0.7 → 2.0.8
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 +44 -0
- package/package.json +1 -1
- package/variables.d.ts +13 -1
package/api.d.ts
CHANGED
|
@@ -290,6 +290,50 @@ interface WebflowApi {
|
|
|
290
290
|
* ```
|
|
291
291
|
*/
|
|
292
292
|
getDefaultVariableCollection(): Promise<null | VariableCollection>;
|
|
293
|
+
/**
|
|
294
|
+
* Creates a new variable collection.
|
|
295
|
+
* @param name - The name of the new variable collection.
|
|
296
|
+
* @returns A Promise that resolves into a newly created Collection.
|
|
297
|
+
* @example
|
|
298
|
+
* ```ts
|
|
299
|
+
* const collection = await webflow.createVariableCollection('My New Collection');
|
|
300
|
+
* ```
|
|
301
|
+
*/
|
|
302
|
+
createVariableCollection(name: string): Promise<VariableCollection>;
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* Fetches a variable collection by its id.
|
|
306
|
+
* @param id - The id of the variable collection to fetch.
|
|
307
|
+
* @returns A Promise that resolves into a Collection.
|
|
308
|
+
* @example
|
|
309
|
+
* ```ts
|
|
310
|
+
* const collection = await webflow.getVariableCollectionById('collectionId');
|
|
311
|
+
* ```
|
|
312
|
+
*/
|
|
313
|
+
getVariableCollectionById(
|
|
314
|
+
id: VariableCollectionId
|
|
315
|
+
): Promise<VariableCollection | null>;
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* Fetches all variable collections.
|
|
319
|
+
* @returns A Promise that resolves to an array of Collection objects.
|
|
320
|
+
* @example
|
|
321
|
+
* ```ts
|
|
322
|
+
* const collections = await webflow.getAllVariableCollections();
|
|
323
|
+
* ```
|
|
324
|
+
*/
|
|
325
|
+
getAllVariableCollections(): Promise<Array<VariableCollection> | null>;
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* Removes the variable collection.
|
|
329
|
+
* @returns A Promise that resolves into a boolean indicating whether deleting the variable collection was successful.
|
|
330
|
+
* @example
|
|
331
|
+
* ```ts
|
|
332
|
+
* const collection = await webflow.removeVariableCollection('collectionId');
|
|
333
|
+
* ```
|
|
334
|
+
*/
|
|
335
|
+
removeVariableCollection(id: VariableCollectionId): Promise<boolean>;
|
|
336
|
+
|
|
293
337
|
/**
|
|
294
338
|
* Sets the extension size to one of predefined sizes or a custom size. If the specified custom size is larger than
|
|
295
339
|
* the user's viewport size, the extension will default to the width/height of the browser's viewport.
|
package/package.json
CHANGED
package/variables.d.ts
CHANGED
|
@@ -30,6 +30,7 @@ interface ColorVariable {
|
|
|
30
30
|
* @returns A Promise that resolves into a value, or if the variable is an alias - the original Variable.
|
|
31
31
|
* @example
|
|
32
32
|
* ```ts
|
|
33
|
+
* const collection = await webflow.getDefaultVariableCollection();
|
|
33
34
|
* const newVariable1 = await collection.createColorVariable('myvar4', 'red');
|
|
34
35
|
* await newVariable1.set('yellow');
|
|
35
36
|
* ```
|
|
@@ -151,7 +152,7 @@ interface NumberVariable {
|
|
|
151
152
|
* @returns A Promise that resolves once the value is successfully set.
|
|
152
153
|
* @example
|
|
153
154
|
* ```ts
|
|
154
|
-
* const newVariable = await collection.createNumberVariable('myvar1', 100
|
|
155
|
+
* const newVariable = await collection.createNumberVariable('myvar1', 100);
|
|
155
156
|
* await newVariable.set(200);
|
|
156
157
|
* ```
|
|
157
158
|
*/
|
|
@@ -335,6 +336,17 @@ interface VariableCollection {
|
|
|
335
336
|
name: string,
|
|
336
337
|
value: string | FontFamilyVariable
|
|
337
338
|
): Promise<FontFamilyVariable>;
|
|
339
|
+
/**
|
|
340
|
+
* Sets the name of the variable collection.
|
|
341
|
+
* @param newName - The desired name of the variable collection.
|
|
342
|
+
* @returns A Promise that resolves once the name is successfully set.
|
|
343
|
+
* @example
|
|
344
|
+
* ```ts
|
|
345
|
+
* const collection = await webflow.createVariableCollection('My Collection');
|
|
346
|
+
* await collection.setName('My New Collection');
|
|
347
|
+
* ```
|
|
348
|
+
*/
|
|
349
|
+
setName(newName: string): Promise<null>;
|
|
338
350
|
}
|
|
339
351
|
|
|
340
352
|
type VariableCollectionId = string;
|