Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@featherds/composables

Package Overview
Dependencies
Maintainers
2
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@featherds/composables - npm Package Compare versions

Comparing version 0.12.1 to 0.12.2

6

events/OutsideClick.d.ts
import { Ref } from "vue";
declare const useOutsideClick: (elementRef: Ref<HTMLElement> | Ref<HTMLElement[]>, listener: (e?: FocusEvent) => void) => Ref<boolean>;
declare const useOutsideClick: (elementRef: Ref<HTMLElement> | Ref<HTMLElement[]>, listener: (e?: FocusEvent) => void, options?: {
click?: boolean;
focus?: boolean;
window?: boolean;
}) => Ref<boolean>;
export { useOutsideClick };

30

events/OutsideClick.js
import { watch, onBeforeUnmount, ref, onMounted } from "vue";
const useOutsideClick = (elementRef, listener) => {
const useOutsideClick = (elementRef, listener, options = {
click: true,
focus: true,
window: true,
}) => {
const active = ref(false);

@@ -24,5 +28,11 @@ const windowBlurChecker = (e) => {

if (document && window) {
document.removeEventListener("click", outSideClick, true);
document.removeEventListener("focus", outSideClick, true);
window.removeEventListener("blur", windowBlurChecker);
if (options.click) {
document.removeEventListener("click", outSideClick, true);
}
if (options.focus) {
document.removeEventListener("focus", outSideClick, true);
}
if (options.window) {
window.removeEventListener("blur", windowBlurChecker);
}
}

@@ -33,5 +43,11 @@ };

if (document && window && enabled) {
document.addEventListener("click", outSideClick, true);
document.addEventListener("focus", outSideClick, true);
window.addEventListener("blur", windowBlurChecker);
if (options.click) {
document.addEventListener("click", outSideClick, true);
}
if (options.focus) {
document.addEventListener("focus", outSideClick, true);
}
if (options.window) {
window.addEventListener("blur", windowBlurChecker);
}
}

@@ -38,0 +54,0 @@ else {

@@ -5,3 +5,12 @@ import { watch, onBeforeUnmount, ref, onMounted, Ref } from "vue";

elementRef: Ref<HTMLElement> | Ref<HTMLElement[]>,
listener: (e?: FocusEvent) => void
listener: (e?: FocusEvent) => void,
options: {
click?: boolean;
focus?: boolean;
window?: boolean;
} = {
click: true,
focus: true,
window: true,
}
) => {

@@ -30,5 +39,11 @@ const active = ref(false);

if (document && window) {
document.removeEventListener("click", outSideClick, true);
document.removeEventListener("focus", outSideClick, true);
window.removeEventListener("blur", windowBlurChecker);
if (options.click) {
document.removeEventListener("click", outSideClick, true);
}
if (options.focus) {
document.removeEventListener("focus", outSideClick, true);
}
if (options.window) {
window.removeEventListener("blur", windowBlurChecker);
}
}

@@ -41,5 +56,11 @@ };

if (document && window && enabled) {
document.addEventListener("click", outSideClick, true);
document.addEventListener("focus", outSideClick, true);
window.addEventListener("blur", windowBlurChecker);
if (options.click) {
document.addEventListener("click", outSideClick, true);
}
if (options.focus) {
document.addEventListener("focus", outSideClick, true);
}
if (options.window) {
window.addEventListener("blur", windowBlurChecker);
}
} else {

@@ -46,0 +67,0 @@ removeEvents();

{
"name": "@featherds/composables",
"version": "0.12.1",
"version": "0.12.2",
"publishConfig": {

@@ -12,3 +12,3 @@ "access": "public"

"dependencies": {
"@featherds/utils": "^0.12.1",
"@featherds/utils": "^0.12.2",
"vue": "^3.1.0-0"

@@ -20,3 +20,3 @@ },

],
"gitHead": "72004491146456809a415fcb4959cb4288ac1d3d"
"gitHead": "e7afa42afa38ecf89a0290f0ba8a1ddc22d67af2"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc