import { IEntity } from "./entity.spec" ; import { IISystemProto , ISystem } from "./system.spec" ; import { IIStateProto , IState } from "./state.spec" ; import { TObjectProto , TTypeProto } from "./_.spec" ; import { IAccessDescriptor , IAccessQuery , TExistenceQuery } from "./query/query.spec" ; import { ISerDe , TSerDeOptions , TSerializer } from "./serde/serde.spec" ; import { ISerialFormat } from "./serde/serial-format.spec" ; import { ICommands } from "./commands/commands.spec" ; import IEntityBuilder from "./entity-builder.spec" ; import { Query } from "./query/query" ; export type TExecutionFunction = ( ( callback : Function ) => any ) | typeof setTimeout | typeof requestAnimationFrame ; export type TGroupHandle = number ; export type TStates = Map < IIStateProto , Set < ISystem > > ; export interface IRunConfiguration { afterStepHandler ? : ( actions : ITransitionActions ) => Promise < void > | void ; beforeStepHandler ? : ( actions : ITransitionActions ) => Promise < void > | void ; executionFunction ? : TExecutionFunction ; initialState ? : IIStateProto ; } export interface IStaticRunConfiguration { afterStepHandler : ( actions : ITransitionActions ) => Promise < void > | void ; beforeStepHandler : ( actions : ITransitionActions ) => Promise < void > | void ; executionFunction : TExecutionFunction ; initialState : IIStateProto ; } export interface ISystemInfo { dependencies : Set < IISystemProto > ; system : ISystem ; } export interface IPartialWorld { readonly commands : ICommands ; readonly name ? : string ; readonly serde : ISerDe ; /**
     * Execute all commands NOW
     */ flushCommands ( ) : Promise < void > ; param query getEntities ( query ? ) : IterableIterator < IEntity > ; param type getResource < T extends Object > ( type ) : T ; /**
     * Get all resources stored in this world. Useful for debugging
     */ getResources ( ) : IterableIterator < unknown > ; /**
     * Re-calculate all entity, component and system dependencies and connections
     */ maintain ( ) : void ; param query param options save < C extends Object , T extends IAccessDescriptor < C > > ( query ? , options ? ) : ISerialFormat ; } /**
 * Actions which can be called from a system run
 */ export interface ISystemActions { readonly commands : ICommands ; readonly currentState : IState | undefined ; param query getEntities ( query ? ) : IterableIterator < IEntity > ; param type getResource < T extends Object > ( type ) : T ; } /**
 * Actions which can be called during an iteration-transition
 */ export interface ITransitionActions extends IPartialWorld { readonly currentState : IState | undefined ; } export interface IWorld extends IPartialWorld { /**
     * Systems which are registered with this world
     */ readonly systemInfos : Set < ISystemInfo > ; param entity addEntity ( entity ) : void ; param type param args addResource < T extends Object > ( type , ... args ) : T ; /**
     * Convenience builder to create a new Entity
     */ buildEntity ( uuid ? ) : IEntityBuilder ; /**
     * Create a new entity and add it to this world
     */ createEntity ( ) : IEntity ; param state dispatch ( state ? ) : Promise < void > ; param world merge ( world ) : [ TGroupHandle , IEntity [ ] ] ; param entity removeEntity ( entity ) : void ; param configuration run ( configuration ? ) : Promise < void > ; } export type TWorldProto = { new ( ) : IWorld ; } ; export default IWorld ;