@lightningtv/solid 3.0.0-8 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +6 -0
- package/dist/jsx-runtime.d.ts +14 -0
- package/dist/src/activeElement.d.ts +1 -1
- package/dist/src/core/animation.d.ts +35 -0
- package/dist/src/core/animation.js +119 -0
- package/dist/src/core/animation.js.map +1 -0
- package/dist/src/core/config.d.ts +49 -0
- package/dist/src/core/config.js +33 -0
- package/dist/src/core/config.js.map +1 -0
- package/dist/src/core/domRenderer.d.ts +115 -0
- package/dist/src/core/domRenderer.js +1152 -0
- package/dist/src/core/domRenderer.js.map +1 -0
- package/dist/src/core/elementNode.d.ts +463 -0
- package/dist/src/core/elementNode.js +833 -0
- package/dist/src/core/elementNode.js.map +1 -0
- package/dist/src/core/flex.d.ts +2 -0
- package/dist/src/core/flex.js +243 -0
- package/dist/src/core/flex.js.map +1 -0
- package/dist/src/core/focusKeyTypes.d.ts +42 -0
- package/dist/src/core/focusKeyTypes.js +2 -0
- package/dist/src/core/focusKeyTypes.js.map +1 -0
- package/dist/src/core/focusManager.d.ts +13 -0
- package/dist/src/core/focusManager.js +276 -0
- package/dist/src/core/focusManager.js.map +1 -0
- package/dist/src/core/index.d.ts +12 -0
- package/dist/src/core/index.js +12 -0
- package/dist/src/core/index.js.map +1 -0
- package/dist/src/core/intrinsicTypes.d.ts +90 -0
- package/dist/src/core/intrinsicTypes.js +2 -0
- package/dist/src/core/intrinsicTypes.js.map +1 -0
- package/dist/src/core/lightningInit.d.ts +89 -0
- package/dist/src/core/lightningInit.js +26 -0
- package/dist/src/core/lightningInit.js.map +1 -0
- package/dist/src/core/nodeTypes.d.ts +6 -0
- package/dist/src/core/nodeTypes.js +6 -0
- package/dist/src/core/nodeTypes.js.map +1 -0
- package/dist/src/core/shaders.d.ts +51 -0
- package/dist/src/core/shaders.js +446 -0
- package/dist/src/core/shaders.js.map +1 -0
- package/dist/src/core/states.d.ts +12 -0
- package/dist/src/core/states.js +84 -0
- package/dist/src/core/states.js.map +1 -0
- package/dist/src/core/utils.d.ts +39 -0
- package/dist/src/core/utils.js +164 -0
- package/dist/src/core/utils.js.map +1 -0
- package/dist/src/devtools/index.d.ts +1 -1
- package/dist/src/devtools/index.js +1 -1
- package/dist/src/devtools/index.js.map +1 -1
- package/dist/src/index.d.ts +3 -3
- package/dist/src/index.js +1 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/primitives/Column.jsx +9 -10
- package/dist/src/primitives/Column.jsx.map +1 -1
- package/dist/src/primitives/FPSCounter.jsx +15 -2
- package/dist/src/primitives/FPSCounter.jsx.map +1 -1
- package/dist/src/primitives/Grid.d.ts +2 -2
- package/dist/src/primitives/Grid.jsx +27 -17
- package/dist/src/primitives/Grid.jsx.map +1 -1
- package/dist/src/primitives/Image.d.ts +8 -0
- package/dist/src/primitives/Image.jsx +24 -0
- package/dist/src/primitives/Image.jsx.map +1 -0
- package/dist/src/primitives/KeepAlive.d.ts +30 -0
- package/dist/src/primitives/KeepAlive.jsx +77 -0
- package/dist/src/primitives/KeepAlive.jsx.map +1 -0
- package/dist/src/primitives/Lazy.d.ts +8 -7
- package/dist/src/primitives/Lazy.jsx +52 -20
- package/dist/src/primitives/Lazy.jsx.map +1 -1
- package/dist/src/primitives/Marquee.jsx +2 -2
- package/dist/src/primitives/Marquee.jsx.map +1 -1
- package/dist/src/primitives/Preserve.d.ts +4 -0
- package/dist/src/primitives/Preserve.jsx +11 -0
- package/dist/src/primitives/Preserve.jsx.map +1 -0
- package/dist/src/primitives/Row.jsx +9 -10
- package/dist/src/primitives/Row.jsx.map +1 -1
- package/dist/src/primitives/Suspense.d.ts +22 -0
- package/dist/src/primitives/Suspense.jsx +33 -0
- package/dist/src/primitives/Suspense.jsx.map +1 -0
- package/dist/src/primitives/Virtual.d.ts +18 -0
- package/dist/src/primitives/Virtual.jsx +443 -0
- package/dist/src/primitives/Virtual.jsx.map +1 -0
- package/dist/src/primitives/VirtualGrid.d.ts +13 -0
- package/dist/src/primitives/VirtualGrid.jsx +160 -0
- package/dist/src/primitives/VirtualGrid.jsx.map +1 -0
- package/dist/src/primitives/Visible.d.ts +0 -1
- package/dist/src/primitives/Visible.jsx +1 -1
- package/dist/src/primitives/Visible.jsx.map +1 -1
- package/dist/src/primitives/announcer/announcer.d.ts +1 -0
- package/dist/src/primitives/announcer/announcer.js +4 -4
- package/dist/src/primitives/announcer/announcer.js.map +1 -1
- package/dist/src/primitives/announcer/speech.d.ts +2 -2
- package/dist/src/primitives/announcer/speech.js +147 -27
- package/dist/src/primitives/announcer/speech.js.map +1 -1
- package/dist/src/primitives/createFocusStack.d.ts +4 -4
- package/dist/src/primitives/createFocusStack.jsx +15 -6
- package/dist/src/primitives/createFocusStack.jsx.map +1 -1
- package/dist/src/primitives/createTag.d.ts +8 -0
- package/dist/src/primitives/createTag.jsx +20 -0
- package/dist/src/primitives/createTag.jsx.map +1 -0
- package/dist/src/primitives/index.d.ts +13 -4
- package/dist/src/primitives/index.js +12 -3
- package/dist/src/primitives/index.js.map +1 -1
- package/dist/src/primitives/types.d.ts +5 -2
- package/dist/src/primitives/useFocusManager.d.ts +2 -2
- package/dist/src/primitives/useFocusManager.js +2 -2
- package/dist/src/primitives/useFocusManager.js.map +1 -1
- package/dist/src/primitives/useMouse.d.ts +18 -2
- package/dist/src/primitives/useMouse.js +171 -47
- package/dist/src/primitives/useMouse.js.map +1 -1
- package/dist/src/primitives/utils/createBlurredImage.d.ts +56 -0
- package/dist/src/primitives/utils/createBlurredImage.js +223 -0
- package/dist/src/primitives/utils/createBlurredImage.js.map +1 -0
- package/dist/src/primitives/utils/createSpriteMap.d.ts +2 -2
- package/dist/src/primitives/utils/createSpriteMap.js +3 -3
- package/dist/src/primitives/utils/createSpriteMap.js.map +1 -1
- package/dist/src/primitives/utils/handleNavigation.d.ts +79 -5
- package/dist/src/primitives/utils/handleNavigation.js +241 -69
- package/dist/src/primitives/utils/handleNavigation.js.map +1 -1
- package/dist/src/primitives/utils/withScrolling.d.ts +14 -2
- package/dist/src/primitives/utils/withScrolling.js +66 -7
- package/dist/src/primitives/utils/withScrolling.js.map +1 -1
- package/dist/src/render.d.ts +5 -4
- package/dist/src/render.js +5 -1
- package/dist/src/render.js.map +1 -1
- package/dist/src/shaders/Rounded.d.ts +7 -0
- package/dist/src/shaders/Rounded.js +88 -0
- package/dist/src/shaders/Rounded.js.map +1 -0
- package/dist/src/shaders/RoundedWithBorder.d.ts +3 -0
- package/dist/src/shaders/RoundedWithBorder.js +217 -0
- package/dist/src/shaders/RoundedWithBorder.js.map +1 -0
- package/dist/src/shaders/index.d.ts +4 -0
- package/dist/src/shaders/index.js +5 -0
- package/dist/src/shaders/index.js.map +1 -0
- package/dist/src/shaders/templates/RoundedTemplate.d.ts +12 -0
- package/dist/src/shaders/templates/RoundedTemplate.js +48 -0
- package/dist/src/shaders/templates/RoundedTemplate.js.map +1 -0
- package/dist/src/shaders/templates/RoundedWithBorderTemplate.d.ts +20 -0
- package/dist/src/shaders/templates/RoundedWithBorderTemplate.js +93 -0
- package/dist/src/shaders/templates/RoundedWithBorderTemplate.js.map +1 -0
- package/dist/src/shaders/utils.d.ts +3 -0
- package/dist/src/shaders/utils.js +31 -0
- package/dist/src/shaders/utils.js.map +1 -0
- package/dist/src/solidOpts.d.ts +1 -7
- package/dist/src/solidOpts.js +9 -1
- package/dist/src/solidOpts.js.map +1 -1
- package/dist/src/types.d.ts +1 -13
- package/dist/src/utils.d.ts +3 -1
- package/dist/src/utils.js +9 -1
- package/dist/src/utils.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/jsx-runtime.d.ts +2 -1
- package/package.json +28 -16
- package/src/activeElement.ts +1 -1
- package/src/core/animation.ts +185 -0
- package/src/core/config.ts +89 -0
- package/src/core/domRenderer.ts +1300 -0
- package/src/core/elementNode.ts +1458 -0
- package/src/core/flex.ts +284 -0
- package/src/core/focusKeyTypes.ts +90 -0
- package/src/core/focusManager.ts +381 -0
- package/src/core/index.ts +13 -0
- package/src/core/intrinsicTypes.ts +199 -0
- package/src/core/lightningInit.ts +147 -0
- package/src/core/nodeTypes.ts +6 -0
- package/src/core/shaders.ts +567 -0
- package/src/core/states.ts +91 -0
- package/src/core/utils.ts +222 -0
- package/src/devtools/index.ts +1 -1
- package/src/index.ts +3 -3
- package/src/primitives/Column.tsx +10 -12
- package/src/primitives/FPSCounter.tsx +16 -2
- package/src/primitives/Grid.tsx +32 -22
- package/src/primitives/Image.tsx +36 -0
- package/src/primitives/KeepAlive.tsx +124 -0
- package/src/primitives/Lazy.tsx +66 -37
- package/src/primitives/{marquee.tsx → Marquee.tsx} +1 -1
- package/src/primitives/Preserve.tsx +18 -0
- package/src/primitives/Row.tsx +13 -14
- package/src/primitives/Suspense.tsx +39 -0
- package/src/primitives/Virtual.tsx +486 -0
- package/src/primitives/VirtualGrid.tsx +220 -0
- package/src/primitives/Visible.tsx +1 -2
- package/src/primitives/announcer/announcer.ts +10 -4
- package/src/primitives/announcer/speech.ts +170 -26
- package/src/primitives/createFocusStack.tsx +18 -7
- package/src/primitives/createTag.tsx +33 -0
- package/src/primitives/index.ts +13 -4
- package/src/primitives/types.ts +12 -2
- package/src/primitives/useFocusManager.ts +3 -3
- package/src/primitives/useHold.ts +69 -0
- package/src/primitives/useMouse.ts +306 -67
- package/src/primitives/utils/createBlurredImage.ts +366 -0
- package/src/primitives/utils/createSpriteMap.ts +8 -6
- package/src/primitives/utils/handleNavigation.ts +300 -84
- package/src/primitives/utils/withScrolling.ts +91 -18
- package/src/render.ts +7 -3
- package/src/shaders/Rounded.ts +100 -0
- package/src/shaders/RoundedWithBorder.ts +245 -0
- package/src/shaders/index.ts +4 -0
- package/src/shaders/templates/RoundedTemplate.ts +57 -0
- package/src/shaders/templates/RoundedWithBorderTemplate.ts +110 -0
- package/src/shaders/utils.ts +44 -0
- package/src/solidOpts.ts +9 -7
- package/src/types.ts +1 -15
- package/src/utils.ts +11 -1
- package/dist/src/client.d.ts +0 -1
- package/dist/src/client.js +0 -2
- package/dist/src/client.js.map +0 -1
- package/dist/src/core.d.ts +0 -1
- package/dist/src/core.js +0 -3
- package/dist/src/core.js.map +0 -1
- package/dist/src/jsx-runtime.d.ts +0 -10
- package/dist/src/jsx-runtime.js +0 -2
- package/dist/src/jsx-runtime.js.map +0 -1
- package/dist/src/primitives/Infinite.d.ts +0 -15
- package/dist/src/primitives/Infinite.jsx +0 -59
- package/dist/src/primitives/Infinite.jsx.map +0 -1
- package/dist/src/primitives/LazyUp.d.ts +0 -11
- package/dist/src/primitives/LazyUp.jsx +0 -38
- package/dist/src/primitives/LazyUp.jsx.map +0 -1
- package/dist/src/primitives/sprite.d.ts +0 -9
- package/dist/src/primitives/sprite.js +0 -18
- package/dist/src/primitives/sprite.js.map +0 -1
- package/dist/src/primitives/utils/createFocusStack.d.ts +0 -24
- package/dist/src/primitives/utils/createFocusStack.js +0 -59
- package/dist/src/primitives/utils/createFocusStack.js.map +0 -1
- package/dist/src/primitives/utils/scrollToIndex.d.ts +0 -2
- package/dist/src/primitives/utils/scrollToIndex.js +0 -33
- package/dist/src/primitives/utils/scrollToIndex.js.map +0 -1
- package/dist/src/renderClient.d.ts +0 -21
- package/dist/src/renderClient.js +0 -64
- package/dist/src/renderClient.js.map +0 -1
package/LICENSE
CHANGED
|
@@ -187,7 +187,7 @@
|
|
|
187
187
|
same "printed page" as the copyright notice for easier
|
|
188
188
|
identification within third-party archives.
|
|
189
189
|
|
|
190
|
-
Copyright
|
|
190
|
+
Copyright 2024 Chris Lorenzo
|
|
191
191
|
|
|
192
192
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
193
|
you may not use this file except in compliance with the License.
|
package/README.md
CHANGED
|
@@ -6,6 +6,12 @@
|
|
|
6
6
|
|
|
7
7
|
Is a UI framework for [LightningJS 3 Renderer](https://lightningjs.io/) built with [SolidJS](https://www.solidjs.com/) Universal Renderer. It allows you to declaratively construct lightning nodes with reactive primitives, with incredible performance.
|
|
8
8
|
|
|
9
|
+
## Used by companies worldwide
|
|
10
|
+
|
|
11
|
+
<div style="display: flex; align-items: center; gap: 20px;">
|
|
12
|
+
<img src="docs/companylogos/Angel.png" alt="Angel Studios" width="200" /> <img src="docs/companylogos/bell-fibe-tv.png" alt="Bell Fibe TV" width="80" />
|
|
13
|
+
</div>
|
|
14
|
+
|
|
9
15
|
## Need Support?
|
|
10
16
|
|
|
11
17
|
[ConnectedTV Dev](https://lightningtv.dev/)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-namespace */
|
|
2
|
+
import type { NodeProps, TextProps } from './src/core/index.js';
|
|
3
|
+
|
|
4
|
+
declare module 'solid-js' {
|
|
5
|
+
namespace JSX {
|
|
6
|
+
interface IntrinsicElements {
|
|
7
|
+
node: NodeProps;
|
|
8
|
+
view: NodeProps;
|
|
9
|
+
text: TextProps;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export type { JSX } from 'solid-js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { type ElementNode } from '
|
|
1
|
+
import { type ElementNode } from './core/index.js';
|
|
2
2
|
export declare const activeElement: import("solid-js").Accessor<ElementNode | undefined>, setActiveElement: import("solid-js").Setter<ElementNode | undefined>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type ElementNode, LightningRendererNumberProps } from './elementNode.js';
|
|
2
|
+
import { type IRendererStage } from './lightningInit.js';
|
|
3
|
+
import { TimingFunction } from '@lightningjs/renderer';
|
|
4
|
+
/**
|
|
5
|
+
* Simplified Animation Settings
|
|
6
|
+
*/
|
|
7
|
+
export interface SimpleAnimationSettings {
|
|
8
|
+
duration?: number;
|
|
9
|
+
delay?: number;
|
|
10
|
+
easing?: string | TimingFunction;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Properties of a Node used by the SimpleAnimation
|
|
14
|
+
* (Excludes shaderProps)
|
|
15
|
+
*/
|
|
16
|
+
export type SimpleAnimationProps = (typeof LightningRendererNumberProps)[number];
|
|
17
|
+
export declare class SimpleAnimation {
|
|
18
|
+
private nodeConfigs;
|
|
19
|
+
private isRegistered;
|
|
20
|
+
private stage;
|
|
21
|
+
register(stage: IRendererStage): void;
|
|
22
|
+
/**
|
|
23
|
+
* Adds a node and its animation properties to this animation instance.
|
|
24
|
+
* The animation's start values for the specified properties are captured
|
|
25
|
+
* from the node's current state when this method is called.
|
|
26
|
+
*
|
|
27
|
+
* @param node - The CoreNode to animate.
|
|
28
|
+
* @param props - The properties to animate and their target values. Only number properties are supported.
|
|
29
|
+
* @param settings - Animation settings for this specific node animation.
|
|
30
|
+
*/
|
|
31
|
+
add(node: ElementNode, key: SimpleAnimationProps, value: number, settings: SimpleAnimationSettings): void;
|
|
32
|
+
update(dt: number): void;
|
|
33
|
+
}
|
|
34
|
+
export declare const simpleAnimation: SimpleAnimation;
|
|
35
|
+
export default simpleAnimation;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { getTimingFunction, mergeColorProgress, } from '@lightningjs/renderer/utils';
|
|
2
|
+
import { isFunc } from './utils.js';
|
|
3
|
+
export class SimpleAnimation {
|
|
4
|
+
nodeConfigs = [];
|
|
5
|
+
isRegistered = false;
|
|
6
|
+
stage;
|
|
7
|
+
register(stage) {
|
|
8
|
+
if (this.isRegistered) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
this.isRegistered = true;
|
|
12
|
+
this.stage = stage;
|
|
13
|
+
stage.animationManager.registerAnimation(this);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Adds a node and its animation properties to this animation instance.
|
|
17
|
+
* The animation's start values for the specified properties are captured
|
|
18
|
+
* from the node's current state when this method is called.
|
|
19
|
+
*
|
|
20
|
+
* @param node - The CoreNode to animate.
|
|
21
|
+
* @param props - The properties to animate and their target values. Only number properties are supported.
|
|
22
|
+
* @param settings - Animation settings for this specific node animation.
|
|
23
|
+
*/
|
|
24
|
+
add(node, key, value, settings) {
|
|
25
|
+
const existingConfig = this.nodeConfigs.find((config) => config.node === node && config.propName === key);
|
|
26
|
+
const duration = settings.duration ?? 0;
|
|
27
|
+
const delay = settings.delay ?? 0;
|
|
28
|
+
const easing = settings.easing || 'linear';
|
|
29
|
+
const timingFunction = isFunc(easing) ? easing : getTimingFunction(easing);
|
|
30
|
+
const targetValue = value;
|
|
31
|
+
const startValue = node[key];
|
|
32
|
+
if (existingConfig) {
|
|
33
|
+
existingConfig.duration = duration;
|
|
34
|
+
existingConfig.delay = delay;
|
|
35
|
+
existingConfig.easing = easing;
|
|
36
|
+
existingConfig.timingFunction = timingFunction;
|
|
37
|
+
existingConfig.targetValue = targetValue;
|
|
38
|
+
existingConfig.startValue = startValue;
|
|
39
|
+
existingConfig.progress = 0;
|
|
40
|
+
existingConfig.delayFor = delay;
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
this.nodeConfigs.push({
|
|
44
|
+
node,
|
|
45
|
+
duration,
|
|
46
|
+
delay,
|
|
47
|
+
easing,
|
|
48
|
+
progress: 0,
|
|
49
|
+
delayFor: delay,
|
|
50
|
+
timingFunction,
|
|
51
|
+
propName: key,
|
|
52
|
+
startValue,
|
|
53
|
+
targetValue,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
update(dt) {
|
|
58
|
+
// Iterate backward to safely remove finished animations
|
|
59
|
+
for (let i = this.nodeConfigs.length - 1; i >= 0; i--) {
|
|
60
|
+
const nodeConfig = this.nodeConfigs[i];
|
|
61
|
+
const { node, duration, timingFunction, propName, startValue, targetValue, } = nodeConfig;
|
|
62
|
+
let remainingDt = dt;
|
|
63
|
+
// 1. Handle Delay
|
|
64
|
+
if (nodeConfig.delayFor > 0) {
|
|
65
|
+
nodeConfig.delayFor -= remainingDt;
|
|
66
|
+
if (nodeConfig.delayFor >= 0) {
|
|
67
|
+
// Still in delay phase for this node, skip applying values this frame
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
// Delay finished this frame, use the remaining time for animation
|
|
72
|
+
remainingDt = -nodeConfig.delayFor;
|
|
73
|
+
nodeConfig.delayFor = 0;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
// 2. Update Progress (directly on nodeConfig.progress)
|
|
77
|
+
if (duration > 0) {
|
|
78
|
+
nodeConfig.progress += remainingDt / duration;
|
|
79
|
+
// Clamp progress between 0 and 1
|
|
80
|
+
nodeConfig.progress = Math.max(0, Math.min(1, nodeConfig.progress));
|
|
81
|
+
}
|
|
82
|
+
else if (duration === 0 && nodeConfig.delayFor <= 0) {
|
|
83
|
+
// Duration is 0 and delay is finished or was 0. Animation completes instantly.
|
|
84
|
+
nodeConfig.progress = 1;
|
|
85
|
+
}
|
|
86
|
+
// 3. Calculate Eased Progress
|
|
87
|
+
const easedProgress = timingFunction(nodeConfig.progress) || nodeConfig.progress;
|
|
88
|
+
// 4. Apply Animated Values to the Node
|
|
89
|
+
let interpolatedValue;
|
|
90
|
+
if (nodeConfig.progress === 1) {
|
|
91
|
+
interpolatedValue = targetValue;
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
if (propName.includes('color')) {
|
|
95
|
+
// Handle color interpolation
|
|
96
|
+
interpolatedValue = mergeColorProgress(startValue, targetValue, easedProgress);
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
// Handle linear interpolation for other number properties
|
|
100
|
+
interpolatedValue =
|
|
101
|
+
startValue + (targetValue - startValue) * easedProgress;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
// @typescript-eslint/no-explicit-any
|
|
105
|
+
node.lng[propName] = interpolatedValue; // Cast to any because the properties on CoreNode might have broader types.
|
|
106
|
+
// 5. Remove Node if Progress is 1
|
|
107
|
+
if (nodeConfig.progress === 1) {
|
|
108
|
+
this.nodeConfigs.splice(i, 1);
|
|
109
|
+
}
|
|
110
|
+
if (this.nodeConfigs.length === 0) {
|
|
111
|
+
this.stage?.animationManager.unregisterAnimation(this);
|
|
112
|
+
this.isRegistered = false;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
export const simpleAnimation = new SimpleAnimation();
|
|
118
|
+
export default simpleAnimation;
|
|
119
|
+
//# sourceMappingURL=animation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"animation.js","sourceRoot":"","sources":["../../../src/core/animation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,6BAA6B,CAAC;AAOrC,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAkCpC,MAAM,OAAO,eAAe;IAClB,WAAW,GAAgC,EAAE,CAAC;IAC9C,YAAY,GAAG,KAAK,CAAC;IACrB,KAAK,CAA6B;IAE1C,QAAQ,CAAC,KAAqB;QAC5B,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YACtB,OAAO;QACT,CAAC;QACD,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QACzB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,KAAK,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IACjD,CAAC;IAED;;;;;;;;OAQG;IACH,GAAG,CACD,IAAiB,EACjB,GAAyB,EACzB,KAAa,EACb,QAAiC;QAEjC,MAAM,cAAc,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAC1C,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,IAAI,IAAI,MAAM,CAAC,QAAQ,KAAK,GAAG,CAC5D,CAAC;QAEF,MAAM,QAAQ,GAAG,QAAQ,CAAC,QAAQ,IAAI,CAAC,CAAC;QACxC,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,IAAI,CAAC,CAAC;QAClC,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,IAAI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d,CAAC;gBACJ,CAAC;qBAAM,CAAC;oBACN,0DAA0D;oBAC1D,iBAAiB;wBACf,UAAU,GAAG,CAAC,WAAW,GAAG,UAAU,CAAC,GAAG,aAAa,CAAC;gBAC5D,CAAC;YACH,CAAC;YACD,qCAAqC;YACpC,IAAI,CAAC,GAAW,CAAC,QAAQ,CAAC,GAAG,iBAAiB,CAAC,CAAC,2EAA2E;YAE5H,kCAAkC;YAClC,IAAI,UAAU,CAAC,QAAQ,KAAK,CAAC,EAAE,CAAC;gBAC9B,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YAChC,CAAC;YACD,IAAI,IAAI,CAAC,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAClC,IAAI,CAAC,KAAK,EAAE,gBAAgB,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC;gBACvD,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;YAC5B,CAAC;QACH,CAAC;IACH,CAAC;CACF;AAED,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,eAAe,EAAE,CAAC;AACrD,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { RendererMainSettings } from '@lightningjs/renderer';
|
|
2
|
+
import type { TextProps, AnimationSettings, DollarString } from './intrinsicTypes.js';
|
|
3
|
+
import { type ElementNode } from './elementNode.js';
|
|
4
|
+
/**
|
|
5
|
+
STATIC LIGHTNING CONFIGURATION \
|
|
6
|
+
Replace the values below with in your build system, \
|
|
7
|
+
or set them in the global scope before importing lightning-core.
|
|
8
|
+
*/
|
|
9
|
+
declare global {
|
|
10
|
+
/** Whether the DOM renderer should be used instead of `@lightningjs/renderer` */
|
|
11
|
+
var LIGHTNING_DOM_RENDERING: boolean | undefined;
|
|
12
|
+
/** Whether element shaders should be disabled */
|
|
13
|
+
var LIGHTNING_DISABLE_SHADERS: boolean | undefined;
|
|
14
|
+
/** Could be set by vite or other bundler */
|
|
15
|
+
interface ImportMetaEnv {
|
|
16
|
+
DEV: boolean;
|
|
17
|
+
}
|
|
18
|
+
interface ImportMeta {
|
|
19
|
+
readonly env: ImportMetaEnv;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export declare const isDev: boolean;
|
|
23
|
+
/** Whether the DOM renderer is used instead of `@lightningjs/renderer` */
|
|
24
|
+
export declare const DOM_RENDERING: boolean;
|
|
25
|
+
/** Whether element shaders are enabled */
|
|
26
|
+
export declare const SHADERS_ENABLED: boolean;
|
|
27
|
+
/**
|
|
28
|
+
RUNTIME LIGHTNING CONFIGURATION \
|
|
29
|
+
This configuration can be set at runtime, but it is recommended to set it
|
|
30
|
+
before running any Lightning modules to ensure consistent behavior across the application.
|
|
31
|
+
*/
|
|
32
|
+
export interface Config {
|
|
33
|
+
debug: boolean;
|
|
34
|
+
focusDebug: boolean;
|
|
35
|
+
domRendererEnabled: boolean;
|
|
36
|
+
keyDebug: boolean;
|
|
37
|
+
simpleAnimationsEnabled?: boolean;
|
|
38
|
+
animationSettings?: AnimationSettings;
|
|
39
|
+
animationsEnabled: boolean;
|
|
40
|
+
fontSettings: Partial<TextProps>;
|
|
41
|
+
rendererOptions?: Partial<RendererMainSettings>;
|
|
42
|
+
setActiveElement: (elm: ElementNode) => void;
|
|
43
|
+
focusStateKey: DollarString;
|
|
44
|
+
lockStyles?: boolean;
|
|
45
|
+
fontWeightAlias?: Record<string, number | string>;
|
|
46
|
+
throttleInput?: number;
|
|
47
|
+
taskDelay?: number;
|
|
48
|
+
}
|
|
49
|
+
export declare const Config: Config;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export const isDev = !!(import.meta.env && import.meta.env.DEV);
|
|
2
|
+
/** Whether the DOM renderer is used instead of `@lightningjs/renderer` */
|
|
3
|
+
export const DOM_RENDERING = typeof LIGHTNING_DOM_RENDERING === 'boolean' && LIGHTNING_DOM_RENDERING;
|
|
4
|
+
/** Whether element shaders are enabled */
|
|
5
|
+
export const SHADERS_ENABLED = !(typeof LIGHTNING_DISABLE_SHADERS === 'boolean' && LIGHTNING_DISABLE_SHADERS);
|
|
6
|
+
export const Config = {
|
|
7
|
+
debug: false,
|
|
8
|
+
domRendererEnabled: false,
|
|
9
|
+
focusDebug: false,
|
|
10
|
+
keyDebug: false,
|
|
11
|
+
animationsEnabled: true,
|
|
12
|
+
animationSettings: {
|
|
13
|
+
duration: 250,
|
|
14
|
+
easing: 'ease-in-out',
|
|
15
|
+
},
|
|
16
|
+
fontSettings: {
|
|
17
|
+
fontFamily: 'Ubuntu',
|
|
18
|
+
fontSize: 100,
|
|
19
|
+
},
|
|
20
|
+
fontWeightAlias: {
|
|
21
|
+
thin: 100,
|
|
22
|
+
light: 300,
|
|
23
|
+
regular: '',
|
|
24
|
+
400: '',
|
|
25
|
+
medium: 500,
|
|
26
|
+
bold: 700,
|
|
27
|
+
black: 900,
|
|
28
|
+
},
|
|
29
|
+
setActiveElement: () => { },
|
|
30
|
+
focusStateKey: '$focus',
|
|
31
|
+
lockStyles: true,
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/core/config.ts"],"names":[],"mappings":"AA4BA,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAEhE,0EAA0E;AAC1E,MAAM,CAAC,MAAM,aAAa,GACxB,OAAO,uBAAuB,KAAK,SAAS,IAAI,uBAAuB,CAAC;AAE1E,0CAA0C;AAC1C,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAC9B,OAAO,yBAAyB,KAAK,SAAS,IAAI,yBAAyB,CAC5E,CAAC;AAyBF,MAAM,CAAC,MAAM,MAAM,GAAW;IAC5B,KAAK,EAAE,KAAK;IACZ,kBAAkB,EAAE,KAAK;IACzB,UAAU,EAAE,KAAK;IACjB,QAAQ,EAAE,KAAK;IACf,iBAAiB,EAAE,IAAI;IACvB,iBAAiB,EAAE;QACjB,QAAQ,EAAE,GAAG;QACb,MAAM,EAAE,aAAa;KACtB;IACD,YAAY,EAAE;QACZ,UAAU,EAAE,QAAQ;QACpB,QAAQ,EAAE,GAAG;KACd;IACD,eAAe,EAAE;QACf,IAAI,EAAE,GAAG;QACT,KAAK,EAAE,GAAG;QACV,OAAO,EAAE,EAAE;QACX,GAAG,EAAE,EAAE;QACP,MAAM,EAAE,GAAG;QACX,IAAI,EAAE,GAAG;QACT,KAAK,EAAE,GAAG;KACX;IACD,gBAAgB,EAAE,GAAG,EAAE,GAAE,CAAC;IAC1B,aAAa,EAAE,QAAQ;IACvB,UAAU,EAAE,IAAI;CACjB,CAAC"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import * as lng from '@lightningjs/renderer';
|
|
2
|
+
import { EventEmitter } from '@lightningjs/renderer/utils';
|
|
3
|
+
import { IRendererShader, IRendererStage, IRendererShaderProps, IRendererTextureProps, IRendererTexture, IRendererMain, IRendererNode, IRendererNodeProps, IRendererTextNode, IRendererTextNodeProps } from './lightningInit.js';
|
|
4
|
+
declare function animate(this: DOMNode, props: Partial<lng.INodeAnimateProps<any>>, settings: Partial<lng.AnimationSettings>): lng.IAnimationController;
|
|
5
|
+
declare class DOMNode extends EventEmitter implements IRendererNode {
|
|
6
|
+
stage: IRendererStage;
|
|
7
|
+
props: IRendererNodeProps;
|
|
8
|
+
div: HTMLDivElement;
|
|
9
|
+
divBg: HTMLElement | undefined;
|
|
10
|
+
divBorder: HTMLElement | undefined;
|
|
11
|
+
id: number;
|
|
12
|
+
renderState: lng.CoreNodeRenderState;
|
|
13
|
+
constructor(stage: IRendererStage, props: IRendererNodeProps);
|
|
14
|
+
destroy(): void;
|
|
15
|
+
get parent(): IRendererNode | null;
|
|
16
|
+
set parent(value: IRendererNode | null);
|
|
17
|
+
animate: typeof animate;
|
|
18
|
+
get x(): number;
|
|
19
|
+
set x(v: number);
|
|
20
|
+
get y(): number;
|
|
21
|
+
set y(v: number);
|
|
22
|
+
get w(): number;
|
|
23
|
+
set w(v: number);
|
|
24
|
+
get h(): number;
|
|
25
|
+
set h(v: number);
|
|
26
|
+
get width(): number;
|
|
27
|
+
set width(v: number);
|
|
28
|
+
get height(): number;
|
|
29
|
+
set height(v: number);
|
|
30
|
+
get alpha(): number;
|
|
31
|
+
set alpha(v: number);
|
|
32
|
+
get autosize(): boolean;
|
|
33
|
+
set autosize(v: boolean);
|
|
34
|
+
get clipping(): boolean;
|
|
35
|
+
set clipping(v: boolean);
|
|
36
|
+
get color(): number;
|
|
37
|
+
set color(v: number);
|
|
38
|
+
get colorTop(): number;
|
|
39
|
+
set colorTop(v: number);
|
|
40
|
+
get colorBottom(): number;
|
|
41
|
+
set colorBottom(v: number);
|
|
42
|
+
get colorLeft(): number;
|
|
43
|
+
set colorLeft(v: number);
|
|
44
|
+
get colorRight(): number;
|
|
45
|
+
set colorRight(v: number);
|
|
46
|
+
get colorTl(): number;
|
|
47
|
+
set colorTl(v: number);
|
|
48
|
+
get colorTr(): number;
|
|
49
|
+
set colorTr(v: number);
|
|
50
|
+
get colorBr(): number;
|
|
51
|
+
set colorBr(v: number);
|
|
52
|
+
get colorBl(): number;
|
|
53
|
+
set colorBl(v: number);
|
|
54
|
+
get zIndex(): number;
|
|
55
|
+
set zIndex(v: number);
|
|
56
|
+
get texture(): lng.Texture | null;
|
|
57
|
+
set texture(v: lng.Texture | null);
|
|
58
|
+
get textureOptions(): IRendererNode['textureOptions'];
|
|
59
|
+
set textureOptions(v: IRendererNode["textureOptions"]);
|
|
60
|
+
get src(): string | null;
|
|
61
|
+
set src(v: string | null);
|
|
62
|
+
get scale(): number;
|
|
63
|
+
set scale(v: number);
|
|
64
|
+
get scaleX(): number;
|
|
65
|
+
set scaleX(v: number);
|
|
66
|
+
get scaleY(): number;
|
|
67
|
+
set scaleY(v: number);
|
|
68
|
+
get mount(): number;
|
|
69
|
+
set mount(v: number);
|
|
70
|
+
get mountX(): number;
|
|
71
|
+
set mountX(v: number);
|
|
72
|
+
get mountY(): number;
|
|
73
|
+
set mountY(v: number);
|
|
74
|
+
get pivot(): number;
|
|
75
|
+
set pivot(v: number);
|
|
76
|
+
get pivotX(): number;
|
|
77
|
+
set pivotX(v: number);
|
|
78
|
+
get pivotY(): number;
|
|
79
|
+
set pivotY(v: number);
|
|
80
|
+
get rotation(): number;
|
|
81
|
+
set rotation(v: number);
|
|
82
|
+
get rtt(): boolean;
|
|
83
|
+
set rtt(v: boolean);
|
|
84
|
+
get shader(): IRendererShader | null;
|
|
85
|
+
set shader(v: IRendererShader | null);
|
|
86
|
+
get data(): IRendererNode['data'];
|
|
87
|
+
set data(v: IRendererNode["data"]);
|
|
88
|
+
get imageType(): "regular" | "compressed" | "svg" | null | undefined;
|
|
89
|
+
set imageType(v: "regular" | "compressed" | "svg" | null | undefined);
|
|
90
|
+
get srcWidth(): number | undefined;
|
|
91
|
+
set srcWidth(v: number | undefined);
|
|
92
|
+
get srcHeight(): number | undefined;
|
|
93
|
+
set srcHeight(v: number | undefined);
|
|
94
|
+
get srcX(): number | undefined;
|
|
95
|
+
set srcX(v: number | undefined);
|
|
96
|
+
get srcY(): number | undefined;
|
|
97
|
+
set srcY(v: number | undefined);
|
|
98
|
+
get boundsMargin(): number | [number, number, number, number] | null;
|
|
99
|
+
set boundsMargin(value: number | [number, number, number, number] | null);
|
|
100
|
+
get absX(): number;
|
|
101
|
+
get absY(): number;
|
|
102
|
+
}
|
|
103
|
+
export declare class DOMRendererMain implements IRendererMain {
|
|
104
|
+
settings: lng.RendererMainSettings;
|
|
105
|
+
root: DOMNode;
|
|
106
|
+
canvas: HTMLCanvasElement;
|
|
107
|
+
stage: IRendererStage;
|
|
108
|
+
constructor(settings: lng.RendererMainSettings, rawTarget: string | HTMLElement);
|
|
109
|
+
createNode(props: Partial<IRendererNodeProps>): IRendererNode;
|
|
110
|
+
createTextNode(props: Partial<IRendererTextNodeProps>): IRendererTextNode;
|
|
111
|
+
createShader(shaderType: string, props?: IRendererShaderProps): IRendererShader;
|
|
112
|
+
createTexture(textureType: keyof lng.TextureMap, props: IRendererTextureProps): IRendererTexture;
|
|
113
|
+
on(name: string, callback: (target: any, data: any) => void): void;
|
|
114
|
+
}
|
|
115
|
+
export {};
|