"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.stopAllPropagation = exports.ALL_EVENTS = exports.stopByPropagation = exports.stopImmediatePropagation = exports.stopPropagation = void 0;
function stopPropagation(event) {
    event.stopPropagation();
}
exports.stopPropagation = stopPropagation;
function stopImmediatePropagation(event) {
    event.stopImmediatePropagation();
}
exports.stopImmediatePropagation = 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.stopByPropagation = stopByPropagation;
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));
}
exports.stopAllPropagation = stopAllPropagation;
//# sourceMappingURL=stopPropagation.js.map