declare type Map = { [K]: V }; declare type Topic = { state: string, command: string, defaultValue: any, values: Map, parseState?: (msg: Object) => any }; declare type Topics = Map; declare type ControlUI = { type: "toggle" | "dropDown" | "slider" | "section", text: string, topic?: string, icon?: string, enableCondition?: (internal: string, actual: any) => boolean, // TOGGLE optional properties on?: string, // on override for toggle off?: string, // off override for toggle toggled?: (internal: string, actual: any) => boolean, // DROPDOWN optional properties options?: Map, //options for dropDown renderValue?: (value: string) => string // SLIDER optional properties min?: number, max?: number, step?: number }; declare type Control = { name: string, position: Array, icon: string, iconColor?: (state: Map) => string, ui: Array }; declare type Controls = Map; declare type Config = { topics: Topics, controls: Controls, layers: Array }; declare type State = { mqtt: ?any, uiOpened: ?string, // A map of the actual state values for each topic. // internal is the internal term for the value, // that is equal to the key in the values section of that // topic, for example given by: // values: { off: "OFF", on: "ON" } // and actual is the value of that or whatever is given by mqtt. values: Map, visibleLayers: Array }; declare type Layer = { image: string, name: string, baseLayer: boolean, defaultVisibility: "visible" | "hidden", }; declare type StateAction = { type: "DISCONNECT" | "CONNECT" | "MESSAGE" | "UI_POPUP", payload?: any };