import * as React from 'react' ; import { define , Record , Store , mixins , mixinRules , ChainableAttributeSpec } from 'type-r' ; import processSpec , { Node , Element , TypeSpecs } from './define' ; import Link from './link' ; import { Component } from './component' ; interface ReactMVx { default : ReactMVx ; define : typeof define ; mixins : typeof mixins ; mixinRules : typeof mixinRules ; Component : typeof Component ; Link : typeof Link ; Node : ChainableAttributeSpec ; Element : ChainableAttributeSpec ; assignToState ( key ) ; } const ReactMVx = Object . create ( React ) ; ReactMVx . default = ReactMVx ; ReactMVx . define = define ; ReactMVx . mixins = mixins ; ReactMVx . Node = Node . value ( null ) ; ReactMVx . Element = Element . value ( null ) ; ReactMVx . Link = Link ; ReactMVx . Component = Component as any ; const assignToState = ReactMVx . assignToState = key => { return function ( prop ) { const source = prop && prop instanceof Link ? prop . value : prop ; this . state . assignFrom ( { [ key ] : source } ) ; if ( source && source . _changeToken ) { this . state [ key ] . _changeToken = source . _changeToken ; } } ; } ; export default ReactMVx ; export { define , mixins , Node , Element , Link , Component , assignToState } ;