@webflow/designer-extension-typings 0.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/elements.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ /// <reference path="./styles.d.ts" />
2
+ /// <reference path="./elements-generated.d.ts" />
3
+
4
+ declare type ElementId = string;
package/index.d.ts ADDED
@@ -0,0 +1,19 @@
1
+ /// <reference path="./styles.d.ts" />
2
+ /// <reference path="./elements.d.ts" />
3
+
4
+ declare global {
5
+ const webflow: WebflowApi;
6
+ }
7
+
8
+ interface WebflowApi {
9
+ getSelectedElement(): Promise<null | AnyElement>;
10
+ getElements<t extends AnyElement['type']>(
11
+ types: Array<t>
12
+ ): Promise<Array<Extract<AnyElement, {type: t}>>>;
13
+ createStyle(name: string): Style;
14
+ createString(text: string): StringElement;
15
+ createDOM(tag: string): DOMElement;
16
+ createHeading(tag: 1 | 2 | 3 | 4 | 5 | 6): DOMElement;
17
+ }
18
+
19
+ export {};
package/package.json ADDED
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "@webflow/designer-extension-typings",
3
+ "version": "0.1.0",
4
+ "license": "SEE LICENSE IN LICENSE",
5
+ "description": "Typings for the Webflow Designer Extension API",
6
+ "main": "",
7
+ "scripts": {
8
+ "test": "tsc"
9
+ }
10
+ }
package/styles.d.ts ADDED
@@ -0,0 +1,51 @@
1
+ interface Style {
2
+ readonly id: StyleId;
3
+ getClassName(): string;
4
+ getProperties(options?: BreakpointAndPseudo): PropertyMap;
5
+ setProperties(props: PropertyMap, options?: BreakpointAndPseudo): undefined;
6
+ getProperty(prop: string, options?: BreakpointAndPseudo): null | string;
7
+ setProperty(
8
+ prop: string,
9
+ value: string,
10
+ options?: BreakpointAndPseudo
11
+ ): undefined;
12
+ clearAllProperties(): undefined;
13
+ save(): Promise<undefined>;
14
+ destroy(): undefined;
15
+ }
16
+
17
+ declare type StyleId = string;
18
+
19
+ declare type PropertyMap = {[property: string]: string};
20
+
21
+ declare type BreakpointAndPseudo = {
22
+ breakpoint?: BreakpointId;
23
+ pseudo?: PseudoStateKey;
24
+ };
25
+
26
+ declare type BreakpointId =
27
+ | 'xxl'
28
+ | 'xl'
29
+ | 'large'
30
+ | 'main'
31
+ | 'medium'
32
+ | 'small'
33
+ | 'tiny';
34
+
35
+ declare type PseudoStateKey =
36
+ | 'noPseudo'
37
+ | 'nth-child(odd)'
38
+ | 'nth-child(even)'
39
+ | 'first-child'
40
+ | 'last-child'
41
+ | 'hover'
42
+ | 'active'
43
+ | 'pressed'
44
+ | 'visited'
45
+ | 'focus'
46
+ | 'focus-visible'
47
+ | 'focus-within'
48
+ | 'placeholder'
49
+ | 'empty'
50
+ | 'before'
51
+ | 'after';
package/tsconfig.json ADDED
@@ -0,0 +1,9 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es6",
4
+ "lib": ["es6"],
5
+ "noEmit": true,
6
+ "strict": true,
7
+ "typeRoots": [],
8
+ }
9
+ }