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

@lightningjs/solid-primitives

Package Overview
Dependencies
Maintainers
7
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lightningjs/solid-primitives - npm Package Compare versions

Comparing version 0.4.0 to 0.4.1

8

dist/packages/useFocusManager.d.ts

@@ -28,3 +28,3 @@ import { ElementNode } from '@lightningjs/solid';

onBlur?: (currentFocusedElm: ElementNode | null, prevFocusedElm: ElementNode | null) => void;
onKeyPress?: (this: ElementNode, e: KeyboardEvent, key: string, currentFocusedElm: ElementNode) => KeyHandlerReturn;
onKeyPress?: (this: ElementNode, e: KeyboardEvent, mappedKeyEvent: string | undefined, currentFocusedElm: ElementNode) => KeyHandlerReturn;
onSelectedChanged?: (container: ElementNode, activeElm: ElementNode, selectedIndex: number | null, lastSelectedIndex: number | null) => void;

@@ -35,2 +35,8 @@ skipFocus?: boolean;

}
interface IntrinsicNodeStyleProps {
focus?: IntrinsicNodeStyleProps;
}
interface IntrinsicTextNodeStyleProps {
focus?: IntrinsicTextNodeStyleProps;
}
interface TextNode {

@@ -37,0 +43,0 @@ skipFocus?: undefined;

20

dist/packages/useFocusManager.js

@@ -37,2 +37,3 @@ /*

};
const keyMapEntries = Object.entries(keyMap);
createEffect(on(activeElement, (currentFocusedElm, prevFocusedElm, prevFocusPath = []) => {

@@ -65,14 +66,21 @@ const newFocusedElms = [];

if (e) {
const key = keyMap[e.key] || e.key;
// Search keyMap for the value of the pressed key
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const foundKeyEntry = keyMapEntries.find(([key, value]) => {
return (value === e.key);
});
untrack(() => {
const fp = focusPath();
for (const elm of fp) {
const onKeyHandler = elm[`on${key}`];
if (isFunc(onKeyHandler)) {
if (onKeyHandler.call(elm, e, elm) === true) {
break;
const mappedKeyEvent = foundKeyEntry ? foundKeyEntry[0] : undefined;
if (mappedKeyEvent) {
const onKeyHandler = elm[`on${mappedKeyEvent}`];
if (isFunc(onKeyHandler)) {
if (onKeyHandler.call(elm, e, elm) === true) {
break;
}
}
}
if (isFunc(elm.onKeyPress)) {
if (elm.onKeyPress.call(elm, e, key, elm) === true) {
if (elm.onKeyPress.call(elm, e, mappedKeyEvent, elm) === true) {
break;

@@ -79,0 +87,0 @@ }

{
"name": "@lightningjs/solid-primitives",
"version": "0.4.0",
"version": "0.4.1",
"description": "Lightning Primitives for Solid Lightning",

@@ -41,3 +41,3 @@ "type": "module",

"@lightningjs/renderer": "^0.3.6",
"@lightningjs/solid": "^0.6.10",
"@lightningjs/solid": "^0.7.0",
"@typescript-eslint/eslint-plugin": "^6.3.0",

@@ -44,0 +44,0 @@ "@typescript-eslint/parser": "^6.3.0",

@@ -56,3 +56,3 @@ /*

e: KeyboardEvent,
key: string,
mappedKeyEvent: string | undefined,
currentFocusedElm: ElementNode,

@@ -71,2 +71,12 @@ ) => KeyHandlerReturn;

interface IntrinsicNodeStyleProps {
// TODO: Refactor states to use a $ prefix
focus?: IntrinsicNodeStyleProps;
}
interface IntrinsicTextNodeStyleProps {
// TODO: Refactor states to use a $ prefix
focus?: IntrinsicTextNodeStyleProps;
}
interface TextNode {

@@ -94,2 +104,3 @@ skipFocus?: undefined;

};
const keyMapEntries = Object.entries(keyMap);
createEffect(

@@ -134,10 +145,17 @@ on(

if (e) {
const key = keyMap[e.key as keyof typeof keyMap] || e.key;
// Search keyMap for the value of the pressed key
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const foundKeyEntry = keyMapEntries.find(([key, value]) => {
return (value === e.key);
});
untrack(() => {
const fp = focusPath();
for (const elm of fp) {
const onKeyHandler = elm[`on${key}` as keyof KeyMapEventHandlers];
if (isFunc(onKeyHandler)) {
if (onKeyHandler.call(elm, e, elm) === true) {
break;
const mappedKeyEvent = foundKeyEntry ? foundKeyEntry[0] : undefined;
if (mappedKeyEvent) {
const onKeyHandler = elm[`on${mappedKeyEvent}` as keyof KeyMapEventHandlers];
if (isFunc(onKeyHandler)) {
if (onKeyHandler.call(elm, e, elm) === true) {
break;
}
}

@@ -147,3 +165,3 @@ }

if (isFunc(elm.onKeyPress)) {
if (elm.onKeyPress.call(elm, e, key, elm) === true) {
if (elm.onKeyPress.call(elm, e, mappedKeyEvent, elm) === true) {
break;

@@ -150,0 +168,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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