"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const dom = require("../dom.js");
const keyboardEvent = require("../keyboardEvent.js");
const mouseEvent = require("../mouseEvent.js");
const touch = require("../touch.js");
const lifecycle = require("../../common/lifecycle.js");
class Widget extends lifecycle.Disposable {
  onclick(domNode, listener) {
    this._register(dom.addDisposableListener(domNode, dom.EventType.CLICK, (e) => listener(new mouseEvent.StandardMouseEvent(e))));
  }
  onmousedown(domNode, listener) {
    this._register(dom.addDisposableListener(domNode, dom.EventType.MOUSE_DOWN, (e) => listener(new mouseEvent.StandardMouseEvent(e))));
  }
  onmouseover(domNode, listener) {
    this._register(dom.addDisposableListener(domNode, dom.EventType.MOUSE_OVER, (e) => listener(new mouseEvent.StandardMouseEvent(e))));
  }
  onnonbubblingmouseout(domNode, listener) {
    this._register(dom.addDisposableNonBubblingMouseOutListener(domNode, (e) => listener(new mouseEvent.StandardMouseEvent(e))));
  }
  onkeydown(domNode, listener) {
    this._register(dom.addDisposableListener(domNode, dom.EventType.KEY_DOWN, (e) => listener(new keyboardEvent.StandardKeyboardEvent(e))));
  }
  onkeyup(domNode, listener) {
    this._register(dom.addDisposableListener(domNode, dom.EventType.KEY_UP, (e) => listener(new keyboardEvent.StandardKeyboardEvent(e))));
  }
  oninput(domNode, listener) {
    this._register(dom.addDisposableListener(domNode, dom.EventType.INPUT, listener));
  }
  onblur(domNode, listener) {
    this._register(dom.addDisposableListener(domNode, dom.EventType.BLUR, listener));
  }
  onfocus(domNode, listener) {
    this._register(dom.addDisposableListener(domNode, dom.EventType.FOCUS, listener));
  }
  ignoreGesture(domNode) {
    touch.Gesture.ignoreTarget(domNode);
  }
}
exports.Widget = Widget;
