Comparing version 0.1.2 to 0.1.4
import { ObjectDirective } from 'vue'; | ||
interface ClickOutsideElement extends HTMLElement { | ||
'@@coContext': { | ||
handler: (e: MouseEvent) => any; | ||
handler: ((e: MouseEvent) => any) | undefined; | ||
}; | ||
@@ -6,0 +6,0 @@ } |
import { on, off } from 'evtd'; | ||
import { warn } from './utils'; | ||
const ctx = '@@coContext'; | ||
const ctxKey = '@@coContext'; | ||
const clickoutside = { | ||
mounted(el, { value }) { | ||
el[ctxKey] = { | ||
handler: undefined | ||
}; | ||
if (typeof value === 'function') { | ||
el[ctx] = { | ||
handler: value | ||
}; | ||
on('clickoutside', el, el[ctx].handler); | ||
el[ctxKey].handler = value; | ||
on('clickoutside', el, value); | ||
} | ||
}, | ||
updated(el, { value }) { | ||
const ctx = el[ctxKey]; | ||
if (typeof value === 'function') { | ||
if (el[ctx] && el[ctx].handler) { | ||
if (el[ctx].handler !== value) { | ||
off('clickoutside', el, el[ctx].handler); | ||
el[ctx].handler = value; | ||
on('clickoutside', el, el[ctx].handler); | ||
if (ctx.handler) { | ||
if (ctx.handler !== value) { | ||
off('clickoutside', el, ctx.handler); | ||
ctx.handler = value; | ||
on('clickoutside', el, value); | ||
} | ||
} | ||
else { | ||
el[ctx].handler = value; | ||
on('clickoutside', el, el[ctx].handler); | ||
el[ctxKey].handler = value; | ||
on('clickoutside', el, value); | ||
} | ||
} | ||
else if (process.env.NODE_ENV !== 'production') { | ||
warn('clickoutside', 'Binding value is not a function.'); | ||
else { | ||
if (ctx.handler) { | ||
off('clickoutside', el, ctx.handler); | ||
ctx.handler = undefined; | ||
} | ||
} | ||
}, | ||
unmounted(el) { | ||
off('clickoutside', el, el[ctx].handler); | ||
const { handler } = el[ctxKey]; | ||
if (handler) { | ||
off('clickoutside', el, handler); | ||
} | ||
el[ctxKey].handler = undefined; | ||
} | ||
}; | ||
export default clickoutside; |
import { ObjectDirective } from 'vue'; | ||
interface MouseMoveOutsideElement extends HTMLElement { | ||
'@@mmoContext': { | ||
handler: (e: MouseEvent) => any; | ||
handler?: (e: MouseEvent) => any; | ||
}; | ||
@@ -6,0 +6,0 @@ } |
@@ -1,10 +0,10 @@ | ||
import { warn } from './utils'; | ||
import { on, off } from 'evtd'; | ||
const ctx = '@@mmoContext'; | ||
const ctxKey = '@@mmoContext'; | ||
const mousemoveoutside = { | ||
beforeMount(el, { value }) { | ||
mounted(el, { value }) { | ||
el[ctxKey] = { | ||
handler: undefined | ||
}; | ||
if (typeof value === 'function') { | ||
el[ctx] = { | ||
handler: value | ||
}; | ||
el[ctxKey].handler = value; | ||
on('mousemoveoutside', el, value); | ||
@@ -14,23 +14,31 @@ } | ||
updated(el, { value }) { | ||
const ctx = el[ctxKey]; | ||
if (typeof value === 'function') { | ||
if (el[ctx] && el[ctx].handler) { | ||
if (el[ctx].handler !== value) { | ||
off('mousemoveoutside', el, el[ctx].handler); | ||
el[ctx].handler = value; | ||
on('mousemoveoutside', el, el[ctx].handler); | ||
if (ctx.handler) { | ||
if (ctx.handler !== value) { | ||
off('mousemoveoutside', el, ctx.handler); | ||
ctx.handler = value; | ||
on('mousemoveoutside', el, value); | ||
} | ||
} | ||
else { | ||
el[ctx].handler = value; | ||
on('mousemoveoutside', el, el[ctx].handler); | ||
el[ctxKey].handler = value; | ||
on('mousemoveoutside', el, value); | ||
} | ||
} | ||
else { | ||
warn('mousemoveoutside', 'Binding value is not a function.'); | ||
if (ctx.handler) { | ||
off('mousemoveoutside', el, ctx.handler); | ||
ctx.handler = undefined; | ||
} | ||
} | ||
}, | ||
unmounted(el) { | ||
off('mousemoveoutside', el, el[ctx].handler); | ||
const { handler } = el[ctxKey]; | ||
if (handler) { | ||
off('mousemoveoutside', el, handler); | ||
} | ||
el[ctxKey].handler = undefined; | ||
} | ||
}; | ||
export default mousemoveoutside; |
import { ObjectDirective } from 'vue'; | ||
interface ClickOutsideElement extends HTMLElement { | ||
'@@coContext': { | ||
handler: (e: MouseEvent) => any; | ||
handler: ((e: MouseEvent) => any) | undefined; | ||
}; | ||
@@ -6,0 +6,0 @@ } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const evtd_1 = require("evtd"); | ||
const utils_1 = require("./utils"); | ||
const ctx = '@@coContext'; | ||
const ctxKey = '@@coContext'; | ||
const clickoutside = { | ||
mounted(el, { value }) { | ||
el[ctxKey] = { | ||
handler: undefined | ||
}; | ||
if (typeof value === 'function') { | ||
el[ctx] = { | ||
handler: value | ||
}; | ||
evtd_1.on('clickoutside', el, el[ctx].handler); | ||
el[ctxKey].handler = value; | ||
evtd_1.on('clickoutside', el, value); | ||
} | ||
}, | ||
updated(el, { value }) { | ||
const ctx = el[ctxKey]; | ||
if (typeof value === 'function') { | ||
if (el[ctx] && el[ctx].handler) { | ||
if (el[ctx].handler !== value) { | ||
evtd_1.off('clickoutside', el, el[ctx].handler); | ||
el[ctx].handler = value; | ||
evtd_1.on('clickoutside', el, el[ctx].handler); | ||
if (ctx.handler) { | ||
if (ctx.handler !== value) { | ||
evtd_1.off('clickoutside', el, ctx.handler); | ||
ctx.handler = value; | ||
evtd_1.on('clickoutside', el, value); | ||
} | ||
} | ||
else { | ||
el[ctx].handler = value; | ||
evtd_1.on('clickoutside', el, el[ctx].handler); | ||
el[ctxKey].handler = value; | ||
evtd_1.on('clickoutside', el, value); | ||
} | ||
} | ||
else if (process.env.NODE_ENV !== 'production') { | ||
utils_1.warn('clickoutside', 'Binding value is not a function.'); | ||
else { | ||
if (ctx.handler) { | ||
evtd_1.off('clickoutside', el, ctx.handler); | ||
ctx.handler = undefined; | ||
} | ||
} | ||
}, | ||
unmounted(el) { | ||
evtd_1.off('clickoutside', el, el[ctx].handler); | ||
const { handler } = el[ctxKey]; | ||
if (handler) { | ||
evtd_1.off('clickoutside', el, handler); | ||
} | ||
el[ctxKey].handler = undefined; | ||
} | ||
}; | ||
exports.default = clickoutside; |
import { ObjectDirective } from 'vue'; | ||
interface MouseMoveOutsideElement extends HTMLElement { | ||
'@@mmoContext': { | ||
handler: (e: MouseEvent) => any; | ||
handler?: (e: MouseEvent) => any; | ||
}; | ||
@@ -6,0 +6,0 @@ } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const utils_1 = require("./utils"); | ||
const evtd_1 = require("evtd"); | ||
const ctx = '@@mmoContext'; | ||
const ctxKey = '@@mmoContext'; | ||
const mousemoveoutside = { | ||
beforeMount(el, { value }) { | ||
mounted(el, { value }) { | ||
el[ctxKey] = { | ||
handler: undefined | ||
}; | ||
if (typeof value === 'function') { | ||
el[ctx] = { | ||
handler: value | ||
}; | ||
el[ctxKey].handler = value; | ||
evtd_1.on('mousemoveoutside', el, value); | ||
@@ -16,23 +16,31 @@ } | ||
updated(el, { value }) { | ||
const ctx = el[ctxKey]; | ||
if (typeof value === 'function') { | ||
if (el[ctx] && el[ctx].handler) { | ||
if (el[ctx].handler !== value) { | ||
evtd_1.off('mousemoveoutside', el, el[ctx].handler); | ||
el[ctx].handler = value; | ||
evtd_1.on('mousemoveoutside', el, el[ctx].handler); | ||
if (ctx.handler) { | ||
if (ctx.handler !== value) { | ||
evtd_1.off('mousemoveoutside', el, ctx.handler); | ||
ctx.handler = value; | ||
evtd_1.on('mousemoveoutside', el, value); | ||
} | ||
} | ||
else { | ||
el[ctx].handler = value; | ||
evtd_1.on('mousemoveoutside', el, el[ctx].handler); | ||
el[ctxKey].handler = value; | ||
evtd_1.on('mousemoveoutside', el, value); | ||
} | ||
} | ||
else { | ||
utils_1.warn('mousemoveoutside', 'Binding value is not a function.'); | ||
if (ctx.handler) { | ||
evtd_1.off('mousemoveoutside', el, ctx.handler); | ||
ctx.handler = undefined; | ||
} | ||
} | ||
}, | ||
unmounted(el) { | ||
evtd_1.off('mousemoveoutside', el, el[ctx].handler); | ||
const { handler } = el[ctxKey]; | ||
if (handler) { | ||
evtd_1.off('mousemoveoutside', el, handler); | ||
} | ||
el[ctxKey].handler = undefined; | ||
} | ||
}; | ||
exports.default = mousemoveoutside; |
{ | ||
"name": "vdirs", | ||
"version": "0.1.2", | ||
"version": "0.1.4", | ||
"description": "Helper directives for Vue.", | ||
@@ -20,8 +20,10 @@ "scripts": { | ||
"@types/node": "^14.14.10", | ||
"evtd": "^0.2.0", | ||
"vue": "^3.0.3" | ||
"evtd": "^0.2.2" | ||
}, | ||
"peerDependencies": { | ||
"vue": "^3.0.11" | ||
}, | ||
"devDependencies": { | ||
"typescript": "^4.1.2" | ||
"typescript": "^4.3.2" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
16414
469
1
- Removedvue@^3.0.3
Updatedevtd@^0.2.2