import { Rule } from '../ruleregistry/rule'; /** * Describes a web component to create and the properties to set on it. * * Used wherever the platform needs a component specified as data rather * than instantiated directly — for example configuration UIs, metadata * renderers, or slot content provided by plugins. * * @example * ```ts * import { ComponentDescriptor } from '@limetech/lime-web-components'; * * const descriptor: ComponentDescriptor = { * name: 'customer-insights-config', * props: { defaultView: 'monthly' }, * }; * ``` * * @public * @group Core */ export interface ComponentDescriptor { /** * Tag name of the web component to create. */ name: string; /** * Properties to set on the created component. */ props?: Record; /** * Optional behavior rules. * * @see {@link Rule} * * @alpha */ rules?: { /** * Rule that gates whether the component should be rendered. A * renderer that consults this field instantiates the component * only when the rule evaluates `true` against the current scope. * * @example * ```ts * import { ComponentDescriptor } from '@limetech/lime-web-components'; * * const descriptor: ComponentDescriptor = { * name: 'customer-insights-panel', * rules: { * visibility: { * type: 'ref', * id: 'limetech.user-has-role', * args: { roles: ['admin'] }, * }, * }, * }; * ``` */ visibility?: Rule; }; }