@lightningtv/solid 3.0.4 → 3.0.6

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.
@@ -49,6 +49,26 @@ export interface NavigableProps extends NodeProps {
49
49
  offset: number,
50
50
  isInitial: boolean,
51
51
  ) => void;
52
+
53
+ /**
54
+ * Defines transitions for animatable properties when navigating up.
55
+ */
56
+ transitionUp?: NodeStyles['transition'];
57
+
58
+ /**
59
+ * Defines transitions for animatable properties when navigating down.
60
+ */
61
+ transitionDown?: NodeStyles['transition'];
62
+
63
+ /**
64
+ * Defines transitions for animatable properties when navigating left.
65
+ */
66
+ transitionLeft?: NodeStyles['transition'];
67
+
68
+ /**
69
+ * Defines transitions for animatable properties when navigating right.
70
+ */
71
+ transitionRight?: NodeStyles['transition'];
52
72
  }
53
73
 
54
74
  // @ts-expect-error animationSettings is not identical - weird
@@ -2,6 +2,34 @@ import * as s from 'solid-js';
2
2
  import * as lng from '../../index.js';
3
3
  import * as lngp from '../index.js';
4
4
 
5
+ export const defaultTransitionBack = {
6
+ x: {
7
+ duration: 180,
8
+ easing: 'cubic-bezier(0.4, 0, 0.2, 1)',
9
+ },
10
+ };
11
+
12
+ export const defaultTransitionForward = {
13
+ x: {
14
+ duration: 180,
15
+ easing: 'cubic-bezier(0.2, 0, 0, 1)',
16
+ },
17
+ };
18
+
19
+ export const defaultTransitionDown = {
20
+ y: {
21
+ duration: 300,
22
+ easing: 'cubic-bezier(0.2, 1, 0.8, 1)',
23
+ },
24
+ };
25
+
26
+ export const defaultTransitionUp = {
27
+ y: {
28
+ duration: 300,
29
+ easing: 'cubic-bezier(0.3, 0, 0.2, 1)',
30
+ },
31
+ };
32
+
5
33
  function idxInArray(idx: number, arr: readonly any[]): boolean {
6
34
  return idx >= 0 && idx < arr.length;
7
35
  }
@@ -93,6 +121,30 @@ export function handleNavigation(
93
121
  direction: 'up' | 'right' | 'down' | 'left',
94
122
  ): lng.KeyHandler {
95
123
  return function () {
124
+ const el = this as lngp.NavigableElement;
125
+ const transition =
126
+ direction === 'up'
127
+ ? el.transitionUp
128
+ : direction === 'down'
129
+ ? el.transitionDown
130
+ : direction === 'left'
131
+ ? el.transitionLeft
132
+ : direction === 'right'
133
+ ? el.transitionRight
134
+ : undefined;
135
+
136
+ if (transition) {
137
+ const currentTransition =
138
+ typeof el.transition === 'object' && el.transition !== null
139
+ ? el.transition
140
+ : {};
141
+
142
+ el.transition = {
143
+ ...currentTransition,
144
+ ...(transition as object),
145
+ };
146
+ }
147
+
96
148
  return moveSelection(
97
149
  this as lngp.NavigableElement,
98
150
  direction === 'up' || direction === 'left' ? -1 : 1,