@lightningtv/core
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -12,11 +12,4 @@ import type { AnimationSettings, RendererMainSettings } from '@lightningjs/renderer'; | ||
} | ||
declare global { | ||
interface ImportMeta { | ||
env: { | ||
DEV: boolean; | ||
}; | ||
} | ||
} | ||
export declare const isDev: boolean; | ||
export declare const Config: Config; | ||
export {}; |
@@ -5,3 +5,3 @@ import { createShader } from './lightningInit.js'; | ||
import States, { type NodeStates } from './states.js'; | ||
import type { RendererMain, INode, INodeAnimatableProps, INodeWritableProps, ShaderRef, Dimensions, AnimationSettings } from '@lightningjs/renderer'; | ||
import type { RendererMain, INode, INodeAnimatableProps, INodeWritableProps, ShaderRef, Dimensions, AnimationSettings, IAnimationController } from '@lightningjs/renderer'; | ||
export type Styles = { | ||
@@ -56,4 +56,4 @@ [key: string]: NodeStyles | TextStyles | undefined; | ||
set shader(shaderProps: Parameters<typeof createShader> | ShaderRef); | ||
_sendToLightningAnimatable(name: string, value: number | string): import("@lightningjs/renderer").IAnimationController | undefined; | ||
animate(props: Partial<INodeAnimatableProps>, animationSettings?: Partial<AnimationSettings>): import("@lightningjs/renderer").IAnimationController; | ||
_sendToLightningAnimatable(name: string, value: number): IAnimationController | undefined; | ||
animate(props: Partial<INodeAnimatableProps>, animationSettings?: Partial<AnimationSettings>): IAnimationController; | ||
chain(props: Partial<INodeAnimatableProps>, animationSettings?: Partial<AnimationSettings>): this; | ||
@@ -60,0 +60,0 @@ start(): Promise<void>; |
@@ -134,3 +134,14 @@ import { renderer, createShader } from './lightningInit.js'; | ||
: this.transition[name]; | ||
return this.animate({ [name]: value }, animationSettings).start(); | ||
const controller = this.animate({ [name]: value }, animationSettings); | ||
if (isFunc(this.onAnimationStarted)) { | ||
controller.once('animating', () => { | ||
this.onAnimationStarted?.call(this, name, value); | ||
}); | ||
} | ||
if (isFunc(this.onAnimationStarted)) { | ||
controller.once('finished', () => { | ||
this.onAnimationStarted?.call(this, name, value); | ||
}); | ||
} | ||
return controller.start(); | ||
} | ||
@@ -137,0 +148,0 @@ this.lng[name] = value; |
@@ -50,2 +50,4 @@ import { type AnimationSettings, type Dimensions, type FadeOutEffectProps, type GlitchEffectProps, type GrayscaleEffectProps, type INode, type INodeWritableProps, type ITextNodeWritableProps, type LinearGradientEffectProps, type NodeFailedPayload, type NodeLoadedPayload, type RadialGradientEffectProps, type RadialProgressEffectProps } from '@lightningjs/renderer'; | ||
onLayout?: (this: ElementNode, target: ElementNode, child?: ElementNode, dimensions?: Dimensions) => void; | ||
onAnimationStarted?: (key: string, value: number) => void; | ||
onAnimationFinished?: (key: string, value: number) => void; | ||
forwardFocus?: number | ((this: ElementNode, elm: ElementNode) => boolean | void); | ||
@@ -52,0 +54,0 @@ ref?: ElementNode | ((node: ElementNode) => void) | undefined; |
{ | ||
"name": "@lightningtv/core", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Lightning TV Core for Universal Renderers", | ||
@@ -51,6 +51,7 @@ "type": "module", | ||
"typescript": "^5.5.2", | ||
"typescript-eslint": "^7.13.1" | ||
"typescript-eslint": "^7.13.1", | ||
"vite": "^5.3.1" | ||
}, | ||
"peerDependencies": { | ||
"@lightningjs/renderer": "^0.9.0" | ||
"@lightningjs/renderer": "^0.9.4" | ||
}, | ||
@@ -57,0 +58,0 @@ "lint-staged": { |
@@ -17,11 +17,2 @@ import type { | ||
declare global { | ||
interface ImportMeta { | ||
env: { | ||
DEV: boolean; | ||
// Add other environment variables here if needed | ||
}; | ||
} | ||
} | ||
function isDevEnv(): boolean { | ||
@@ -28,0 +19,0 @@ return !!(import.meta.env && import.meta.env.DEV); |
@@ -39,2 +39,3 @@ import { renderer, createShader } from './lightningInit.js'; | ||
ITextNodeWritableProps, | ||
IAnimationController, | ||
} from '@lightningjs/renderer'; | ||
@@ -227,3 +228,3 @@ import { assertTruthy } from '@lightningjs/renderer/utils'; | ||
_sendToLightningAnimatable(name: string, value: number | string) { | ||
_sendToLightningAnimatable(name: string, value: number) { | ||
if ( | ||
@@ -240,3 +241,17 @@ this.transition && | ||
return this.animate({ [name]: value }, animationSettings).start(); | ||
const controller = this.animate({ [name]: value }, animationSettings); | ||
if (isFunc(this.onAnimationStarted)) { | ||
controller.once('animating', () => { | ||
this.onAnimationStarted?.call(this, name, value); | ||
}); | ||
} | ||
if (isFunc(this.onAnimationStarted)) { | ||
controller.once('finished', () => { | ||
this.onAnimationStarted?.call(this, name, value); | ||
}); | ||
} | ||
return controller.start(); | ||
} | ||
@@ -250,3 +265,3 @@ | ||
animationSettings?: Partial<AnimationSettings>, | ||
) { | ||
): IAnimationController { | ||
assertTruthy(this.rendered, 'Node must be rendered before animating'); | ||
@@ -253,0 +268,0 @@ return (this.lng as INode).animate( |
@@ -82,2 +82,4 @@ import { | ||
) => void; | ||
onAnimationStarted?: (key: string, value: number) => void; | ||
onAnimationFinished?: (key: string, value: number) => void; | ||
forwardFocus?: | ||
@@ -84,0 +86,0 @@ | number |
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
155638
2274
14