import { Component } from './component'; import { ContextManager } from './context'; import { Entity } from './entity'; /** * Represents a factory function for creating new Behavior instances. * * @typeParam BehaviorType - The specific type of Behavior to be constructed. * @typeParam K - The type of Component associated with the Behavior. * @returns A new instance of the specified BehaviorType. */ export type BehaviorConstructor = BehaviorType extends Behavior ? new (contextManager: ContextManager, instance: K, ...args: any[]) => BehaviorType : never; /** * Extracts the constructor properties of a specified Behavior type. * * @typeParam BehaviorType - The Behavior type for which the constructor properties are to be extracted. * @returns The type of the component that the specified Behavior type is associated with. */ export type ConstructorPropsOfBehavior = BehaviorType extends Behavior ? R : never; /** * Defines a mapping of behavior IDs to their respective properties. */ export type BehaviorConstructorProps = { [id: string]: unknown; }; export type ConstructorForBehavior = new (contextManager: ContextManager, instance: BehaviorType extends Behavior ? InstanceType : never) => BehaviorType; /** * Base class for all behaviors. * * Behaviors are a versatile way to add interactivity to your experience. They’re often used to: * - Listen to the events emitted by a node and then perform an action, such as playing an animation or calling a function in a context. * - Change the behavior or properties of the node they're attached to. * * @link [custom-behaviors](https://docs.zap.works/mattercraft/scripting/custom-behaviors/) */ export declare class Behavior extends Entity { readonly instance: InstanceType; /** * Constructs this behavior * * @param contextManager The current ContextManager * @param instance The instance of the component that this behavior is attached to */ constructor(contextManager: ContextManager, instance: InstanceType); private _updateEnabledResolved; dispose(): never; } /** * Checks if a specified Behavior should run at design time. * * @param b - The BehaviorConstructor to check. * @returns A boolean indicating whether the behavior should run at design time. */ export declare function shouldBehaviorRunAtDesignTime(b: BehaviorConstructor): boolean; /** * Registers a Behavior to run at design time. * * @param b - The BehaviorConstructor to register. * @returns The updated Set containing all registered BehaviorConstructors. */ export declare function registerBehaviorRunAtDesignTime(b: BehaviorConstructor): Set, ...args: any[]) => Behavior>>;