@webflow/designer-extension-typings 2.0.3 → 2.0.6
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 +35 -1
- package/app-connections.d.ts +5 -0
- package/element-presets-generated.d.ts +1 -0
- package/package.json +1 -1
- package/styles-generated.d.ts +62 -38
- package/styles.d.ts +0 -18
- package/variables.d.ts +155 -13
package/api.d.ts
CHANGED
|
@@ -68,6 +68,18 @@ interface WebflowApi {
|
|
|
68
68
|
* ```
|
|
69
69
|
*/
|
|
70
70
|
getMediaQuery(): Promise<BreakpointId>;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Get the current pseudo mode.
|
|
74
|
+
* @returns A Promise that resolves to a PseudoStateKey which is a string representing the current pseudo mode.
|
|
75
|
+
* @example
|
|
76
|
+
* ```ts
|
|
77
|
+
* const pseudoMode = await webflow.getPseudoMode();
|
|
78
|
+
* console.log('Current Pseudo Mode:', pseudoMode);
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
getPseudoMode(): Promise<null | PseudoStateKey>;
|
|
82
|
+
|
|
71
83
|
/**
|
|
72
84
|
* Create a component by promoting a Root Element.
|
|
73
85
|
* @param name - The name of the component.
|
|
@@ -312,10 +324,11 @@ interface WebflowApi {
|
|
|
312
324
|
* webflow.notify({ type: 'Info', message: 'Great work!' }); // General notification
|
|
313
325
|
* webflow.notify({ type: 'Error', message: 'Something went wrong, try again!' }); // Error notification
|
|
314
326
|
* webflow.notify({ type: 'Success', message: 'Successfully did something!' }); // Success notification
|
|
327
|
+
* webflow.notify({ type: 'Warning', message: 'Something is not right, please check again!' }); // Warning notification
|
|
315
328
|
* ```
|
|
316
329
|
*/
|
|
317
330
|
notify(opts: {
|
|
318
|
-
type: 'Error' | 'Info' | 'Success';
|
|
331
|
+
type: 'Error' | 'Info' | 'Success' | 'Warning';
|
|
319
332
|
message: string;
|
|
320
333
|
}): Promise<void>;
|
|
321
334
|
/**
|
|
@@ -411,6 +424,11 @@ interface WebflowApi {
|
|
|
411
424
|
|
|
412
425
|
subscribe(event: 'currentappmode', callback: () => void): Unsubscribe;
|
|
413
426
|
|
|
427
|
+
subscribe(
|
|
428
|
+
event: 'pseudomode',
|
|
429
|
+
callback: (pseudoMode: null | PseudoStateKey) => void
|
|
430
|
+
): Unsubscribe;
|
|
431
|
+
|
|
414
432
|
getIdToken(): Promise<string>;
|
|
415
433
|
getAppSubscriptions(): Promise<Array<AppSubscription>>;
|
|
416
434
|
elementPresets: ElementPresets;
|
|
@@ -493,6 +511,14 @@ interface WebflowApi {
|
|
|
493
511
|
*/
|
|
494
512
|
appModes: {[key in AppMode]: AppMode};
|
|
495
513
|
|
|
514
|
+
/**
|
|
515
|
+
* Closes the extension
|
|
516
|
+
* ```ts
|
|
517
|
+
* await webflow.closeExtension();
|
|
518
|
+
* ```
|
|
519
|
+
*/
|
|
520
|
+
closeExtension(): Promise<null>;
|
|
521
|
+
|
|
496
522
|
/**
|
|
497
523
|
* Gets the current App connection
|
|
498
524
|
* ```ts
|
|
@@ -508,6 +534,14 @@ interface WebflowApi {
|
|
|
508
534
|
* ```
|
|
509
535
|
*/
|
|
510
536
|
getCurrentAppConnectionResource(): Promise<null | AppConnectionResource>;
|
|
537
|
+
|
|
538
|
+
/**
|
|
539
|
+
* Gets the current App launch context (i.e how the app was launched)
|
|
540
|
+
* ```ts
|
|
541
|
+
* const launchContext = await webflow.getLaunchContext();
|
|
542
|
+
* ```
|
|
543
|
+
*/
|
|
544
|
+
getLaunchContext(): Promise<null | LaunchContext>;
|
|
511
545
|
}
|
|
512
546
|
|
|
513
547
|
type Unsubscribe = () => void;
|
package/app-connections.d.ts
CHANGED
package/package.json
CHANGED
package/styles-generated.d.ts
CHANGED
|
@@ -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
|
-
|
|
70
|
-
|
|
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'
|
|
@@ -562,3 +568,21 @@ type StyleProperty =
|
|
|
562
568
|
| '-webkit-text-fill-color'
|
|
563
569
|
| '-webkit-text-stroke-color'
|
|
564
570
|
| '-webkit-text-stroke-width';
|
|
571
|
+
|
|
572
|
+
type PseudoStateKey =
|
|
573
|
+
| 'noPseudo'
|
|
574
|
+
| 'nth-child(odd)'
|
|
575
|
+
| 'nth-child(even)'
|
|
576
|
+
| 'first-child'
|
|
577
|
+
| 'last-child'
|
|
578
|
+
| 'hover'
|
|
579
|
+
| 'active'
|
|
580
|
+
| 'pressed'
|
|
581
|
+
| 'visited'
|
|
582
|
+
| 'focus'
|
|
583
|
+
| 'focus-visible'
|
|
584
|
+
| 'focus-within'
|
|
585
|
+
| 'placeholder'
|
|
586
|
+
| 'empty'
|
|
587
|
+
| 'before'
|
|
588
|
+
| 'after';
|
package/styles.d.ts
CHANGED
|
@@ -100,21 +100,3 @@ type BreakpointId =
|
|
|
100
100
|
| 'medium'
|
|
101
101
|
| 'small'
|
|
102
102
|
| 'tiny';
|
|
103
|
-
|
|
104
|
-
type PseudoStateKey =
|
|
105
|
-
| 'noPseudo'
|
|
106
|
-
| 'nth-child(odd)'
|
|
107
|
-
| 'nth-child(even)'
|
|
108
|
-
| 'first-child'
|
|
109
|
-
| 'last-child'
|
|
110
|
-
| 'hover'
|
|
111
|
-
| 'active'
|
|
112
|
-
| 'pressed'
|
|
113
|
-
| 'visited'
|
|
114
|
-
| 'focus'
|
|
115
|
-
| 'focus-visible'
|
|
116
|
-
| 'focus-within'
|
|
117
|
-
| 'placeholder'
|
|
118
|
-
| 'empty'
|
|
119
|
-
| 'before'
|
|
120
|
-
| 'after';
|
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
|
|
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
|
|
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
|
|
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 =
|
|
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'
|