@webflow/designer-extension-typings 2.0.35 → 2.1.1
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 +48 -0
- package/elements-generated.d.ts +6 -0
- package/package.json +1 -1
- package/slots.d.ts +20 -0
- package/styles-generated.d.ts +0 -1
- package/styles.d.ts +27 -15
package/api.d.ts
CHANGED
|
@@ -21,6 +21,19 @@ interface AppModeChangeEvent {
|
|
|
21
21
|
appModes: {[key in AppMode]: boolean};
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
type AppearanceSettings =
|
|
25
|
+
| 'darkDefault'
|
|
26
|
+
| 'darkDarker'
|
|
27
|
+
| 'darkBrighter'
|
|
28
|
+
| 'light';
|
|
29
|
+
|
|
30
|
+
type ThemeStyles = {
|
|
31
|
+
colors: Record<string, string>;
|
|
32
|
+
boxShadows: Record<string, string>;
|
|
33
|
+
controls: Record<string, string>;
|
|
34
|
+
opacities: Record<string, string>;
|
|
35
|
+
};
|
|
36
|
+
|
|
24
37
|
interface SharedApi {
|
|
25
38
|
/**
|
|
26
39
|
* Get metadata about the current Site.
|
|
@@ -169,6 +182,20 @@ interface SharedApi {
|
|
|
169
182
|
options: ComponentOptions,
|
|
170
183
|
source: Component
|
|
171
184
|
): Promise<Component>;
|
|
185
|
+
/**
|
|
186
|
+
* Duplicate an existing component by ID.
|
|
187
|
+
* @param options - Options for the new component, including a required name.
|
|
188
|
+
* @param source - The ID of the existing Component to duplicate.
|
|
189
|
+
* @returns A Promise resolving to the newly created Component.
|
|
190
|
+
* @example
|
|
191
|
+
* ```ts
|
|
192
|
+
* const copy = await webflow.registerComponent({name: 'Hero Copy'}, '204d04de-bf48-5b5b-0ca8-6ec4c5364fd2')
|
|
193
|
+
* ```
|
|
194
|
+
*/
|
|
195
|
+
registerComponent(
|
|
196
|
+
options: ComponentOptions,
|
|
197
|
+
source: string
|
|
198
|
+
): Promise<Component>;
|
|
172
199
|
/**
|
|
173
200
|
* Convert an element or element preset into a component. Equivalent to the
|
|
174
201
|
* "Convert selection" action in the Designer's "New component" menu.
|
|
@@ -660,6 +687,19 @@ interface DesignerOnlyApi {
|
|
|
660
687
|
* ```
|
|
661
688
|
*/
|
|
662
689
|
getMediaQuery(): Promise<BreakpointId>;
|
|
690
|
+
/**
|
|
691
|
+
* Get the currently active designer theme.
|
|
692
|
+
* @returns The active theme name.
|
|
693
|
+
*/
|
|
694
|
+
getTheme(): Promise<AppearanceSettings>;
|
|
695
|
+
|
|
696
|
+
/**
|
|
697
|
+
* Get the structured style tokens for a given theme. Returns color, box-shadow,
|
|
698
|
+
* control, and opacity token values as flat key-value records.
|
|
699
|
+
* @param themeName - The theme to get tokens for.
|
|
700
|
+
* @returns The ThemeStyles object for the requested theme.
|
|
701
|
+
*/
|
|
702
|
+
getThemeStyles(themeName: AppearanceSettings): Promise<ThemeStyles>;
|
|
663
703
|
/**
|
|
664
704
|
* Get the current pseudo mode.
|
|
665
705
|
* @returns A Promise that resolves to a PseudoStateKey which is a string representing the current pseudo mode.
|
|
@@ -860,6 +900,14 @@ interface DesignerOnlyApi {
|
|
|
860
900
|
event: 'selectedvariant',
|
|
861
901
|
callback: (variant: Variant) => void
|
|
862
902
|
): Unsubscribe;
|
|
903
|
+
/**
|
|
904
|
+
* Subscribe to designer theme changes. The callback fires whenever the user
|
|
905
|
+
* switches themes in the Webflow designer appearance settings.
|
|
906
|
+
*/
|
|
907
|
+
subscribe(
|
|
908
|
+
event: 'currenttheme',
|
|
909
|
+
callback: (theme: AppearanceSettings) => void
|
|
910
|
+
): Unsubscribe;
|
|
863
911
|
/**
|
|
864
912
|
* Checks if the user has the ability to perform the given App Mode
|
|
865
913
|
* @param appModes
|
package/elements-generated.d.ts
CHANGED
|
@@ -273,8 +273,13 @@ interface ComponentElement
|
|
|
273
273
|
readonly id: FullElementId;
|
|
274
274
|
readonly type: 'ComponentInstance';
|
|
275
275
|
readonly plugin: '';
|
|
276
|
+
readonly selectedSlotId?: string | null;
|
|
276
277
|
getComponent(): Promise<Component>;
|
|
277
278
|
getSlots(): Promise<Array<SlotInstanceElement>>;
|
|
279
|
+
getSelectedSlot(): Promise<SlotInstanceElement | null>;
|
|
280
|
+
getTextPropElement(
|
|
281
|
+
propId: string
|
|
282
|
+
): Promise<TextPropElement | RichTextPropElement | null>;
|
|
278
283
|
getProps(): Promise<Array<InstancePropSummary>>;
|
|
279
284
|
getResolvedProps(): Promise<Array<ResolvedInstanceProp>>;
|
|
280
285
|
searchProps(
|
|
@@ -284,6 +289,7 @@ interface ComponentElement
|
|
|
284
289
|
props: Array<SetInstancePropEntry>
|
|
285
290
|
): Promise<Array<SetInstancePropEntry>>;
|
|
286
291
|
resetAllProps(): Promise<null>;
|
|
292
|
+
unlinkComponent(): Promise<AnyElement>;
|
|
287
293
|
}
|
|
288
294
|
|
|
289
295
|
interface UnknownElement
|
package/package.json
CHANGED
package/slots.d.ts
CHANGED
|
@@ -14,3 +14,23 @@ interface SlotInstanceElement {
|
|
|
14
14
|
append(child: Component): Promise<null>;
|
|
15
15
|
prepend(child: Component): Promise<null>;
|
|
16
16
|
}
|
|
17
|
+
|
|
18
|
+
interface FullTextPropId {
|
|
19
|
+
readonly component: string;
|
|
20
|
+
readonly element: string;
|
|
21
|
+
readonly prop: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
interface TextPropElement {
|
|
25
|
+
readonly id: FullTextPropId;
|
|
26
|
+
readonly type: 'TextPropElement';
|
|
27
|
+
getDisplayName(): Promise<string>;
|
|
28
|
+
getChildren(): Promise<AnyElement[]>;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
interface RichTextPropElement {
|
|
32
|
+
readonly id: FullTextPropId;
|
|
33
|
+
readonly type: 'RichTextPropElement';
|
|
34
|
+
getDisplayName(): Promise<string>;
|
|
35
|
+
getChildren(): Promise<AnyElement[]>;
|
|
36
|
+
}
|
package/styles-generated.d.ts
CHANGED
package/styles.d.ts
CHANGED
|
@@ -12,6 +12,16 @@ interface Style {
|
|
|
12
12
|
* ```
|
|
13
13
|
*/
|
|
14
14
|
getName(): Promise<string>;
|
|
15
|
+
/**
|
|
16
|
+
* Rename the Style.
|
|
17
|
+
* @param name - The new name for the Style.
|
|
18
|
+
* @returns A Promise that resolves to null when the rename is complete.
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* await myStyle.setName('NewStyleName');
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
setName(name: string): Promise<null>;
|
|
15
25
|
/**
|
|
16
26
|
* Retrieve the properties of the style.
|
|
17
27
|
* @param options - Options to filter properties based on breakpoints, pseudo states, and component variants.
|
|
@@ -165,7 +175,7 @@ interface Style {
|
|
|
165
175
|
/**
|
|
166
176
|
* Retrieve a variable mode from the style.
|
|
167
177
|
* @param collection - The collection from which to get the currently applied mode.
|
|
168
|
-
* @param options - Options to get variable mode based on breakpoints
|
|
178
|
+
* @param options - Options to get variable mode based on breakpoints, pseudo classes / states, and component variants.
|
|
169
179
|
* @example
|
|
170
180
|
* ```ts
|
|
171
181
|
* const collection = await webflow.getVariableCollectionById('collection-id');
|
|
@@ -174,29 +184,31 @@ interface Style {
|
|
|
174
184
|
*/
|
|
175
185
|
getVariableMode(
|
|
176
186
|
collection: VariableCollection,
|
|
177
|
-
options?:
|
|
187
|
+
options?: StyleOptions
|
|
178
188
|
): Promise<null | VariableMode>;
|
|
179
189
|
/**
|
|
180
190
|
* Sets a variable mode for the style.
|
|
181
191
|
* @param collection - The collection that the mode being set belongs to.
|
|
182
192
|
* @param mode - The variable mode to set.
|
|
183
|
-
* @param options - Options to set variable mode based on breakpoints
|
|
193
|
+
* @param options - Options to set variable mode based on breakpoints, pseudo classes / states, and component variants.
|
|
184
194
|
* @example
|
|
185
195
|
* ```ts
|
|
186
196
|
* const collection = await webflow.getVariableCollectionById('collection-id');
|
|
187
197
|
* const mode = await collection.getVariableModeByName('Dark');
|
|
188
|
-
* await myStyle.setVariableMode(collection, mode
|
|
198
|
+
* await myStyle.setVariableMode(collection, mode, {
|
|
199
|
+
* variantId: 'variant-dark',
|
|
200
|
+
* });
|
|
189
201
|
* ```
|
|
190
202
|
*/
|
|
191
203
|
setVariableMode(
|
|
192
204
|
collection: VariableCollection,
|
|
193
205
|
mode: VariableMode,
|
|
194
|
-
options?:
|
|
206
|
+
options?: StyleOptions
|
|
195
207
|
): Promise<null>;
|
|
196
208
|
/**
|
|
197
209
|
* Removes a variable mode from the style.
|
|
198
210
|
* @param collection - The collection that the mode being removed belongs to.
|
|
199
|
-
* @param options - Options to remove variable mode based on breakpoints
|
|
211
|
+
* @param options - Options to remove variable mode based on breakpoints, pseudo classes / states, and component variants.
|
|
200
212
|
* @example
|
|
201
213
|
* ```ts
|
|
202
214
|
* const collection = await webflow.getVariableCollectionById('collection-id');
|
|
@@ -205,23 +217,23 @@ interface Style {
|
|
|
205
217
|
*/
|
|
206
218
|
removeVariableMode(
|
|
207
219
|
collection: VariableCollection,
|
|
208
|
-
options?:
|
|
220
|
+
options?: StyleOptions
|
|
209
221
|
): Promise<null>;
|
|
210
222
|
/**
|
|
211
223
|
* Retrieve all variable modes applied on the style.
|
|
212
|
-
* @param options - Options to get variable modes based on breakpoints
|
|
224
|
+
* @param options - Options to get variable modes based on breakpoints, pseudo classes / states, and component variants.
|
|
213
225
|
* @example
|
|
214
226
|
* ```ts
|
|
215
227
|
* const modes = await myStyle.getVariableModes();
|
|
216
228
|
* ```
|
|
217
229
|
*/
|
|
218
230
|
getVariableModes(
|
|
219
|
-
options?:
|
|
231
|
+
options?: StyleOptions
|
|
220
232
|
): Promise<VariableModeStylePropertyMap>;
|
|
221
233
|
/**
|
|
222
234
|
* Sets variable modes for the style.
|
|
223
235
|
* @param props - The variable modes to set.
|
|
224
|
-
* @param options - Options to set variable modes based on breakpoints
|
|
236
|
+
* @param options - Options to set variable modes based on breakpoints, pseudo classes / states, and component variants.
|
|
225
237
|
* @example
|
|
226
238
|
* ```ts
|
|
227
239
|
* await myStyle.setVariableModes({
|
|
@@ -232,12 +244,12 @@ interface Style {
|
|
|
232
244
|
*/
|
|
233
245
|
setVariableModes(
|
|
234
246
|
props: VariableModeStylePropertyMap,
|
|
235
|
-
options?:
|
|
247
|
+
options?: StyleOptions
|
|
236
248
|
): Promise<null>;
|
|
237
249
|
/**
|
|
238
250
|
* Removes variable modes from the style.
|
|
239
251
|
* @param modes - The variable modes to remove from the style.
|
|
240
|
-
* @param options - Options to remove variable modes based on breakpoints
|
|
252
|
+
* @param options - Options to remove variable modes based on breakpoints, pseudo classes / states, and component variants.
|
|
241
253
|
* @example
|
|
242
254
|
* ```ts
|
|
243
255
|
* const collection = await webflow.getVariableCollectionById('collection-id');
|
|
@@ -248,17 +260,17 @@ interface Style {
|
|
|
248
260
|
*/
|
|
249
261
|
removeVariableModes(
|
|
250
262
|
modes: Array<VariableMode>,
|
|
251
|
-
options?:
|
|
263
|
+
options?: StyleOptions
|
|
252
264
|
): Promise<null>;
|
|
253
265
|
/**
|
|
254
266
|
* Removes all variable modes from the style.
|
|
255
|
-
* @param options - Options to remove all variable modes based on breakpoints
|
|
267
|
+
* @param options - Options to remove all variable modes based on breakpoints, pseudo classes / states, and component variants.
|
|
256
268
|
* @example
|
|
257
269
|
* ```ts
|
|
258
270
|
* await myStyle.removeAllVariableModes();
|
|
259
271
|
* ```
|
|
260
272
|
*/
|
|
261
|
-
removeAllVariableModes(options?:
|
|
273
|
+
removeAllVariableModes(options?: StyleOptions): Promise<null>;
|
|
262
274
|
/**
|
|
263
275
|
* Retrieves the parent style for a combo class and otherwise returns null.
|
|
264
276
|
* @example
|