import type { TemplateResult } from '../../../../../external/lit/index.js';
import { nothing } from '../../../../../external/lit/index.js';
import { type UmbExtensionElementAndApiInitializer, type UmbApiConstructorArgumentsMethodType, type ApiLoaderProperty } from '../../../../../libs/extension-api/index.js';
import { UmbLitElement } from '../../../lit-element/index.js';
/**
* A custom element that dynamically renders extensions with both UI elements and API classes.
*
* Similar to `umb-extension-slot`, this element observes the extension registry and renders permitted extensions.
* The key difference is that this slot also initializes an API class for each extension, allowing extensions
* to have both a visual component and associated business logic. The API instance is created with configurable
* constructor arguments and can receive properties.
* @element umb-extension-with-api-slot
* @slot default - Fallback content shown when no extensions are permitted (unless `fallbackRenderMethod` is provided).
* @example Basic usage - Render extensions with APIs
* ```html
*
* ```
* @example Multiple types - Render extensions from multiple types
* ```html
*
* ```
* @example Single extension - Only render the first matching extension
* ```html
*
* ```
* @example With filter - Filter extensions by manifest properties
* ```html
* manifest.forEntityTypes.includes(entityType)}>
*
* ```
* @example With element props - Pass data to extension elements
* ```html
*
*
* ```
* @example With API args - Pass constructor arguments to extension APIs
* ```html
*
*
* ```
* @example With API args method - Dynamic constructor arguments based on manifest
* ```html
* [workspaceContext, manifest.meta]}>
*
* ```
* @example Combined usage - Filter, element props, and API args
* ```html
* ext.component}>
*
* ```
* @example Custom render method - Control how extensions are rendered
* ```html
* html`
*
* `}>
*
* ```
* @example Fallback content - Shows the slotted content when no extensions match
* ```html
*
* No actions available
*
* ```
* @example Fallback render method - Shows the result of the fallbackRenderMethod when no extensions match
* ```html
*
* .fallbackRenderMethod=${() => html`No extensions available
`}
*
* ```
*/
export declare class UmbExtensionWithApiSlotElement extends UmbLitElement {
#private;
private _permitted?;
/**
* When true, only renders the highest weighted permitted extension.
* Useful for extension types where only one instance should be displayed.
* @example
* ```html
*
* ```
*/
single?: boolean;
/**
* The type or types of extensions to render. Required for the slot to display anything.
* Can be a single type string or an array of type strings to render extensions from multiple types.
* @example Single type
* ```html
*
* ```
* @example Multiple types
* ```html
*
* ```
*/
get type(): string | string[] | undefined;
set type(value: string | string[] | undefined);
/**
* Filter function for extension manifests.
* This is an initial filter taking effect before conditions or overwrites are applied.
* Extensions will still be filtered by their manifest-defined conditions after this filter.
* The filter function receives the extension manifest and should return true to include it.
* @example Filter by entity type
* ```html
* manifest.forEntityTypes.includes(entityType)}>
*
* ```
* @example Filter by meta properties
* ```html
* manifest.meta.look === 'primary'}>
*
* ```
*/
get filter(): (manifest: any) => boolean;
set filter(value: (manifest: any) => boolean);
/**
* Properties to pass to all rendered extension elements.
* These properties are spread onto each extension element instance.
* Note: The extension's manifest is always passed automatically regardless of this setting.
* @example Pass entity context to extension elements
* ```html
*
*
* ```
*/
get elementProps(): Record | undefined;
set elementProps(newVal: Record | undefined);
/**
* Constructor arguments to pass when instantiating the extension APIs.
* Can be an array of arguments or a function that receives the manifest and returns arguments.
* Note: The host controller is always prepended as the first argument automatically.
* @example Static array of arguments
* ```html
*
*
* ```
* @example Dynamic arguments based on manifest
* ```html
* [entityContext, manifest.meta.actionType]}>
*
* ```
*/
get apiArgs(): Array | UmbApiConstructorArgumentsMethodType | undefined;
set apiArgs(newVal: Array | UmbApiConstructorArgumentsMethodType | undefined);
/**
* Properties to pass to all extension API instances after construction.
* These properties are spread onto each API instance.
* Note: The extension's manifest is always passed automatically regardless of this setting.
* @example Pass configuration to extension APIs
* ```html
*
*
* ```
*/
get apiProps(): Record | undefined;
set apiProps(newVal: Record | undefined);
/**
* Fallback element tag name to use when an extension manifest doesn't specify its own element.
* This allows extensions to rely on a default UI implementation while still being registered.
* @example Provide a default action element
* ```html
*
*
* ```
*/
defaultElement?: string;
/**
* Fallback API loader to use when an extension manifest doesn't specify its own API.
* This allows extensions to rely on a default API implementation while still being registered.
* Can be a string path to the API module or an API loader function.
* @example Provide a default API
* ```html
* import('./default-workspace-action.api.js')}>
*
* ```
*/
defaultApi?: ApiLoaderProperty;
/**
* Custom render function for controlling how each extension is rendered.
* When provided, this function is called for each permitted extension instead of the default rendering.
* The function receives the extension initializer (with `component`, `api`, and `manifest` properties) and the index,
* and should return a TemplateResult, HTMLElement, null, or nothing.
* @example Wrap extensions in custom markup
* ```html
* html`
*
* ${ext.component}
*
* `}>
*
* ```
* @example Access API from render method
* ```html
* {
* console.log('API instance:', ext.api);
* return ext.component;
* }}>
*
* ```
*/
renderMethod?: (extension: UmbExtensionElementAndApiInitializer, index: number) => TemplateResult | TemplateResult<1> | HTMLElement | null | undefined | typeof nothing;
/**
* Render function called when no extensions are permitted.
* When provided, this function is called instead of rendering the default slot content.
* Useful for providing custom empty states or fallback UI.
* The function should return a TemplateResult, HTMLElement, null, or nothing.
* @example Custom empty state
* ```html
* html`No actions available
`}>
*
* ```
*/
fallbackRenderMethod?: () => TemplateResult | TemplateResult<1> | HTMLElement | null | undefined | typeof nothing;
connectedCallback(): void;
disconnectedCallback(): void;
render(): unknown;
static styles: import("lit").CSSResult;
}
declare global {
interface HTMLElementTagNameMap {
'umb-extension-with-api-slot': UmbExtensionWithApiSlotElement;
}
}