import { ComponentSchema, TraitSchema, MethodSchema, RuntimeTrait } from '@subscan/widget-core';
import { CustomOptions } from '@sinclair/typebox';
import { Emitter } from 'mitt';
import { Node } from 'acorn';
import { JSONSchema7 } from 'json-schema';
export declare type ComponentId = string & {
    kind: 'componentId';
};
export declare type TraitId = string & {
    kind: 'traitId';
};
export declare type ComponentType = string & {
    kind: 'componentType';
};
export declare type ModuleId = string & {
    kind: 'moduleId';
};
export declare type ModuleType = string & {
    kind: 'moduleType';
};
export declare type TraitType = string & {
    kind: 'traitType';
};
export declare type SlotName = string & {
    kind: 'slotName';
};
export declare type MethodName = string & {
    kind: 'methodName';
};
export declare type StyleSlotName = string & {
    kind: 'styleSlotName';
};
export declare type EventName = string & {
    kind: 'eventName';
};
export declare type AppModelEventType = {
    idChange: {
        oldId: ComponentId;
        newId: ComponentId;
    };
};
export interface IAppModel {
    emitter: Emitter<AppModelEventType>;
    topComponents: IComponentModel[];
    moduleIds: ModuleId[];
    allComponents: IComponentModel[];
    allComponentsWithOrphan: IComponentModel[];
    toSchema(): ComponentSchema[];
    genId(type: ComponentType): ComponentId;
    createComponent(type: ComponentType, id?: ComponentId): IComponentModel;
    getComponentById(id: ComponentId): IComponentModel | undefined;
    removeComponent(componentId: ComponentId): void;
    appendChild(component: IComponentModel): void;
    changeComponentMapId(oldId: ComponentId, newId: ComponentId): void;
    _bindComponentToModel(component: IComponentModel): void;
    traverseTree(cb: (c: IComponentModel) => void): void;
}
export interface IModuleModel {
    id: ModuleId;
    type: ModuleType;
    property: Record<string, IFieldModel>;
}
export interface IComponentModel {
    appModel: IAppModel;
    id: ComponentId;
    type: ComponentType;
    properties: IFieldModel;
    rawProperties: Record<string, any>;
    children: Record<SlotName, IComponentModel[]>;
    parent: IComponentModel | null;
    parentId: ComponentId | null;
    parentSlot: SlotName | null;
    traits: ITraitModel[];
    slots: SlotName[];
    styleSlots: StyleSlotName[];
    stateExample: Record<string, any>;
    methods: MethodSchema[];
    events: EventName[];
    allComponents: IComponentModel[];
    nextSibling: IComponentModel | null;
    prevSibling: IComponentModel | null;
    _isDirty: boolean;
    _slotTrait: ITraitModel | null;
    toSchema(): ComponentSchema;
    updateComponentProperty: (property: string, value: unknown) => void;
    appendTo: (parent?: IComponentModel, slot?: SlotName) => void;
    moveAfter: (after: IComponentModel | null) => IComponentModel;
    appendChild: (component: IComponentModel, slot: SlotName) => void;
    changeId: (newId: ComponentId) => IComponentModel;
    addTrait: (traitType: TraitType, properties: Record<string, unknown>) => ITraitModel;
    removeTrait: (traitId: TraitId) => void;
    updateTraitProperties: (traitId: TraitId, properties: Record<string, unknown>) => void;
    updateSlotTrait: (parent: ComponentId, slot: SlotName) => void;
    removeChild: (child: IComponentModel) => void;
}
export interface ITraitModel {
    spec: RuntimeTrait;
    id: TraitId;
    parent: IComponentModel;
    type: TraitType;
    rawProperties: Record<string, any>;
    properties: IFieldModel;
    methods: MethodSchema[];
    _isDirty: boolean;
    toSchema(): TraitSchema;
    updateProperty: (key: string, value: any) => void;
}
export declare type ASTNode = Node & {
    name: string;
};
export declare type RefInfo = {
    componentIdASTNodes: ASTNode[];
    refProperties: string[];
};
export interface IFieldModel {
    spec?: JSONSchema7 & CustomOptions;
    isDynamic: boolean;
    rawValue: any;
    update: (value: unknown) => void;
    getProperty: (key: string) => IFieldModel | void;
    getPropertyByPath: (path: string) => IFieldModel | void;
    getValue: () => unknown | void | IFieldModel;
    traverse: (cb: (f: IFieldModel, key: string) => void) => void;
    refComponentInfos: Record<ComponentId | ModuleId, RefInfo>;
}
