import type { AnyCustomVisualization } from '../../../infra/plugins/widget-plugins/types'; import { type WidgetKey } from '../widget-identity/widget-key'; import type { ErasedWidgetDefinition } from './types'; /** * Registry tier a widget definition belongs to: the SDK's static built-ins (`'internal'`), a widget * plugin or a legacy custom widget registration. The tier is registry bookkeeping; it is not part of * the definition. * * @internal */ export type WidgetDefinitionSource = 'internal' | 'plugin' | 'legacy'; /** * Tier a definition can be registered into at runtime. The `'internal'` tier is static * (`BUILT_IN_WIDGET_DEFINITIONS`) and cannot be registered into. * * @internal */ export type RuntimeWidgetDefinitionSource = Exclude; /** * Registry of widget definitions, one per `PluginProvider`. * * Lookups read the static built-in definitions (`'internal'`) first, then the runtime entries this * instance holds (`'plugin'` and `'legacy'`). Built-in definitions take precedence over plugins, and * plugins over legacy custom widgets; within a tier, the first registration wins. * * @internal */ export declare class WidgetDefinitionRegistry { /** Runtime entries: the plugin and legacy tiers only. */ private readonly entries; /** * Registers a widget definition into a runtime tier. * * A key held by a built-in definition is never replaced: a plugin registration there is ignored * with a warning, a legacy one is ignored silently (Angular and Vue seed the built-in tabber as a * legacy widget on every mount). A plugin registration replaces a legacy entry; any other * registration on an existing key is ignored. * * @param definition - The definition to register; its `key` is the registry key. * @param source - The runtime tier to register into. */ register(definition: ErasedWidgetDefinition, source: RuntimeWidgetDefinitionSource): void; /** * Removes a runtime entry. Only removes it when it belongs to the given tier; built-in * definitions cannot be removed. * * @param key - The registry key. * @param source - The runtime tier the entry must belong to. */ unregister(key: WidgetKey, source: RuntimeWidgetDefinitionSource): void; /** * Looks up a widget definition, reading the built-in definitions first. * * @param key - The registry key. * @param source - When set, returns the definition only if it belongs to this tier. * @returns The definition, or `undefined` when none matches. */ get(key: WidgetKey, source?: WidgetDefinitionSource): ErasedWidgetDefinition | undefined; /** * Checks whether a widget definition is registered. * * @param key - The registry key. * @param source - When set, checks only this tier. * @returns `true` when {@link WidgetDefinitionRegistry.get} would return a definition. */ has(key: WidgetKey, source?: WidgetDefinitionSource): boolean; /** * Lists the widget definitions visible through this registry: built-ins first, then runtime * entries in registration order. * * @param source - When set, lists only this tier. * @returns The matching definitions. */ getAll(source?: WidgetDefinitionSource): readonly ErasedWidgetDefinition[]; /** * Registers a custom widget component under its `customWidgetType`, with the plugin default * abilities. Compatibility accessor over {@link WidgetDefinitionRegistry.register}. * * @param customWidgetType - The custom widget type name, without the `custom:` prefix. * @param component - The component rendering the custom widget. * @param source - The runtime tier to register into. */ registerComponent(customWidgetType: string, component: AnyCustomVisualization, source: RuntimeWidgetDefinitionSource): void; /** * Removes a custom widget registered under its `customWidgetType`. * Compatibility accessor over {@link WidgetDefinitionRegistry.unregister}. * * @param customWidgetType - The custom widget type name, without the `custom:` prefix. * @param source - The runtime tier the entry must belong to. */ unregisterComponent(customWidgetType: string, source: RuntimeWidgetDefinitionSource): void; /** * Gets the component of a custom widget by its `customWidgetType`, including the built-in tabber. * Compatibility accessor over {@link WidgetDefinitionRegistry.get}. * * @param customWidgetType - The custom widget type name, without the `custom:` prefix. * @param source - When set, returns the component only if its entry belongs to this tier. * @returns The component, or `undefined` when none matches. */ getComponent(customWidgetType: string, source?: RuntimeWidgetDefinitionSource): AnyCustomVisualization | undefined; /** * Checks whether a custom widget is registered under its `customWidgetType`. * Compatibility accessor over {@link WidgetDefinitionRegistry.has}. * * @param customWidgetType - The custom widget type name, without the `custom:` prefix. * @param source - When set, checks only this tier. * @returns `true` when a matching entry exists. */ hasComponent(customWidgetType: string, source?: RuntimeWidgetDefinitionSource): boolean; }