Comparing version 17.7.0 to 17.8.0
# CHANGELOG | ||
## 17.8.0 | ||
New hooks `useIsFocused()` and `useIsMouseOver()`. They return true if any child of current component has such state. | ||
New function `shouldBeFocusVisible()` which returns true if last user interaction was by keyboard. | ||
## 17.7.0 | ||
@@ -4,0 +9,0 @@ |
{ | ||
"name": "bobril", | ||
"version": "17.7.0", | ||
"version": "17.8.0", | ||
"description": "Component Oriented MVC Framework with virtual DOM and CSS", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -14,3 +14,6 @@ import { | ||
preventDefault, | ||
CommonUseIsHook, | ||
buildUseIsHook, | ||
} from "./core"; | ||
import { isBoolean } from "./isFunc"; | ||
@@ -313,2 +316,6 @@ import { newHashObj } from "./localHelpers"; | ||
const mouseOverHookSet = new Set<CommonUseIsHook>(); | ||
export let useIsMouseOver = buildUseIsHook(mouseOverHookSet); | ||
function mouseEnterAndLeave(ev: IBobrilPointerEvent) { | ||
@@ -319,2 +326,4 @@ lastMouseEv = ev; | ||
mouseOverHookSet.forEach((v) => v.update(toPath)); | ||
bubble(node, "onMouseOver", ev); | ||
@@ -486,3 +495,3 @@ | ||
var bustingEventNames = ["!PointerDown", "!PointerMove", "!PointerUp", "!PointerCancel", "^click"]; | ||
var bustingEventNames = ["!PointerDown", "!PointerMove", "!PointerUp", "!PointerCancel", "^click"] as const; | ||
var bustingEventHandlers = [ | ||
@@ -610,1 +619,17 @@ bustingPointerDown, | ||
}; | ||
let lastInteractionWasKeyboard = false; | ||
addEvent(bustingEventNames[0], 2, () => { | ||
lastInteractionWasKeyboard = false; | ||
return false; | ||
}); | ||
addEvent("keydown", 2, () => { | ||
lastInteractionWasKeyboard = true; | ||
return false; | ||
}); | ||
export function shouldBeFocusVisible() { | ||
return lastInteractionWasKeyboard; | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
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
393005
9398