#import <UIEvents/EventModifier.idl>

// https://w3c.github.io/uievents/#mouseevent
[Exposed=Window]
interface MouseEvent : UIEvent {
    constructor(DOMString type, optional MouseEventInit eventInitDict = {});

    // https://drafts.csswg.org/cssom-view/#extensions-to-the-mouseevent-interface
    readonly attribute double screenX;
    readonly attribute double screenY;
    readonly attribute double pageX;
    readonly attribute double pageY;
    readonly attribute double clientX;
    readonly attribute double clientY;
    readonly attribute double x;
    readonly attribute double y;
    readonly attribute double offsetX;
    readonly attribute double offsetY;

    readonly attribute boolean ctrlKey;
    readonly attribute boolean shiftKey;
    readonly attribute boolean altKey;
    readonly attribute boolean metaKey;

    // https://w3c.github.io/pointerlock/#extensions-to-the-mouseevent-interface
    readonly attribute double movementX;
    readonly attribute double movementY;

    readonly attribute short button;
    readonly attribute unsigned short buttons;

    readonly attribute EventTarget? relatedTarget;

    boolean getModifierState(DOMString keyArg);
};

// https://w3c.github.io/uievents/#idl-mouseeventinit
dictionary MouseEventInit : EventModifierInit {
    // https://drafts.csswg.org/cssom-view/#extensions-to-the-mouseevent-interface
    double screenX = 0;
    double screenY = 0;
    double clientX = 0;
    double clientY = 0;

    // https://w3c.github.io/pointerlock/#extensions-to-the-mouseeventinit-dictionary
    double movementX = 0;
    double movementY = 0;

    short button = 0;
    unsigned short buttons = 0;
    EventTarget? relatedTarget = null;
};
