import { BehaviorByID, BehaviorData, ComputedHierarchy, EntityPropOverride, NodeByID, NodeData, ZComponentData } from './core'; import { Prop } from '../types'; /** * Computes and memoizes the hierarchy of nodes. * * @param nodes - A map of node IDs to node data. * @returns The computed hierarchy of nodes. */ export declare function computeNodeHierarchy(nodes: NodeByID): ComputedHierarchy; export interface HierarchyDiffItem { id: string; label?: string; type?: 'added' | 'deleted' | 'moved'; order?: string; } export type HierarchyDiff = { [id: string]: HierarchyDiffItem[]; }; export declare function computeHierarchyDiff(before: NodeByID | undefined, after: NodeByID): HierarchyDiff; /** * Computes and memoizes the hierarchy of behaviors. * * @param behaviors - A map of behavior IDs to behavior data. * @returns The computed hierarchy of behaviors. */ export declare function computeBehaviorHierarchy(behaviors: BehaviorByID): ComputedHierarchy; /** * Adds a new node to the specified ZComponentData. * * @param zcomp - The ZComponentData to which the node is added. * @param info - The combined data of the node to be added. */ export declare function addNode(zcomp: ZComponentData, info: NodeDataCombined): void; /** * Adds a new behavior to the specified ZComponentData. * * @param zcomp - The ZComponentData to which the behavior is added. * @param info - The combined data of the behavior to be added. */ export declare function addBehavior(zcomp: ZComponentData, info: BehaviorDataCombined): void; /** * Updates a component property in the ZComponentData. * * @param zcomp - The ZComponentData to update. * @param prop - The property name to update. * @param isConstructorProp - Indicates if the property is a constructor property. * @param newValue - The new value for the property. * @param newIsConstructorProp - Indicates if the new value is a constructor property. */ export declare function updateComponentProp(zcomp: ZComponentData, prop: string, isConstructorProp: boolean, newValue: Prop | undefined, newIsConstructorProp: boolean): void; export declare function addEntityPropOverride(zcomp: ZComponentData, o: EntityPropOverride): void; /** * Deletes an entity property override from the specified ZComponentData. * * @param zcomp - The ZComponentData to update. * @param id - The ID of the EntityPropOverride to delete. */ export declare function deleteEntityPropOverride(zcomp: ZComponentData, id: string): void; /** * Deep clones the given object. * * @typeParam T - The type of the object to clone. * @param obj - The object to clone. * @returns A deep clone of the object. */ export declare function clone(obj: T): T; /** * Checks if two objects are equal by comparing their JSON string representations. * * @typeParam T - The type of the objects to compare. * @param obj1 - The first object to compare. * @param obj2 - The second object to compare. * @returns True if the objects are equal, otherwise false. */ export declare function isEqual(obj1: T, obj2: T): boolean; export declare function addEntity(zcomp: ZComponentData, id: string, info: EntityDataCombined): void; /** * Moves nodes to a new parent within the ZComponentData hierarchy. * * @param zcomp - The ZComponentData containing the nodes. * @param nodeIDs - Array of node IDs to be moved. * @param newParentID - The ID of the new parent node. * @param indx - The index at which to insert the nodes in the new parent's child array. */ export declare function moveNodes(zcomp: ZComponentData, nodeIDs: string[], newParentID: string, indx: number): void; /** * Deletes a node and its child nodes and associated behaviors from ZComponentData. * * @param zcomp - The ZComponentData from which the node will be deleted. * @param id - The ID of the node to delete. */ export declare function deleteNode(zcomp: ZComponentData, id: string): void; /** * Deletes a behavior from ZComponentData. * * @param zcomp - The ZComponentData from which the behavior will be deleted. * @param id - The ID of the behavior to delete. */ export declare function deleteBehavior(zcomp: ZComponentData, id: string): void; /** * Retrieves combined data for a specific node in ZComponentData. * * @param zcomp - The ZComponentData containing the node. * @param id - The ID of the node. * @returns Combined node data or undefined if the node doesn't exist. */ export declare function getNodeDataCombined(zcomp: ZComponentData, id: string): NodeDataCombined | undefined; /** * Retrieves combined data for a specific behavior in ZComponentData. * * @param zcomp - The ZComponentData containing the behavior. * @param id - The ID of the behavior. * @returns Combined behavior data or undefined if the behavior doesn't exist. */ export declare function getBehaviorDataCombined(zcomp: ZComponentData, id: string): BehaviorDataCombined | undefined; /** * Fixes any duplicate index issues in the node hierarchy. * * @param zcomp - The ZComponentData containing the nodes. * @param hierarchy - The computed hierarchy of nodes. * @param nodeID - The ID of the parent node. * @param indx - The index to start checking for duplicates. */ export declare function fixAnyDuplicateIndex(zcomp: ZComponentData, hierarchy: ComputedHierarchy, nodeID: string, indx: number): void; /** * Fixes any duplicate index issues in the behavior hierarchy. * * @param zcomp - The ZComponentData containing the behaviors. * @param behaviors - The computed hierarchy of behaviors. * @param nodeID - The ID of the parent node. * @param indx - The index to start checking for duplicates. */ export declare function fixAnyDuplicateBehaviorsIndex(zcomp: ZComponentData, behaviors: ComputedHierarchy, nodeID: string, indx: number): void; /** * Calculates the order for a node to be placed at a specific index under a parent. * * @param zcomp - The ZComponentData containing the nodes. * @param parentID - The ID of the parent node. * @param indx - The index at which the node is to be placed. * @returns The order string for the node. */ export declare function nodeOrderForParentIndex(zcomp: ZComponentData, parentID: string, indx?: number): string; /** * Calculates the order for a behavior to be placed at a specific index under a parent. * * @param zcomp - The ZComponentData containing the behaviors. * @param parentID - The ID of the parent node. * @param indx - The index at which the behavior is to be placed. * @returns The order string for the behavior. */ export declare function behaviorOrderForParentIndex(zcomp: ZComponentData, parentID: string, indx?: number): string; /** * Adds a node's label to the ZComponentData's label register. * * @param zcomp - The ZComponentData to update. * @param id - The ID of the node whose label is to be added. */ export declare function addNodeLabelToRegister(zcomp: ZComponentData, id: string): void; /** * Removes a node's label from the ZComponentData's label register. * * @param zcomp - The ZComponentData to update. * @param id - The ID of the node whose label is to be removed. */ export declare function removeNodeLabelFromRegister(zcomp: ZComponentData, id: string): void; /** * Adds a node's script name to the ZComponentData's script name register. * * @param zcomp - The ZComponentData to update. * @param id - The ID of the node whose script name is to be added. */ export declare function addNodeScriptNameToRegister(zcomp: ZComponentData, id: string): void; /** * Removes a node's script name from the ZComponentData's script name register. * * @param zcomp - The ZComponentData to update. * @param id - The ID of the node whose script name is to be removed. */ export declare function removeNodeScriptNameFromRegister(zcomp: ZComponentData, id: string): void; /** * Changes the label of a node in the ZComponentData. * * @param zcomp - The ZComponentData to update. * @param id - The ID of the node whose label is to be changed. * @param newLabel - The new label for the node. */ export declare function changeNodeLabel(zcomp: ZComponentData, id: string, newLabel: string | undefined): void; /** * Changes the script name of a node in the ZComponentData. * * @param zcomp - The ZComponentData to update. * @param id - The ID of the node whose script name is to be changed. * @param newScriptName - The new script name for the node. */ export declare function changeNodeScriptName(zcomp: ZComponentData, id: string, newScriptName: string | undefined): void; /** * Deletes an entity and its associated data from ZComponentData. * * @param zcomp - The ZComponentData to update. * @param id - The ID of the entity to delete. */ export declare function deleteEntity(zcomp: ZComponentData, id: string): void; /** * Iterates over each ancestor of a node and executes a function. * * @param zcomp - The ZComponentData containing the node. * @param id - The ID of the node. * @param fn - The function to execute for each ancestor. */ export declare function forEachNodeAncestor(zcomp: ZComponentData, id: string, fn: (ancestorID: string) => void): void; /** * Represents combined entity data, including properties and constructor properties. */ export interface EntityDataCombined { /** * A map of property identifiers to their values. */ props: { [id: string]: any; }; /** * A map of constructor property identifiers to their values. */ constructorProps: { [id: string]: any; }; } /** * Represents combined node data, including the node data itself, properties, and constructor properties. */ export interface NodeDataCombined extends EntityDataCombined { /** * The data of the node. */ data: NodeData; } /** * Represents combined behavior data, including the behavior data itself, properties, and constructor properties. */ export interface BehaviorDataCombined extends EntityDataCombined { /** * The data of the behavior. */ data: BehaviorData; } /** * Generates a unique label for a node in ZComponentData. * * @param zcomp - The ZComponentData to check for existing labels. * @param label - The base label to make unique. * @returns A unique label for the node. */ export declare function getUniqueLabel(zcomp: ZComponentData, label: string): string; export declare function getUniqueName(n: string, requireUniqueIn: string[] | { [k: string]: any; }): string;