text: import {remove, within} from '../util/index';
  
  export default function (UIkit) {
  
      const DATA = UIkit.data;
  
      UIkit.prototype.$mount = function (el) {
  
          const {name} = this.$options;
  
          if (!el[DATA]) {
              el[DATA] = {};
          }
  
          if (el[DATA][name]) {
              return;
          }
  
          el[DATA][name] = this;
  
          this.$el = this.$options.el = this.$options.el || el;
  
          this._initProps();
  
          this._callHook('init');
  
          if (within(el, document)) {
              this._callConnected();
          }
      };
  
      UIkit.prototype.$emit = function (e) {
          this._callUpdate(e);
      };
  
      UIkit.prototype.$reset = function (data) {
          this._callDisconnected();
          this._initProps(data);
          this._callConnected();
      };
  
      UIkit.prototype.$destroy = function (removeEl = false) {
  
          const {el, name} = this.$options;
  
          if (el) {
              this._callDisconnected();
          }
  
          this._callHook('destroy');
  
          if (!el || !el[DATA]) {
              return;
          }
  
          delete el[DATA][name];
  
          if (!Object.keys(el[DATA]).length) {
              delete el[DATA];
          }
  
          if (removeEl) {
              remove(this.$el);
          }
      };
  
  }
  