Comparing version 0.1.4 to 0.1.5
import { ObjectDirective } from 'vue'; | ||
interface ZIndexableElement extends HTMLElement { | ||
'@@ziContext': { | ||
enabled: boolean; | ||
enabled?: boolean; | ||
}; | ||
} | ||
declare const zindexable: ObjectDirective<ZIndexableElement>; | ||
declare const zindexable: ObjectDirective<ZIndexableElement, { | ||
zIndex?: number; | ||
enabled?: boolean; | ||
} | undefined>; | ||
export default zindexable; |
import zIndexManager from './z-index-manager'; | ||
const ctx = '@@ziContext'; | ||
// We don't expect manually bound zindex should be changed | ||
const zindexable = { | ||
@@ -7,3 +8,5 @@ mounted(el, bindings) { | ||
const { zIndex, enabled } = value; | ||
zIndexManager.ensureZIndex(el, zIndex); | ||
if (enabled) { | ||
zIndexManager.ensureZIndex(el, zIndex); | ||
} | ||
el[ctx] = { | ||
@@ -22,6 +25,8 @@ enabled | ||
}, | ||
unmounted(el) { | ||
zIndexManager.unregister(el); | ||
unmounted(el, bindings) { | ||
const { value = {} } = bindings; | ||
const { zIndex } = value; | ||
zIndexManager.unregister(el, zIndex); | ||
} | ||
}; | ||
export default zindexable; |
@@ -7,3 +7,3 @@ declare class ZIndexManager { | ||
ensureZIndex(el: HTMLElement, zIndex?: number): void; | ||
unregister(el: HTMLElement): void; | ||
unregister(el: HTMLElement, zIndex?: number): void; | ||
squashState(): void; | ||
@@ -10,0 +10,0 @@ rearrange(): void; |
@@ -28,3 +28,3 @@ import { warn } from '../utils'; | ||
} | ||
unregister(el) { | ||
unregister(el, zIndex) { | ||
const { elementZIndex } = this; | ||
@@ -34,4 +34,4 @@ if (elementZIndex.has(el)) { | ||
} | ||
else { | ||
warn('vdirs/z-index-manager/unregister-element', 'Element not found when unregistering.'); | ||
else if (zIndex === undefined) { | ||
warn('z-index-manager/unregister-element', 'Element not found when unregistering.'); | ||
} | ||
@@ -38,0 +38,0 @@ this.squashState(); |
@@ -12,3 +12,3 @@ "use strict"; | ||
el[ctxKey].handler = value; | ||
evtd_1.on('clickoutside', el, value); | ||
(0, evtd_1.on)('clickoutside', el, value); | ||
} | ||
@@ -21,5 +21,5 @@ }, | ||
if (ctx.handler !== value) { | ||
evtd_1.off('clickoutside', el, ctx.handler); | ||
(0, evtd_1.off)('clickoutside', el, ctx.handler); | ||
ctx.handler = value; | ||
evtd_1.on('clickoutside', el, value); | ||
(0, evtd_1.on)('clickoutside', el, value); | ||
} | ||
@@ -29,3 +29,3 @@ } | ||
el[ctxKey].handler = value; | ||
evtd_1.on('clickoutside', el, value); | ||
(0, evtd_1.on)('clickoutside', el, value); | ||
} | ||
@@ -35,3 +35,3 @@ } | ||
if (ctx.handler) { | ||
evtd_1.off('clickoutside', el, ctx.handler); | ||
(0, evtd_1.off)('clickoutside', el, ctx.handler); | ||
ctx.handler = undefined; | ||
@@ -44,3 +44,3 @@ } | ||
if (handler) { | ||
evtd_1.off('clickoutside', el, handler); | ||
(0, evtd_1.off)('clickoutside', el, handler); | ||
} | ||
@@ -47,0 +47,0 @@ el[ctxKey].handler = undefined; |
@@ -12,3 +12,3 @@ "use strict"; | ||
el[ctxKey].handler = value; | ||
evtd_1.on('mousemoveoutside', el, value); | ||
(0, evtd_1.on)('mousemoveoutside', el, value); | ||
} | ||
@@ -21,5 +21,5 @@ }, | ||
if (ctx.handler !== value) { | ||
evtd_1.off('mousemoveoutside', el, ctx.handler); | ||
(0, evtd_1.off)('mousemoveoutside', el, ctx.handler); | ||
ctx.handler = value; | ||
evtd_1.on('mousemoveoutside', el, value); | ||
(0, evtd_1.on)('mousemoveoutside', el, value); | ||
} | ||
@@ -29,3 +29,3 @@ } | ||
el[ctxKey].handler = value; | ||
evtd_1.on('mousemoveoutside', el, value); | ||
(0, evtd_1.on)('mousemoveoutside', el, value); | ||
} | ||
@@ -35,3 +35,3 @@ } | ||
if (ctx.handler) { | ||
evtd_1.off('mousemoveoutside', el, ctx.handler); | ||
(0, evtd_1.off)('mousemoveoutside', el, ctx.handler); | ||
ctx.handler = undefined; | ||
@@ -44,3 +44,3 @@ } | ||
if (handler) { | ||
evtd_1.off('mousemoveoutside', el, handler); | ||
(0, evtd_1.off)('mousemoveoutside', el, handler); | ||
} | ||
@@ -47,0 +47,0 @@ el[ctxKey].handler = undefined; |
import { ObjectDirective } from 'vue'; | ||
interface ZIndexableElement extends HTMLElement { | ||
'@@ziContext': { | ||
enabled: boolean; | ||
enabled?: boolean; | ||
}; | ||
} | ||
declare const zindexable: ObjectDirective<ZIndexableElement>; | ||
declare const zindexable: ObjectDirective<ZIndexableElement, { | ||
zIndex?: number; | ||
enabled?: boolean; | ||
} | undefined>; | ||
export default zindexable; |
@@ -5,2 +5,3 @@ "use strict"; | ||
const ctx = '@@ziContext'; | ||
// We don't expect manually bound zindex should be changed | ||
const zindexable = { | ||
@@ -10,3 +11,5 @@ mounted(el, bindings) { | ||
const { zIndex, enabled } = value; | ||
z_index_manager_1.default.ensureZIndex(el, zIndex); | ||
if (enabled) { | ||
z_index_manager_1.default.ensureZIndex(el, zIndex); | ||
} | ||
el[ctx] = { | ||
@@ -25,6 +28,8 @@ enabled | ||
}, | ||
unmounted(el) { | ||
z_index_manager_1.default.unregister(el); | ||
unmounted(el, bindings) { | ||
const { value = {} } = bindings; | ||
const { zIndex } = value; | ||
z_index_manager_1.default.unregister(el, zIndex); | ||
} | ||
}; | ||
exports.default = zindexable; |
@@ -7,3 +7,3 @@ declare class ZIndexManager { | ||
ensureZIndex(el: HTMLElement, zIndex?: number): void; | ||
unregister(el: HTMLElement): void; | ||
unregister(el: HTMLElement, zIndex?: number): void; | ||
squashState(): void; | ||
@@ -10,0 +10,0 @@ rearrange(): void; |
@@ -30,3 +30,3 @@ "use strict"; | ||
} | ||
unregister(el) { | ||
unregister(el, zIndex) { | ||
const { elementZIndex } = this; | ||
@@ -36,4 +36,4 @@ if (elementZIndex.has(el)) { | ||
} | ||
else { | ||
utils_1.warn('vdirs/z-index-manager/unregister-element', 'Element not found when unregistering.'); | ||
else if (zIndex === undefined) { | ||
(0, utils_1.warn)('z-index-manager/unregister-element', 'Element not found when unregistering.'); | ||
} | ||
@@ -40,0 +40,0 @@ this.squashState(); |
{ | ||
"name": "vdirs", | ||
"version": "0.1.4", | ||
"version": "0.1.5", | ||
"description": "Helper directives for Vue.", | ||
@@ -19,3 +19,2 @@ "scripts": { | ||
"dependencies": { | ||
"@types/node": "^14.14.10", | ||
"evtd": "^0.2.2" | ||
@@ -27,4 +26,7 @@ }, | ||
"devDependencies": { | ||
"typescript": "^4.3.2" | ||
"@babel/types": "^7.16.0", | ||
"@types/node": "^16.0.0", | ||
"typescript": "^4.3.2", | ||
"vue": "^3.0.11" | ||
} | ||
} |
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
17122
2
485
4
- Removed@types/node@^14.14.10
- Removed@types/node@14.18.63(transitive)