@webflow/designer-extension-typings 2.0.35 → 2.1.0

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 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
@@ -273,8 +273,10 @@ 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>;
278
280
  getProps(): Promise<Array<InstancePropSummary>>;
279
281
  getResolvedProps(): Promise<Array<ResolvedInstanceProp>>;
280
282
  searchProps(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webflow/designer-extension-typings",
3
- "version": "2.0.35",
3
+ "version": "2.1.0",
4
4
  "license": "MIT",
5
5
  "description": "Typings for the Webflow Designer Extension API",
6
6
  "main": "",
@@ -1015,7 +1015,6 @@ type PseudoStateKey =
1015
1015
  | 'last-child'
1016
1016
  | 'hover'
1017
1017
  | 'active'
1018
- | 'pressed'
1019
1018
  | 'visited'
1020
1019
  | 'focus'
1021
1020
  | 'focus-visible'
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.