import { Prop } from '../types'; import { Animation } from './animation'; export interface ID { id: string; } export type Child = ID; export type NodeByID = { [id: string]: NodeData | undefined; }; export type PropsByID = { [id: string]: { [id: string]: any; } | undefined; }; export type BehaviorByID = { [id: string]: BehaviorData | undefined; }; export type Props = { [id: string]: Prop; }; export type ComputedHierarchy = { [id: string]: string[]; }; export type Import = string; export type ParsedImport = [string, string]; export type ElementType = Import; export type PropType = string; export interface ZComponentData { id: string; nodes: NodeByID; root: string; props: Props; constructorProps?: Props; entityProps: PropsByID; entityConstructorProps: PropsByID; preview: Import; entityPropOverrides?: { [id: string]: EntityPropOverride; }; behaviors: BehaviorByID; animation?: Animation; entitiesByLabel?: { [id: string]: { [id: string]: boolean; }; }; entitiesByScriptName?: { [id: string]: { [id: string]: boolean; }; }; group?: string; icon?: string; tags?: string[]; allowedParents?: string[]; comments?: string[]; } export interface NodeData { id: string; label?: string; scriptName?: string; type: ElementType; locked?: boolean; parent?: { id: string; order: string; }; } export interface BehaviorData { id: string; type: Import; label?: string; parent: { id: string; order: string; scriptName?: string; }; } export type EntityPropOverride = PropEntityPropOverride | ImportEntityPropOverride | ContextValueEntityPropOverride; export declare enum EntityPropOverrideType { ComponentProp = "componentprop", Import = "import", ContextValue = "contextvalue" } export interface BaseEntityPropOverride { id: string; entityID: string; entityPropPath: (string | number)[]; entityPropIsConstructor: boolean; type: EntityPropOverrideType; } export interface PropEntityPropOverride extends BaseEntityPropOverride { propName: string; isConstructorProp: boolean; type: EntityPropOverrideType.ComponentProp; } export interface ImportEntityPropOverride extends BaseEntityPropOverride { imp: string; type: EntityPropOverrideType.Import; } export interface ContextValueEntityPropOverride extends BaseEntityPropOverride { imp: string; val: string; type: EntityPropOverrideType.ContextValue; } export declare enum FunctionCallType { Entity = "entity", Context = "context", Import = "import", EmitComponentEvent = "emitcomponentevent" } export interface BaseFunctionCall { _zfn: true; t: FunctionCallType; args: { [id: number]: any; }; } export interface EntityFunctionCall extends BaseFunctionCall { entityID: string; t: FunctionCallType.Entity; fn: string; } export interface ContextFunctionCall extends BaseFunctionCall { imp: string; fn: string; t: FunctionCallType.Context; resolved?: any; } export interface ImportFunctionCall extends BaseFunctionCall { imp: string; t: FunctionCallType.Import; resolved?: any; } export interface EmitComponentEventFunctionCall extends BaseFunctionCall { prop: string; t: FunctionCallType.EmitComponentEvent; } export type FunctionCall = EntityFunctionCall | ContextFunctionCall | ImportFunctionCall | EmitComponentEventFunctionCall;