@solidtv/solid 1.1.0 → 1.1.2

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.
Files changed (84) hide show
  1. package/dist/jsx-runtime.d.ts +0 -1
  2. package/dist/src/core/config.js.map +1 -1
  3. package/dist/src/core/dom-renderer/domRenderer.js +36 -36
  4. package/dist/src/core/dom-renderer/domRenderer.js.map +1 -1
  5. package/dist/src/core/dom-renderer/domRendererUtils.js +2 -2
  6. package/dist/src/core/dom-renderer/domRendererUtils.js.map +1 -1
  7. package/dist/src/core/elementNode.d.ts +19 -14
  8. package/dist/src/core/elementNode.js +42 -7
  9. package/dist/src/core/elementNode.js.map +1 -1
  10. package/dist/src/core/flex.js +1 -1
  11. package/dist/src/core/flex.js.map +1 -1
  12. package/dist/src/core/flexLayout.js +5 -9
  13. package/dist/src/core/flexLayout.js.map +1 -1
  14. package/dist/src/core/focusManager.js.map +1 -1
  15. package/dist/src/core/nodeTypes.d.ts +1 -1
  16. package/dist/src/core/nodeTypes.js.map +1 -1
  17. package/dist/src/core/shaders.js +1 -1
  18. package/dist/src/core/shaders.js.map +1 -1
  19. package/dist/src/core/states.js.map +1 -1
  20. package/dist/src/core/utils.js +2 -1
  21. package/dist/src/core/utils.js.map +1 -1
  22. package/dist/src/devtools/index.js +2 -2
  23. package/dist/src/devtools/index.js.map +1 -1
  24. package/dist/src/primitives/Column.jsx +1 -1
  25. package/dist/src/primitives/Column.jsx.map +1 -1
  26. package/dist/src/primitives/Grid.jsx.map +1 -1
  27. package/dist/src/primitives/Image.jsx.map +1 -1
  28. package/dist/src/primitives/KeepAlive.d.ts +4 -3
  29. package/dist/src/primitives/KeepAlive.jsx +48 -21
  30. package/dist/src/primitives/KeepAlive.jsx.map +1 -1
  31. package/dist/src/primitives/Lazy.d.ts +16 -0
  32. package/dist/src/primitives/Lazy.jsx +82 -38
  33. package/dist/src/primitives/Lazy.jsx.map +1 -1
  34. package/dist/src/primitives/LazyImport.js +14 -11
  35. package/dist/src/primitives/LazyImport.js.map +1 -1
  36. package/dist/src/primitives/Marquee.jsx +3 -3
  37. package/dist/src/primitives/Marquee.jsx.map +1 -1
  38. package/dist/src/primitives/Preserve.jsx +1 -1
  39. package/dist/src/primitives/Preserve.jsx.map +1 -1
  40. package/dist/src/primitives/Row.jsx +1 -1
  41. package/dist/src/primitives/Row.jsx.map +1 -1
  42. package/dist/src/primitives/Suspense.jsx +1 -1
  43. package/dist/src/primitives/Suspense.jsx.map +1 -1
  44. package/dist/src/primitives/Virtual.jsx +7 -6
  45. package/dist/src/primitives/Virtual.jsx.map +1 -1
  46. package/dist/src/primitives/borderBox.jsx.map +1 -1
  47. package/dist/src/primitives/useMouse.js +72 -82
  48. package/dist/src/primitives/useMouse.js.map +1 -1
  49. package/dist/src/primitives/utils/createSpriteMap.js.map +1 -1
  50. package/dist/src/primitives/utils/handleNavigation.js +13 -10
  51. package/dist/src/primitives/utils/handleNavigation.js.map +1 -1
  52. package/dist/src/solidOpts.js +1 -1
  53. package/dist/src/solidOpts.js.map +1 -1
  54. package/dist/tsconfig.tsbuildinfo +1 -1
  55. package/jsx-runtime.d.ts +0 -1
  56. package/package.json +2 -1
  57. package/src/core/config.ts +2 -0
  58. package/src/core/dom-renderer/domRenderer.ts +46 -46
  59. package/src/core/dom-renderer/domRendererUtils.ts +2 -2
  60. package/src/core/elementNode.ts +50 -20
  61. package/src/core/flex.ts +3 -3
  62. package/src/core/flexLayout.ts +7 -11
  63. package/src/core/focusManager.ts +1 -1
  64. package/src/core/nodeTypes.ts +1 -1
  65. package/src/core/shaders.ts +1 -1
  66. package/src/core/states.ts +2 -2
  67. package/src/core/utils.ts +2 -1
  68. package/src/devtools/index.ts +2 -2
  69. package/src/primitives/Column.tsx +0 -1
  70. package/src/primitives/Grid.tsx +1 -1
  71. package/src/primitives/Image.tsx +1 -1
  72. package/src/primitives/KeepAlive.tsx +75 -39
  73. package/src/primitives/Lazy.tsx +106 -37
  74. package/src/primitives/LazyImport.ts +5 -4
  75. package/src/primitives/Marquee.tsx +3 -3
  76. package/src/primitives/Preserve.tsx +1 -1
  77. package/src/primitives/Row.tsx +0 -1
  78. package/src/primitives/Suspense.tsx +1 -1
  79. package/src/primitives/Virtual.tsx +8 -8
  80. package/src/primitives/borderBox.tsx +1 -1
  81. package/src/primitives/useMouse.ts +94 -125
  82. package/src/primitives/utils/createSpriteMap.ts +1 -1
  83. package/src/primitives/utils/handleNavigation.ts +20 -11
  84. package/src/solidOpts.ts +1 -1
@@ -5,12 +5,15 @@ import { chainFunctions } from './utils/chainFunctions.js';
5
5
 
6
6
  export interface KeepAliveElement {
7
7
  id: string;
8
- owner: s.Owner | null;
9
- children: s.JSX.Element;
8
+ // owner / children / dispose are populated lazily — the preload path
9
+ // creates a partial entry holding only `id` + `isAlive` until the route
10
+ // mounts, so callers must null-check before use.
11
+ owner?: s.Owner | null;
12
+ children?: s.JSX.Element;
10
13
  routeSignal?: s.Signal<unknown>;
11
14
  isAlive?: s.Accessor<boolean>;
12
15
  setIsAlive?: (v: boolean) => void;
13
- dispose: () => void;
16
+ dispose?: () => void;
14
17
  }
15
18
 
16
19
  const keepAliveElements = new Map<string, KeepAliveElement>();
@@ -40,7 +43,7 @@ const _removeKeepAlive = (
40
43
  ): void => {
41
44
  const element = map.get(id);
42
45
  if (element) {
43
- (element.children as unknown as ElementNode)?.destroy();
46
+ (element.children as unknown as ElementNode | undefined)?.destroy();
44
47
  element.dispose?.();
45
48
  map.delete(id);
46
49
  }
@@ -53,7 +56,7 @@ export const removeKeepAliveRoute = (id: string): void =>
53
56
 
54
57
  const _clearKeepAlive = (map: Map<string, KeepAliveElement>): void => {
55
58
  map.forEach((element) => {
56
- (element.children as unknown as ElementNode)?.destroy();
59
+ (element.children as unknown as ElementNode | undefined)?.destroy();
57
60
  element.dispose?.();
58
61
  });
59
62
  map.clear();
@@ -109,13 +112,13 @@ const createKeepAliveComponent = (
109
112
  ) => {
110
113
  return (props: s.ParentProps<KeepAliveProps>) => {
111
114
  let existing = map.get(props.id);
115
+ const existingChild = existing?.children as ElementNode | undefined;
112
116
 
113
117
  if (
114
118
  existing &&
115
- (props.shouldDispose?.(props.id) ||
116
- (existing.children as unknown as ElementNode)?.destroyed)
119
+ (props.shouldDispose?.(props.id) || existingChild?.destroyed)
117
120
  ) {
118
- (existing.children as unknown as ElementNode).destroy();
121
+ existingChild?.destroy();
119
122
  existing.dispose?.();
120
123
  map.delete(props.id);
121
124
  existing = undefined;
@@ -138,9 +141,9 @@ const createKeepAliveComponent = (
138
141
  });
139
142
  return children;
140
143
  });
141
- } else if (existing && !existing.children) {
142
- existing.children = s.runWithOwner(existing.owner, () =>
143
- wrapChildren(props, existing!.setIsAlive),
144
+ } else if (!existing.children) {
145
+ existing.children = s.runWithOwner(existing.owner ?? null, () =>
146
+ wrapChildren(props, existing.setIsAlive),
144
147
  );
145
148
  }
146
149
  return existing.children;
@@ -156,6 +159,23 @@ const KeepAliveRouteInternal = createKeepAliveComponent(
156
159
  storeKeepAliveRoute,
157
160
  );
158
161
 
162
+ // Cache the resolved <Route> JSX per key. Solid Router uses the routeDef
163
+ // object itself as the route key (see @solidjs/router index.js:455), so if
164
+ // KeepAliveRoute ever gets re-evaluated, a new routeDef would drift the key
165
+ // and force routeStates to dispose + recreate sibling contexts (which would
166
+ // re-invoke their components). Returning the same JSX reference keeps the
167
+ // route key stable across re-evaluations.
168
+ //
169
+ // Note: this captures `props` at first invocation. If you rely on dynamic
170
+ // changes to KeepAliveRoute props (e.g., a reactive `transition` or `preload`
171
+ // reference), use a stable wrapper around them or clear this cache when
172
+ // they change.
173
+ const keepAliveRouteCache = new Map<string, s.JSX.Element>();
174
+
175
+ export const clearKeepAliveRouteCache = (): void => {
176
+ keepAliveRouteCache.clear();
177
+ };
178
+
159
179
  export const KeepAliveRoute = <S extends string>(
160
180
  props: RouteProps<S> & {
161
181
  id?: string;
@@ -173,20 +193,22 @@ export const KeepAliveRoute = <S extends string>(
173
193
  },
174
194
  ) => {
175
195
  const key = props.id || props.path;
196
+
197
+ const cached = keepAliveRouteCache.get(key);
198
+ if (cached) {
199
+ return cached;
200
+ }
201
+
176
202
  let savedFocusedElement: ElementNode | undefined;
177
203
 
178
- const getExisting = () => {
204
+ const getExisting = (): KeepAliveElement => {
179
205
  let existing = keepAliveRouteElements.get(key);
180
206
  if (!existing) {
181
207
  const [isAlive, setIsAlive] = s.createSignal(true);
182
- existing = {
183
- id: key,
184
- isAlive,
185
- setIsAlive,
186
- } as any;
187
- keepAliveRouteElements.set(key, existing!);
208
+ existing = { id: key, isAlive, setIsAlive };
209
+ keepAliveRouteElements.set(key, existing);
188
210
  }
189
- return existing!;
211
+ return existing;
190
212
  };
191
213
 
192
214
  const onRemove = chainFunctions(props.onRemove, (elm: ElementNode) => {
@@ -202,7 +224,7 @@ export const KeepAliveRoute = <S extends string>(
202
224
  isChild = true;
203
225
  break;
204
226
  }
205
- current = current.parent as ElementNode | undefined;
227
+ current = current.parent;
206
228
  }
207
229
 
208
230
  if (isChild && savedFocusedElement) {
@@ -216,13 +238,13 @@ export const KeepAliveRoute = <S extends string>(
216
238
  const preload = props.preload
217
239
  ? (preloadProps: RoutePreloadFuncArgs) => {
218
240
  let existing = getExisting();
241
+ const existingChild = existing.children as unknown as ElementNode | undefined;
219
242
 
220
243
  if (
221
- existing.children &&
222
- (props.shouldDispose?.(key) ||
223
- (existing.children as unknown as ElementNode)?.destroyed)
244
+ existingChild &&
245
+ (props.shouldDispose?.(key) || existingChild.destroyed)
224
246
  ) {
225
- (existing.children as unknown as ElementNode).destroy();
247
+ existingChild.destroy();
226
248
  existing.dispose?.();
227
249
  keepAliveRouteElements.delete(key);
228
250
  existing = getExisting();
@@ -235,7 +257,7 @@ export const KeepAliveRoute = <S extends string>(
235
257
  return props.preload!({ ...preloadProps, isAlive: existing.isAlive! });
236
258
  });
237
259
  } else if (existing.children) {
238
- (existing.children as unknown as ElementNode)?.setFocus();
260
+ (existing.children as unknown as ElementNode).setFocus();
239
261
  return props.preload!({ ...preloadProps, isAlive: existing.isAlive! });
240
262
  } else {
241
263
  return props.preload!({
@@ -246,23 +268,37 @@ export const KeepAliveRoute = <S extends string>(
246
268
  }
247
269
  : undefined;
248
270
 
249
- return (
271
+ const componentWrapper = (childProps: RouteProps<S>) => {
272
+ const existing = getExisting();
273
+ // Do NOT spread `childProps`: it has a `children` getter (the router's
274
+ // outlet) that would be invoked eagerly, creating a <Show> subscribed to
275
+ // the next routeStates index. That stale Show would then fire when the
276
+ // user navigates to a sibling route whose matches populate that index,
277
+ // causing the sibling's component to be created from the preserved
278
+ // KeepAlive subtree. Inherit via prototype so the getter is preserved.
279
+ const innerProps = Object.create(childProps, {
280
+ isAlive: { value: existing.isAlive!, enumerable: true, configurable: true },
281
+ }) as RouteProps<S> & { isAlive: s.Accessor<boolean> };
282
+ return (
283
+ <KeepAliveRouteInternal
284
+ id={key}
285
+ onRemove={onRemove}
286
+ onRender={onRender}
287
+ transition={props.transition}
288
+ >
289
+ {props.component(innerProps)}
290
+ </KeepAliveRouteInternal>
291
+ );
292
+ };
293
+
294
+ const routeElement = (
250
295
  <Route
251
296
  {...props}
252
297
  preload={preload}
253
- component={(childProps) => {
254
- const existing = getExisting();
255
- return (
256
- <KeepAliveRouteInternal
257
- id={key}
258
- onRemove={onRemove}
259
- onRender={onRender}
260
- transition={props.transition}
261
- >
262
- {props.component({ ...childProps, isAlive: existing.isAlive! })}
263
- </KeepAliveRouteInternal>
264
- );
265
- }}
298
+ component={componentWrapper}
266
299
  />
267
300
  );
301
+
302
+ keepAliveRouteCache.set(key, routeElement);
303
+ return routeElement;
268
304
  };
@@ -4,15 +4,51 @@ import * as s from 'solid-js';
4
4
 
5
5
  type LazyProps<T extends readonly any[]> = lng.NewOmit<lng.NodeProps, 'children'> & {
6
6
  each: T | undefined | null | false;
7
+
8
+ /** Initial visible item count before user navigation. */
7
9
  upCount: number;
10
+
11
+ /**
12
+ * Items to keep rendered ahead of the current selection. When selection
13
+ * moves within this distance of the rendered edge, the next item is
14
+ * scheduled to mount. Default depends on the scroll mode.
15
+ */
8
16
  buffer?: number;
17
+
18
+ /**
19
+ * Milliseconds to wait after a navigation key press before mounting the
20
+ * next item. Should match the scroll animation duration — mounting items
21
+ * mid-animation causes jank. If the user presses again before this timer
22
+ * fires (faster than the animation), an item is added synchronously to
23
+ * keep the rendered window ahead of selection.
24
+ */
9
25
  delay?: number;
26
+
27
+ /** Render `upCount` items synchronously on mount instead of ramping up. */
10
28
  sync?: boolean;
29
+
30
+ /** Continue mounting items in the background past `upCount`. */
11
31
  eagerLoad?: boolean;
32
+
33
+ /** Skip refocusing the container when `each.length` changes. */
12
34
  noRefocus?: boolean;
35
+
13
36
  children: (item: s.Accessor<T[number]>, index: number) => s.JSX.Element;
14
37
  };
15
38
 
39
+ // Lifecycle when props.each changes:
40
+ // 1. items memo invalidates → <Index> reconciles → new ElementNodes mounted (sync)
41
+ // 2. refocus effect runs (microtask) → calls viewRef.setFocus()
42
+ // 3. setFocus queues runPostMutation
43
+ // 4. post-mutation: delete-flush → layout → setActiveElement
44
+ // Children are always mounted before focus is applied; do not wrap setFocus
45
+ // in queueMicrotask — it only adds a redundant defer.
46
+ //
47
+ // Navigation key handler (updateOffset):
48
+ // - On each onRight/onDown, if selection is within `buffer` of the rendered
49
+ // edge, mount one more item. With `delay` set, the mount is deferred until
50
+ // the scroll animation completes so it doesn't drop a frame mid-animation.
51
+ // If the user out-paces `delay`, the mount fires synchronously instead.
16
52
  function createLazy<T>(
17
53
  component: s.ValidComponent,
18
54
  props: LazyProps<readonly T[]>,
@@ -20,9 +56,17 @@ function createLazy<T>(
20
56
  ) {
21
57
  // Need at least one item so it can be focused
22
58
  const [offset, setOffset] = s.createSignal<number>(props.sync ? props.upCount : 0);
23
- let timeoutId: ReturnType<typeof setTimeout> | null = null;
59
+ let preloadTimer: ReturnType<typeof setTimeout> | null = null;
60
+ let navDelayTimer: ReturnType<typeof setTimeout> | null = null;
61
+ let disposed = false;
24
62
  let viewRef!: lngp.NavigableElement;
25
- let itemLength: number = 0;
63
+ let itemLength = 0;
64
+
65
+ s.onCleanup(() => {
66
+ disposed = true;
67
+ if (preloadTimer) clearTimeout(preloadTimer);
68
+ if (navDelayTimer) clearTimeout(navDelayTimer);
69
+ });
26
70
 
27
71
  const buffer = s.createMemo(() => {
28
72
  if (typeof props.buffer === 'number') {
@@ -44,39 +88,54 @@ function createLazy<T>(
44
88
 
45
89
  if (!props.sync || props.eagerLoad) {
46
90
  s.createEffect(() => {
47
- if (props.each) {
48
- const loadItems = () => {
49
- let count = s.untrack(offset);
50
- if (count < props.upCount) {
51
- setOffset(count + 1);
52
- timeoutId = setTimeout(loadItems, 16); // ~60fps
53
- count++;
54
- } else if (props.eagerLoad) {
55
- const maxOffset = props.each ? props.each.length : 0;
56
- if (count >= maxOffset) return;
57
- setOffset((prev) => Math.min(prev + 1, maxOffset));
58
- lng.scheduleTask(loadItems);
59
- }
60
- };
61
- loadItems();
91
+ if (!props.each) return;
92
+ // Cancel any in-flight preload chain from a prior effect run before
93
+ // starting a new one — otherwise two chains share state and race.
94
+ if (preloadTimer) {
95
+ clearTimeout(preloadTimer);
96
+ preloadTimer = null;
62
97
  }
98
+ const loadItems = () => {
99
+ if (disposed) return;
100
+ const count = s.untrack(offset);
101
+ if (count < props.upCount) {
102
+ setOffset(count + 1);
103
+ preloadTimer = setTimeout(loadItems, 16); // ~60fps
104
+ } else if (props.eagerLoad) {
105
+ const maxOffset = props.each ? props.each.length : 0;
106
+ if (count >= maxOffset) return;
107
+ setOffset((prev) => Math.min(prev + 1, maxOffset));
108
+ lng.scheduleTask(loadItems);
109
+ }
110
+ };
111
+ loadItems();
63
112
  });
64
113
  }
65
114
 
66
- const items: s.Accessor<T[]> = s.createMemo(() => {
67
- if (Array.isArray(props.each)) {
68
- if (itemLength != props.each.length) {
69
- itemLength = props.each.length;
70
- if (viewRef && !viewRef.noRefocus && lng.hasFocus(viewRef)) {
71
- queueMicrotask(() => viewRef.setFocus());
115
+ // Refocus when each.length changes. Side effect kept out of the items memo
116
+ // (memos must be pure — Solid may skip evaluation when there are no readers).
117
+ s.createEffect(() => {
118
+ if (!Array.isArray(props.each)) {
119
+ itemLength = 0;
120
+ return;
121
+ }
122
+ const len = props.each.length;
123
+ if (itemLength !== len) {
124
+ itemLength = len;
125
+ if (viewRef && !viewRef.noRefocus && lng.hasFocus(viewRef)) {
126
+ // Clamp selected so a shrunk list doesn't refocus a disposed index.
127
+ if (typeof viewRef.selected === 'number' && viewRef.selected >= len) {
128
+ viewRef.selected = Math.max(0, len - 1);
72
129
  }
130
+ viewRef.setFocus();
73
131
  }
74
- return props.each.slice(0, offset());
75
132
  }
76
- itemLength = 0;
77
- return [];
78
133
  });
79
134
 
135
+ const items: s.Accessor<T[]> = s.createMemo(() =>
136
+ Array.isArray(props.each) ? props.each.slice(0, offset()) : [],
137
+ );
138
+
80
139
  function lazyScrollToIndex(this: lngp.NavigableElement, index: number) {
81
140
  setOffset(Math.max(index, 0) + buffer())
82
141
  queueMicrotask(() => viewRef.scrollToIndex(index));
@@ -85,24 +144,34 @@ function createLazy<T>(
85
144
  const updateOffset = (_event: KeyboardEvent, container: lng.ElementNode) => {
86
145
  const maxOffset = props.each ? props.each.length : 0;
87
146
  const selected = container.selected || 0;
88
- const numChildren = container.children.length;
89
- if (offset() >= maxOffset || selected < numChildren - buffer()) return;
147
+ const rendered = offset(); // == container.children.length
148
+
149
+ // Already mounted everything, or still far enough from the rendered edge
150
+ // that the buffer covers the next selection — no work to do.
151
+ if (rendered >= maxOffset || selected < rendered - buffer()) return;
152
+
153
+ const bump = () => setOffset((prev) => Math.min(prev + 1, maxOffset));
90
154
 
155
+ // No animation to hide behind — mount immediately.
91
156
  if (!props.delay) {
92
- setOffset((prev) => Math.min(prev + 1, maxOffset));
157
+ bump();
93
158
  return;
94
159
  }
95
160
 
96
- if (timeoutId) {
97
- clearTimeout(timeoutId);
98
- //Moving faster than the delay so need to go sync
99
- setOffset((prev) => Math.min(prev + 1, maxOffset));
161
+ // A delayed mount from the previous press hasn't fired yet, which means
162
+ // the user is navigating faster than the scroll animation. Drop the wait
163
+ // (we can't smooth a frame the user is already past) and mount now.
164
+ if (navDelayTimer) {
165
+ clearTimeout(navDelayTimer);
166
+ bump();
100
167
  }
101
168
 
102
- timeoutId = setTimeout(() => {
103
- setOffset((prev) => Math.min(prev + 1, maxOffset));
104
- timeoutId = null;
105
- }, props.delay ?? 0);
169
+ // Schedule the trailing mount to land after the scroll animation completes,
170
+ // so a single item mount doesn't jank the in-flight animation.
171
+ navDelayTimer = setTimeout(() => {
172
+ bump();
173
+ navDelayTimer = null;
174
+ }, props.delay);
106
175
  };
107
176
 
108
177
  const handler = keyHandler(updateOffset);
@@ -34,8 +34,9 @@ export function lazy<T extends Component<any>>(
34
34
  comp = s;
35
35
  }
36
36
  let Comp: T | undefined;
37
- return createMemo(() =>
38
- (Comp = comp())
37
+ return createMemo(() => {
38
+ Comp = comp();
39
+ return Comp
39
40
  ? untrack(() => {
40
41
  if (!ctx || sharedConfig.done) return Comp!(props);
41
42
  const c = sharedConfig.context;
@@ -44,8 +45,8 @@ export function lazy<T extends Component<any>>(
44
45
  sharedConfig.context = c;
45
46
  return r;
46
47
  })
47
- : null,
48
- ) as unknown as JSX.Element;
48
+ : null;
49
+ }) as unknown as JSX.Element;
49
50
  }) as T;
50
51
  wrap.preload = () =>
51
52
  p || ((p = fn()).then((mod) => (comp = () => mod.default)), p);
@@ -69,7 +69,7 @@ export function MarqueeText(props: MarqueeTextProps) {
69
69
  s.createEffect(() => {
70
70
  if (shouldScroll()) {
71
71
 
72
- let options: lng.AnimationSettings = {
72
+ const options: lng.AnimationSettings = {
73
73
  duration: (textWidth() + scrollGap()) / speed() * 1000,
74
74
  delay: delay(),
75
75
  loop: true,
@@ -79,8 +79,8 @@ export function MarqueeText(props: MarqueeTextProps) {
79
79
  text1.lng.x = 0
80
80
  text2.lng.x = textWidth() + scrollGap()
81
81
 
82
- let a1 = text1.lng.animate!({x: -textWidth() -scrollGap()}, options).start()
83
- let a2 = text2.lng.animate!({x: 0}, options).start()
82
+ const a1 = text1.lng.animate!({x: -textWidth() -scrollGap()}, options).start()
83
+ const a2 = text2.lng.animate!({x: 0}, options).start()
84
84
 
85
85
  s.onCleanup(() => {
86
86
  a1.stop()
@@ -3,7 +3,7 @@ import * as lng from '@solidtv/solid'
3
3
 
4
4
  function Preserve(props: lng.NodeProps): s.JSX.Element {
5
5
 
6
- let view = <view {...props} /> as any as lng.ElementNode
6
+ const view = <view {...props} /> as any as lng.ElementNode
7
7
 
8
8
  view.preserve = true;
9
9
 
@@ -33,7 +33,6 @@ export const Row: Component<RowProps> = (props) => {
33
33
  <view
34
34
  transitionLeft={defaultTransitionBack}
35
35
  transitionRight={defaultTransitionForward}
36
- transition={/* @once */ {}}
37
36
  {...props}
38
37
  selected={props.selected || 0}
39
38
  onLeft={/* @once */ chainFunctions(props.onLeft, onLeft)}
@@ -24,7 +24,7 @@ export function Suspense(props: {
24
24
 
25
25
  let children: s.JSX.Element;
26
26
 
27
- let suspense = s.Suspense({
27
+ const suspense = s.Suspense({
28
28
  get children() {
29
29
  return [children = s.children(() => props.children) as any];
30
30
  },
@@ -247,7 +247,7 @@ function createVirtual<T>(
247
247
  }
248
248
  break;
249
249
 
250
- case 'edge':
250
+ case 'edge': {
251
251
  const startScrolling = Math.max(
252
252
  1,
253
253
  props.displaySize + (atStart ? -1 : 0),
@@ -316,6 +316,7 @@ function createVirtual<T>(
316
316
  }
317
317
  }
318
318
  break;
319
+ }
319
320
 
320
321
  case 'none':
321
322
  default:
@@ -396,18 +397,18 @@ function createVirtual<T>(
396
397
  _active,
397
398
  _lastIdx,
398
399
  ) {
399
- let idx = _idx;
400
- let lastIdx = _lastIdx || 0;
401
- let active = _active;
400
+ const idx = _idx;
401
+ const lastIdx = _lastIdx || 0;
402
+ const active = _active;
402
403
  const noChange = idx === lastIdx;
403
404
  const total = itemCount();
404
405
  originalPosition = originalPosition ?? elm[axis];
405
406
 
406
407
  if (props.onSelectedChanged) {
407
408
  props.onSelectedChanged.call(
408
- this as lngp.NavigableElement,
409
+ this,
409
410
  idx,
410
- this as lngp.NavigableElement,
411
+ this,
411
412
  active,
412
413
  lastIdx,
413
414
  );
@@ -480,7 +481,7 @@ function createVirtual<T>(
480
481
 
481
482
  queueMicrotask(() => {
482
483
  viewRef.updateLayout();
483
- let activeIndex = viewRef.children.findIndex((x) => x.item === item);
484
+ const activeIndex = viewRef.children.findIndex((x) => x.item === item);
484
485
  if (activeIndex === -1) return;
485
486
  viewRef.selected = activeIndex;
486
487
  if (lng.hasFocus(viewRef)) {
@@ -539,7 +540,6 @@ function createVirtual<T>(
539
540
 
540
541
  return (
541
542
  <view
542
- transition={/* @once */ {}}
543
543
  transitionLeft={isRow ? defaultTransitionBack : undefined}
544
544
  transitionRight={isRow ? defaultTransitionForward : undefined}
545
545
  transitionUp={!isRow ? defaultTransitionUp : undefined}
@@ -62,7 +62,7 @@ export function borderBox(
62
62
  });
63
63
  } else if (border) {
64
64
  border.destroy();
65
- el.removeChild(border!);
65
+ el.removeChild(border);
66
66
  border = null;
67
67
  }
68
68
  }, el.onFocusChanged);