@webflow/designer-extension-typings 0.1.2 → 0.1.4

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.
@@ -18,6 +18,8 @@ interface CustomAttributes {
18
18
  readonly customAttributes: true;
19
19
  getCustomAttribute(name: string): null | string;
20
20
  setCustomAttribute(name: string, value: string): undefined;
21
+ removeCustomAttribute(name: string): undefined;
22
+ getAllCustomAttributes(): Array<CustomAttribute>;
21
23
  }
22
24
 
23
25
  interface NoCustomAttributes {
@@ -90,6 +92,7 @@ interface DOMElement
90
92
  getTag(): null | string;
91
93
  getAttribute(name: string): null | string;
92
94
  setAttribute(name: string, value: string): undefined;
95
+ removeAttribute(name: string): undefined;
93
96
  }
94
97
 
95
98
  interface AnimationElement
@@ -105,6 +108,19 @@ interface AnimationElement
105
108
  readonly plugin: 'Animation';
106
109
  }
107
110
 
111
+ interface SplineElement
112
+ extends WebflowElement,
113
+ Configurable,
114
+ CustomAttributes,
115
+ DomId,
116
+ Styles,
117
+ NoChildren,
118
+ NoTextContent {
119
+ readonly id: ElementId;
120
+ readonly type: 'Spline';
121
+ readonly plugin: 'Animation';
122
+ }
123
+
108
124
  interface BlockElement
109
125
  extends WebflowElement,
110
126
  Configurable,
@@ -514,7 +530,7 @@ interface CommerceAddToCartButtonElement
514
530
  extends WebflowElement,
515
531
  Configurable,
516
532
  CustomAttributes,
517
- DomId,
533
+ NoDomId,
518
534
  Styles,
519
535
  NoChildren,
520
536
  NoTextContent {
@@ -696,7 +712,7 @@ interface CommerceCartOpenLinkElement
696
712
  extends WebflowElement,
697
713
  Configurable,
698
714
  CustomAttributes,
699
- DomId,
715
+ NoDomId,
700
716
  Styles,
701
717
  Children,
702
718
  TextContent {
@@ -748,7 +764,7 @@ interface CommerceCartContainerElement
748
764
  extends WebflowElement,
749
765
  Configurable,
750
766
  CustomAttributes,
751
- DomId,
767
+ NoDomId,
752
768
  Styles,
753
769
  Children,
754
770
  NoTextContent {
@@ -969,7 +985,7 @@ interface CommerceCartCloseLinkElement
969
985
  extends WebflowElement,
970
986
  Configurable,
971
987
  CustomAttributes,
972
- DomId,
988
+ NoDomId,
973
989
  Styles,
974
990
  Children,
975
991
  TextContent {
@@ -995,7 +1011,7 @@ interface CommerceCartRemoveLinkElement
995
1011
  extends WebflowElement,
996
1012
  Configurable,
997
1013
  CustomAttributes,
998
- DomId,
1014
+ NoDomId,
999
1015
  Styles,
1000
1016
  Children,
1001
1017
  TextContent {
@@ -2516,7 +2532,7 @@ interface FormBlockLabelElement
2516
2532
  extends WebflowElement,
2517
2533
  Configurable,
2518
2534
  CustomAttributes,
2519
- DomId,
2535
+ NoDomId,
2520
2536
  Styles,
2521
2537
  Children,
2522
2538
  TextContent {
@@ -2928,6 +2944,58 @@ interface IconElement
2928
2944
  readonly plugin: 'Icon';
2929
2945
  }
2930
2946
 
2947
+ interface LocalesWrapperElement
2948
+ extends WebflowElement,
2949
+ Configurable,
2950
+ CustomAttributes,
2951
+ DomId,
2952
+ Styles,
2953
+ Children,
2954
+ NoTextContent {
2955
+ readonly id: ElementId;
2956
+ readonly type: 'LocalesWrapper';
2957
+ readonly plugin: 'Localization';
2958
+ }
2959
+
2960
+ interface LocalesEmptyElement
2961
+ extends WebflowElement,
2962
+ Configurable,
2963
+ CustomAttributes,
2964
+ DomId,
2965
+ Styles,
2966
+ Children,
2967
+ NoTextContent {
2968
+ readonly id: ElementId;
2969
+ readonly type: 'LocalesEmpty';
2970
+ readonly plugin: 'Localization';
2971
+ }
2972
+
2973
+ interface LocalesListElement
2974
+ extends WebflowElement,
2975
+ Configurable,
2976
+ CustomAttributes,
2977
+ DomId,
2978
+ Styles,
2979
+ Children,
2980
+ NoTextContent {
2981
+ readonly id: ElementId;
2982
+ readonly type: 'LocalesList';
2983
+ readonly plugin: 'Localization';
2984
+ }
2985
+
2986
+ interface LocalesItemElement
2987
+ extends WebflowElement,
2988
+ Configurable,
2989
+ CustomAttributes,
2990
+ DomId,
2991
+ Styles,
2992
+ Children,
2993
+ NoTextContent {
2994
+ readonly id: ElementId;
2995
+ readonly type: 'LocalesItem';
2996
+ readonly plugin: 'Localization';
2997
+ }
2998
+
2931
2999
  interface ContainerElement
2932
3000
  extends WebflowElement,
2933
3001
  Configurable,
@@ -3019,7 +3087,7 @@ interface CellElement
3019
3087
  readonly plugin: 'Layout';
3020
3088
  }
3021
3089
 
3022
- interface FlexContainerElement
3090
+ interface BlockContainerElement
3023
3091
  extends WebflowElement,
3024
3092
  Configurable,
3025
3093
  CustomAttributes,
@@ -3028,7 +3096,7 @@ interface FlexContainerElement
3028
3096
  Children,
3029
3097
  NoTextContent {
3030
3098
  readonly id: ElementId;
3031
- readonly type: 'FlexContainer';
3099
+ readonly type: 'BlockContainer';
3032
3100
  readonly plugin: 'Layout';
3033
3101
  }
3034
3102
 
@@ -3127,7 +3195,7 @@ interface NavbarMenuElement
3127
3195
  extends WebflowElement,
3128
3196
  Configurable,
3129
3197
  CustomAttributes,
3130
- DomId,
3198
+ NoDomId,
3131
3199
  Styles,
3132
3200
  Children,
3133
3201
  NoTextContent {
@@ -3816,7 +3884,7 @@ interface UserFormBlockLabelElement
3816
3884
  extends WebflowElement,
3817
3885
  Configurable,
3818
3886
  CustomAttributes,
3819
- DomId,
3887
+ NoDomId,
3820
3888
  Styles,
3821
3889
  Children,
3822
3890
  TextContent {
@@ -4154,6 +4222,7 @@ declare type AnyElement =
4154
4222
  | UnknownElement
4155
4223
  | DOMElement
4156
4224
  | AnimationElement
4225
+ | SplineElement
4157
4226
  | BlockElement
4158
4227
  | BlockquoteElement
4159
4228
  | EmphasizedElement
@@ -4371,6 +4440,10 @@ declare type AnyElement =
4371
4440
  | FormFileUploadInfoElement
4372
4441
  | FormFileUploadTextElement
4373
4442
  | IconElement
4443
+ | LocalesWrapperElement
4444
+ | LocalesEmptyElement
4445
+ | LocalesListElement
4446
+ | LocalesItemElement
4374
4447
  | ContainerElement
4375
4448
  | RowElement
4376
4449
  | ColumnElement
@@ -4378,7 +4451,7 @@ declare type AnyElement =
4378
4451
  | GridElement
4379
4452
  | LayoutElement
4380
4453
  | CellElement
4381
- | FlexContainerElement
4454
+ | BlockContainerElement
4382
4455
  | VFlexElement
4383
4456
  | HFlexElement
4384
4457
  | LightboxWrapperElement
package/elements.d.ts CHANGED
@@ -2,3 +2,7 @@
2
2
  /// <reference path="./elements-generated.d.ts" />
3
3
 
4
4
  declare type ElementId = string;
5
+ declare type CustomAttribute = {
6
+ name: string;
7
+ value: string;
8
+ };
package/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  /// <reference path="./styles.d.ts" />
2
+ /// <reference path="./pages.d.ts" />
2
3
  /// <reference path="./elements.d.ts" />
3
4
 
4
5
  declare global {
@@ -6,15 +7,24 @@ declare global {
6
7
  }
7
8
 
8
9
  interface WebflowApi {
10
+ getSiteInfo(): Promise<{siteId: string; siteName: string}>;
9
11
  getSelectedElement(): Promise<null | AnyElement>;
10
12
  getMediaQuery(): Promise<BreakpointId>;
11
13
  getAllElements(): Promise<Array<AnyElement>>;
12
14
  createStyle(name: string): Style;
13
15
  getStyleByName(name: string): Promise<null | Style>;
14
16
  getAllStyles(): Promise<Array<Style>>;
17
+ getCurrentPage(): Promise<Page>;
18
+ getAllPagesAndFolders(): Promise<Array<Page | Folder>>;
19
+ createFolder(): Promise<Folder>;
20
+ createPage(): Promise<Page>;
21
+ switchPage(page: Page): Promise<void>;
15
22
  createString(text: string): StringElement;
16
23
  createDOM(tag: string): DOMElement;
17
24
  createHeading(tag: 1 | 2 | 3 | 4 | 5 | 6): HeadingElement;
25
+ setExtensionSize(
26
+ size: 'default' | 'comfortable' | 'large' | {width: number; height: number}
27
+ ): Promise<null>;
18
28
  notify(opts: {
19
29
  type: 'Error' | 'Info' | 'Success';
20
30
  message: string;
@@ -27,6 +37,7 @@ interface WebflowApi {
27
37
  event: 'mediaquery',
28
38
  callback: (breakpoint: BreakpointId) => void
29
39
  ): Unsubscribe;
40
+ subscribe(event: 'currentpage', callback: (page: Page) => void): Unsubscribe;
30
41
  }
31
42
 
32
43
  type Unsubscribe = () => undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webflow/designer-extension-typings",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "description": "Typings for the Webflow Designer Extension API",
6
6
  "main": "",
package/pages.d.ts ADDED
@@ -0,0 +1,66 @@
1
+ interface Folder {
2
+ readonly id: FolderId;
3
+ readonly type: 'Folder';
4
+
5
+ getName(): string;
6
+ setName(name: string): undefined;
7
+ getSlug(): string;
8
+ setSlug(slug: string): undefined;
9
+ getParent(): Promise<null | Folder>;
10
+ setParent(parent: Folder): undefined;
11
+
12
+ save(): Promise<undefined>;
13
+ destroy(): undefined;
14
+ }
15
+
16
+ interface Page {
17
+ readonly id: PageId;
18
+ readonly type: 'Page';
19
+
20
+ getName(): string;
21
+ setName(name: string): undefined;
22
+ getSlug(): string;
23
+ setSlug(slug: string): undefined;
24
+ getParent(): Promise<null | Folder>;
25
+ setParent(parent: Folder): undefined;
26
+
27
+ getTitle(): string;
28
+ setTitle(title: string): undefined;
29
+ getDescription(): string;
30
+ setDescription(description: string): undefined;
31
+ isDraft(): boolean;
32
+ setDraft(isDraft: boolean): undefined;
33
+ usesTitleAsOgTitle(): boolean;
34
+ useTitleAsOgTitle(use: boolean): undefined;
35
+ getOgTitle(): string;
36
+ setOgTitle(title: string): undefined;
37
+ usesDescriptionAsOgDescription(): boolean;
38
+ useDescriptionAsOgDescription(use: boolean): undefined;
39
+ getOgDescription(): string;
40
+ setOgDescription(description: string): undefined;
41
+ getOgImage(): string;
42
+ setOgImage(url: string): undefined;
43
+ isExcludedFromSearch(): boolean;
44
+ excludeFromSearch(shouldExclude: boolean): undefined;
45
+ usesTitleAsSearchTitle(): boolean;
46
+ useTitleAsSearchTitle(use: boolean): undefined;
47
+ getSearchTitle(): string;
48
+ setSearchTitle(title: string): undefined;
49
+ usesDescriptionAsSearchDescription(): boolean;
50
+ useDescriptionAsSearchDescription(use: boolean): undefined;
51
+ getSearchDescription(): string;
52
+ setSearchDescription(description: string): undefined;
53
+ usesOgImageAsSearchImage(): boolean;
54
+ useOgImageAsSearchImage(use: boolean): undefined;
55
+ getSearchImage(): string;
56
+ setSearchImage(url: string): undefined;
57
+ isPasswordProtected(): boolean;
58
+ getUtilityPageKey(): null | string;
59
+ isHomepage(): boolean;
60
+
61
+ save(): Promise<undefined>;
62
+ destroy(): undefined;
63
+ }
64
+
65
+ declare type FolderId = string;
66
+ declare type PageId = string;