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

@enact/spotlight

Package Overview
Dependencies
Maintainers
1
Versions
218
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@enact/spotlight - npm Package Compare versions

Comparing version 3.3.0-alpha.15 to 3.3.0

8

CHANGELOG.md

@@ -5,2 +5,6 @@ # Change Log

## [3.3.0] - 2020-07-13
No significant changes.
## [3.3.0-alpha.15] - 2020-07-07

@@ -12,6 +16,4 @@

### Added
No significant changes.
- `spotlight` container config prop `straightOnlyLeave` to prevent navigation to oblique containers when leaving the current container
## [3.3.0-alpha.13] - 2020-06-22

@@ -18,0 +20,0 @@

{
"name": "@enact/spotlight",
"version": "3.3.0-alpha.15",
"version": "3.3.0",
"description": "A focus management library",

@@ -24,3 +24,3 @@ "main": "src/spotlight.js",

"dependencies": {
"@enact/core": "^3.3.0-alpha.15",
"@enact/core": "^3.3.0",
"prop-types": "^15.7.2",

@@ -27,0 +27,0 @@ "ramda": "^0.24.1",

@@ -209,3 +209,7 @@ "use strict";

return keyCode === value;
});
}); // FIXME: temporary patch to maintain compatibility with moonstone 3.2.5 which
// deconstructs `preventDefault` from the event which is incompatible with React's
// synthetic event.
ev.preventDefault = ev.preventDefault.bind(ev);
(0, _handle.forward)('onKeyUp', ev, props);

@@ -212,0 +216,0 @@ var notPrevented = !ev.defaultPrevented; // bail early for non-selection keyup to avoid clearing lastSelectTarget prematurely

@@ -121,2 +121,4 @@ "use strict";

overflow: false,
partition: false,
// use the container bounds for partitioning when leaving
rememberSource: false,

@@ -130,4 +132,2 @@ restrict: 'self-first',

straightOnly: false,
straightOnlyLeave: false,
// prevents navigation to oblique containers when leaving the current container
straightOverlapThreshold: 0.5,

@@ -134,0 +134,0 @@ tabIndexIgnoreList: 'a, input, select, textarea, button, iframe, [contentEditable=true]'

@@ -265,2 +265,4 @@ "use strict";

function navigate(targetRect, direction, rects, config) {
var partitionRect = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : targetRect;
if (!targetRect || !direction || !rects || !rects.length || !config) {

@@ -275,3 +277,3 @@ return null;

straightOverlapThreshold = config.straightOverlapThreshold;
var groups = partition(rects, targetRect, straightOverlapThreshold, function (rect, destRect) {
var groups = partition(rects, partitionRect, straightOverlapThreshold, function (rect, destRect) {
return calcGroupId(direction === 'up' || direction === 'down' ? calcNextExtendedGridPosition(rect, destRect) : calcNextGridPosition(rect, destRect));

@@ -278,0 +280,0 @@ });

@@ -288,19 +288,7 @@ "use strict";

var currentContainerId = (0, _last["default"])(currentContainerIds);
var nextContainerIds = (0, _container.getContainersForNode)(next);
var nextContainerIds = (0, _container.getContainersForNode)(next); // prevent focus if 5-way is being held and the next element isn't wrapped by
// the current element's immediate container
if (nextContainerIds.indexOf(currentContainerId) < 0) {
// prevent focus if 5-way is being held and the next element isn't wrapped by
// the current element's immediate container
if (_5WayKeyHold && !(0, _container.isContainer5WayHoldable)(currentContainerId)) {
return false;
}
if ((0, _container.getContainerConfig)(currentContainerId).straightOnlyLeave) {
var currentContainerRect = (0, _utils.getContainerRect)(currentContainerId);
var nextContainerRect = (0, _utils.getContainerRect)((0, _last["default"])(nextContainerIds)); // prevent focus for obliquely leaving straightOnlyLeave containers
if ((direction === 'left' || direction === 'right') && (nextContainerRect.bottom < currentContainerRect.top || nextContainerRect.top > currentContainerRect.bottom) || (direction === 'up' || direction === 'down') && (nextContainerRect.right < currentContainerRect.left || nextContainerRect.left > currentContainerRect.right)) {
return false;
}
}
if (_5WayKeyHold && nextContainerIds.indexOf(currentContainerId) < 0 && !(0, _container.isContainer5WayHoldable)(currentContainerId)) {
return false;
}

@@ -307,0 +295,0 @@

@@ -305,6 +305,18 @@ "use strict";

return "break";
} // If one of the downstream containers is configured for partition, we use that
// container's bounds as the partition rect for navigation.
var partitionContainer = elementContainerIds.slice(elementContainerIds.indexOf(containerId) + 1).find(function (id) {
var cfg = (0, _container.getContainerConfig)(id);
return cfg && cfg.partition;
});
var partitionRect = elementRect;
if (partitionContainer) {
partitionRect = (0, _utils.getContainerRect)(partitionContainer);
} // try to navigate from element to one of the candidates in containerId
next = (0, _navigate["default"])(elementRect, direction, elementRects, (0, _container.getContainerConfig)(containerId)); // if we match a container,
next = (0, _navigate["default"])(elementRect, direction, elementRects, (0, _container.getContainerConfig)(containerId), partitionRect); // if we match a container,

@@ -311,0 +323,0 @@ if (next && (0, _container.isContainer)(next)) {

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