@webflow/designer-extension-typings 2.0.33 → 2.0.34
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 +7 -1
- package/components.d.ts +37 -0
- package/element-settings.d.ts +55 -21
- package/elements-generated.d.ts +966 -337
- package/package.json +1 -1
- package/styles.d.ts +112 -28
package/package.json
CHANGED
package/styles.d.ts
CHANGED
|
@@ -14,69 +14,139 @@ interface Style {
|
|
|
14
14
|
getName(): Promise<string>;
|
|
15
15
|
/**
|
|
16
16
|
* Retrieve the properties of the style.
|
|
17
|
-
* @param options - Options to filter properties based on breakpoints
|
|
18
|
-
* @returns CSS properties and their values for the given
|
|
17
|
+
* @param options - Options to filter properties based on breakpoints, pseudo states, and component variants.
|
|
18
|
+
* @returns CSS properties and their values for the given options.
|
|
19
19
|
* @example
|
|
20
20
|
* ```ts
|
|
21
|
-
*
|
|
22
|
-
*
|
|
21
|
+
* // Get base properties
|
|
22
|
+
* let baseProperties = await myStyle.getProperties();
|
|
23
|
+
*
|
|
24
|
+
* // Get properties for a specific breakpoint and pseudo state
|
|
25
|
+
* let hoverProperties = await myStyle.getProperties({ breakpoint: 'medium', pseudo: 'hover' });
|
|
26
|
+
*
|
|
27
|
+
* // Get properties for a component variant
|
|
28
|
+
* let variantProperties = await myStyle.getProperties({ variantId: 'variant-dark' });
|
|
29
|
+
*
|
|
30
|
+
* // Combine variant with breakpoint and pseudo
|
|
31
|
+
* let combinedProperties = await myStyle.getProperties({
|
|
32
|
+
* variantId: 'variant-dark',
|
|
33
|
+
* breakpoint: 'medium',
|
|
34
|
+
* pseudo: 'hover',
|
|
35
|
+
* });
|
|
23
36
|
* ```
|
|
24
37
|
*/
|
|
25
|
-
getProperties(options?:
|
|
38
|
+
getProperties(options?: StyleOptions): Promise<PropertyMap>;
|
|
26
39
|
/**
|
|
27
|
-
* Sets CSS properties for the Style
|
|
40
|
+
* Sets CSS properties for the Style.
|
|
28
41
|
* @param props - The new properties to set for the style. You can use variables here as well.
|
|
29
|
-
* @param options - Options to
|
|
42
|
+
* @param options - Options to target specific breakpoints, pseudo states, and component variants.
|
|
30
43
|
* @example
|
|
31
44
|
* ```ts
|
|
32
|
-
*
|
|
45
|
+
* // Set base properties
|
|
46
|
+
* await myStyle.setProperties({ color: 'red', 'font-size': '16px' });
|
|
47
|
+
*
|
|
48
|
+
* // Set properties for breakpoint and pseudo state
|
|
49
|
+
* await myStyle.setProperties(
|
|
50
|
+
* { color: 'blue', 'font-size': '18px' },
|
|
51
|
+
* { breakpoint: 'medium', pseudo: 'hover' }
|
|
52
|
+
* );
|
|
53
|
+
*
|
|
54
|
+
* // Set properties for a component variant
|
|
55
|
+
* await myStyle.setProperties(
|
|
56
|
+
* { color: 'white', 'background-color': 'black' },
|
|
57
|
+
* { variantId: 'variant-dark' }
|
|
58
|
+
* );
|
|
59
|
+
*
|
|
60
|
+
* // Target variant by name instead of ID
|
|
61
|
+
* await myStyle.setProperties(
|
|
62
|
+
* { 'font-weight': 'bold' },
|
|
63
|
+
* { variantName: 'Dark Mode' }
|
|
64
|
+
* );
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
setProperties(props: PropertyMap, options?: StyleOptions): Promise<null>;
|
|
68
|
+
/**
|
|
69
|
+
* Removes multiple CSS properties from the Style.
|
|
70
|
+
* @param props - Array of property names to remove.
|
|
71
|
+
* @param options - Options to target specific breakpoints, pseudo states, and component variants.
|
|
72
|
+
* @example
|
|
73
|
+
* ```ts
|
|
74
|
+
* // Remove properties from base styles
|
|
75
|
+
* await myStyle.removeProperties(['color', 'font-size']);
|
|
76
|
+
*
|
|
77
|
+
* // Remove properties from a variant
|
|
78
|
+
* await myStyle.removeProperties(['color', 'background-color'], { variantId: 'variant-dark' });
|
|
33
79
|
* ```
|
|
34
80
|
*/
|
|
35
|
-
setProperties(
|
|
36
|
-
props: PropertyMap,
|
|
37
|
-
options?: BreakpointAndPseudo
|
|
38
|
-
): Promise<null>;
|
|
39
81
|
removeProperties(
|
|
40
82
|
props: Array<StyleProperty>,
|
|
41
|
-
options?:
|
|
83
|
+
options?: StyleOptions
|
|
42
84
|
): Promise<null>;
|
|
43
85
|
/**
|
|
44
86
|
* Retrieve the value of a specific property of the style.
|
|
45
87
|
* @param prop - The name of the property to retrieve.
|
|
46
|
-
* @param options - Options to
|
|
47
|
-
* @returns Returns the value of
|
|
88
|
+
* @param options - Options to target specific breakpoints, pseudo states, and component variants.
|
|
89
|
+
* @returns Returns the value of the CSS property, or null if not set.
|
|
48
90
|
* @example
|
|
49
91
|
* ```ts
|
|
50
|
-
*
|
|
51
|
-
* let
|
|
52
|
-
*
|
|
92
|
+
* // Get base property
|
|
93
|
+
* let color = await myStyle.getProperty('color');
|
|
94
|
+
*
|
|
95
|
+
* // Get property for breakpoint and pseudo state
|
|
96
|
+
* let hoverColor = await myStyle.getProperty('color', { breakpoint: 'medium', pseudo: 'hover' });
|
|
97
|
+
*
|
|
98
|
+
* // Get property for a component variant
|
|
99
|
+
* let variantColor = await myStyle.getProperty('color', { variantId: 'variant-dark' });
|
|
100
|
+
*
|
|
101
|
+
* // Get property from variant by name
|
|
102
|
+
* let namedVariantColor = await myStyle.getProperty('color', { variantName: 'Dark Mode' });
|
|
53
103
|
* ```
|
|
54
104
|
*/
|
|
55
105
|
getProperty<p extends StyleProperty>(
|
|
56
106
|
prop: p,
|
|
57
|
-
options?:
|
|
107
|
+
options?: StyleOptions
|
|
58
108
|
): Promise<null | PropertyMap[p]>;
|
|
59
109
|
/**
|
|
60
|
-
* Sets a specific CSS property for the Style
|
|
110
|
+
* Sets a specific CSS property for the Style.
|
|
61
111
|
* @param prop - The name of the property to set.
|
|
62
112
|
* @param value - The new value to set for the property.
|
|
63
|
-
* @param options - Options to
|
|
113
|
+
* @param options - Options to target specific breakpoints, pseudo states, and component variants.
|
|
64
114
|
* @example
|
|
65
115
|
* ```ts
|
|
66
|
-
*
|
|
116
|
+
* // Set base property
|
|
117
|
+
* await myStyle.setProperty('color', 'red');
|
|
118
|
+
*
|
|
119
|
+
* // Set property for breakpoint and pseudo state
|
|
120
|
+
* await myStyle.setProperty('color', 'blue', { breakpoint: 'medium', pseudo: 'hover' });
|
|
121
|
+
*
|
|
122
|
+
* // Set property for a component variant
|
|
123
|
+
* await myStyle.setProperty('color', 'white', { variantId: 'variant-dark' });
|
|
124
|
+
*
|
|
125
|
+
* // Set property on variant by name
|
|
126
|
+
* await myStyle.setProperty('font-weight', 'bold', { variantName: 'Dark Mode' });
|
|
67
127
|
* ```
|
|
68
128
|
*/
|
|
69
129
|
setProperty<p extends StyleProperty>(
|
|
70
130
|
prop: p,
|
|
71
131
|
value: NonNullable<PropertyMap[p]>,
|
|
72
|
-
options?:
|
|
73
|
-
): Promise<null>;
|
|
74
|
-
removeProperty(
|
|
75
|
-
prop: StyleProperty,
|
|
76
|
-
options?: BreakpointAndPseudo
|
|
132
|
+
options?: StyleOptions
|
|
77
133
|
): Promise<null>;
|
|
78
134
|
/**
|
|
79
|
-
* Removes
|
|
135
|
+
* Removes a specific CSS property from the Style.
|
|
136
|
+
* @param prop - The name of the property to remove.
|
|
137
|
+
* @param options - Options to target specific breakpoints, pseudo states, and component variants.
|
|
138
|
+
* @example
|
|
139
|
+
* ```ts
|
|
140
|
+
* // Remove property from base styles
|
|
141
|
+
* await myStyle.removeProperty('color');
|
|
142
|
+
*
|
|
143
|
+
* // Remove property from a variant
|
|
144
|
+
* await myStyle.removeProperty('color', { variantId: 'variant-dark' });
|
|
145
|
+
* ```
|
|
146
|
+
*/
|
|
147
|
+
removeProperty(prop: StyleProperty, options?: StyleOptions): Promise<null>;
|
|
148
|
+
/**
|
|
149
|
+
* Removes all CSS properties from the Style, including base styles and all variant styles.
|
|
80
150
|
* @example
|
|
81
151
|
* ```ts
|
|
82
152
|
* await myStyle.removeAllProperties();
|
|
@@ -206,6 +276,20 @@ type BreakpointAndPseudo = {
|
|
|
206
276
|
pseudo?: PseudoStateKey;
|
|
207
277
|
};
|
|
208
278
|
|
|
279
|
+
/**
|
|
280
|
+
* Options for targeting style properties by breakpoint, pseudo state, and component variant.
|
|
281
|
+
*
|
|
282
|
+
* When no options are provided, the base styles are targeted (main breakpoint, no pseudo, no variant).
|
|
283
|
+
* Specify variantId to target component variant styles.
|
|
284
|
+
*/
|
|
285
|
+
type StyleOptions = BreakpointAndPseudo & {
|
|
286
|
+
/**
|
|
287
|
+
* Component variant ID to target.
|
|
288
|
+
* Cannot be 'base' (omit options entirely for base styles).
|
|
289
|
+
*/
|
|
290
|
+
variantId?: string;
|
|
291
|
+
};
|
|
292
|
+
|
|
209
293
|
type BreakpointId =
|
|
210
294
|
| 'xxl'
|
|
211
295
|
| 'xl'
|