fix component decoration

Components are considered to be "in the document" after decoration.
add component state class auto update
add component.toggleState
fix compiler warnings