@webflow/designer-extension-typings 2.0.30 → 2.0.33
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 +25 -0
- package/components.d.ts +337 -0
- package/element-presets-generated.d.ts +2 -0
- package/element-settings-generated.d.ts +24 -2
- package/element-settings.d.ts +89 -1
- package/elements-generated.d.ts +357 -2
- package/elements.d.ts +5 -0
- package/instance-props.d.ts +192 -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
|
|
|
@@ -28,6 +29,7 @@ interface SharedApi {
|
|
|
28
29
|
* - siteId: the unique ID of the current Webflow site.
|
|
29
30
|
* - siteName: the name of the current Webflow site.
|
|
30
31
|
* - shortName: a shortened reference to the name of the current Webflow site.
|
|
32
|
+
* - kind: the type of site ('site' for standard Webflow sites).
|
|
31
33
|
* - isPasswordProtected: whether the site is password protected.
|
|
32
34
|
* - isPrivateStaging: whether the site has private staging turned on or not.
|
|
33
35
|
* - domains: an array of objects representing the domains associated with the site, each containing the following properties:
|
|
@@ -41,6 +43,7 @@ interface SharedApi {
|
|
|
41
43
|
* console.log('Site ID:', siteInfo.siteId);
|
|
42
44
|
* console.log('Site Name:', siteInfo.siteName);
|
|
43
45
|
* console.log('Shortened Site Name:', siteInfo.shortName);
|
|
46
|
+
* console.log('Site Kind:', siteInfo.kind);
|
|
44
47
|
* console.log('Domains:', siteInfo.domains);
|
|
45
48
|
* console.log('Workspace ID:', siteInfo.workspaceId);
|
|
46
49
|
* console.log('Workspace Slug:', siteInfo.workspaceSlug);
|
|
@@ -50,6 +53,7 @@ interface SharedApi {
|
|
|
50
53
|
siteId: string;
|
|
51
54
|
siteName: string;
|
|
52
55
|
shortName: string;
|
|
56
|
+
kind: 'site';
|
|
53
57
|
isPasswordProtected: boolean;
|
|
54
58
|
isPrivateStaging: boolean;
|
|
55
59
|
workspaceId: string;
|
|
@@ -829,6 +833,27 @@ interface DesignerOnlyApi {
|
|
|
829
833
|
event: 'pseudomode',
|
|
830
834
|
callback: (pseudoMode: null | PseudoStateKey) => void
|
|
831
835
|
): Unsubscribe;
|
|
836
|
+
/**
|
|
837
|
+
* Subscribe to variant selection changes. The callback fires whenever the selected
|
|
838
|
+
* variant changes on the component canvas.
|
|
839
|
+
* @param event - The name of the event to subscribe to, specifically 'selectedvariant'.
|
|
840
|
+
* @param callback - A callback function receiving the newly selected Variant.
|
|
841
|
+
* @returns An Unsubscribe function that can be used to stop receiving notifications.
|
|
842
|
+
* @example
|
|
843
|
+
* ```ts
|
|
844
|
+
* const unsub = webflow.subscribe('selectedvariant', (variant) => {
|
|
845
|
+
* console.log('Variant changed:', variant.name);
|
|
846
|
+
* console.log('Variant ID:', variant.id);
|
|
847
|
+
* });
|
|
848
|
+
*
|
|
849
|
+
* // Later, to stop listening:
|
|
850
|
+
* unsub();
|
|
851
|
+
* ```
|
|
852
|
+
*/
|
|
853
|
+
subscribe(
|
|
854
|
+
event: 'selectedvariant',
|
|
855
|
+
callback: (variant: Variant) => void
|
|
856
|
+
): Unsubscribe;
|
|
832
857
|
/**
|
|
833
858
|
* Checks if the user has the ability to perform the given App Mode
|
|
834
859
|
* @param appModes
|
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
|
|
@@ -104,6 +132,88 @@ interface Component {
|
|
|
104
132
|
options: SetSelectedVariantOptions | string
|
|
105
133
|
): Promise<null>;
|
|
106
134
|
|
|
135
|
+
/**
|
|
136
|
+
* Reorder variants on this component by specifying an array of variant IDs
|
|
137
|
+
* in the desired order. Accepts variant IDs or `'base'`.
|
|
138
|
+
*
|
|
139
|
+
* When a partial list is provided, the listed variants are repositioned
|
|
140
|
+
* relative to the first item in the list while unlisted variants keep their
|
|
141
|
+
* existing relative order.
|
|
142
|
+
*
|
|
143
|
+
* @param variantIds - Array of variant IDs (or `'base'`) in the desired order.
|
|
144
|
+
* @returns A Promise that resolves when the reorder is complete.
|
|
145
|
+
* @example
|
|
146
|
+
* ```ts
|
|
147
|
+
* // Full reorder
|
|
148
|
+
* await component.reorderVariants(['base', 'variant-2', 'variant-1', 'variant-3']);
|
|
149
|
+
*
|
|
150
|
+
* // Partial reorder — move variant-1 and variant-3 together
|
|
151
|
+
* // Before: base, variant-1, variant-2, variant-3
|
|
152
|
+
* await component.reorderVariants(['variant-1', 'variant-3']);
|
|
153
|
+
* // After: base, variant-1, variant-3, variant-2
|
|
154
|
+
* ```
|
|
155
|
+
*/
|
|
156
|
+
reorderVariants(variantIds: string[]): Promise<null>;
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Delete a variant from this component by ID.
|
|
160
|
+
* The base variant cannot be deleted.
|
|
161
|
+
*
|
|
162
|
+
* @param options - An object containing the `id` of the variant to delete.
|
|
163
|
+
* @returns A promise that resolves when the variant has been deleted.
|
|
164
|
+
* @example
|
|
165
|
+
* ```ts
|
|
166
|
+
* await heroComponent.deleteVariant({ id: 'variant-456' });
|
|
167
|
+
* ```
|
|
168
|
+
*/
|
|
169
|
+
deleteVariant(options: DeleteVariantOptions): Promise<null>;
|
|
170
|
+
/**
|
|
171
|
+
* Get a single variant by ID.
|
|
172
|
+
* Use `'base'` to retrieve the base variant.
|
|
173
|
+
* @param variantId - The variant ID, or `'base'` for the base variant
|
|
174
|
+
* @returns A Promise resolving to the Variant object.
|
|
175
|
+
* @example
|
|
176
|
+
* ```ts
|
|
177
|
+
* const variant = await component.getVariant('variant-123');
|
|
178
|
+
* console.log(variant.name); // "Dark Mode"
|
|
179
|
+
*
|
|
180
|
+
* const base = await component.getVariant('base');
|
|
181
|
+
* console.log(base.name); // "Primary"
|
|
182
|
+
* ```
|
|
183
|
+
*/
|
|
184
|
+
getVariant(variantId: string): Promise<Variant>;
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Update settings on a variant. Currently only `name` is supported.
|
|
188
|
+
* Use `'base'` as the variant ID to rename the base variant.
|
|
189
|
+
*
|
|
190
|
+
* @param variantId - The variant ID, or `'base'` for the base variant
|
|
191
|
+
* @param settings - An object with the properties to update
|
|
192
|
+
* @returns A Promise resolving to the updated Variant object.
|
|
193
|
+
* @example
|
|
194
|
+
* ```ts
|
|
195
|
+
* // Two-argument form
|
|
196
|
+
* const updated = await component.setVariant('variant-123', { name: 'Foo' });
|
|
197
|
+
*
|
|
198
|
+
* // Rename the base variant
|
|
199
|
+
* const base = await component.setVariant('base', { name: 'Default' });
|
|
200
|
+
* ```
|
|
201
|
+
*/
|
|
202
|
+
setVariant(variantId: string, settings: {name: string}): Promise<Variant>;
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Update settings on a variant using an options object.
|
|
206
|
+
* Currently only `name` is supported.
|
|
207
|
+
*
|
|
208
|
+
* @param options - An object containing the variant `id` and properties to update
|
|
209
|
+
* @returns A Promise resolving to the updated Variant object.
|
|
210
|
+
* @example
|
|
211
|
+
* ```ts
|
|
212
|
+
* const updated = await component.setVariant({ id: 'variant-123', name: 'Foo' });
|
|
213
|
+
* ```
|
|
214
|
+
*/
|
|
215
|
+
setVariant(options: SetVariantOptions): Promise<Variant>;
|
|
216
|
+
|
|
107
217
|
/**
|
|
108
218
|
* Get the settings (name, group, description) of a component.
|
|
109
219
|
* @returns A Promise resolving to the component's settings.
|
|
@@ -129,6 +239,56 @@ interface Component {
|
|
|
129
239
|
* ```
|
|
130
240
|
*/
|
|
131
241
|
setSettings(settings: Partial<ComponentSettings>): Promise<null>;
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Get all prop definitions on this component.
|
|
245
|
+
* Returns all prop types including variant, visibility, filter, sort, selectedItems,
|
|
246
|
+
* and booleanFilter — not only the creatable types.
|
|
247
|
+
* Props are returned in panel display order: ungrouped first, then grouped.
|
|
248
|
+
* @returns A Promise resolving to an array of prop definitions.
|
|
249
|
+
*/
|
|
250
|
+
getProps(): Promise<Prop[]>;
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Create a new prop on this component.
|
|
254
|
+
*
|
|
255
|
+
* Supports all 10 creatable prop types. Name conflicts within the same group
|
|
256
|
+
* are auto-incremented (e.g., "Heading" → "Heading 2"). The returned `Prop`
|
|
257
|
+
* includes computed fields (`id`, `valueType`, `bindableTo`) so callers don't
|
|
258
|
+
* need a follow-up `getProps()` call.
|
|
259
|
+
*
|
|
260
|
+
* @param options - The prop definition including type, name, and optional settings.
|
|
261
|
+
* @returns A Promise resolving to the created prop with computed binding metadata.
|
|
262
|
+
*
|
|
263
|
+
* @example
|
|
264
|
+
* ```ts
|
|
265
|
+
* const prop = await component.createProp({
|
|
266
|
+
* type: 'textContent',
|
|
267
|
+
* name: 'Heading',
|
|
268
|
+
* group: 'Content',
|
|
269
|
+
* defaultValue: 'Welcome',
|
|
270
|
+
* });
|
|
271
|
+
* ```
|
|
272
|
+
*/
|
|
273
|
+
createProp(options: CreatePropOptions): Promise<Prop>;
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Create multiple props on this component in a single transaction.
|
|
277
|
+
* If any prop fails validation, no props are created.
|
|
278
|
+
* @param options - An array of prop definitions, each using the same shape as createProp.
|
|
279
|
+
* @returns A Promise resolving to an array of created props, in the same order as the input.
|
|
280
|
+
*/
|
|
281
|
+
createProps(options: CreatePropOptions[]): Promise<Prop[]>;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* Options for creating a new variant or duplicating an existing one.
|
|
286
|
+
*/
|
|
287
|
+
interface CreateVariantOptions {
|
|
288
|
+
/** The name for the new variant (required for create, optional base for duplicate) */
|
|
289
|
+
name: string;
|
|
290
|
+
/** Whether to select this variant after creation (optional, defaults to false) */
|
|
291
|
+
isSelected?: boolean;
|
|
132
292
|
}
|
|
133
293
|
|
|
134
294
|
/** Select variant by display name. */
|
|
@@ -146,6 +306,19 @@ type SetSelectedVariantOptions =
|
|
|
146
306
|
| SetSelectedVariantByName
|
|
147
307
|
| SetSelectedVariantById;
|
|
148
308
|
|
|
309
|
+
/** Options for deleting a variant by ID. */
|
|
310
|
+
interface DeleteVariantOptions {
|
|
311
|
+
/** The ID of the variant to delete. The base variant ('base') cannot be deleted. */
|
|
312
|
+
id: string;
|
|
313
|
+
}
|
|
314
|
+
/** Options for setVariant — update variant settings by ID. */
|
|
315
|
+
interface SetVariantOptions {
|
|
316
|
+
/** The variant ID, or `'base'` for the base variant. */
|
|
317
|
+
id: string;
|
|
318
|
+
/** The new display name for the variant. */
|
|
319
|
+
name: string;
|
|
320
|
+
}
|
|
321
|
+
|
|
149
322
|
interface Variant {
|
|
150
323
|
/** The variant ID. The base variant always has id 'base'. */
|
|
151
324
|
readonly id: string;
|
|
@@ -160,6 +333,170 @@ interface Variant {
|
|
|
160
333
|
readonly isSelected: boolean;
|
|
161
334
|
}
|
|
162
335
|
|
|
336
|
+
/**
|
|
337
|
+
* A prop definition on a component.
|
|
338
|
+
*
|
|
339
|
+
* `type` and `valueType` describe the same prop from two different angles:
|
|
340
|
+
* - `type` is the prop's structural category in the component definition
|
|
341
|
+
* (e.g. `'image'` for image asset props).
|
|
342
|
+
* - `valueType` is the data-binding value type used when binding a CMS field
|
|
343
|
+
* or variable to this prop (e.g. `'imageAsset'` for the same image prop).
|
|
344
|
+
* For most prop types these are identical. The only current exception is image
|
|
345
|
+
* asset props, where `type === 'image'` and `valueType === 'imageAsset'`.
|
|
346
|
+
*/
|
|
347
|
+
interface Prop {
|
|
348
|
+
/** The field ID from the component's WFDL data type. */
|
|
349
|
+
readonly id: string;
|
|
350
|
+
/**
|
|
351
|
+
* The prop's structural category (e.g. `'string'`, `'boolean'`, `'image'`,
|
|
352
|
+
* `'variant'`, `'slot'`). Use this to determine which optional fields
|
|
353
|
+
* (`min`/`max`/`decimals`, `trueLabel`/`falseLabel`, `multiline`) are present.
|
|
354
|
+
*/
|
|
355
|
+
readonly type: PropType;
|
|
356
|
+
/**
|
|
357
|
+
* The data-binding value type for this prop (e.g. `'string'`, `'boolean'`,
|
|
358
|
+
* `'imageAsset'`, `'variant'`). Use this when filtering which CMS fields or
|
|
359
|
+
* variables are compatible with this prop via `bindableTo`.
|
|
360
|
+
* Identical to `type` for all prop types except image asset props
|
|
361
|
+
* (`type: 'image'`, `valueType: 'imageAsset'`).
|
|
362
|
+
*/
|
|
363
|
+
readonly valueType: BindableValueType;
|
|
364
|
+
/** The data-binding target types this prop can accept. */
|
|
365
|
+
readonly bindableTo: readonly BindableValueType[];
|
|
366
|
+
/** The display name for this prop (derived from its label). */
|
|
367
|
+
name: string;
|
|
368
|
+
/** The group name this prop belongs to, or null if ungrouped. */
|
|
369
|
+
group: string | null;
|
|
370
|
+
/** A tooltip description for this prop, or null if not set. */
|
|
371
|
+
tooltip: string | null;
|
|
372
|
+
/**
|
|
373
|
+
* The default value for this prop, or null if not set or not applicable.
|
|
374
|
+
*
|
|
375
|
+
* The shape depends on `valueType`:
|
|
376
|
+
* - `'string'` | `'number'` | `'id'` | `'altText'` → the raw primitive value
|
|
377
|
+
* - `'boolean'` → `true` or `false`
|
|
378
|
+
* - `'imageAsset'` → the asset ID string
|
|
379
|
+
* - `'link'` → `{ mode: string; to?: string | object; openInNewTab?: boolean; rel?: string }`
|
|
380
|
+
* - `'video'` → `{ src?: string; title?: string }`
|
|
381
|
+
* - `'textContent'` → the plain-text string extracted from the default children
|
|
382
|
+
* - `'richText'` → `{ innerText: string }`
|
|
383
|
+
* - `'variant'` | `'visibility'` | `'filter'` | `'sort'` | `'selectedItems'`
|
|
384
|
+
* → always `null`
|
|
385
|
+
*/
|
|
386
|
+
readonly defaultValue: ResolvedValue | null;
|
|
387
|
+
/** Whether the text input allows multiple lines. Present on string and textContent props. */
|
|
388
|
+
multiline?: boolean;
|
|
389
|
+
/** The minimum allowed value. Present on number props. */
|
|
390
|
+
min?: number;
|
|
391
|
+
/** The maximum allowed value. Present on number props. */
|
|
392
|
+
max?: number;
|
|
393
|
+
/** The number of decimal places (precision) allowed. Present on number props. */
|
|
394
|
+
decimals?: number;
|
|
395
|
+
/** The label shown when the boolean is true. Present on boolean props. */
|
|
396
|
+
trueLabel?: string;
|
|
397
|
+
/** The label shown when the boolean is false. Present on boolean props. */
|
|
398
|
+
falseLabel?: string;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
// ---------------------------------------------------------------------------
|
|
402
|
+
// createProp input types (discriminated union on `type`)
|
|
403
|
+
// ---------------------------------------------------------------------------
|
|
404
|
+
|
|
405
|
+
/** Common fields shared by all prop types. */
|
|
406
|
+
interface CreatePropCommon {
|
|
407
|
+
/** Display name for the prop. Auto-incremented on conflicts within the same group. */
|
|
408
|
+
name: string;
|
|
409
|
+
/** Group/folder name. Props with the same group appear together in the props panel. */
|
|
410
|
+
group?: string;
|
|
411
|
+
/** Tooltip text shown on hover in the props panel. */
|
|
412
|
+
tooltip?: string;
|
|
413
|
+
/** The default value for this prop, or null if not set or not applicable. */
|
|
414
|
+
defaultValue?: ResolvedValue | null;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
interface TextContentPropInput extends CreatePropCommon {
|
|
418
|
+
type: 'textContent';
|
|
419
|
+
/** Whether the text input supports multiple lines. */
|
|
420
|
+
multiline?: boolean;
|
|
421
|
+
defaultValue?: string;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
interface StringPropInput extends CreatePropCommon {
|
|
425
|
+
type: 'string';
|
|
426
|
+
defaultValue?: string;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
interface RichTextPropInput extends CreatePropCommon {
|
|
430
|
+
type: 'richText';
|
|
431
|
+
defaultValue?: RichTextResolvedValue;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
interface ImagePropInput extends CreatePropCommon {
|
|
435
|
+
type: 'image';
|
|
436
|
+
/** Default asset ID. */
|
|
437
|
+
defaultValue?: string;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
interface LinkPropInput extends CreatePropCommon {
|
|
441
|
+
type: 'link';
|
|
442
|
+
defaultValue?: LinkResolvedValue;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
interface VideoPropInput extends CreatePropCommon {
|
|
446
|
+
type: 'video';
|
|
447
|
+
defaultValue?: VideoResolvedValue;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
interface NumberPropInput extends CreatePropCommon {
|
|
451
|
+
type: 'number';
|
|
452
|
+
min?: number;
|
|
453
|
+
max?: number;
|
|
454
|
+
/** Number of decimal places allowed. */
|
|
455
|
+
decimals?: number;
|
|
456
|
+
defaultValue?: number;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
interface BooleanPropInput extends CreatePropCommon {
|
|
460
|
+
type: 'boolean';
|
|
461
|
+
/** Label shown when the value is true (e.g., "Visible"). */
|
|
462
|
+
trueLabel?: string;
|
|
463
|
+
/** Label shown when the value is false (e.g., "Hidden"). */
|
|
464
|
+
falseLabel?: string;
|
|
465
|
+
defaultValue?: boolean;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
interface IdPropInput extends CreatePropCommon {
|
|
469
|
+
type: 'id';
|
|
470
|
+
/**
|
|
471
|
+
* Default ID value. Normalized on the host side — invalid characters are
|
|
472
|
+
* stripped, spaces become hyphens, result is lowercased. The response returns
|
|
473
|
+
* the normalized value. Error if normalization produces an empty string.
|
|
474
|
+
*/
|
|
475
|
+
defaultValue?: string;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
interface AltTextPropInput extends CreatePropCommon {
|
|
479
|
+
type: 'altText';
|
|
480
|
+
/**
|
|
481
|
+
* Default alt text value. The special strings `"decorative"` (marks image as
|
|
482
|
+
* decorative) and `"inherit"` (inherit from asset) have semantic meaning.
|
|
483
|
+
*/
|
|
484
|
+
defaultValue?: string | null;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
/** Options for creating a new prop on a component. Discriminated on `type`. */
|
|
488
|
+
type CreatePropOptions =
|
|
489
|
+
| TextContentPropInput
|
|
490
|
+
| StringPropInput
|
|
491
|
+
| RichTextPropInput
|
|
492
|
+
| ImagePropInput
|
|
493
|
+
| LinkPropInput
|
|
494
|
+
| VideoPropInput
|
|
495
|
+
| NumberPropInput
|
|
496
|
+
| BooleanPropInput
|
|
497
|
+
| IdPropInput
|
|
498
|
+
| AltTextPropInput;
|
|
499
|
+
|
|
163
500
|
/**
|
|
164
501
|
* Settings for a component, including name, group, and description.
|
|
165
502
|
*/
|
|
@@ -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,10 @@ type BindableValueType =
|
|
|
28
29
|
| 'sort'
|
|
29
30
|
| 'selectedItems'
|
|
30
31
|
| 'visibility'
|
|
31
|
-
| 'booleanFilter'
|
|
32
|
+
| 'booleanFilter'
|
|
33
|
+
| 'altText'
|
|
34
|
+
| 'id'
|
|
35
|
+
| 'headingTag';
|
|
32
36
|
|
|
33
37
|
type PropType =
|
|
34
38
|
| 'textContent'
|
|
@@ -42,8 +46,26 @@ type PropType =
|
|
|
42
46
|
| 'variant'
|
|
43
47
|
| 'slot'
|
|
44
48
|
| 'id'
|
|
49
|
+
| 'altText'
|
|
45
50
|
| 'booleanFilter'
|
|
46
51
|
| 'visibility'
|
|
47
52
|
| 'filter'
|
|
48
53
|
| 'sort'
|
|
49
|
-
| 'selectedItems'
|
|
54
|
+
| 'selectedItems'
|
|
55
|
+
| 'headingTag';
|
|
56
|
+
|
|
57
|
+
type CmsFieldType =
|
|
58
|
+
| 'plainText'
|
|
59
|
+
| 'email'
|
|
60
|
+
| 'phone'
|
|
61
|
+
| 'url'
|
|
62
|
+
| 'date'
|
|
63
|
+
| 'option'
|
|
64
|
+
| 'number'
|
|
65
|
+
| 'color'
|
|
66
|
+
| 'boolean'
|
|
67
|
+
| 'image'
|
|
68
|
+
| 'multiImage'
|
|
69
|
+
| 'file'
|
|
70
|
+
| 'video'
|
|
71
|
+
| 'richText';
|
package/element-settings.d.ts
CHANGED
|
@@ -7,7 +7,65 @@ 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;
|
|
54
|
+
|
|
55
|
+
interface ElementSetting {
|
|
56
|
+
valueType: BindableValueType;
|
|
57
|
+
canBind: boolean;
|
|
58
|
+
value: SettingValue;
|
|
59
|
+
resolvedValue: ResolvedValue | null;
|
|
60
|
+
display: SettingDisplay;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
interface SearchSettingsOptions {
|
|
64
|
+
/** Filter to settings that produce a specific value type (e.g., "string", "image") */
|
|
65
|
+
valueType?: BindableValueType;
|
|
66
|
+
/** Filter to a specific setting by key (e.g., "domId", "assetId") */
|
|
67
|
+
key?: string;
|
|
68
|
+
}
|
|
11
69
|
|
|
12
70
|
interface SearchBindableSourcesOptions {
|
|
13
71
|
/** Filter to sources compatible with a specific element setting key (e.g., "altText", "src", "domId") */
|
|
@@ -15,3 +73,33 @@ interface SearchBindableSourcesOptions {
|
|
|
15
73
|
/** Filter to sources that produce a specific value type (e.g., "string", "imageAsset") */
|
|
16
74
|
valueType?: BindableValueType;
|
|
17
75
|
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Input to element.setSettings().
|
|
79
|
+
* Each key is a setting key (e.g., 'domId', 'tag', 'assetId').
|
|
80
|
+
* Values can be:
|
|
81
|
+
* - A static value (string, number, boolean, or object depending on the setting type)
|
|
82
|
+
* - A BindingInput to bind the setting to a data source
|
|
83
|
+
* - null to reset the setting to its default / disconnect any binding
|
|
84
|
+
*/
|
|
85
|
+
type SetSettingsInput = Record<string, ResolvedValue | BindingInput | null>;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Return type for element.getSettings().
|
|
89
|
+
* Each key is a setting key (e.g., 'domId', 'tag', 'visibility').
|
|
90
|
+
* Static values are bare (string, number, boolean, etc.).
|
|
91
|
+
* Bound values include binding metadata (sourceType + source fields).
|
|
92
|
+
* Settings with no value and no default are null.
|
|
93
|
+
*/
|
|
94
|
+
type ElementSettingSummaries = Record<
|
|
95
|
+
string,
|
|
96
|
+
ResolvedValue | BindingValue | null
|
|
97
|
+
>;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Return type for element.getResolvedSettings().
|
|
101
|
+
* Each key is a setting key (e.g., 'domId', 'tag', 'visibility').
|
|
102
|
+
* Values are the resolved output — static values are bare, bindings
|
|
103
|
+
* are evaluated to their current value, and unresolvable bindings are null.
|
|
104
|
+
*/
|
|
105
|
+
type ResolvedElementSettings = Record<string, ResolvedValue | null>;
|