@lightningtv/core
Advanced tools
Comparing version 1.0.0-rc1.1 to 1.0.0-rc1.2
@@ -5,3 +5,3 @@ import { createShader } from './lightningInit.js'; | ||
import States, { type NodeStates } from './states.js'; | ||
import type { RendererMain, INode, INodeProps, ShaderRef, Dimensions, AnimationSettings, IAnimationController } from '@lightningjs/renderer'; | ||
import type { RendererMain, INode, INodeAnimateProps, INodeProps, Dimensions, AnimationSettings, IAnimationController } from '@lightningjs/renderer'; | ||
export type Styles = { | ||
@@ -42,3 +42,3 @@ [key: string]: NodeStyles | TextStyles | undefined; | ||
_animationQueue: Array<{ | ||
props: Partial<any>; | ||
props: Partial<INodeAnimateProps>; | ||
animationSettings?: Partial<AnimationSettings>; | ||
@@ -56,6 +56,6 @@ }> | undefined; | ||
set parent(p: ElementNode | undefined); | ||
set shader(shaderProps: Parameters<typeof createShader> | ShaderRef); | ||
set shader(shaderProps: Parameters<typeof createShader> | ReturnType<RendererMain['createShader']>); | ||
_sendToLightningAnimatable(name: string, value: number): IAnimationController | undefined; | ||
animate(props: Partial<any>, animationSettings?: Partial<AnimationSettings>): IAnimationController; | ||
chain(props: Partial<any>, animationSettings?: Partial<AnimationSettings>): this; | ||
animate(props: Partial<INodeAnimateProps>, animationSettings?: Partial<AnimationSettings>): IAnimationController; | ||
chain(props: Partial<INodeAnimateProps>, animationSettings?: Partial<AnimationSettings>): this; | ||
start(): Promise<void>; | ||
@@ -62,0 +62,0 @@ setFocus(): void; |
@@ -12,3 +12,2 @@ import { renderer, createShader } from './lightningInit.js'; | ||
function convertEffectsToShader(styleEffects) { | ||
// Should be EffectDesc | ||
const effects = []; | ||
@@ -20,3 +19,3 @@ let index = 0; | ||
} | ||
return createShader('DynamicShader', { effects: effects }); | ||
return createShader('DynamicShader', { effects }); | ||
} | ||
@@ -125,6 +124,7 @@ function borderAccessor(direction = '') { | ||
set shader(shaderProps) { | ||
let shProps = shaderProps; | ||
if (isArray(shaderProps)) { | ||
shaderProps = createShader(...shaderProps); | ||
shProps = createShader(...shaderProps); | ||
} | ||
this.lng.shader = shaderProps; | ||
this.lng.shader = shProps; | ||
} | ||
@@ -131,0 +131,0 @@ _sendToLightningAnimatable(name, value) { |
{ | ||
"name": "@lightningtv/core", | ||
"version": "1.0.0-rc1.1", | ||
"version": "1.0.0-rc1.2", | ||
"description": "Lightning TV Core for Universal Renderers", | ||
@@ -55,3 +55,3 @@ "type": "module", | ||
"peerDependencies": { | ||
"@lightningjs/renderer": "^1.0.0-rc.0" | ||
"@lightningjs/renderer": "^1.0.0-rc.1" | ||
}, | ||
@@ -58,0 +58,0 @@ "lint-staged": { |
@@ -11,3 +11,2 @@ import { renderer, createShader } from './lightningInit.js'; | ||
type TextStyles, | ||
type ShaderEffectDesc, | ||
AddColorString, | ||
@@ -34,3 +33,2 @@ } from './intrinsicTypes.js'; | ||
INodeProps, | ||
ShaderRef, | ||
Dimensions, | ||
@@ -42,2 +40,4 @@ AnimationSettings, | ||
IAnimationController, | ||
EffectDescUnion, | ||
ShaderController, | ||
} from '@lightningjs/renderer'; | ||
@@ -50,12 +50,13 @@ import { assertTruthy } from '@lightningjs/renderer/utils'; | ||
function convertEffectsToShader(styleEffects: StyleEffects) { | ||
// Should be EffectDesc | ||
const effects: ShaderEffectDesc[] = []; | ||
function convertEffectsToShader( | ||
styleEffects: StyleEffects, | ||
): ShaderController<'DynamicShader'> { | ||
const effects: EffectDescUnion[] = []; | ||
let index = 0; | ||
for (const [type, props] of Object.entries(styleEffects)) { | ||
effects.push({ name: `el${index}`, type, props } as ShaderEffectDesc); | ||
effects.push({ name: `el${index}`, type, props } as EffectDescUnion); | ||
index++; | ||
} | ||
return createShader('DynamicShader', { effects: effects as any[] }); | ||
return createShader('DynamicShader', { effects }); | ||
} | ||
@@ -185,3 +186,3 @@ | ||
| Array<{ | ||
props: Partial<any>; | ||
props: Partial<INodeAnimateProps>; | ||
animationSettings?: Partial<AnimationSettings>; | ||
@@ -210,3 +211,3 @@ }> | ||
if (this.rendered) { | ||
this.shader = convertEffectsToShader(v) as unknown as ShaderRef; | ||
this.shader = convertEffectsToShader(v); | ||
} | ||
@@ -226,7 +227,12 @@ } | ||
set shader(shaderProps: Parameters<typeof createShader> | ShaderRef) { | ||
set shader( | ||
shaderProps: | ||
| Parameters<typeof createShader> | ||
| ReturnType<RendererMain['createShader']>, | ||
) { | ||
let shProps = shaderProps; | ||
if (isArray(shaderProps)) { | ||
shaderProps = createShader(...shaderProps) as unknown as ShaderRef; | ||
shProps = createShader(...shaderProps); | ||
} | ||
this.lng.shader = shaderProps; | ||
this.lng.shader = shProps; | ||
} | ||
@@ -270,3 +276,3 @@ | ||
animate( | ||
props: Partial<any>, | ||
props: Partial<INodeAnimateProps>, | ||
animationSettings?: Partial<AnimationSettings>, | ||
@@ -281,3 +287,6 @@ ): IAnimationController { | ||
chain(props: Partial<any>, animationSettings?: Partial<AnimationSettings>) { | ||
chain( | ||
props: Partial<INodeAnimateProps>, | ||
animationSettings?: Partial<AnimationSettings>, | ||
) { | ||
if (this._animationRunning) { | ||
@@ -284,0 +293,0 @@ this._animationQueue = []; |
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
158204
2310