message: fix mounted and unload call in web component
diff: @@ -23,20 +23,23 @@ export const customElement = (componentClass, options: CustomElementOptions = {}
  connectedCallback() {
  if (this.isConnected && !this._component) {
  const opts = { render: true, shadow: false, ...options };
  - this._shadowRoot = opts.shadow ?
  - this.attachShadow({ mode: 'open' }) : this;
  + this._shadowRoot = opts.shadow ? this.attachShadow({ mode: 'open' }) : this;
  const props = {}
  Array.from(this.attributes).forEach(item => props[item.name] = item.value);
  const children = this.children ? Array.from(this.children) : [];
  children.forEach(el => el.parentElement.removeChild(el));
  this._component = new componentClass({ ...props, children }).mount(this._shadowRoot, opts);
  - this._component.mounted && this._component.mounted(props, children);
  + if (this._component.mounted) {
  + const new_state = this._component.mounted(props, children, this._component.state);
  + if (typeof new_state !== 'undefined') this._component.state = new_state;
  + }
  this.on = this._component.on.bind(this._component);
  this.run = this._component.run.bind(this._component);
  }
  }
  disconnectedCallback() {
  + this._component.unload && this._component.unload();
  this._component.unmount();
  this._component = null;
  }
  