/** * Simplified types for definition getters. * These expose only the commonly-used fields from the internal manifest types. */ import type { DataType } from '../generated/dm-types'; import type { ElementDataTypeMap, ElementDataValue } from './data'; import type { CssPropertyType, CssPropertyOptions } from './css-properties'; import type { ElementStyleValue, CssPropertyKey } from './styles'; import type { FilterDefinition, SortDefinition } from '@wix/app-extensions/trusted'; export { DataType } from '../generated/dm-types'; export type ElementStyleDefinition = { displayName?: string | null; defaultValue?: ElementStyleValue; statesDefaultValues?: Record; /** Only for cssCustomProperties */ cssPropertyType?: CssPropertyType; /** Configuration options for specific CSS property types (filter, display, etc.) */ cssPropertyOptions?: CssPropertyOptions; }; export type ElementStyleDefinitions = { cssProperties: Partial>; cssCustomProperties: Record; }; export type ElementStyleDefaultValues = { cssProperties: Partial>; cssCustomProperties: Record; }; export type ElementPresetDefinition = { displayName?: string; thumbnailUrl?: string | null; initialSize?: { width?: number | null; height?: number | null; }; }; export type ElementPresetDefinitions = Record; export type NativeStateType = 'hover' | 'focus' | 'disabled' | 'invalid'; export type ElementStateDefinition = { displayName?: string | null; className?: string | null; pseudoClass?: NativeStateType; props?: Record; }; export type ElementStateDefinitions = Record; type ElementDataDefinitionExtraFields = { [DataType.filter]: { filter?: FilterDefinition; }; [DataType.sort]: { sort?: SortDefinition; }; }; type ExtraFieldsFor = TypeKey extends keyof ElementDataDefinitionExtraFields ? ElementDataDefinitionExtraFields[TypeKey] : {}; export type ElementDataDefinition = { dataType?: TypeKey; displayName?: string | null; description?: string | null; defaultValue?: TypeKey extends keyof ElementDataTypeMap ? ElementDataTypeMap[TypeKey] : ElementDataValue; } & ExtraFieldsFor; export type ElementDataDefinitions = Record; export type ElementDataDefaultValues = Partial<{ [Key in DataType]: ElementDataTypeMap[Key]; }>;