@webflow/designer-extension-typings 2.0.13 → 2.0.15
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/package.json +1 -1
- package/variables.d.ts +177 -15
package/package.json
CHANGED
package/variables.d.ts
CHANGED
|
@@ -38,7 +38,7 @@ interface ColorVariable {
|
|
|
38
38
|
* ```
|
|
39
39
|
*/
|
|
40
40
|
set(
|
|
41
|
-
value: ColorValue | ColorVariable,
|
|
41
|
+
value: ColorValue | ColorVariable | CustomValue,
|
|
42
42
|
options?: VariableOptions
|
|
43
43
|
): Promise<null>;
|
|
44
44
|
/**
|
|
@@ -52,7 +52,9 @@ interface ColorVariable {
|
|
|
52
52
|
* console.log(await newVariable1.get());
|
|
53
53
|
* ```
|
|
54
54
|
*/
|
|
55
|
-
get(
|
|
55
|
+
get(
|
|
56
|
+
options?: VariableOptions
|
|
57
|
+
): Promise<ColorValue | ColorVariable | CustomValue>;
|
|
56
58
|
/**
|
|
57
59
|
* Removes a variable from the default collection.
|
|
58
60
|
* @returns A Promise that resolves into a boolean indicating whether deleting the variable was successful or not.
|
|
@@ -64,6 +66,36 @@ interface ColorVariable {
|
|
|
64
66
|
* ```
|
|
65
67
|
*/
|
|
66
68
|
remove(): Promise<boolean>;
|
|
69
|
+
/**
|
|
70
|
+
* Gets a CSS string representing a binding to the variable.
|
|
71
|
+
*
|
|
72
|
+
* This string can be used in custom CSS values to ensure the binding will not break
|
|
73
|
+
* if the variable is renamed.
|
|
74
|
+
*
|
|
75
|
+
* @returns A Promise that resolves into a string representing the variable's name binding. (e.g. `var(--my-color-variable)`)
|
|
76
|
+
* @example
|
|
77
|
+
* ```ts
|
|
78
|
+
* const collection = await webflow.getDefaultVariableCollection();
|
|
79
|
+
* const variable = await collection.getVariable('id-123')
|
|
80
|
+
* const variableBinding = await variable.getBinding()
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
getBinding(): Promise<string>;
|
|
84
|
+
/**
|
|
85
|
+
* Gets a CSS string representing the variable's name.
|
|
86
|
+
*
|
|
87
|
+
* This string can be used in custom CSS with a variable (e.g. binding with a fallback value).
|
|
88
|
+
*
|
|
89
|
+
*
|
|
90
|
+
* @returns A Promise that resolves into a string representing the variable's name. (e.g. `--my-color-variable`)
|
|
91
|
+
* @example
|
|
92
|
+
* ```ts
|
|
93
|
+
* const collection = await webflow.getDefaultVariableCollection();
|
|
94
|
+
* const variable = await collection.getVariable('id-123')
|
|
95
|
+
* const variableCSSName = await variable.getCSSName()
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
getCSSName(): Promise<string>;
|
|
67
99
|
}
|
|
68
100
|
|
|
69
101
|
interface SizeVariable {
|
|
@@ -105,7 +137,7 @@ interface SizeVariable {
|
|
|
105
137
|
* ```
|
|
106
138
|
*/
|
|
107
139
|
set(
|
|
108
|
-
value: SizeValue | SizeVariable,
|
|
140
|
+
value: SizeValue | SizeVariable | CustomValue,
|
|
109
141
|
options?: VariableOptions
|
|
110
142
|
): Promise<null>;
|
|
111
143
|
/**
|
|
@@ -119,7 +151,9 @@ interface SizeVariable {
|
|
|
119
151
|
* console.log(await newVariable1.get());
|
|
120
152
|
* ```
|
|
121
153
|
*/
|
|
122
|
-
get(
|
|
154
|
+
get(
|
|
155
|
+
options?: VariableOptions
|
|
156
|
+
): Promise<SizeValue | SizeVariable | CustomValue>;
|
|
123
157
|
/**
|
|
124
158
|
* Removes a variable from the default collection.
|
|
125
159
|
* @returns A Promise that resolves into a boolean indicating whether deleting the variable was successful or not.
|
|
@@ -130,6 +164,35 @@ interface SizeVariable {
|
|
|
130
164
|
* ```
|
|
131
165
|
*/
|
|
132
166
|
remove(): Promise<boolean>;
|
|
167
|
+
/**
|
|
168
|
+
* Gets a CSS string representing a binding to the variable.
|
|
169
|
+
*
|
|
170
|
+
* This string can be used in custom CSS values to ensure the binding will not break
|
|
171
|
+
* if the variable is renamed.
|
|
172
|
+
*
|
|
173
|
+
* @returns A Promise that resolves into a string representing the variable's name binding. (e.g. `var(--my-size-variable)`)
|
|
174
|
+
* @example
|
|
175
|
+
* ```ts
|
|
176
|
+
* const collection = await webflow.getDefaultVariableCollection();
|
|
177
|
+
* const variable = await collection.getVariable('id-123')
|
|
178
|
+
* const variableBinding = await variable.getBinding()
|
|
179
|
+
* ```
|
|
180
|
+
*/
|
|
181
|
+
getBinding(): Promise<string>;
|
|
182
|
+
/**
|
|
183
|
+
* Gets a CSS string representing the variable's name.
|
|
184
|
+
*
|
|
185
|
+
* This string can be used in custom CSS with a variable (e.g. binding with a fallback value).
|
|
186
|
+
*
|
|
187
|
+
* @returns A Promise that resolves into a string representing the variable's name. (e.g. `--my-size-variable`)
|
|
188
|
+
* @example
|
|
189
|
+
* ```ts
|
|
190
|
+
* const collection = await webflow.getDefaultVariableCollection();
|
|
191
|
+
* const variable = await collection.getVariable('id-123')
|
|
192
|
+
* const variableCSSName = await variable.getCSSName()
|
|
193
|
+
* ```
|
|
194
|
+
*/
|
|
195
|
+
getCSSName(): Promise<string>;
|
|
133
196
|
}
|
|
134
197
|
|
|
135
198
|
interface NumberVariable {
|
|
@@ -174,7 +237,7 @@ interface NumberVariable {
|
|
|
174
237
|
* ```
|
|
175
238
|
*/
|
|
176
239
|
set(
|
|
177
|
-
value: NumberValue | NumberVariable,
|
|
240
|
+
value: NumberValue | NumberVariable | CustomValue,
|
|
178
241
|
options?: VariableOptions
|
|
179
242
|
): Promise<null>;
|
|
180
243
|
|
|
@@ -189,7 +252,9 @@ interface NumberVariable {
|
|
|
189
252
|
* console.log(await newVariable.get());
|
|
190
253
|
* ```
|
|
191
254
|
*/
|
|
192
|
-
get(
|
|
255
|
+
get(
|
|
256
|
+
options?: VariableOptions
|
|
257
|
+
): Promise<NumberValue | NumberVariable | CustomValue>;
|
|
193
258
|
|
|
194
259
|
/**
|
|
195
260
|
* Removes the variable from the default collection.
|
|
@@ -201,6 +266,35 @@ interface NumberVariable {
|
|
|
201
266
|
* ```
|
|
202
267
|
*/
|
|
203
268
|
remove(): Promise<boolean>;
|
|
269
|
+
/**
|
|
270
|
+
* Gets a CSS string representing a binding to the variable.
|
|
271
|
+
*
|
|
272
|
+
* This string can be used in custom CSS values to ensure the binding will not break
|
|
273
|
+
* if the variable is renamed.
|
|
274
|
+
*
|
|
275
|
+
* @returns A Promise that resolves into a string representing the variable's name binding. (e.g. `var(--my-number-variable)`)
|
|
276
|
+
* @example
|
|
277
|
+
* ```ts
|
|
278
|
+
* const collection = await webflow.getDefaultVariableCollection();
|
|
279
|
+
* const variable = await collection.getVariable('id-123')
|
|
280
|
+
* const variableBinding = await variable.getBinding()
|
|
281
|
+
* ```
|
|
282
|
+
*/
|
|
283
|
+
getBinding(): Promise<string>;
|
|
284
|
+
/**
|
|
285
|
+
* Gets a CSS string representing the variable's name.
|
|
286
|
+
*
|
|
287
|
+
* This string can be used in custom CSS with a variable (e.g. binding with a fallback value).
|
|
288
|
+
*
|
|
289
|
+
* @returns A Promise that resolves into a string representing the variable's CSS name. (e.g. `--my-number-variable`)
|
|
290
|
+
* @example
|
|
291
|
+
* ```ts
|
|
292
|
+
* const collection = await webflow.getDefaultVariableCollection();
|
|
293
|
+
* const variable = await collection.getVariable('id-123')
|
|
294
|
+
* const variableCSSName = await variable.getCSSName()
|
|
295
|
+
* ```
|
|
296
|
+
*/
|
|
297
|
+
getCSSName(): Promise<string>;
|
|
204
298
|
}
|
|
205
299
|
|
|
206
300
|
interface PercentageVariable {
|
|
@@ -244,7 +338,7 @@ interface PercentageVariable {
|
|
|
244
338
|
* ```
|
|
245
339
|
*/
|
|
246
340
|
set(
|
|
247
|
-
value: PercentageValue | PercentageVariable,
|
|
341
|
+
value: PercentageValue | PercentageVariable | CustomValue,
|
|
248
342
|
options?: VariableOptions
|
|
249
343
|
): Promise<null>;
|
|
250
344
|
|
|
@@ -259,7 +353,9 @@ interface PercentageVariable {
|
|
|
259
353
|
* console.log(await newVariable.get());
|
|
260
354
|
* ```
|
|
261
355
|
*/
|
|
262
|
-
get(
|
|
356
|
+
get(
|
|
357
|
+
options?: VariableOptions
|
|
358
|
+
): Promise<PercentageValue | PercentageVariable | CustomValue>;
|
|
263
359
|
|
|
264
360
|
/**
|
|
265
361
|
* Removes the variable from the default collection.
|
|
@@ -271,6 +367,35 @@ interface PercentageVariable {
|
|
|
271
367
|
* ```
|
|
272
368
|
*/
|
|
273
369
|
remove(): Promise<boolean>;
|
|
370
|
+
/**
|
|
371
|
+
* Gets a CSS string representing a binding to the variable.
|
|
372
|
+
*
|
|
373
|
+
* This string can be used in custom CSS values to ensure the binding will not break
|
|
374
|
+
* if the variable is renamed.
|
|
375
|
+
*
|
|
376
|
+
* @returns A Promise that resolves into a string representing the variable's name binding. (e.g. `var(--my-percentage-variable)`)
|
|
377
|
+
* @example
|
|
378
|
+
* ```ts
|
|
379
|
+
* const collection = await webflow.getDefaultVariableCollection();
|
|
380
|
+
* const variable = await collection.getVariable('id-123')
|
|
381
|
+
* const variableBinding = await variable.getBinding()
|
|
382
|
+
* ```
|
|
383
|
+
*/
|
|
384
|
+
getBinding(): Promise<string>;
|
|
385
|
+
/**
|
|
386
|
+
* Gets a CSS string representing the variable's name.
|
|
387
|
+
*
|
|
388
|
+
* This string can be used in custom CSS with a variable (e.g. binding with a fallback value).
|
|
389
|
+
*
|
|
390
|
+
* @returns A Promise that resolves into a string representing the variable's name. (e.g. `--my-percentage-variable`)
|
|
391
|
+
* @example
|
|
392
|
+
* ```ts
|
|
393
|
+
* const collection = await webflow.getDefaultVariableCollection();
|
|
394
|
+
* const variable = await collection.getVariable('id-123')
|
|
395
|
+
* const variableCSSName = await variable.getCSSName()
|
|
396
|
+
* ```
|
|
397
|
+
*/
|
|
398
|
+
getCSSName(): Promise<string>;
|
|
274
399
|
}
|
|
275
400
|
|
|
276
401
|
interface FontFamilyVariable {
|
|
@@ -312,7 +437,7 @@ interface FontFamilyVariable {
|
|
|
312
437
|
* ```
|
|
313
438
|
*/
|
|
314
439
|
set(
|
|
315
|
-
value: FontFamilyValue | FontFamilyVariable,
|
|
440
|
+
value: FontFamilyValue | FontFamilyVariable | CustomValue,
|
|
316
441
|
options?: VariableOptions
|
|
317
442
|
): Promise<null>;
|
|
318
443
|
/**
|
|
@@ -326,7 +451,9 @@ interface FontFamilyVariable {
|
|
|
326
451
|
* console.log(await newVariable1.get());
|
|
327
452
|
* ```
|
|
328
453
|
*/
|
|
329
|
-
get(
|
|
454
|
+
get(
|
|
455
|
+
options?: VariableOptions
|
|
456
|
+
): Promise<FontFamilyValue | FontFamilyVariable | CustomValue>;
|
|
330
457
|
/**
|
|
331
458
|
* Removes a variable from the default collection.
|
|
332
459
|
* @returns A Promise that resolves into a boolean indicating whether deleting the variable was successful or not.
|
|
@@ -337,6 +464,35 @@ interface FontFamilyVariable {
|
|
|
337
464
|
* ```
|
|
338
465
|
*/
|
|
339
466
|
remove(): Promise<boolean>;
|
|
467
|
+
/**
|
|
468
|
+
* Gets a CSS string representing a binding to the variable.
|
|
469
|
+
*
|
|
470
|
+
* This string can be used in custom CSS values to ensure the binding will not break
|
|
471
|
+
* if the variable is renamed.
|
|
472
|
+
*
|
|
473
|
+
* @returns A Promise that resolves into a string representing the variable's name binding. (e.g. `var(--my-font-family-variable)`)
|
|
474
|
+
* @example
|
|
475
|
+
* ```ts
|
|
476
|
+
* const collection = await webflow.getDefaultVariableCollection();
|
|
477
|
+
* const variable = await collection.getVariable('id-123')
|
|
478
|
+
* const variableBinding = await variable.getBinding()
|
|
479
|
+
* ```
|
|
480
|
+
*/
|
|
481
|
+
getBinding(): Promise<string>;
|
|
482
|
+
/**
|
|
483
|
+
* Gets a CSS string representing the variable's name.
|
|
484
|
+
*
|
|
485
|
+
* This string can be used in custom CSS with a variable (e.g. binding with a fallback value).
|
|
486
|
+
*
|
|
487
|
+
* @returns A Promise that resolves into a string representing the variable's name. (e.g. `--my-font-family-variable`)
|
|
488
|
+
* @example
|
|
489
|
+
* ```ts
|
|
490
|
+
* const collection = await webflow.getDefaultVariableCollection();
|
|
491
|
+
* const variable = await collection.getVariable('id-123')
|
|
492
|
+
* const variableCSSName = await variable.getCSSName()
|
|
493
|
+
* ```
|
|
494
|
+
*/
|
|
495
|
+
getCSSName(): Promise<string>;
|
|
340
496
|
}
|
|
341
497
|
|
|
342
498
|
type Variable =
|
|
@@ -354,23 +510,23 @@ interface VariableCollection {
|
|
|
354
510
|
getAllVariables(): Promise<Array<Variable>>;
|
|
355
511
|
createColorVariable(
|
|
356
512
|
name: string,
|
|
357
|
-
value: string | ColorVariable
|
|
513
|
+
value: string | ColorVariable | CustomValue
|
|
358
514
|
): Promise<ColorVariable>;
|
|
359
515
|
createSizeVariable(
|
|
360
516
|
name: string,
|
|
361
|
-
value: SizeValue | SizeVariable
|
|
517
|
+
value: SizeValue | SizeVariable | CustomValue
|
|
362
518
|
): Promise<SizeVariable>;
|
|
363
519
|
createNumberVariable(
|
|
364
520
|
name: string,
|
|
365
|
-
value: number | NumberVariable
|
|
521
|
+
value: number | NumberVariable | CustomValue
|
|
366
522
|
): Promise<NumberVariable>;
|
|
367
523
|
createPercentageVariable(
|
|
368
524
|
name: string,
|
|
369
|
-
value: number | PercentageVariable
|
|
525
|
+
value: number | PercentageVariable | CustomValue
|
|
370
526
|
): Promise<PercentageVariable>;
|
|
371
527
|
createFontFamilyVariable(
|
|
372
528
|
name: string,
|
|
373
|
-
value: string | FontFamilyVariable
|
|
529
|
+
value: string | FontFamilyVariable | CustomValue
|
|
374
530
|
): Promise<FontFamilyVariable>;
|
|
375
531
|
/**
|
|
376
532
|
* Sets the name of the variable collection.
|
|
@@ -490,4 +646,10 @@ type SizeUnit =
|
|
|
490
646
|
type VariableOptions = {
|
|
491
647
|
/** The mode to get/set the variable value for. */
|
|
492
648
|
mode?: VariableMode;
|
|
649
|
+
/** Whether to return custom values. */
|
|
650
|
+
customValues?: boolean;
|
|
651
|
+
};
|
|
652
|
+
type CustomValue = {
|
|
653
|
+
type: 'custom';
|
|
654
|
+
value: string;
|
|
493
655
|
};
|