UNPKG

2.55 kBTypeScriptView Raw
1import { StateObject } from '../state/stateObject';
2import { RawParams } from '../params/interface';
3import { Param } from '../params/param';
4import { Resolvable } from '../resolve/resolvable';
5import { ViewConfig } from '../view/interface';
6/**
7 * A node in a [[TreeChanges]] path
8 *
9 * For a [[TreeChanges]] path, this class holds the stateful information for a single node in the path.
10 * Each PathNode corresponds to a state being entered, exited, or retained.
11 * The stateful information includes parameter values and resolve data.
12 */
13export declare class PathNode {
14 /** The state being entered, exited, or retained */
15 state: StateObject;
16 /** The parameters declared on the state */
17 paramSchema: Param[];
18 /** The parameter values that belong to the state */
19 paramValues: {
20 [key: string]: any;
21 };
22 /** The individual (stateful) resolvable objects that belong to the state */
23 resolvables: Resolvable[];
24 /** The state's declared view configuration objects */
25 views: ViewConfig[];
26 /**
27 * Returns a clone of the PathNode
28 * @deprecated use instance method `node.clone()`
29 */
30 static clone: (node: PathNode) => PathNode;
31 /** Creates a copy of a PathNode */
32 constructor(node: PathNode);
33 /** Creates a new (empty) PathNode for a State */
34 constructor(state: StateObject);
35 clone(): PathNode;
36 /** Sets [[paramValues]] for the node, from the values of an object hash */
37 applyRawParams(params: RawParams): PathNode;
38 /** Gets a specific [[Param]] metadata that belongs to the node */
39 parameter(name: string): Param;
40 /**
41 * @returns true if the state and parameter values for another PathNode are
42 * equal to the state and param values for this PathNode
43 */
44 equals(node: PathNode, paramsFn?: GetParamsFn): boolean;
45 /**
46 * Finds Params with different parameter values on another PathNode.
47 *
48 * Given another node (of the same state), finds the parameter values which differ.
49 * Returns the [[Param]] (schema objects) whose parameter values differ.
50 *
51 * Given another node for a different state, returns `false`
52 *
53 * @param node The node to compare to
54 * @param paramsFn A function that returns which parameters should be compared.
55 * @returns The [[Param]]s which differ, or null if the two nodes are for different states
56 */
57 diff(node: PathNode, paramsFn?: GetParamsFn): Param[] | false;
58}
59/** @internal */
60export declare type GetParamsFn = (pathNode: PathNode) => Param[];