import type { NodeSchema } from '../../types';
import type { Node } from '../node/node';
import type { Props } from './props';
import { TRANSFORM_STAGE } from '../../types';
export declare const UNSET: unique symbol;
export type UNSET = typeof UNSET;
export type ValueTypes = 'unset' | 'literal' | 'list' | 'map' | 'expression';
/**
 * a common interface for Prop and Props
 */
export interface PropParent {
    readonly props: Props;
    readonly owner: Node;
    get path(): string[];
    delete(prop: Prop): void;
}
export type PropKey = string | number;
export type PropValue = CompositeValue;
export type PropsMap = CompositeObject<NodeSchema | NodeSchema[]>;
export type CompositeValue = JSONValue | CompositeArray | CompositeObject | JSExpression | JSFunction;
export type CompositeArray = CompositeValue[];
export interface CompositeObject<T = CompositeValue> {
    [key: PropKey]: CompositeValue | T;
}
export type JSONValue = boolean | string | number | null | undefined | JSONArray | JSONObject;
export type JSONArray = JSONValue[];
export interface JSONObject {
    [key: PropKey]: JSONValue;
}
export interface JSExpression {
    type: 'JSExpression';
    /**
     * 表达式字符串
     */
    value: string;
    /**
     * 模拟值
     */
    mock?: any;
    /**
     * 源码
     */
    compiled?: string;
}
export interface JSFunction {
    type: 'JSFunction';
    /**
     * 函数定义，或直接函数表达式
     */
    value: string;
    /**
     * 源码
     */
    compiled?: string;
    /**
     * 模拟值
     */
    mock?: any;
    /**
     * 额外扩展属性，如 extType、events
     */
    [key: string]: any;
}
export declare const isJSExpression: (data: any) => data is JSExpression;
export declare function isJSFunction(data: any): data is JSFunction;
export declare class Prop {
    readonly parent: PropParent;
    readonly isProp = true;
    readonly id: string;
    accessor key: PropKey;
    readonly owner: Node;
    getNode(): Node<NodeSchema>;
    readonly props: Props;
    getProps(): Props;
    private accessor _value;
    get value(): unknown | UNSET;
    private _code;
    /**
     * 获得表达式值
     */
    get code(): string;
    /**
     * 设置表达式值
     */
    set code(code: string);
    private accessor _type;
    get type(): ValueTypes;
    /** use for list or map type */
    private accessor _items;
    /**
     * 作为一层缓存机制，主要是复用部分已存在的 Prop，保持响应式关系，比如：
     * 当前 Prop#_value 值为 { a: 1 }，当调用 setValue({ a: 2 }) 时，所有原来的子 Prop 均被销毁，
     * 导致假如外部有 mobx reaction（常见于 observer），此时响应式链路会被打断，
     * 因为 reaction 监听的是原 Prop(a) 的 _value，而不是新 Prop(a) 的 _value。
     */
    private accessor _maps;
    /**
     * Construct the items and maps for the prop value
     */
    private get items();
    private get maps();
    /**
     * return a path of prop
     */
    get path(): string[];
    /**
     * item length
     */
    get size(): number;
    constructor(parent: PropParent, key: PropKey, value?: PropValue | UNSET);
    /**
     * This is to trigger the execution of the items getter function,
     * which will construct the items and maps for the prop value
     */
    initItems(): void;
    export(stage?: TRANSFORM_STAGE): PropValue;
    /**
     * whether the prop has been destroyed
     */
    private accessor purged;
    /**
     * clear internal data
     */
    purge(): void;
    remove(): void;
    /**
     * dispose internal data, use for changing value,
     * this will not trigger reactive
     */
    private dispose;
    unset(): void;
    isUnset(): boolean;
    /**
     * @returns  0: the same 1: maybe & like 2: not the same
     */
    compare(other: Prop | null): number;
    /**
     * set value, val should be JSON Object
     */
    setValue(val: PropValue): void;
    getValue(): unknown;
    getAsString(): string;
    get(path: PropKey, createIfNone?: boolean): Prop | null;
    set(key: PropKey, value: PropValue | Prop, force?: boolean): Prop | null;
    delete(prop: Prop): void;
    add(key: PropKey, value?: PropValue | UNSET, force?: boolean): Prop | null;
    /**
     * check if the prop has the key, only for map and list type
     */
    has(key: PropKey): boolean;
    deleteKey(key: PropKey): void;
    /**
     * @see SettingTarget
     */
    getPropValue(key: PropKey): any;
    /**
     * @see SettingTarget
     */
    setPropValue(key: PropKey, value: any): void;
    /**
     * @see SettingTarget
     */
    clearPropValue(key: PropKey): void;
    forEach(fn: (item: Prop, key: PropKey | number) => void): void;
    map<T>(fn: (item: Prop, key: PropKey | number) => T): T[] | null;
    [Symbol.iterator](): {
        next(): {
            value: Prop;
        };
    };
}
export declare const isProp: (obj: any) => obj is Prop;
/**
 * split path to entry and nest
 * - entry: a or 0
 * - nest: .b or [1].b
 */
export declare const splitPath: (path: PropKey) => {
    entry: PropKey;
    nest: string;
};
/**
 * check if the key is a valid array index
 */
export declare function isValidArrayIndex(key: any, limit?: number): key is number;
