@webflow/designer-extension-typings 2.0.30 → 2.0.31
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 +1 -0
- package/components.d.ts +38 -0
- package/element-presets-generated.d.ts +2 -0
- package/element-settings-generated.d.ts +20 -1
- package/element-settings.d.ts +44 -1
- package/elements-generated.d.ts +42 -0
- package/instance-props.d.ts +150 -0
- package/package.json +1 -1
package/api.d.ts
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
/// <reference path="./assets.d.ts" />
|
|
11
11
|
/// <reference path="./element-settings-generated.d.ts" />
|
|
12
12
|
/// <reference path="./element-settings.d.ts" />
|
|
13
|
+
/// <reference path="./instance-props.d.ts" />
|
|
13
14
|
/// <reference path="./app-modes-generated.d.ts" />
|
|
14
15
|
/// <reference path="./app-connections.d.ts" />
|
|
15
16
|
|
package/components.d.ts
CHANGED
|
@@ -69,6 +69,34 @@ interface Component {
|
|
|
69
69
|
*/
|
|
70
70
|
getVariants(): Promise<Variant[]>;
|
|
71
71
|
|
|
72
|
+
/**
|
|
73
|
+
* Create a new variant for this component.
|
|
74
|
+
* @param options - The name for the new variant and optional selection behavior
|
|
75
|
+
* @returns A promise that resolves to the newly created Variant.
|
|
76
|
+
* @example
|
|
77
|
+
* ```ts
|
|
78
|
+
* const variant = await heroComponent.createVariant({ name: "Dark Mode" });
|
|
79
|
+
* console.log(variant.name); // "Dark Mode"
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
createVariant(options: CreateVariantOptions): Promise<Variant>;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Duplicate an existing variant. Overload: pass sourceVariantId as second argument.
|
|
86
|
+
* @param options - Options for the duplicate (name base, isSelected)
|
|
87
|
+
* @param sourceVariantId - The variant ID to duplicate, or 'base' to duplicate the base variant
|
|
88
|
+
* @returns A promise that resolves to the newly created duplicate Variant.
|
|
89
|
+
* @example
|
|
90
|
+
* ```ts
|
|
91
|
+
* const duplicate = await heroComponent.createVariant({ name: "Copy" }, variants[1].id);
|
|
92
|
+
* const baseCopy = await heroComponent.createVariant({ name: "Base Copy" }, "base");
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
createVariant(
|
|
96
|
+
options: CreateVariantOptions,
|
|
97
|
+
sourceVariantId: string
|
|
98
|
+
): Promise<Variant>;
|
|
99
|
+
|
|
72
100
|
/**
|
|
73
101
|
* Get the currently selected variant for this component.
|
|
74
102
|
* The selected variant reflects the Designer's current editing
|
|
@@ -131,6 +159,16 @@ interface Component {
|
|
|
131
159
|
setSettings(settings: Partial<ComponentSettings>): Promise<null>;
|
|
132
160
|
}
|
|
133
161
|
|
|
162
|
+
/**
|
|
163
|
+
* Options for creating a new variant or duplicating an existing one.
|
|
164
|
+
*/
|
|
165
|
+
interface CreateVariantOptions {
|
|
166
|
+
/** The name for the new variant (required for create, optional base for duplicate) */
|
|
167
|
+
name: string;
|
|
168
|
+
/** Whether to select this variant after creation (optional, defaults to false) */
|
|
169
|
+
isSelected?: boolean;
|
|
170
|
+
}
|
|
171
|
+
|
|
134
172
|
/** Select variant by display name. */
|
|
135
173
|
interface SetSelectedVariantByName {
|
|
136
174
|
name: string;
|
|
@@ -37,6 +37,7 @@ type ElementPresets = {
|
|
|
37
37
|
CommerceCheckoutAdditionalInfoSummaryWrapper: ElementPreset<CommerceCheckoutAdditionalInfoSummaryWrapperElement>;
|
|
38
38
|
CommerceDownloadsWrapper: ElementPreset<CommerceDownloadsWrapperElement>;
|
|
39
39
|
DropdownWrapper: ElementPreset<DropdownWrapperElement>;
|
|
40
|
+
DropTarget: ElementPreset<DropTargetElement>;
|
|
40
41
|
DynamoWrapper: ElementPreset<DynamoWrapperElement>;
|
|
41
42
|
HtmlEmbed: ElementPreset<HtmlEmbedElement>;
|
|
42
43
|
Video: ElementPreset<VideoElement>;
|
|
@@ -104,4 +105,5 @@ type ElementPresets = {
|
|
|
104
105
|
LayoutFooterDark: ElementPreset<SectionElement>;
|
|
105
106
|
LayoutFooterLight: ElementPreset<SectionElement>;
|
|
106
107
|
LayoutFooterSubscribe: ElementPreset<SectionElement>;
|
|
108
|
+
Slot: ElementPreset<SlotElement>;
|
|
107
109
|
};
|
|
@@ -20,6 +20,7 @@ type BindableValueType =
|
|
|
20
20
|
| 'imageSet'
|
|
21
21
|
| 'number'
|
|
22
22
|
| 'enum'
|
|
23
|
+
| 'option'
|
|
23
24
|
| 'slot'
|
|
24
25
|
| 'reference'
|
|
25
26
|
| 'referenceSet'
|
|
@@ -28,7 +29,9 @@ type BindableValueType =
|
|
|
28
29
|
| 'sort'
|
|
29
30
|
| 'selectedItems'
|
|
30
31
|
| 'visibility'
|
|
31
|
-
| 'booleanFilter'
|
|
32
|
+
| 'booleanFilter'
|
|
33
|
+
| 'altText'
|
|
34
|
+
| 'id';
|
|
32
35
|
|
|
33
36
|
type PropType =
|
|
34
37
|
| 'textContent'
|
|
@@ -42,8 +45,24 @@ type PropType =
|
|
|
42
45
|
| 'variant'
|
|
43
46
|
| 'slot'
|
|
44
47
|
| 'id'
|
|
48
|
+
| 'altText'
|
|
45
49
|
| 'booleanFilter'
|
|
46
50
|
| 'visibility'
|
|
47
51
|
| 'filter'
|
|
48
52
|
| 'sort'
|
|
49
53
|
| 'selectedItems';
|
|
54
|
+
|
|
55
|
+
type CmsFieldType =
|
|
56
|
+
| 'plainText'
|
|
57
|
+
| 'email'
|
|
58
|
+
| 'phone'
|
|
59
|
+
| 'url'
|
|
60
|
+
| 'date'
|
|
61
|
+
| 'option'
|
|
62
|
+
| 'number'
|
|
63
|
+
| 'color'
|
|
64
|
+
| 'boolean'
|
|
65
|
+
| 'image'
|
|
66
|
+
| 'file'
|
|
67
|
+
| 'video'
|
|
68
|
+
| 'richText';
|
package/element-settings.d.ts
CHANGED
|
@@ -7,7 +7,50 @@ interface PropBindableSource {
|
|
|
7
7
|
bindableTo: readonly BindableValueType[];
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
interface CmsBindableSource {
|
|
11
|
+
sourceType: 'cms';
|
|
12
|
+
collectionId: string;
|
|
13
|
+
collectionName: string;
|
|
14
|
+
fieldId: string;
|
|
15
|
+
fieldName: string;
|
|
16
|
+
fieldGroup: string | null;
|
|
17
|
+
fieldType: CmsFieldType;
|
|
18
|
+
valueType: BindableValueType;
|
|
19
|
+
bindableTo: readonly BindableValueType[];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface PageBindableSource {
|
|
23
|
+
sourceType: 'page';
|
|
24
|
+
fieldKey: string;
|
|
25
|
+
fieldName: string;
|
|
26
|
+
valueType: BindableValueType;
|
|
27
|
+
bindableTo: readonly BindableValueType[];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
interface LocaleBindableSource {
|
|
31
|
+
sourceType: 'locale';
|
|
32
|
+
fieldKey: string;
|
|
33
|
+
fieldName: string;
|
|
34
|
+
fieldType: 'string';
|
|
35
|
+
valueType: BindableValueType;
|
|
36
|
+
bindableTo: readonly BindableValueType[];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
interface LocaleItemBindableSource {
|
|
40
|
+
sourceType: 'localeItem';
|
|
41
|
+
fieldKey: string;
|
|
42
|
+
fieldName: string;
|
|
43
|
+
fieldType: 'string';
|
|
44
|
+
valueType: BindableValueType;
|
|
45
|
+
bindableTo: readonly BindableValueType[];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
type BindableSource =
|
|
49
|
+
| PropBindableSource
|
|
50
|
+
| CmsBindableSource
|
|
51
|
+
| PageBindableSource
|
|
52
|
+
| LocaleBindableSource
|
|
53
|
+
| LocaleItemBindableSource;
|
|
11
54
|
|
|
12
55
|
interface SearchBindableSourcesOptions {
|
|
13
56
|
/** Filter to sources compatible with a specific element setting key (e.g., "altText", "src", "domId") */
|
package/elements-generated.d.ts
CHANGED
|
@@ -71,6 +71,7 @@ interface WebflowElement {
|
|
|
71
71
|
remove(this: {id: FullElementId}): Promise<null>;
|
|
72
72
|
readonly before: InsertOrMoveElement;
|
|
73
73
|
readonly after: InsertOrMoveElement;
|
|
74
|
+
getParentComponent(this: {id: FullElementId}): Promise<Component | null>;
|
|
74
75
|
}
|
|
75
76
|
|
|
76
77
|
interface CustomAttributes {
|
|
@@ -178,6 +179,13 @@ interface ComponentElement
|
|
|
178
179
|
readonly plugin: '';
|
|
179
180
|
getComponent(): Promise<Component>;
|
|
180
181
|
getSlots(): Promise<Array<SlotInstanceElement>>;
|
|
182
|
+
getProps(): Promise<Array<InstancePropSummary>>;
|
|
183
|
+
searchProps(
|
|
184
|
+
options?: SearchInstancePropsOptions
|
|
185
|
+
): Promise<Array<InstanceProp>>;
|
|
186
|
+
setProps(
|
|
187
|
+
props: Array<SetInstancePropEntry>
|
|
188
|
+
): Promise<Array<SetInstancePropEntry>>;
|
|
181
189
|
}
|
|
182
190
|
|
|
183
191
|
interface UnknownElement
|
|
@@ -3161,6 +3169,22 @@ interface DropdownWrapperElement
|
|
|
3161
3169
|
readonly plugin: 'Dropdown';
|
|
3162
3170
|
}
|
|
3163
3171
|
|
|
3172
|
+
interface DropTargetElement
|
|
3173
|
+
extends
|
|
3174
|
+
WebflowElement,
|
|
3175
|
+
CustomAttributes,
|
|
3176
|
+
DomId,
|
|
3177
|
+
Styles,
|
|
3178
|
+
Children,
|
|
3179
|
+
NoTextContent,
|
|
3180
|
+
NoAppConnections,
|
|
3181
|
+
DisplayName,
|
|
3182
|
+
ElementSettings {
|
|
3183
|
+
readonly id: FullElementId;
|
|
3184
|
+
readonly type: 'DropTarget';
|
|
3185
|
+
readonly plugin: 'PageBuilding';
|
|
3186
|
+
}
|
|
3187
|
+
|
|
3164
3188
|
interface DynamoWrapperElement
|
|
3165
3189
|
extends
|
|
3166
3190
|
WebflowElement,
|
|
@@ -4639,6 +4663,22 @@ interface GridRowElement
|
|
|
4639
4663
|
readonly plugin: 'Users';
|
|
4640
4664
|
}
|
|
4641
4665
|
|
|
4666
|
+
interface SlotElement
|
|
4667
|
+
extends
|
|
4668
|
+
WebflowElement,
|
|
4669
|
+
CustomAttributes,
|
|
4670
|
+
DomId,
|
|
4671
|
+
Styles,
|
|
4672
|
+
Children,
|
|
4673
|
+
NoTextContent,
|
|
4674
|
+
NoAppConnections,
|
|
4675
|
+
DisplayName,
|
|
4676
|
+
ElementSettings {
|
|
4677
|
+
readonly id: FullElementId;
|
|
4678
|
+
readonly type: 'Slot';
|
|
4679
|
+
readonly plugin: 'Slots';
|
|
4680
|
+
}
|
|
4681
|
+
|
|
4642
4682
|
interface FrameElement
|
|
4643
4683
|
extends
|
|
4644
4684
|
WebflowElement,
|
|
@@ -4842,6 +4882,7 @@ type AnyElement =
|
|
|
4842
4882
|
| DropdownListElement
|
|
4843
4883
|
| DropdownToggleElement
|
|
4844
4884
|
| DropdownWrapperElement
|
|
4885
|
+
| DropTargetElement
|
|
4845
4886
|
| DynamoWrapperElement
|
|
4846
4887
|
| DynamoListElement
|
|
4847
4888
|
| DynamoItemElement
|
|
@@ -4932,4 +4973,5 @@ type AnyElement =
|
|
|
4932
4973
|
| BlockHeaderElement
|
|
4933
4974
|
| FlexColumnElement
|
|
4934
4975
|
| GridRowElement
|
|
4976
|
+
| SlotElement
|
|
4935
4977
|
| FrameElement;
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
// Instance Props types
|
|
2
|
+
|
|
3
|
+
interface LinkResolvedValue {
|
|
4
|
+
mode:
|
|
5
|
+
| 'url'
|
|
6
|
+
| 'page'
|
|
7
|
+
| 'pageSection'
|
|
8
|
+
| 'email'
|
|
9
|
+
| 'phone'
|
|
10
|
+
| 'file'
|
|
11
|
+
| 'collectionPage';
|
|
12
|
+
to?:
|
|
13
|
+
| string
|
|
14
|
+
| {pageId: string}
|
|
15
|
+
| {assetId: string}
|
|
16
|
+
| {fullElementId: {element: string; component: string}}
|
|
17
|
+
| {pageSlug: string};
|
|
18
|
+
openInNewTab?: boolean;
|
|
19
|
+
emailSubject?: string;
|
|
20
|
+
rel?: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
interface VideoResolvedValue {
|
|
24
|
+
src?: string;
|
|
25
|
+
title?: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
interface RichTextResolvedValue {
|
|
29
|
+
innerText: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
type ResolvedValue =
|
|
33
|
+
| string
|
|
34
|
+
| number
|
|
35
|
+
| boolean
|
|
36
|
+
| null
|
|
37
|
+
| LinkResolvedValue
|
|
38
|
+
| VideoResolvedValue
|
|
39
|
+
| RichTextResolvedValue;
|
|
40
|
+
|
|
41
|
+
interface StaticPropValue {
|
|
42
|
+
sourceType: 'static';
|
|
43
|
+
value: ResolvedValue | null;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
type BindingPropValue =
|
|
47
|
+
| {
|
|
48
|
+
sourceType: 'prop';
|
|
49
|
+
propId: string;
|
|
50
|
+
propName: string;
|
|
51
|
+
propGroup: string | null;
|
|
52
|
+
}
|
|
53
|
+
| {
|
|
54
|
+
sourceType: 'cms';
|
|
55
|
+
collectionId: string;
|
|
56
|
+
collectionName: string;
|
|
57
|
+
fieldId: string;
|
|
58
|
+
fieldName: string;
|
|
59
|
+
fieldGroup: string | null;
|
|
60
|
+
fieldType: CmsFieldType;
|
|
61
|
+
}
|
|
62
|
+
| {
|
|
63
|
+
sourceType: 'locale';
|
|
64
|
+
fieldKey: string;
|
|
65
|
+
fieldName: string;
|
|
66
|
+
fieldType: 'string';
|
|
67
|
+
}
|
|
68
|
+
| {
|
|
69
|
+
sourceType: 'localeItem';
|
|
70
|
+
fieldKey: string;
|
|
71
|
+
fieldName: string;
|
|
72
|
+
fieldType: 'string';
|
|
73
|
+
}
|
|
74
|
+
| {
|
|
75
|
+
sourceType: 'page';
|
|
76
|
+
fieldKey: string;
|
|
77
|
+
fieldName: string;
|
|
78
|
+
}
|
|
79
|
+
| {sourceType: 'conditional'}
|
|
80
|
+
| {sourceType: 'legacy'};
|
|
81
|
+
|
|
82
|
+
type InstancePropValue = StaticPropValue | BindingPropValue;
|
|
83
|
+
|
|
84
|
+
interface InstancePropDisplay {
|
|
85
|
+
label: string;
|
|
86
|
+
group: string | null;
|
|
87
|
+
trueLabel?: string;
|
|
88
|
+
falseLabel?: string;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
interface InstanceProp {
|
|
92
|
+
propId: string;
|
|
93
|
+
valueType: BindableValueType;
|
|
94
|
+
hasOverride: boolean;
|
|
95
|
+
value: InstancePropValue;
|
|
96
|
+
resolvedValue: ResolvedValue | null;
|
|
97
|
+
defaultValue: ResolvedValue | null;
|
|
98
|
+
display: InstancePropDisplay;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
interface InstancePropSummary {
|
|
102
|
+
propId: string;
|
|
103
|
+
value: ResolvedValue | BindingPropValue | null;
|
|
104
|
+
hasOverride: boolean;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
interface SearchInstancePropsOptions {
|
|
108
|
+
/** Filter to props that produce a specific value type (e.g., "string", "boolean") */
|
|
109
|
+
valueType?: BindableValueType;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// Set Instance Props types
|
|
113
|
+
|
|
114
|
+
interface PropBindingInput {
|
|
115
|
+
sourceType: 'prop';
|
|
116
|
+
propId: string;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
interface CmsBindingInput {
|
|
120
|
+
sourceType: 'cms';
|
|
121
|
+
collectionId: string;
|
|
122
|
+
fieldId: string;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
interface PageBindingInput {
|
|
126
|
+
sourceType: 'page';
|
|
127
|
+
fieldKey: string;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
interface LocaleBindingInput {
|
|
131
|
+
sourceType: 'locale';
|
|
132
|
+
fieldKey: string;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
interface LocaleItemBindingInput {
|
|
136
|
+
sourceType: 'localeItem';
|
|
137
|
+
fieldKey: string;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
type BindingInput =
|
|
141
|
+
| PropBindingInput
|
|
142
|
+
| CmsBindingInput
|
|
143
|
+
| PageBindingInput
|
|
144
|
+
| LocaleBindingInput
|
|
145
|
+
| LocaleItemBindingInput;
|
|
146
|
+
|
|
147
|
+
interface SetInstancePropEntry {
|
|
148
|
+
propId: string;
|
|
149
|
+
value: ResolvedValue | BindingInput | null;
|
|
150
|
+
}
|