@webflow/designer-extension-typings 2.0.31 → 2.0.34
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 +31 -1
- package/components.d.ts +336 -0
- package/element-settings-generated.d.ts +5 -2
- package/element-settings.d.ts +79 -0
- package/elements-generated.d.ts +1280 -338
- package/elements.d.ts +5 -0
- package/instance-props.d.ts +64 -22
- package/package.json +1 -1
- package/styles.d.ts +112 -28
package/api.d.ts
CHANGED
|
@@ -29,6 +29,7 @@ interface SharedApi {
|
|
|
29
29
|
* - siteId: the unique ID of the current Webflow site.
|
|
30
30
|
* - siteName: the name of the current Webflow site.
|
|
31
31
|
* - shortName: a shortened reference to the name of the current Webflow site.
|
|
32
|
+
* - kind: the type of site ('site' for standard Webflow sites).
|
|
32
33
|
* - isPasswordProtected: whether the site is password protected.
|
|
33
34
|
* - isPrivateStaging: whether the site has private staging turned on or not.
|
|
34
35
|
* - domains: an array of objects representing the domains associated with the site, each containing the following properties:
|
|
@@ -42,6 +43,7 @@ interface SharedApi {
|
|
|
42
43
|
* console.log('Site ID:', siteInfo.siteId);
|
|
43
44
|
* console.log('Site Name:', siteInfo.siteName);
|
|
44
45
|
* console.log('Shortened Site Name:', siteInfo.shortName);
|
|
46
|
+
* console.log('Site Kind:', siteInfo.kind);
|
|
45
47
|
* console.log('Domains:', siteInfo.domains);
|
|
46
48
|
* console.log('Workspace ID:', siteInfo.workspaceId);
|
|
47
49
|
* console.log('Workspace Slug:', siteInfo.workspaceSlug);
|
|
@@ -51,6 +53,7 @@ interface SharedApi {
|
|
|
51
53
|
siteId: string;
|
|
52
54
|
siteName: string;
|
|
53
55
|
shortName: string;
|
|
56
|
+
kind: 'site';
|
|
54
57
|
isPasswordProtected: boolean;
|
|
55
58
|
isPrivateStaging: boolean;
|
|
56
59
|
workspaceId: string;
|
|
@@ -342,7 +345,13 @@ interface SharedApi {
|
|
|
342
345
|
* const heroComponent = await webflow.getComponent('4a669354-353a-97eb-795c-4471b406e043');
|
|
343
346
|
* await webflow.openCanvas(heroComponent);
|
|
344
347
|
*
|
|
345
|
-
* // Open a component canvas by
|
|
348
|
+
* // Open a component canvas by component instance (ComponentElement)
|
|
349
|
+
* const selectedElement = await webflow.getSelectedElement();
|
|
350
|
+
* if (selectedElement?.type === 'ComponentInstance') {
|
|
351
|
+
* await webflow.openCanvas(selectedElement);
|
|
352
|
+
* }
|
|
353
|
+
*
|
|
354
|
+
* // Open a page canvas by page
|
|
346
355
|
* const myPage = await webflow.getPage('123');
|
|
347
356
|
* await webflow.openCanvas(myPage);
|
|
348
357
|
* ```
|
|
@@ -830,6 +839,27 @@ interface DesignerOnlyApi {
|
|
|
830
839
|
event: 'pseudomode',
|
|
831
840
|
callback: (pseudoMode: null | PseudoStateKey) => void
|
|
832
841
|
): Unsubscribe;
|
|
842
|
+
/**
|
|
843
|
+
* Subscribe to variant selection changes. The callback fires whenever the selected
|
|
844
|
+
* variant changes on the component canvas.
|
|
845
|
+
* @param event - The name of the event to subscribe to, specifically 'selectedvariant'.
|
|
846
|
+
* @param callback - A callback function receiving the newly selected Variant.
|
|
847
|
+
* @returns An Unsubscribe function that can be used to stop receiving notifications.
|
|
848
|
+
* @example
|
|
849
|
+
* ```ts
|
|
850
|
+
* const unsub = webflow.subscribe('selectedvariant', (variant) => {
|
|
851
|
+
* console.log('Variant changed:', variant.name);
|
|
852
|
+
* console.log('Variant ID:', variant.id);
|
|
853
|
+
* });
|
|
854
|
+
*
|
|
855
|
+
* // Later, to stop listening:
|
|
856
|
+
* unsub();
|
|
857
|
+
* ```
|
|
858
|
+
*/
|
|
859
|
+
subscribe(
|
|
860
|
+
event: 'selectedvariant',
|
|
861
|
+
callback: (variant: Variant) => void
|
|
862
|
+
): Unsubscribe;
|
|
833
863
|
/**
|
|
834
864
|
* Checks if the user has the ability to perform the given App Mode
|
|
835
865
|
* @param appModes
|
package/components.d.ts
CHANGED
|
@@ -132,6 +132,88 @@ interface Component {
|
|
|
132
132
|
options: SetSelectedVariantOptions | string
|
|
133
133
|
): Promise<null>;
|
|
134
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
|
+
|
|
135
217
|
/**
|
|
136
218
|
* Get the settings (name, group, description) of a component.
|
|
137
219
|
* @returns A Promise resolving to the component's settings.
|
|
@@ -157,6 +239,83 @@ interface Component {
|
|
|
157
239
|
* ```
|
|
158
240
|
*/
|
|
159
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
|
+
* * Get a single prop definition by its ID.
|
|
254
|
+
* @param propId - The unique ID of the prop.
|
|
255
|
+
* @returns A Promise resolving to the prop definition.
|
|
256
|
+
*/
|
|
257
|
+
getProp(propId: string): Promise<Prop>;
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* Get a prop definition by its display name.
|
|
261
|
+
* Matches only ungrouped props.
|
|
262
|
+
* Use the `groupName` overload for grouped props.
|
|
263
|
+
* @param name - The display name of the prop.
|
|
264
|
+
* @returns A Promise resolving to the prop definition.
|
|
265
|
+
*/
|
|
266
|
+
getPropByName(name: string): Promise<Prop>;
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Get a prop definition by its group and display name.
|
|
270
|
+
* @param groupName - The group the prop belongs to.
|
|
271
|
+
* @param name - The display name of the prop within that group.
|
|
272
|
+
* @returns A Promise resolving to the prop definition.
|
|
273
|
+
*/
|
|
274
|
+
getPropByName(groupName: string, name: string): Promise<Prop>;
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Create a new prop on this component.
|
|
278
|
+
*
|
|
279
|
+
* Supports all 10 creatable prop types. Name conflicts within the same group
|
|
280
|
+
* are auto-incremented (e.g., "Heading" → "Heading 2"). The returned `Prop`
|
|
281
|
+
* includes computed fields (`id`, `valueType`, `bindableTo`) so callers don't
|
|
282
|
+
* need a follow-up `getProps()` call.
|
|
283
|
+
*
|
|
284
|
+
* @param options - The prop definition including type, name, and optional settings.
|
|
285
|
+
* @returns A Promise resolving to the created prop with computed binding metadata.
|
|
286
|
+
*
|
|
287
|
+
* @example
|
|
288
|
+
* ```ts
|
|
289
|
+
* const prop = await component.createProp({
|
|
290
|
+
* type: 'textContent',
|
|
291
|
+
* name: 'Heading',
|
|
292
|
+
* group: 'Content',
|
|
293
|
+
* defaultValue: 'Welcome',
|
|
294
|
+
* });
|
|
295
|
+
* ```
|
|
296
|
+
*/
|
|
297
|
+
createProp(options: CreatePropOptions): Promise<Prop>;
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Create multiple props on this component in a single transaction.
|
|
301
|
+
* If any prop fails validation, no props are created.
|
|
302
|
+
* @param options - An array of prop definitions, each using the same shape as createProp.
|
|
303
|
+
* @returns A Promise resolving to an array of created props, in the same order as the input.
|
|
304
|
+
*/
|
|
305
|
+
createProps(options: CreatePropOptions[]): Promise<Prop[]>;
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Remove a prop from this component.
|
|
309
|
+
* @param propId - The ID of the prop to remove.
|
|
310
|
+
* @returns A Promise that resolves when the prop has been removed.
|
|
311
|
+
* @example
|
|
312
|
+
* ```ts
|
|
313
|
+
* const props = await component.getProps();
|
|
314
|
+
* const unused = props.find(p => p.name === 'Old Heading');
|
|
315
|
+
* await component.removeProp(unused.id);
|
|
316
|
+
* ```
|
|
317
|
+
*/
|
|
318
|
+
removeProp(propId: string): Promise<null>;
|
|
160
319
|
}
|
|
161
320
|
|
|
162
321
|
/**
|
|
@@ -184,6 +343,19 @@ type SetSelectedVariantOptions =
|
|
|
184
343
|
| SetSelectedVariantByName
|
|
185
344
|
| SetSelectedVariantById;
|
|
186
345
|
|
|
346
|
+
/** Options for deleting a variant by ID. */
|
|
347
|
+
interface DeleteVariantOptions {
|
|
348
|
+
/** The ID of the variant to delete. The base variant ('base') cannot be deleted. */
|
|
349
|
+
id: string;
|
|
350
|
+
}
|
|
351
|
+
/** Options for setVariant — update variant settings by ID. */
|
|
352
|
+
interface SetVariantOptions {
|
|
353
|
+
/** The variant ID, or `'base'` for the base variant. */
|
|
354
|
+
id: string;
|
|
355
|
+
/** The new display name for the variant. */
|
|
356
|
+
name: string;
|
|
357
|
+
}
|
|
358
|
+
|
|
187
359
|
interface Variant {
|
|
188
360
|
/** The variant ID. The base variant always has id 'base'. */
|
|
189
361
|
readonly id: string;
|
|
@@ -198,6 +370,170 @@ interface Variant {
|
|
|
198
370
|
readonly isSelected: boolean;
|
|
199
371
|
}
|
|
200
372
|
|
|
373
|
+
/**
|
|
374
|
+
* A prop definition on a component.
|
|
375
|
+
*
|
|
376
|
+
* `type` and `valueType` describe the same prop from two different angles:
|
|
377
|
+
* - `type` is the prop's structural category in the component definition
|
|
378
|
+
* (e.g. `'image'` for image asset props).
|
|
379
|
+
* - `valueType` is the data-binding value type used when binding a CMS field
|
|
380
|
+
* or variable to this prop (e.g. `'imageAsset'` for the same image prop).
|
|
381
|
+
* For most prop types these are identical. The only current exception is image
|
|
382
|
+
* asset props, where `type === 'image'` and `valueType === 'imageAsset'`.
|
|
383
|
+
*/
|
|
384
|
+
interface Prop {
|
|
385
|
+
/** The field ID from the component's WFDL data type. */
|
|
386
|
+
readonly id: string;
|
|
387
|
+
/**
|
|
388
|
+
* The prop's structural category (e.g. `'string'`, `'boolean'`, `'image'`,
|
|
389
|
+
* `'variant'`, `'slot'`). Use this to determine which optional fields
|
|
390
|
+
* (`min`/`max`/`decimals`, `trueLabel`/`falseLabel`, `multiline`) are present.
|
|
391
|
+
*/
|
|
392
|
+
readonly type: PropType;
|
|
393
|
+
/**
|
|
394
|
+
* The data-binding value type for this prop (e.g. `'string'`, `'boolean'`,
|
|
395
|
+
* `'imageAsset'`, `'variant'`). Use this when filtering which CMS fields or
|
|
396
|
+
* variables are compatible with this prop via `bindableTo`.
|
|
397
|
+
* Identical to `type` for all prop types except image asset props
|
|
398
|
+
* (`type: 'image'`, `valueType: 'imageAsset'`).
|
|
399
|
+
*/
|
|
400
|
+
readonly valueType: BindableValueType;
|
|
401
|
+
/** The data-binding target types this prop can accept. */
|
|
402
|
+
readonly bindableTo: readonly BindableValueType[];
|
|
403
|
+
/** The display name for this prop (derived from its label). */
|
|
404
|
+
name: string;
|
|
405
|
+
/** The group name this prop belongs to, or null if ungrouped. */
|
|
406
|
+
group: string | null;
|
|
407
|
+
/** A tooltip description for this prop, or null if not set. */
|
|
408
|
+
tooltip: string | null;
|
|
409
|
+
/**
|
|
410
|
+
* The default value for this prop, or null if not set or not applicable.
|
|
411
|
+
*
|
|
412
|
+
* The shape depends on `valueType`:
|
|
413
|
+
* - `'string'` | `'number'` | `'id'` | `'altText'` → the raw primitive value
|
|
414
|
+
* - `'boolean'` → `true` or `false`
|
|
415
|
+
* - `'imageAsset'` → the asset ID string
|
|
416
|
+
* - `'link'` → `{ mode: string; to?: string | object; openInNewTab?: boolean; rel?: string }`
|
|
417
|
+
* - `'video'` → `{ src?: string; title?: string }`
|
|
418
|
+
* - `'textContent'` → the plain-text string extracted from the default children
|
|
419
|
+
* - `'richText'` → `{ innerText: string }`
|
|
420
|
+
* - `'variant'` | `'visibility'` | `'filter'` | `'sort'` | `'selectedItems'`
|
|
421
|
+
* → always `null`
|
|
422
|
+
*/
|
|
423
|
+
readonly defaultValue: ResolvedValue | null;
|
|
424
|
+
/** Whether the text input allows multiple lines. Present on string and textContent props. */
|
|
425
|
+
multiline?: boolean;
|
|
426
|
+
/** The minimum allowed value. Present on number props. */
|
|
427
|
+
min?: number;
|
|
428
|
+
/** The maximum allowed value. Present on number props. */
|
|
429
|
+
max?: number;
|
|
430
|
+
/** The number of decimal places (precision) allowed. Present on number props. */
|
|
431
|
+
decimals?: number;
|
|
432
|
+
/** The label shown when the boolean is true. Present on boolean props. */
|
|
433
|
+
trueLabel?: string;
|
|
434
|
+
/** The label shown when the boolean is false. Present on boolean props. */
|
|
435
|
+
falseLabel?: string;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
// ---------------------------------------------------------------------------
|
|
439
|
+
// createProp input types (discriminated union on `type`)
|
|
440
|
+
// ---------------------------------------------------------------------------
|
|
441
|
+
|
|
442
|
+
/** Common fields shared by all prop types. */
|
|
443
|
+
interface CreatePropCommon {
|
|
444
|
+
/** Display name for the prop. Auto-incremented on conflicts within the same group. */
|
|
445
|
+
name: string;
|
|
446
|
+
/** Group/folder name. Props with the same group appear together in the props panel. */
|
|
447
|
+
group?: string;
|
|
448
|
+
/** Tooltip text shown on hover in the props panel. */
|
|
449
|
+
tooltip?: string;
|
|
450
|
+
/** The default value for this prop, or null if not set or not applicable. */
|
|
451
|
+
defaultValue?: ResolvedValue | null;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
interface TextContentPropInput extends CreatePropCommon {
|
|
455
|
+
type: 'textContent';
|
|
456
|
+
/** Whether the text input supports multiple lines. */
|
|
457
|
+
multiline?: boolean;
|
|
458
|
+
defaultValue?: string;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
interface StringPropInput extends CreatePropCommon {
|
|
462
|
+
type: 'string';
|
|
463
|
+
defaultValue?: string;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
interface RichTextPropInput extends CreatePropCommon {
|
|
467
|
+
type: 'richText';
|
|
468
|
+
defaultValue?: RichTextResolvedValue;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
interface ImagePropInput extends CreatePropCommon {
|
|
472
|
+
type: 'image';
|
|
473
|
+
/** Default asset ID. */
|
|
474
|
+
defaultValue?: string;
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
interface LinkPropInput extends CreatePropCommon {
|
|
478
|
+
type: 'link';
|
|
479
|
+
defaultValue?: LinkResolvedValue;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
interface VideoPropInput extends CreatePropCommon {
|
|
483
|
+
type: 'video';
|
|
484
|
+
defaultValue?: VideoResolvedValue;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
interface NumberPropInput extends CreatePropCommon {
|
|
488
|
+
type: 'number';
|
|
489
|
+
min?: number;
|
|
490
|
+
max?: number;
|
|
491
|
+
/** Number of decimal places allowed. */
|
|
492
|
+
decimals?: number;
|
|
493
|
+
defaultValue?: number;
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
interface BooleanPropInput extends CreatePropCommon {
|
|
497
|
+
type: 'boolean';
|
|
498
|
+
/** Label shown when the value is true (e.g., "Visible"). */
|
|
499
|
+
trueLabel?: string;
|
|
500
|
+
/** Label shown when the value is false (e.g., "Hidden"). */
|
|
501
|
+
falseLabel?: string;
|
|
502
|
+
defaultValue?: boolean;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
interface IdPropInput extends CreatePropCommon {
|
|
506
|
+
type: 'id';
|
|
507
|
+
/**
|
|
508
|
+
* Default ID value. Normalized on the host side — invalid characters are
|
|
509
|
+
* stripped, spaces become hyphens, result is lowercased. The response returns
|
|
510
|
+
* the normalized value. Error if normalization produces an empty string.
|
|
511
|
+
*/
|
|
512
|
+
defaultValue?: string;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
interface AltTextPropInput extends CreatePropCommon {
|
|
516
|
+
type: 'altText';
|
|
517
|
+
/**
|
|
518
|
+
* Default alt text value. The special strings `"decorative"` (marks image as
|
|
519
|
+
* decorative) and `"inherit"` (inherit from asset) have semantic meaning.
|
|
520
|
+
*/
|
|
521
|
+
defaultValue?: string | null;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
/** Options for creating a new prop on a component. Discriminated on `type`. */
|
|
525
|
+
type CreatePropOptions =
|
|
526
|
+
| TextContentPropInput
|
|
527
|
+
| StringPropInput
|
|
528
|
+
| RichTextPropInput
|
|
529
|
+
| ImagePropInput
|
|
530
|
+
| LinkPropInput
|
|
531
|
+
| VideoPropInput
|
|
532
|
+
| NumberPropInput
|
|
533
|
+
| BooleanPropInput
|
|
534
|
+
| IdPropInput
|
|
535
|
+
| AltTextPropInput;
|
|
536
|
+
|
|
201
537
|
/**
|
|
202
538
|
* Settings for a component, including name, group, and description.
|
|
203
539
|
*/
|
|
@@ -31,7 +31,8 @@ type BindableValueType =
|
|
|
31
31
|
| 'visibility'
|
|
32
32
|
| 'booleanFilter'
|
|
33
33
|
| 'altText'
|
|
34
|
-
| 'id'
|
|
34
|
+
| 'id'
|
|
35
|
+
| 'headingTag';
|
|
35
36
|
|
|
36
37
|
type PropType =
|
|
37
38
|
| 'textContent'
|
|
@@ -50,7 +51,8 @@ type PropType =
|
|
|
50
51
|
| 'visibility'
|
|
51
52
|
| 'filter'
|
|
52
53
|
| 'sort'
|
|
53
|
-
| 'selectedItems'
|
|
54
|
+
| 'selectedItems'
|
|
55
|
+
| 'headingTag';
|
|
54
56
|
|
|
55
57
|
type CmsFieldType =
|
|
56
58
|
| 'plainText'
|
|
@@ -63,6 +65,7 @@ type CmsFieldType =
|
|
|
63
65
|
| 'color'
|
|
64
66
|
| 'boolean'
|
|
65
67
|
| 'image'
|
|
68
|
+
| 'multiImage'
|
|
66
69
|
| 'file'
|
|
67
70
|
| 'video'
|
|
68
71
|
| 'richText';
|
package/element-settings.d.ts
CHANGED
|
@@ -52,9 +52,88 @@ type BindableSource =
|
|
|
52
52
|
| LocaleBindableSource
|
|
53
53
|
| LocaleItemBindableSource;
|
|
54
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
|
+
}
|
|
69
|
+
|
|
55
70
|
interface SearchBindableSourcesOptions {
|
|
56
71
|
/** Filter to sources compatible with a specific element setting key (e.g., "altText", "src", "domId") */
|
|
57
72
|
settingKey?: string;
|
|
58
73
|
/** Filter to sources that produce a specific value type (e.g., "string", "imageAsset") */
|
|
59
74
|
valueType?: BindableValueType;
|
|
60
75
|
}
|
|
76
|
+
|
|
77
|
+
/** An attribute on an element, as returned by `getSettings()`. */
|
|
78
|
+
interface ElementAttribute {
|
|
79
|
+
/** The attribute name — a plain string, or binding metadata if bound to a data source. Null when the underlying binding can't be resolved. */
|
|
80
|
+
name: string | BindingValue | null;
|
|
81
|
+
/** The attribute's value — a plain string, or binding metadata if bound to a data source. Null when the underlying binding can't be resolved. */
|
|
82
|
+
value: string | BindingValue | null;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** An attribute on an element, as returned by `getResolvedSettings()`. */
|
|
86
|
+
interface ResolvedElementAttribute {
|
|
87
|
+
/** The evaluated string name. Null when a binding can't be resolved at design time. */
|
|
88
|
+
name: string | null;
|
|
89
|
+
/** The evaluated string value. Null when a binding can't be resolved at design time. */
|
|
90
|
+
value: string | null;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** An attribute to set on an element via `setSettings()`. */
|
|
94
|
+
interface SetElementAttribute {
|
|
95
|
+
/** A plain string name, or a binding descriptor. Name bindings are only supported on DOM elements. */
|
|
96
|
+
name: string | BindingInput;
|
|
97
|
+
/** A plain string value, or a binding descriptor to bind to a data source. */
|
|
98
|
+
value: string | BindingInput;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Input to `element.setSettings()`.
|
|
103
|
+
*
|
|
104
|
+
* Each key is a setting (e.g., `domId`, `tag`, `assetId`). Values can be a
|
|
105
|
+
* static value, a binding descriptor, or `null` to reset to default.
|
|
106
|
+
*
|
|
107
|
+
* The `attributes` key is special: it takes a `SetElementAttribute[]` that
|
|
108
|
+
* replaces all attributes on the element (pass an empty array to remove
|
|
109
|
+
* them all). Only `attributes` accepts `SetElementAttribute[]` — other
|
|
110
|
+
* setting keys expect a value, binding descriptor, or `null`.
|
|
111
|
+
*/
|
|
112
|
+
interface SetSettingsInput {
|
|
113
|
+
[key: string]: ResolvedValue | BindingInput | SetElementAttribute[] | null;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Return type for `element.getSettings()`.
|
|
118
|
+
*
|
|
119
|
+
* Each key is a setting (e.g., `domId`, `tag`, `visibility`). Static values
|
|
120
|
+
* are returned as-is. Bound values include binding metadata. Null means the
|
|
121
|
+
* setting has no value and no default.
|
|
122
|
+
*
|
|
123
|
+
* `attributes` (when present) is the element's full attribute list.
|
|
124
|
+
*/
|
|
125
|
+
interface ElementSettingSummaries {
|
|
126
|
+
[key: string]: ResolvedValue | BindingValue | ElementAttribute[] | null;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Return type for `element.getResolvedSettings()`.
|
|
131
|
+
*
|
|
132
|
+
* Same keys as `getSettings()`, but every value is fully evaluated.
|
|
133
|
+
* Bindings that can't be resolved at design time are null.
|
|
134
|
+
*
|
|
135
|
+
* `attributes` (when present) contains the resolved attribute values.
|
|
136
|
+
*/
|
|
137
|
+
interface ResolvedElementSettings {
|
|
138
|
+
[key: string]: ResolvedValue | ResolvedElementAttribute[] | null;
|
|
139
|
+
}
|