@lightningtv/core
Advanced tools
Comparing version 1.0.0-rc1.2 to 1.0.0-rc2
@@ -1,2 +0,2 @@ | ||
import type { ElementNode, ElementText } from './elementNode.js'; | ||
import { ElementNode, type ElementText } from './elementNode.js'; | ||
/** | ||
@@ -3,0 +3,0 @@ * Children class |
@@ -0,1 +1,2 @@ | ||
import { ElementNode } from './elementNode.js'; | ||
/** | ||
@@ -11,4 +12,10 @@ * Children class | ||
get selected() { | ||
// For selected Elements should always be an ElementNode | ||
return this[this._parent.selected || 0]; | ||
const selectedIndex = this._parent.selected || 0; | ||
for (let i = selectedIndex; i < this.length; i++) { | ||
if (this[i] instanceof ElementNode) { | ||
this._parent.selected = i; | ||
return this[i]; | ||
} | ||
} | ||
return undefined; | ||
} | ||
@@ -15,0 +22,0 @@ get firstChild() { |
@@ -27,2 +27,3 @@ import { createShader } from './lightningInit.js'; | ||
selected?: number; | ||
skipFocus?: boolean; | ||
autofocus?: boolean; | ||
@@ -29,0 +30,0 @@ flexItem?: boolean; |
@@ -187,2 +187,8 @@ import { renderer, createShader } from './lightningInit.js'; | ||
// can be 0 | ||
if (this.skipFocus) { | ||
const index = this.parent?.children.indexOf(this); | ||
const nextChild = this.parent?.children[index + 1]; | ||
isElementNode(nextChild) && nextChild.setFocus(); | ||
return; | ||
} | ||
if (this.forwardFocus !== undefined) { | ||
@@ -189,0 +195,0 @@ if (isFunc(this.forwardFocus)) { |
@@ -56,2 +56,3 @@ import { type IAnimationController, type AnimationSettings, type Dimensions, type FadeOutEffectProps, type GlitchEffectProps, type GrayscaleEffectProps, type INode, type ITextNodeProps, type LinearGradientEffectProps, type NodeFailedPayload, type NodeLoadedPayload, type RadialGradientEffectProps, type RadialProgressEffectProps, INodeProps } from '@lightningjs/renderer'; | ||
selected?: number; | ||
skipFocus?: boolean; | ||
states?: NodeStates; | ||
@@ -58,0 +59,0 @@ text?: string; |
{ | ||
"name": "@lightningtv/core", | ||
"version": "1.0.0-rc1.2", | ||
"version": "1.0.0-rc2", | ||
"description": "Lightning TV Core for Universal Renderers", | ||
@@ -55,3 +55,3 @@ "type": "module", | ||
"peerDependencies": { | ||
"@lightningjs/renderer": "^1.0.0-rc.1" | ||
"@lightningjs/renderer": "^1.0.0-rc.3" | ||
}, | ||
@@ -58,0 +58,0 @@ "lint-staged": { |
@@ -1,2 +0,2 @@ | ||
import type { ElementNode, ElementText } from './elementNode.js'; | ||
import { ElementNode, type ElementText } from './elementNode.js'; | ||
@@ -15,4 +15,12 @@ /** | ||
get selected(): ElementNode | undefined { | ||
// For selected Elements should always be an ElementNode | ||
return this[this._parent.selected || 0] as ElementNode | undefined; | ||
const selectedIndex = this._parent.selected || 0; | ||
for (let i = selectedIndex; i < this.length; i++) { | ||
if (this[i] instanceof ElementNode) { | ||
this._parent.selected = i; | ||
return this[i] as ElementNode; | ||
} | ||
} | ||
return undefined; | ||
} | ||
@@ -19,0 +27,0 @@ |
@@ -164,2 +164,3 @@ import { renderer, createShader } from './lightningInit.js'; | ||
selected?: number; | ||
skipFocus?: boolean; | ||
autofocus?: boolean; | ||
@@ -317,2 +318,9 @@ flexItem?: boolean; | ||
// can be 0 | ||
if (this.skipFocus) { | ||
const index = this.parent?.children.indexOf(this); | ||
const nextChild = this.parent?.children[index! + 1]; | ||
isElementNode(nextChild) && nextChild.setFocus(); | ||
return; | ||
} | ||
if (this.forwardFocus !== undefined) { | ||
@@ -319,0 +327,0 @@ if (isFunc(this.forwardFocus)) { |
@@ -99,2 +99,3 @@ import { | ||
selected?: number; | ||
skipFocus?: boolean; | ||
states?: NodeStates; | ||
@@ -101,0 +102,0 @@ text?: string; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
159734
2339