"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ALL_EVENTS = void 0;
exports.stopPropagation = stopPropagation;
exports.stopImmediatePropagation = stopImmediatePropagation;
exports.stopByPropagation = stopByPropagation;
exports.stopAllPropagation = stopAllPropagation;
function stopPropagation(event) {
    event.stopPropagation();
}
function stopImmediatePropagation(event) {
    event.stopImmediatePropagation();
}
function stopByPropagation($element, name) {
    $element.addEventListener(name, (event) => {
        event.stopPropagation();
        $element.dispatchEvent(new CustomEvent(`_${name}`, { detail: event, bubbles: event.bubbles }));
    }, { passive: true, capture: false });
}
exports.ALL_EVENTS = [
    'pointerdown',
    'pointermove',
    'pointerup',
    'pointerenter',
    'pointerleave',
    'pointercancel',
    'pointerover',
    'pointerout',
    'click',
    'focus',
    'blur',
    'wheel',
    'scroll',
    'keypress',
    'keydown',
    'keyup',
    'touchstart',
    'dragover',
    'drop',
    'contextmenu',
];
function stopAllPropagation($element) {
    exports.ALL_EVENTS.forEach((name) => stopByPropagation($element, name));
}
//# sourceMappingURL=stopPropagation.js.map