import { ComponentManager, ModifierManager, HelperManager, Owner, InternalHelperManager, HelperDefinitionState, Helper, HelperManagerWithDestroyable, HelperManagerWithValue, HelperCapabilitiesVersions, HelperCapabilities, InternalComponentManager, InternalModifierManager, ComponentCapabilitiesVersions, ComponentCapabilities, Arguments, ComponentDefinitionState, VMArguments, Nullable, Destroyable, InternalComponentCapabilities, UpdatableTag, SimpleElement, CapturedArguments, ModifierCapabilitiesVersions, ModifierCapabilities, TemplateFactory, Expand, CapabilityMask, InternalComponentCapability, DynamicLayoutCapability, WithDynamicLayout, DynamicTagCapability, PrepareArgsCapability, WithPrepareArgs, CreateArgsCapability, AttributeHookCapability, ElementHookCapability, DynamicScopeCapability, CreateCallerCapability, UpdateHookCapability, WithUpdateHook, CreateInstanceCapability, WithCreateInstance, WrappedCapability, WillDestroyCapability, HasSubOwnerCapability, WithSubOwner } from '@glimmer/interfaces'; import { Reference } from '@glimmer/reference'; import { Tag } from '@glimmer/validator'; import { InternalComponentCapabilities as InternalComponentCapabilities$1 } from '@glimmer/vm'; type Manager = ComponentManager | ModifierManager | HelperManager; type ManagerFactory = (owner: O) => D; declare function setComponentManager(factory: ManagerFactory>, obj: T): T; declare function setModifierManager(factory: ManagerFactory>, obj: T): T; declare function setHelperManager(factory: ManagerFactory>, obj: T): T; declare function helperCapabilities(managerAPI: Version, options?: Partial): HelperCapabilities; declare function hasValue(manager: HelperManager): manager is HelperManagerWithValue; declare function hasDestroyable(manager: HelperManager): manager is HelperManagerWithDestroyable; declare class CustomHelperManager implements InternalHelperManager { private factory; constructor(factory: ManagerFactory>); private helperManagerDelegates; private undefinedDelegate; private getDelegateForOwner; getDelegateFor(owner: O | undefined): HelperManager; getHelper(definition: HelperDefinitionState): Helper; } declare function setInternalModifierManager(manager: InternalModifierManager, definition: T): T; declare function getInternalModifierManager(definition: object): InternalModifierManager; declare function getInternalModifierManager(definition: object, isOptional: true | undefined): InternalModifierManager | null; declare function setInternalHelperManager(manager: CustomHelperManager | Helper, definition: T): T; declare function getInternalHelperManager(definition: object): CustomHelperManager | Helper; declare function getInternalHelperManager(definition: object, isOptional: true | undefined): CustomHelperManager | Helper | null; declare function setInternalComponentManager(factory: InternalComponentManager, obj: T): T; declare function getInternalComponentManager(definition: object): InternalComponentManager; declare function getInternalComponentManager(definition: object, isOptional: true | undefined): InternalComponentManager | null; declare function hasInternalComponentManager(definition: object): boolean; declare function hasInternalHelperManager(definition: object): boolean; declare function hasInternalModifierManager(definition: object): boolean; declare function componentCapabilities(managerAPI: Version, options?: ComponentCapabilitiesVersions[Version]): ComponentCapabilities; /** The CustomComponentManager allows addons to provide custom component implementations that integrate seamlessly into Ember. This is accomplished through a delegate, registered with the custom component manager, which implements a set of hooks that determine component behavior. To create a custom component manager, instantiate a new CustomComponentManager class and pass the delegate as the first argument: ```js let manager = new CustomComponentManager({ // ...delegate implementation... }); ``` ## Delegate Hooks Throughout the lifecycle of a component, the component manager will invoke delegate hooks that are responsible for surfacing those lifecycle changes to the end developer. * `create()` - invoked when a new instance of a component should be created * `update()` - invoked when the arguments passed to a component change * `getContext()` - returns the object that should be */ declare class CustomComponentManager implements InternalComponentManager> { private factory; private componentManagerDelegates; constructor(factory: ManagerFactory>); private getDelegateFor; create(owner: O, definition: ComponentDefinitionState, vmArgs: VMArguments): CustomComponentState; getDebugName(definition: ComponentDefinitionState): string; update(bucket: CustomComponentState): void; didCreate({ component, delegate }: CustomComponentState): void; didUpdate({ component, delegate }: CustomComponentState): void; didRenderLayout(): void; didUpdateLayout(): void; getSelf({ component, delegate }: CustomComponentState): Reference; getDestroyable(bucket: CustomComponentState): Nullable; getCapabilities(): InternalComponentCapabilities; } /** * Stores internal state about a component instance after it's been created. */ declare class CustomComponentState { component: ComponentInstance; delegate: ComponentManager; args: Arguments; constructor(component: ComponentInstance, delegate: ComponentManager, args: Arguments); } declare function modifierCapabilities(managerAPI: Version, optionalFeatures?: ModifierCapabilitiesVersions[Version]): ModifierCapabilities; interface CustomModifierState { tag: UpdatableTag; element: SimpleElement; modifier: ModifierInstance; delegate: ModifierManager; args: Arguments; debugName?: string; } /** The CustomModifierManager allows addons to provide custom modifier implementations that integrate seamlessly into Ember. This is accomplished through a delegate, registered with the custom modifier manager, which implements a set of hooks that determine modifier behavior. To create a custom modifier manager, instantiate a new CustomModifierManager class and pass the delegate as the first argument: ```js let manager = new CustomModifierManager({ // ...delegate implementation... }); ``` ## Delegate Hooks Throughout the lifecycle of a modifier, the modifier manager will invoke delegate hooks that are responsible for surfacing those lifecycle changes to the end developer. * `createModifier()` - invoked when a new instance of a modifier should be created * `installModifier()` - invoked when the modifier is installed on the element * `updateModifier()` - invoked when the arguments passed to a modifier change * `destroyModifier()` - invoked when the modifier is about to be destroyed */ declare class CustomModifierManager implements InternalModifierManager> { private factory; private componentManagerDelegates; constructor(factory: ManagerFactory>); private getDelegateFor; create(owner: O, element: SimpleElement, definition: object, capturedArgs: CapturedArguments): CustomModifierState; getDebugName(definition: object): string; getDebugInstance({ modifier }: CustomModifierState): ModifierInstance; getTag({ tag }: CustomModifierState): UpdatableTag; install({ element, args, modifier, delegate }: CustomModifierState): void; update({ args, modifier, delegate }: CustomModifierState): void; getDestroyable(state: CustomModifierState): CustomModifierState; } declare function setComponentTemplate(factory: TemplateFactory, obj: object): object; declare function getComponentTemplate(obj: object): TemplateFactory | undefined; declare function getCustomTagFor(obj: object): ((obj: object, key: string) => Tag) | undefined; declare function setCustomTagFor(obj: object, customTagFn: (obj: object, key: string) => Tag): void; type CapabilityOptions = Expand<{ [P in keyof Omit]?: boolean | undefined; }>; /** * Converts a ComponentCapabilities object into a 32-bit integer representation. */ declare function capabilityFlagsFrom(capabilities: CapabilityOptions): CapabilityMask; type InternalComponentCapabilityFor = C extends DynamicLayoutCapability ? WithDynamicLayout : C extends DynamicTagCapability ? InternalComponentManager : C extends PrepareArgsCapability ? WithPrepareArgs : C extends CreateArgsCapability ? InternalComponentManager : C extends AttributeHookCapability ? InternalComponentManager : C extends ElementHookCapability ? InternalComponentManager : C extends DynamicScopeCapability ? InternalComponentManager : C extends CreateCallerCapability ? InternalComponentManager : C extends UpdateHookCapability ? WithUpdateHook : C extends CreateInstanceCapability ? WithCreateInstance : C extends WrappedCapability ? InternalComponentManager : C extends WillDestroyCapability ? InternalComponentManager : C extends HasSubOwnerCapability ? WithSubOwner : never; declare function managerHasCapability(_manager: InternalComponentManager, capabilities: CapabilityMask, capability: F): _manager is InternalComponentCapabilityFor; declare function hasCapability(capabilities: CapabilityMask, capability: InternalComponentCapability): boolean; export { CustomComponentManager, CustomHelperManager, CustomModifierManager, capabilityFlagsFrom, componentCapabilities, getComponentTemplate, getCustomTagFor, getInternalComponentManager, getInternalHelperManager, getInternalModifierManager, hasCapability, hasDestroyable, hasInternalComponentManager, hasInternalHelperManager, hasInternalModifierManager, hasValue, helperCapabilities, managerHasCapability, modifierCapabilities, setComponentManager, setComponentTemplate, setCustomTagFor, setHelperManager, setInternalComponentManager, setInternalHelperManager, setInternalModifierManager, setModifierManager };