@lightningtv/core
Advanced tools
Comparing version 2.2.3 to 2.3.0-beta.1
@@ -41,2 +41,3 @@ import { createShader } from './lightningInit.js'; | ||
selected?: number; | ||
$states?: Record<string, Styles>; | ||
preFlexwidth?: number; | ||
@@ -43,0 +44,0 @@ preFlexheight?: number; |
import { renderer, createShader } from './lightningInit.js'; | ||
import States from './states.js'; | ||
import calculateFlex from './flex.js'; | ||
import { log, isArray, isNumber, isFunc, keyExists, flattenStyles, isINode, isElementNode, isElementText, isTextNode, logRenderTree, } from './utils.js'; | ||
import { log, isArray, isNumber, isFunc, flattenStyles, isINode, isElementNode, isElementText, isTextNode, logRenderTree, } from './utils.js'; | ||
import { Config, isDev } from './config.js'; | ||
@@ -441,17 +441,16 @@ import { assertTruthy } from '@lightningjs/renderer/utils'; | ||
const states = this.states; | ||
if (this._undoStyles || (this.style && keyExists(this.style, states))) { | ||
if (this.$states !== undefined) { | ||
this._undoStyles = this._undoStyles || []; | ||
const stylesToUndo = {}; | ||
this._undoStyles.forEach((styleKey) => { | ||
if (isDev) { | ||
if (!this.style[styleKey]) { | ||
console.warn('fallback style key not found: ', styleKey); | ||
} | ||
} | ||
stylesToUndo[styleKey] = this.style[styleKey]; | ||
}); | ||
const newStyles = states.reduce((acc, state) => { | ||
const styles = this.style[state]; | ||
if (styles) { | ||
acc = { | ||
...acc, | ||
...styles, | ||
}; | ||
} | ||
return acc; | ||
const styles = this.$states[state]; | ||
return styles ? { ...acc, ...styles } : acc; | ||
}, {}); | ||
@@ -458,0 +457,0 @@ this._undoStyles = Object.keys(newStyles); |
@@ -67,3 +67,2 @@ import { type FadeOutEffectProps, type GlitchEffectProps, type GrayscaleEffectProps, type AnimationSettings as RendererAnimationSettings, type LinearGradientEffectProps, type RadialGradientEffectProps, type RadialProgressEffectProps, type ITextNodeProps } from '@lightningjs/renderer'; | ||
export interface NodeStyles extends NodeProps { | ||
[key: string]: NodeProps[keyof NodeProps] | NodeProps | undefined; | ||
} | ||
@@ -76,3 +75,2 @@ type NestedNodeStyles = NodeStyles | Array<NestedNodeStyles | undefined>; | ||
export interface TextStyles extends TextProps { | ||
[key: string]: TextProps[keyof TextProps] | TextProps | undefined; | ||
} | ||
@@ -79,0 +77,0 @@ type NestedTextStyles = TextStyles | Array<NestedTextStyles | undefined>; |
{ | ||
"name": "@lightningtv/core", | ||
"version": "2.2.3", | ||
"version": "2.3.0-beta.1", | ||
"description": "Lightning TV Core for Universal Renderers", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -217,2 +217,3 @@ import { renderer, createShader } from './lightningInit.js'; | ||
selected?: number; | ||
$states?: Record<string, Styles>; | ||
preFlexwidth?: number; | ||
@@ -663,3 +664,3 @@ preFlexheight?: number; | ||
if (this._undoStyles || (this.style && keyExists(this.style, states))) { | ||
if (this.$states !== undefined) { | ||
this._undoStyles = this._undoStyles || []; | ||
@@ -669,2 +670,7 @@ const stylesToUndo: { [key: string]: any } = {}; | ||
this._undoStyles.forEach((styleKey) => { | ||
if (isDev) { | ||
if (!this.style[styleKey]) { | ||
console.warn('fallback style key not found: ', styleKey); | ||
} | ||
} | ||
stylesToUndo[styleKey] = this.style[styleKey]; | ||
@@ -674,10 +680,4 @@ }); | ||
const newStyles: Styles = states.reduce((acc, state) => { | ||
const styles = this.style[state]; | ||
if (styles) { | ||
acc = { | ||
...acc, | ||
...styles, | ||
}; | ||
} | ||
return acc; | ||
const styles = this.$states![state]; | ||
return styles ? { ...acc, ...styles } : acc; | ||
}, {}); | ||
@@ -684,0 +684,0 @@ |
@@ -127,5 +127,3 @@ import { | ||
} | ||
export interface NodeStyles extends NodeProps { | ||
[key: string]: NodeProps[keyof NodeProps] | NodeProps | undefined; | ||
} | ||
export interface NodeStyles extends NodeProps {} | ||
type NestedNodeStyles = NodeStyles | Array<NestedNodeStyles | undefined>; | ||
@@ -162,5 +160,3 @@ | ||
export interface TextStyles extends TextProps { | ||
[key: string]: TextProps[keyof TextProps] | TextProps | undefined; | ||
} | ||
export interface TextStyles extends TextProps {} | ||
type NestedTextStyles = TextStyles | Array<NestedTextStyles | undefined>; | ||
@@ -167,0 +163,0 @@ |
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
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
216245
3283
3