@webflow/designer-extension-typings 2.0.15 → 2.0.19
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 +8 -1
- package/elements-generated.d.ts +6 -0
- package/package.json +1 -1
- package/styles.d.ts +101 -0
package/api.d.ts
CHANGED
|
@@ -33,6 +33,8 @@ interface WebflowApi {
|
|
|
33
33
|
* console.log('Site Name:', siteInfo.siteName);
|
|
34
34
|
* console.log('Shortened Site Name:', siteInfo.shortName);
|
|
35
35
|
* console.log('Domains:', siteInfo.domains);
|
|
36
|
+
* console.log('Workspace ID:', siteInfo.workspaceId);
|
|
37
|
+
* console.log('Workspace Slug:', siteInfo.workspaceSlug);
|
|
36
38
|
* ```
|
|
37
39
|
*/
|
|
38
40
|
getSiteInfo(): Promise<{
|
|
@@ -41,6 +43,8 @@ interface WebflowApi {
|
|
|
41
43
|
shortName: string;
|
|
42
44
|
isPasswordProtected: boolean;
|
|
43
45
|
isPrivateStaging: boolean;
|
|
46
|
+
workspaceId: string;
|
|
47
|
+
workspaceSlug: string;
|
|
44
48
|
domains: Array<{
|
|
45
49
|
url: string;
|
|
46
50
|
lastPublished: string | null;
|
|
@@ -386,8 +390,9 @@ interface WebflowApi {
|
|
|
386
390
|
* Notifies the user with a message using a specific style. Error messages provide user's with the opportunity to
|
|
387
391
|
* close the Designer Extension.
|
|
388
392
|
* @param opts - An object containing the following notification options:
|
|
389
|
-
* - type: The type of notification to display. One of 'Error', 'Info', 'Success'.
|
|
393
|
+
* - type: The type of notification to display. One of 'Error', 'Info', 'Success', 'Warning'.
|
|
390
394
|
* - message: The message to display in the notification.
|
|
395
|
+
* - dismissAfter: (optional) Number of milliseconds after which the notification will be auto-dismissed. If not provided, uses default 4000ms.
|
|
391
396
|
* @returns A Promise that resolves when the notification is displayed to the user.
|
|
392
397
|
* @example
|
|
393
398
|
* ```ts
|
|
@@ -395,11 +400,13 @@ interface WebflowApi {
|
|
|
395
400
|
* webflow.notify({ type: 'Error', message: 'Something went wrong, try again!' }); // Error notification
|
|
396
401
|
* webflow.notify({ type: 'Success', message: 'Successfully did something!' }); // Success notification
|
|
397
402
|
* webflow.notify({ type: 'Warning', message: 'Something is not right, please check again!' }); // Warning notification
|
|
403
|
+
* webflow.notify({ type: 'Error', message: 'Something went wrong!', dismissAfter: 5000 }); // Error notification with custom dismiss
|
|
398
404
|
* ```
|
|
399
405
|
*/
|
|
400
406
|
notify(opts: {
|
|
401
407
|
type: 'Error' | 'Info' | 'Success' | 'Warning';
|
|
402
408
|
message: string;
|
|
409
|
+
dismissAfter?: number;
|
|
403
410
|
}): Promise<void>;
|
|
404
411
|
/**
|
|
405
412
|
* Allows you to register your custom functions (callbacks) to be executed when certain events happen. This event
|
package/elements-generated.d.ts
CHANGED
|
@@ -2817,6 +2817,12 @@ interface FormTextInputElement
|
|
|
2817
2817
|
setName(name: string): Promise<null>;
|
|
2818
2818
|
getRequired(): Promise<boolean>;
|
|
2819
2819
|
setRequired(value: boolean): Promise<null>;
|
|
2820
|
+
getInputType(): Promise<
|
|
2821
|
+
'text' | 'email' | 'password' | 'tel' | 'number' | 'url' | null
|
|
2822
|
+
>;
|
|
2823
|
+
setInputType(
|
|
2824
|
+
type: 'text' | 'email' | 'password' | 'tel' | 'number' | 'url'
|
|
2825
|
+
): Promise<null>;
|
|
2820
2826
|
}
|
|
2821
2827
|
|
|
2822
2828
|
interface FormWrapperElement
|
package/package.json
CHANGED
package/styles.d.ts
CHANGED
|
@@ -92,6 +92,103 @@ interface Style {
|
|
|
92
92
|
* ```
|
|
93
93
|
*/
|
|
94
94
|
isComboClass(): boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Retrieve a variable mode from the style.
|
|
97
|
+
* @param collection - The collection from which to get the currently applied mode.
|
|
98
|
+
* @param options - Options to get variable mode based on breakpoints and pseudo classes / states.
|
|
99
|
+
* @example
|
|
100
|
+
* ```ts
|
|
101
|
+
* const collection = await webflow.getVariableCollectionById('collection-id');
|
|
102
|
+
* let variableMode = await myStyle.getVariableMode(collection);
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
getVariableMode(
|
|
106
|
+
collection: VariableCollection,
|
|
107
|
+
options?: BreakpointAndPseudo
|
|
108
|
+
): Promise<null | VariableMode>;
|
|
109
|
+
/**
|
|
110
|
+
* Sets a variable mode for the style.
|
|
111
|
+
* @param collection - The collection that the mode being set belongs to.
|
|
112
|
+
* @param mode - The variable mode to set.
|
|
113
|
+
* @param options - Options to set variable mode based on breakpoints and pseudo classes / states.
|
|
114
|
+
* @example
|
|
115
|
+
* ```ts
|
|
116
|
+
* const collection = await webflow.getVariableCollectionById('collection-id');
|
|
117
|
+
* const mode = await collection.getVariableModeByName('Dark');
|
|
118
|
+
* await myStyle.setVariableMode(collection, mode);
|
|
119
|
+
* ```
|
|
120
|
+
*/
|
|
121
|
+
setVariableMode(
|
|
122
|
+
collection: VariableCollection,
|
|
123
|
+
mode: VariableMode,
|
|
124
|
+
options?: BreakpointAndPseudo
|
|
125
|
+
): Promise<null>;
|
|
126
|
+
/**
|
|
127
|
+
* Removes a variable mode from the style.
|
|
128
|
+
* @param collection - The collection that the mode being removed belongs to.
|
|
129
|
+
* @param options - Options to remove variable mode based on breakpoints and pseudo classes / states.
|
|
130
|
+
* @example
|
|
131
|
+
* ```ts
|
|
132
|
+
* const collection = await webflow.getVariableCollectionById('collection-id');
|
|
133
|
+
* await myStyle.removeVariableMode(collection)
|
|
134
|
+
* ```
|
|
135
|
+
*/
|
|
136
|
+
removeVariableMode(
|
|
137
|
+
collection: VariableCollection,
|
|
138
|
+
options?: BreakpointAndPseudo
|
|
139
|
+
): Promise<null>;
|
|
140
|
+
/**
|
|
141
|
+
* Retrieve all variable modes applied on the style.
|
|
142
|
+
* @param options - Options to get variable modes based on breakpoints and pseudo classes / states.
|
|
143
|
+
* @example
|
|
144
|
+
* ```ts
|
|
145
|
+
* const modes = await myStyle.getVariableModes();
|
|
146
|
+
* ```
|
|
147
|
+
*/
|
|
148
|
+
getVariableModes(
|
|
149
|
+
options?: BreakpointAndPseudo
|
|
150
|
+
): Promise<VariableModeStylePropertyMap>;
|
|
151
|
+
/**
|
|
152
|
+
* Sets variable modes for the style.
|
|
153
|
+
* @param props - The variable modes to set.
|
|
154
|
+
* @param options - Options to set variable modes based on breakpoints and pseudo classes / states.
|
|
155
|
+
* @example
|
|
156
|
+
* ```ts
|
|
157
|
+
* await myStyle.setVariableModes({
|
|
158
|
+
* 'collection-id-1': 'mode-id-1',
|
|
159
|
+
* 'collection-id-2': 'mode-id-2',
|
|
160
|
+
* });
|
|
161
|
+
* ```
|
|
162
|
+
*/
|
|
163
|
+
setVariableModes(
|
|
164
|
+
props: VariableModeStylePropertyMap,
|
|
165
|
+
options?: BreakpointAndPseudo
|
|
166
|
+
): Promise<null>;
|
|
167
|
+
/**
|
|
168
|
+
* Removes variable modes from the style.
|
|
169
|
+
* @param modes - The variable modes to remove from the style.
|
|
170
|
+
* @param options - Options to remove variable modes based on breakpoints and pseudo classes / states.
|
|
171
|
+
* @example
|
|
172
|
+
* ```ts
|
|
173
|
+
* await myStyle.removeVariableModes({
|
|
174
|
+
* 'collection-id-1': 'mode-id-1',
|
|
175
|
+
* 'collection-id-2': 'mode-id-2',
|
|
176
|
+
* });
|
|
177
|
+
* ```
|
|
178
|
+
*/
|
|
179
|
+
removeVariableModes(
|
|
180
|
+
modes: Array<VariableMode>,
|
|
181
|
+
options?: BreakpointAndPseudo
|
|
182
|
+
): Promise<null>;
|
|
183
|
+
/**
|
|
184
|
+
* Removes all variable modes from the style.
|
|
185
|
+
* @param options - Options to remove all variable modes based on breakpoints and pseudo classes / states.
|
|
186
|
+
* @example
|
|
187
|
+
* ```ts
|
|
188
|
+
* await myStyle.removeAllVariableModes();
|
|
189
|
+
* ```
|
|
190
|
+
*/
|
|
191
|
+
removeAllVariableModes(options?: BreakpointAndPseudo): Promise<null>;
|
|
95
192
|
}
|
|
96
193
|
|
|
97
194
|
type StyleId = string;
|
|
@@ -109,3 +206,7 @@ type BreakpointId =
|
|
|
109
206
|
| 'medium'
|
|
110
207
|
| 'small'
|
|
111
208
|
| 'tiny';
|
|
209
|
+
|
|
210
|
+
type VariableModeStylePropertyMap = {
|
|
211
|
+
[collectionId: VariableCollectionId]: VariableModeId;
|
|
212
|
+
};
|