@webflow/designer-extension-typings 2.0.7 → 2.0.9
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 +67 -3
- package/package.json +1 -1
- package/variables.d.ts +13 -1
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:
|
|
@@ -290,6 +310,50 @@ interface WebflowApi {
|
|
|
290
310
|
* ```
|
|
291
311
|
*/
|
|
292
312
|
getDefaultVariableCollection(): Promise<null | VariableCollection>;
|
|
313
|
+
/**
|
|
314
|
+
* Creates a new variable collection.
|
|
315
|
+
* @param name - The name of the new variable collection.
|
|
316
|
+
* @returns A Promise that resolves into a newly created Collection.
|
|
317
|
+
* @example
|
|
318
|
+
* ```ts
|
|
319
|
+
* const collection = await webflow.createVariableCollection('My New Collection');
|
|
320
|
+
* ```
|
|
321
|
+
*/
|
|
322
|
+
createVariableCollection(name: string): Promise<VariableCollection>;
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* Fetches a variable collection by its id.
|
|
326
|
+
* @param id - The id of the variable collection to fetch.
|
|
327
|
+
* @returns A Promise that resolves into a Collection.
|
|
328
|
+
* @example
|
|
329
|
+
* ```ts
|
|
330
|
+
* const collection = await webflow.getVariableCollectionById('collectionId');
|
|
331
|
+
* ```
|
|
332
|
+
*/
|
|
333
|
+
getVariableCollectionById(
|
|
334
|
+
id: VariableCollectionId
|
|
335
|
+
): Promise<VariableCollection | null>;
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* Fetches all variable collections.
|
|
339
|
+
* @returns A Promise that resolves to an array of Collection objects.
|
|
340
|
+
* @example
|
|
341
|
+
* ```ts
|
|
342
|
+
* const collections = await webflow.getAllVariableCollections();
|
|
343
|
+
* ```
|
|
344
|
+
*/
|
|
345
|
+
getAllVariableCollections(): Promise<Array<VariableCollection> | null>;
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* Removes the variable collection.
|
|
349
|
+
* @returns A Promise that resolves into a boolean indicating whether deleting the variable collection was successful.
|
|
350
|
+
* @example
|
|
351
|
+
* ```ts
|
|
352
|
+
* const collection = await webflow.removeVariableCollection('collectionId');
|
|
353
|
+
* ```
|
|
354
|
+
*/
|
|
355
|
+
removeVariableCollection(id: VariableCollectionId): Promise<boolean>;
|
|
356
|
+
|
|
293
357
|
/**
|
|
294
358
|
* Sets the extension size to one of predefined sizes or a custom size. If the specified custom size is larger than
|
|
295
359
|
* 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;
|