@webflow/designer-extension-typings 2.0.5 → 2.0.7

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.
@@ -3,6 +3,7 @@
3
3
  type ElementPresets = {
4
4
  Animation: ElementPreset<AnyElement>;
5
5
  Spline: ElementPreset<AnyElement>;
6
+ Rive: ElementPreset<AnyElement>;
6
7
  SearchForm: ElementPreset<AnyElement>;
7
8
  DOM: ElementPreset<DOMElement>;
8
9
  DivBlock: ElementPreset<BlockElement>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webflow/designer-extension-typings",
3
- "version": "2.0.5",
3
+ "version": "2.0.7",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "description": "Typings for the Webflow Designer Extension API",
6
6
  "main": "",
package/pages.d.ts CHANGED
@@ -130,13 +130,13 @@ interface Page {
130
130
  getTitle(): Promise<string>;
131
131
  /**
132
132
  * Sets the title of the page to the provided value.
133
- * @param title - The new title to set for the page.
133
+ * @param title - The new title to set for the page. Passing null will unset the current value.
134
134
  * @example
135
135
  * ```ts
136
136
  * await myPage.setTitle("New Page Title");
137
137
  * ```
138
138
  */
139
- setTitle(title: string): Promise<null>;
139
+ setTitle(title: string | null): Promise<null>;
140
140
  /**
141
141
  * Retrieves the description of the page.
142
142
  * @example
@@ -148,13 +148,13 @@ interface Page {
148
148
  getDescription(): Promise<string>;
149
149
  /**
150
150
  * Sets the description of the page to the provided value.
151
- * @param description - The new description to set for the page.
151
+ * @param description - The new description to set for the page. Passing null will unset the current value.
152
152
  * @example
153
153
  * ```ts
154
154
  * await myPage.setDescription("New Page Description");
155
155
  * ```
156
156
  */
157
- setDescription(description: string): Promise<null>;
157
+ setDescription(description: string | null): Promise<null>;
158
158
  /**
159
159
  * Checks if the page is in draft mode or not.
160
160
  * @example
@@ -203,13 +203,13 @@ interface Page {
203
203
  getOpenGraphTitle(): Promise<string>;
204
204
  /**
205
205
  * Sets the Open Graph (OG) title of the page to the provided value.
206
- * @param title - The new OG title to set for the page.
206
+ * @param title - The new OG title to set for the page. Passing null will unset the current value.
207
207
  * @example
208
208
  * ```ts
209
209
  * await myPage.setOpenGraphTitle("New OG Title");
210
210
  * ```
211
211
  */
212
- setOpenGraphTitle(title: string): Promise<null>;
212
+ setOpenGraphTitle(title: string | null): Promise<null>;
213
213
  /**
214
214
  * Checks if the page uses its description as the Open Graph description.
215
215
  * @example
@@ -239,13 +239,13 @@ interface Page {
239
239
  getOpenGraphDescription(): Promise<string>;
240
240
  /**
241
241
  * Sets the Open Graph (OG) description of the page to the provided value.
242
- * @param description - The new OG description to set for the page.
242
+ * @param description - The new OG description to set for the page. Passing null will unset the current value.
243
243
  * @example
244
244
  * ```ts
245
245
  * myPage.setOpenGraphDescription("New OG Description");
246
246
  * ```
247
247
  */
248
- setOpenGraphDescription(description: string): Promise<null>;
248
+ setOpenGraphDescription(description: string | null): Promise<null>;
249
249
  /**
250
250
  * Retrieves the URL of the Open Graph (OG) image associated with the page.
251
251
  * @example
@@ -257,13 +257,13 @@ interface Page {
257
257
  getOpenGraphImage(): Promise<null | string>;
258
258
  /**
259
259
  * Sets the URL of the Open Graph (OG) image associated with the page.
260
- * @param url - The new URL of the OG image to set for the page.
260
+ * @param url - The new URL of the OG image to set for the page. Passing null will unset the current value.
261
261
  * @example
262
262
  * ```ts
263
263
  * myPage.setOpenGraphImage("https://example.com/image.jpg");
264
264
  * ```
265
265
  */
266
- setOpenGraphImage(url: string): Promise<null>;
266
+ setOpenGraphImage(url: string | null): Promise<null>;
267
267
  /**
268
268
  * Checks if the page is excluded from search engine indexing.
269
269
  * @example
@@ -311,13 +311,13 @@ interface Page {
311
311
  getSearchTitle(): Promise<string>;
312
312
  /**
313
313
  * Sets the search engine title of the page to the provided value.
314
- * @param title - The new search engine title to set for the page.
314
+ * @param title - The new search engine title to set for the page. Passing null will unset the current value.
315
315
  * @example
316
316
  * ```ts
317
317
  * myPage.setSearchTitle("New Search Engine Title");
318
318
  * ```
319
319
  */
320
- setSearchTitle(title: string): Promise<null>;
320
+ setSearchTitle(title: string | null): Promise<null>;
321
321
  /**
322
322
  * Checks if the page uses its description as the search engine description.
323
323
  * @example
@@ -347,13 +347,13 @@ interface Page {
347
347
  getSearchDescription(): Promise<string>;
348
348
  /**
349
349
  * Sets the search engine description of the page to the provided value.
350
- * @param description - The new search engine description to set for the page.
350
+ * @param description - The new search engine description to set for the page. Passing null will unset the current value.
351
351
  * @example
352
352
  * ```ts
353
353
  * myPage.setSearchDescription("New Search Engine Description");
354
354
  * ```
355
355
  */
356
- setSearchDescription(description: string): Promise<null>;
356
+ setSearchDescription(description: string | null): Promise<null>;
357
357
  /**
358
358
  * Checks if the page uses its Open Graph (OG) image as the search engine image.
359
359
  * @example
@@ -382,13 +382,13 @@ interface Page {
382
382
  getSearchImage(): Promise<string>;
383
383
  /**
384
384
  * Sets the search engine image URL of the page.
385
- * @param url - The new search engine image URL to set for the page.
385
+ * @param url - The new search engine image URL to set for the page. Passing null will unset the current value.
386
386
  * @example
387
387
  * ```ts
388
388
  * myPage.setSearchImage("https://example.com/image.jpg");
389
389
  * ```
390
390
  */
391
- setSearchImage(url: string): Promise<null>;
391
+ setSearchImage(url: string | null): Promise<null>;
392
392
  /**
393
393
  * Checks if the page is password-protected.
394
394
  * @example
@@ -14,13 +14,13 @@ type PropertyMap = {
14
14
  'animation-play-state'?: string;
15
15
  'animation-timing-function'?: string;
16
16
  appearance?: string;
17
- 'backdrop-filter'?: string;
17
+ 'backdrop-filter'?: string | SizeVariable;
18
18
  'backface-visibility'?: string;
19
19
  'background-attachment'?: string;
20
20
  'background-blend-mode'?: string;
21
21
  'background-clip'?: string;
22
22
  'background-color'?: string | ColorVariable;
23
- 'background-image'?: string;
23
+ 'background-image'?: string | ColorVariable;
24
24
  'background-origin'?: string;
25
25
  'background-position'?: string;
26
26
  'background-position-x'?: string | SizeVariable;
@@ -35,11 +35,12 @@ type PropertyMap = {
35
35
  'border-block-start-style'?: string;
36
36
  'border-block-start-width'?: string | SizeVariable;
37
37
  'border-bottom-color'?: string | ColorVariable;
38
- 'border-bottom-left-radius'?: string | SizeVariable;
39
- 'border-bottom-right-radius'?: string | SizeVariable;
38
+ 'border-bottom-left-radius'?: string | SizeVariable | PercentageVariable;
39
+ 'border-bottom-right-radius'?: string | SizeVariable | PercentageVariable;
40
40
  'border-bottom-style'?: string;
41
41
  'border-bottom-width'?: string | SizeVariable;
42
42
  'border-collapse'?: string;
43
+ 'border-color'?: string | ColorVariable;
43
44
  'border-end-end-radius'?: string | SizeVariable;
44
45
  'border-end-start-radius'?: string | SizeVariable;
45
46
  'border-image-outset'?: string | SizeVariable;
@@ -56,18 +57,20 @@ type PropertyMap = {
56
57
  'border-left-color'?: string | ColorVariable;
57
58
  'border-left-style'?: string;
58
59
  'border-left-width'?: string | SizeVariable;
60
+ 'border-radius'?: string | SizeVariable | PercentageVariable;
59
61
  'border-right-color'?: string | ColorVariable;
60
62
  'border-right-style'?: string;
61
63
  'border-right-width'?: string | SizeVariable;
62
64
  'border-start-end-radius'?: string | SizeVariable;
63
65
  'border-start-start-radius'?: string | SizeVariable;
64
66
  'border-top-color'?: string | ColorVariable;
65
- 'border-top-left-radius'?: string | SizeVariable;
66
- 'border-top-right-radius'?: string | SizeVariable;
67
+ 'border-top-left-radius'?: string | SizeVariable | PercentageVariable;
68
+ 'border-top-right-radius'?: string | SizeVariable | PercentageVariable;
67
69
  'border-top-style'?: string;
68
70
  'border-top-width'?: string | SizeVariable;
69
- bottom?: string | SizeVariable;
70
- 'box-shadow'?: string;
71
+ 'border-width'?: string | SizeVariable;
72
+ bottom?: string | SizeVariable | PercentageVariable;
73
+ 'box-shadow'?: string | SizeVariable;
71
74
  'box-sizing'?: string;
72
75
  'break-after'?: string;
73
76
  'break-before'?: string;
@@ -99,11 +102,11 @@ type PropertyMap = {
99
102
  fill?: string;
100
103
  'fill-opacity'?: string;
101
104
  'fill-rule'?: string;
102
- filter?: string;
103
- 'flex-basis'?: string | SizeVariable;
105
+ filter?: string | SizeVariable;
106
+ 'flex-basis'?: string | SizeVariable | PercentageVariable;
104
107
  'flex-direction'?: string;
105
- 'flex-grow'?: string;
106
- 'flex-shrink'?: string;
108
+ 'flex-grow'?: string | NumberVariable;
109
+ 'flex-shrink'?: string | NumberVariable;
107
110
  'flex-wrap'?: string;
108
111
  float?: string;
109
112
  'flood-color'?: string | ColorVariable;
@@ -111,7 +114,7 @@ type PropertyMap = {
111
114
  'font-family'?: string | FontFamilyVariable;
112
115
  'font-kerning'?: string;
113
116
  'font-optical-sizing'?: string;
114
- 'font-size'?: string | SizeVariable;
117
+ 'font-size'?: string | SizeVariable | PercentageVariable;
115
118
  'font-stretch'?: string;
116
119
  'font-style'?: string;
117
120
  'font-variant-alternates'?: string;
@@ -119,20 +122,20 @@ type PropertyMap = {
119
122
  'font-variant-east-asian'?: string;
120
123
  'font-variant-ligatures'?: string;
121
124
  'font-variant-numeric'?: string;
122
- 'font-weight'?: string;
125
+ 'font-weight'?: string | NumberVariable;
123
126
  'grid-auto-columns'?: string;
124
127
  'grid-auto-flow'?: string;
125
128
  'grid-auto-rows'?: string;
126
129
  'grid-column-end'?: string;
127
- 'grid-column-gap'?: string;
130
+ 'grid-column-gap'?: string | SizeVariable | PercentageVariable;
128
131
  'grid-column-start'?: string;
129
132
  'grid-row-end'?: string;
130
- 'grid-row-gap'?: string | SizeVariable;
133
+ 'grid-row-gap'?: string | SizeVariable | PercentageVariable;
131
134
  'grid-row-start'?: string;
132
135
  'grid-template-areas'?: string;
133
136
  'grid-template-columns'?: string;
134
137
  'grid-template-rows'?: string;
135
- height?: string | SizeVariable;
138
+ height?: string | SizeVariable | PercentageVariable;
136
139
  'image-orientation'?: string;
137
140
  'image-rendering'?: string;
138
141
  'inline-size'?: string | SizeVariable;
@@ -144,34 +147,34 @@ type PropertyMap = {
144
147
  'justify-content'?: string;
145
148
  'justify-items'?: string;
146
149
  'justify-self'?: string;
147
- left?: string | SizeVariable;
150
+ left?: string | SizeVariable | PercentageVariable;
148
151
  'letter-spacing'?: string | SizeVariable;
149
152
  'lighting-color'?: string | ColorVariable;
150
153
  'line-break'?: string;
151
- 'line-height'?: string | SizeVariable;
154
+ 'line-height'?: string | SizeVariable | NumberVariable | PercentageVariable;
152
155
  'list-style-image'?: string;
153
156
  'list-style-position'?: string;
154
157
  'list-style-type'?: string;
155
158
  'margin-block-end'?: string | SizeVariable;
156
159
  'margin-block-start'?: string | SizeVariable;
157
- 'margin-bottom'?: string | SizeVariable;
160
+ 'margin-bottom'?: string | SizeVariable | PercentageVariable;
158
161
  'margin-inline-end'?: string | SizeVariable;
159
162
  'margin-inline-start'?: string | SizeVariable;
160
- 'margin-left'?: string | SizeVariable;
161
- 'margin-right'?: string | SizeVariable;
162
- 'margin-top'?: string | SizeVariable;
163
+ 'margin-left'?: string | SizeVariable | PercentageVariable;
164
+ 'margin-right'?: string | SizeVariable | PercentageVariable;
165
+ 'margin-top'?: string | SizeVariable | PercentageVariable;
163
166
  'marker-end'?: string;
164
167
  'marker-mid'?: string;
165
168
  'marker-start'?: string;
166
169
  'mask-type'?: string;
167
170
  'max-block-size'?: string | SizeVariable;
168
- 'max-height'?: string | SizeVariable;
171
+ 'max-height'?: string | SizeVariable | PercentageVariable;
169
172
  'max-inline-size'?: string | SizeVariable;
170
- 'max-width'?: string | SizeVariable;
173
+ 'max-width'?: string | SizeVariable | PercentageVariable;
171
174
  'min-block-size'?: string | SizeVariable;
172
- 'min-height'?: string | SizeVariable;
175
+ 'min-height'?: string | SizeVariable | PercentageVariable;
173
176
  'min-inline-size'?: string | SizeVariable;
174
- 'min-width'?: string | SizeVariable;
177
+ 'min-width'?: string | SizeVariable | PercentageVariable;
175
178
  'mix-blend-mode'?: string;
176
179
  'object-fit'?: string;
177
180
  'object-position'?: string;
@@ -179,7 +182,7 @@ type PropertyMap = {
179
182
  'offset-distance'?: string | SizeVariable;
180
183
  'offset-path'?: string;
181
184
  'offset-rotate'?: string;
182
- opacity?: string;
185
+ opacity?: string | NumberVariable | PercentageVariable;
183
186
  order?: string;
184
187
  'outline-color'?: string | ColorVariable;
185
188
  'outline-offset'?: string | SizeVariable;
@@ -192,12 +195,12 @@ type PropertyMap = {
192
195
  'overscroll-behavior-inline'?: string;
193
196
  'padding-block-end'?: string | SizeVariable;
194
197
  'padding-block-start'?: string | SizeVariable;
195
- 'padding-bottom'?: string | SizeVariable;
198
+ 'padding-bottom'?: string | SizeVariable | PercentageVariable;
196
199
  'padding-inline-end'?: string | SizeVariable;
197
200
  'padding-inline-start'?: string | SizeVariable;
198
- 'padding-left'?: string | SizeVariable;
199
- 'padding-right'?: string | SizeVariable;
200
- 'padding-top'?: string | SizeVariable;
201
+ 'padding-left'?: string | SizeVariable | PercentageVariable;
202
+ 'padding-right'?: string | SizeVariable | PercentageVariable;
203
+ 'padding-top'?: string | SizeVariable | PercentageVariable;
201
204
  'paint-order'?: string;
202
205
  perspective?: string | SizeVariable;
203
206
  'perspective-origin'?: string;
@@ -205,7 +208,7 @@ type PropertyMap = {
205
208
  position?: string;
206
209
  r?: string | SizeVariable;
207
210
  resize?: string;
208
- right?: string | SizeVariable;
211
+ right?: string | SizeVariable | PercentageVariable;
209
212
  rotate?: string;
210
213
  'row-gap'?: string | SizeVariable;
211
214
  rx?: string | SizeVariable;
@@ -247,13 +250,13 @@ type PropertyMap = {
247
250
  'text-emphasis-color'?: string | ColorVariable;
248
251
  'text-emphasis-position'?: string;
249
252
  'text-emphasis-style'?: string;
250
- 'text-indent'?: string | SizeVariable;
253
+ 'text-indent'?: string | SizeVariable | PercentageVariable;
251
254
  'text-overflow'?: string;
252
255
  'text-rendering'?: string;
253
- 'text-shadow'?: string;
256
+ 'text-shadow'?: string | SizeVariable;
254
257
  'text-transform'?: string;
255
258
  'text-underline-position'?: string;
256
- top?: string | SizeVariable;
259
+ top?: string | SizeVariable | PercentageVariable;
257
260
  'touch-action'?: string;
258
261
  transform?: string;
259
262
  'transform-origin'?: string;
@@ -268,14 +271,14 @@ type PropertyMap = {
268
271
  'vertical-align'?: string;
269
272
  visibility?: string;
270
273
  'white-space'?: string;
271
- width?: string | SizeVariable;
274
+ width?: string | SizeVariable | PercentageVariable;
272
275
  'will-change'?: string;
273
276
  'word-break'?: string;
274
277
  'word-spacing'?: string | SizeVariable;
275
278
  'writing-mode'?: string;
276
279
  x?: string | SizeVariable;
277
280
  y?: string | SizeVariable;
278
- 'z-index'?: string;
281
+ 'z-index'?: string | NumberVariable;
279
282
  '-webkit-line-clamp'?: string;
280
283
  '-webkit-text-fill-color'?: string | ColorVariable;
281
284
  '-webkit-text-stroke-color'?: string | ColorVariable;
@@ -322,6 +325,7 @@ type StyleProperty =
322
325
  | 'border-bottom-style'
323
326
  | 'border-bottom-width'
324
327
  | 'border-collapse'
328
+ | 'border-color'
325
329
  | 'border-end-end-radius'
326
330
  | 'border-end-start-radius'
327
331
  | 'border-image-outset'
@@ -338,6 +342,7 @@ type StyleProperty =
338
342
  | 'border-left-color'
339
343
  | 'border-left-style'
340
344
  | 'border-left-width'
345
+ | 'border-radius'
341
346
  | 'border-right-color'
342
347
  | 'border-right-style'
343
348
  | 'border-right-width'
@@ -348,6 +353,7 @@ type StyleProperty =
348
353
  | 'border-top-right-radius'
349
354
  | 'border-top-style'
350
355
  | 'border-top-width'
356
+ | 'border-width'
351
357
  | 'bottom'
352
358
  | 'box-shadow'
353
359
  | 'box-sizing'
package/variables.d.ts CHANGED
@@ -2,13 +2,13 @@ interface ColorVariable {
2
2
  readonly id: VariableId;
3
3
  readonly type: 'Color';
4
4
  /**
5
- * Get a list of all variables associated with a collection.
5
+ * Get the variable's name.
6
6
  * @returns A Promise that resolves into a the Variable Name.
7
7
  * @example
8
8
  * ```ts
9
9
  * const collection = await webflow.getDefaultVariableCollection();
10
- * const variable = collection.getVariable('id-123')
11
- * const variableName = variable.getName()
10
+ * const variable = await collection.getVariable('id-123')
11
+ * const variableName = await variable.getName()
12
12
  * ```
13
13
  */
14
14
  getName(): Promise<string>;
@@ -51,7 +51,7 @@ interface ColorVariable {
51
51
  * @example
52
52
  * ```ts
53
53
  * const newVariable1 = await collection.createColorVariable('myvar4', 'red')
54
- * newVariable1.remove()
54
+ * await newVariable1.remove()
55
55
  * ```
56
56
  */
57
57
  remove(): Promise<boolean>;
@@ -61,13 +61,13 @@ interface SizeVariable {
61
61
  readonly id: VariableId;
62
62
  readonly type: 'Size';
63
63
  /**
64
- * Get a list of all variables associated with a collection.
64
+ * Get the variable's name.
65
65
  * @returns A Promise that resolves into a the Variable Name.
66
66
  * @example
67
67
  * ```ts
68
68
  * const collection = await webflow.getDefaultVariableCollection();
69
- * const variable = collection.getVariable('id-123')
70
- * const variableName = variable.getName()
69
+ * const variable = await collection.getVariable('id-123')
70
+ * const variableName = await variable.getName()
71
71
  * ```
72
72
  */
73
73
  getName(): Promise<string>;
@@ -110,7 +110,134 @@ interface SizeVariable {
110
110
  * @example
111
111
  * ```ts
112
112
  * const newVariable1 = await collection.createColorVariable('myvar4', 'red')
113
- * newVariable1.remove()
113
+ * await newVariable1.remove()
114
+ * ```
115
+ */
116
+ remove(): Promise<boolean>;
117
+ }
118
+
119
+ interface NumberVariable {
120
+ readonly id: VariableId;
121
+ readonly type: 'Number';
122
+
123
+ /**
124
+ * Get the variable's name.
125
+ * @returns A Promise that resolves into the Variable Name.
126
+ * @example
127
+ * ```ts
128
+ * const collection = await webflow.getDefaultVariableCollection();
129
+ * const variable = await collection.getVariable('id-123')
130
+ * const variableName = await variable.getName()
131
+ * ```
132
+ */
133
+ getName(): Promise<string>;
134
+
135
+ /**
136
+ * Set the variable's name.
137
+ * @param newName - The desired name of the variable.
138
+ * @returns A Promise that resolves once the name is successfully set.
139
+ * @example
140
+ * ```ts
141
+ * const collection = await webflow.getDefaultVariableCollection();
142
+ * const numberVariable = await collection.getVariableByName("number");
143
+ * await numberVariable.setName("My Number Variable");
144
+ * ```
145
+ */
146
+ setName(newName: string): Promise<null>;
147
+
148
+ /**
149
+ * Set the value of the variable. The value must be of the same type as the value of the instantiated variable.
150
+ * @param value - The desired value of the variable.
151
+ * @returns A Promise that resolves once the value is successfully set.
152
+ * @example
153
+ * ```ts
154
+ * const newVariable = await collection.createNumberVariable('myvar1', 100});
155
+ * await newVariable.set(200);
156
+ * ```
157
+ */
158
+ set(value: NumberValue | NumberVariable): Promise<null>;
159
+
160
+ /**
161
+ * Get the variable’s value.
162
+ * @returns A Promise that resolves into the variable's number value, or if the variable is an alias - the original Variable.
163
+ * @example
164
+ * ```ts
165
+ * const newVariable = await collection.createNumberVariable('myvar1', 100);
166
+ * console.log(await newVariable.get());
167
+ * ```
168
+ */
169
+ get(): Promise<NumberValue | NumberVariable>;
170
+
171
+ /**
172
+ * Removes the variable from the default collection.
173
+ * @returns A Promise that resolves into a boolean indicating whether deleting the variable was successful.
174
+ * @example
175
+ * ```ts
176
+ * const newVariable = await collection.createNumberVariable('myvar1', 100);
177
+ * await newVariable.remove();
178
+ * ```
179
+ */
180
+ remove(): Promise<boolean>;
181
+ }
182
+
183
+ interface PercentageVariable {
184
+ readonly id: VariableId;
185
+ readonly type: 'Percentage';
186
+ /**
187
+ * Get the variable's name.
188
+ * @returns A Promise that resolves into the Variable Name.
189
+ * @example
190
+ * ```ts
191
+ * const collection = await webflow.getDefaultVariableCollection();
192
+ * const variable = await collection.getVariable('id-123')
193
+ * const variableName = await variable.getName()
194
+ * ```
195
+ */
196
+ getName(): Promise<string>;
197
+
198
+ /**
199
+ * Set the variable's name.
200
+ * @param newName - The desired name of the variable.
201
+ * @returns A Promise that resolves once the name is successfully set.
202
+ * @example
203
+ * ```ts
204
+ * const collection = await webflow.getDefaultVariableCollection();
205
+ * const percentageVariable = await collection.getVariableByName("percentage");
206
+ * await percentageVariable.setName("My Percentage Variable");
207
+ * ```
208
+ */
209
+ setName(newName: string): Promise<null>;
210
+
211
+ /**
212
+ * Set the value of the variable. The value must be of the same type as the value of the instantiated variable.
213
+ * @param value - The desired value of the variable.
214
+ * @returns A Promise that resolves once the value is successfully set.
215
+ * @example
216
+ * ```ts
217
+ * const newVariable = await collection.createPercentageVariable('myvar1', 100);
218
+ * await newVariable.set(50);
219
+ * ```
220
+ */
221
+ set(value: PercentageValue | PercentageVariable): Promise<null>;
222
+
223
+ /**
224
+ * Get the variable’s value.
225
+ * @returns A Promise that resolves into the variable's value, or if the variable is an alias - the original Variable.
226
+ * @example
227
+ * ```ts
228
+ * const newVariable = await collection.createPercentageVariable('myvar1', 100);
229
+ * console.log(await newVariable.get());
230
+ * ```
231
+ */
232
+ get(): Promise<PercentageValue | PercentageVariable>;
233
+
234
+ /**
235
+ * Removes the variable from the default collection.
236
+ * @returns A Promise that resolves into a boolean indicating whether deleting the variable was successful.
237
+ * @example
238
+ * ```ts
239
+ * const newVariable = await collection.createPercentageVariable('myvar1', 100);
240
+ * await newVariable.remove();
114
241
  * ```
115
242
  */
116
243
  remove(): Promise<boolean>;
@@ -120,13 +247,13 @@ interface FontFamilyVariable {
120
247
  readonly id: VariableId;
121
248
  readonly type: 'FontFamily';
122
249
  /**
123
- * Get a list of all variables associated with a collection.
250
+ * Get the variable's name.
124
251
  * @returns A Promise that resolves into a the Variable Name.
125
252
  * @example
126
253
  * ```ts
127
254
  * const collection = await webflow.getDefaultVariableCollection();
128
- * const variable = collection.getVariable('id-123')
129
- * const variableName = variable.getName()
255
+ * const variable = await collection.getVariable('id-123')
256
+ * const variableName = await variable.getName()
130
257
  * ```
131
258
  */
132
259
  getName(): Promise<string>;
@@ -169,13 +296,18 @@ interface FontFamilyVariable {
169
296
  * @example
170
297
  * ```ts
171
298
  * const newVariable1 = await collection.createColorVariable('myvar4', 'red')
172
- * newVariable1.remove()
299
+ * await newVariable1.remove()
173
300
  * ```
174
301
  */
175
302
  remove(): Promise<boolean>;
176
303
  }
177
304
 
178
- type Variable = ColorVariable | SizeVariable | FontFamilyVariable;
305
+ type Variable =
306
+ | ColorVariable
307
+ | SizeVariable
308
+ | FontFamilyVariable
309
+ | NumberVariable
310
+ | PercentageVariable;
179
311
 
180
312
  interface VariableCollection {
181
313
  readonly id: VariableCollectionId;
@@ -191,6 +323,14 @@ interface VariableCollection {
191
323
  name: string,
192
324
  value: SizeValue | SizeVariable
193
325
  ): Promise<SizeVariable>;
326
+ createNumberVariable(
327
+ name: string,
328
+ value: number | NumberVariable
329
+ ): Promise<NumberVariable>;
330
+ createPercentageVariable(
331
+ name: string,
332
+ value: number | PercentageVariable
333
+ ): Promise<PercentageVariable>;
194
334
  createFontFamilyVariable(
195
335
  name: string,
196
336
  value: string | FontFamilyVariable
@@ -202,6 +342,8 @@ type VariableId = string;
202
342
  type ColorValue = string;
203
343
  type SizeValue = {value: number; unit: SizeUnit};
204
344
  type FontFamilyValue = string;
345
+ type NumberValue = number;
346
+ type PercentageValue = number;
205
347
 
206
348
  type SizeUnit =
207
349
  | 'px'