@solidtv/solid 1.7.3 → 1.8.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/MIGRATION-1.8.md +270 -0
- package/dist/src/core/dom-renderer/dashedBorderStyle.d.ts +20 -0
- package/dist/src/core/dom-renderer/dashedBorderStyle.js +104 -0
- package/dist/src/core/dom-renderer/dashedBorderStyle.js.map +1 -0
- package/dist/src/core/dom-renderer/domRenderer.d.ts +14 -0
- package/dist/src/core/dom-renderer/domRenderer.js +194 -12
- package/dist/src/core/dom-renderer/domRenderer.js.map +1 -1
- package/dist/src/core/dom-renderer/domRendererTypes.d.ts +12 -2
- package/dist/src/core/elementNode.d.ts +176 -9
- package/dist/src/core/elementNode.js +1906 -411
- package/dist/src/core/elementNode.js.map +1 -1
- package/dist/src/core/flexLayout.d.ts +6 -0
- package/dist/src/core/flexLayout.js +535 -218
- package/dist/src/core/flexLayout.js.map +1 -1
- package/dist/src/core/focusManager.js +70 -23
- package/dist/src/core/focusManager.js.map +1 -1
- package/dist/src/core/fontLoaded.d.ts +10 -0
- package/dist/src/core/fontLoaded.js +26 -0
- package/dist/src/core/fontLoaded.js.map +1 -0
- package/dist/src/core/intrinsicTypes.d.ts +2 -1
- package/dist/src/core/lightningInit.js +8 -1
- package/dist/src/core/lightningInit.js.map +1 -1
- package/dist/src/core/shaders.d.ts +5 -2
- package/dist/src/core/shaders.js +6 -0
- package/dist/src/core/shaders.js.map +1 -1
- package/dist/src/core/states.d.ts +2 -0
- package/dist/src/core/states.js +26 -7
- package/dist/src/core/states.js.map +1 -1
- package/dist/src/core/stylePlan.d.ts +39 -0
- package/dist/src/core/stylePlan.js +159 -0
- package/dist/src/core/stylePlan.js.map +1 -0
- package/dist/src/core/utils.js +2 -2
- package/dist/src/primitives/Grid.d.ts +7 -1
- package/dist/src/primitives/Grid.jsx +48 -4
- package/dist/src/primitives/Grid.jsx.map +1 -1
- package/dist/src/primitives/Virtual.jsx +16 -6
- package/dist/src/primitives/Virtual.jsx.map +1 -1
- package/dist/src/primitives/useMouse.d.ts +10 -5
- package/dist/src/primitives/useMouse.js +42 -10
- package/dist/src/primitives/useMouse.js.map +1 -1
- package/dist/src/primitives/utils/handleNavigation.js +29 -6
- package/dist/src/primitives/utils/handleNavigation.js.map +1 -1
- package/dist/src/primitives/utils/withScrolling.js +2 -1
- package/dist/src/primitives/utils/withScrolling.js.map +1 -1
- package/dist/src/solidOpts.js +22 -8
- package/dist/src/solidOpts.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/docs/AI_CODING_GUIDELINES.md +7 -6
- package/docs/AI_UPGRADE_1.8.md +290 -0
- package/package.json +5 -3
- package/src/core/dom-renderer/dashedBorderStyle.ts +128 -0
- package/src/core/dom-renderer/domRenderer.ts +201 -10
- package/src/core/dom-renderer/domRendererTypes.ts +12 -0
- package/src/core/elementNode.ts +2124 -459
- package/src/core/flexLayout.ts +583 -231
- package/src/core/focusManager.ts +86 -27
- package/src/core/fontLoaded.ts +29 -0
- package/src/core/intrinsicTypes.ts +2 -0
- package/src/core/lightningInit.ts +8 -1
- package/src/core/shaders.ts +12 -0
- package/src/core/states.ts +29 -9
- package/src/core/stylePlan.ts +195 -0
- package/src/core/utils.ts +2 -2
- package/src/primitives/Grid.tsx +66 -14
- package/src/primitives/Virtual.tsx +20 -6
- package/src/primitives/useMouse.ts +73 -6
- package/src/primitives/utils/handleNavigation.ts +40 -6
- package/src/primitives/utils/withScrolling.ts +3 -2
- package/src/solidOpts.ts +23 -8
- package/dist/src/core/flex.d.ts +0 -2
- package/dist/src/core/flex.js +0 -285
- package/dist/src/core/flex.js.map +0 -1
- package/src/core/flex.ts +0 -332
package/src/primitives/Grid.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { createSignal, createMemo, createEffect, JSX, untrack, Index } from "solid-js";
|
|
2
|
-
import { type NodeProps, ElementNode, NewOmit, hasFocus } from "@solidtv/solid";
|
|
3
|
-
import {
|
|
1
|
+
import { createSignal, createMemo, createEffect, createRenderEffect, JSX, untrack, Index } from "solid-js";
|
|
2
|
+
import { type NodeProps, type INode, ElementNode, NewOmit, hasFocus } from "@solidtv/solid";
|
|
3
|
+
import { chainRefs } from "./utils/chainFunctions.js";
|
|
4
4
|
|
|
5
5
|
export interface GridItemProps<T> {
|
|
6
6
|
item: T
|
|
@@ -19,7 +19,13 @@ export interface GridProps<T> extends NewOmit<NodeProps, 'children'> {
|
|
|
19
19
|
itemOffset?: number;
|
|
20
20
|
columns?: number;
|
|
21
21
|
looping?: boolean;
|
|
22
|
-
|
|
22
|
+
/** How the grid follows focus vertically:
|
|
23
|
+
* auto - the focused row moves to the top (default)
|
|
24
|
+
* edge - the grid moves only when focus goes past the last row that fits
|
|
25
|
+
* (above the screen's bottom, or a clipping parent's) or above the first
|
|
26
|
+
* row shown; it then moves just enough to show that row
|
|
27
|
+
* none - the grid does not move */
|
|
28
|
+
scroll?: "auto" | "edge" | "none";
|
|
23
29
|
selected?: number;
|
|
24
30
|
onSelectedChanged?: (index: number, grid: ElementNode, elm?: ElementNode) => void;
|
|
25
31
|
}
|
|
@@ -114,25 +120,63 @@ export function Grid<T>(props: GridProps<T>): JSX.Element {
|
|
|
114
120
|
});
|
|
115
121
|
}
|
|
116
122
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
)
|
|
123
|
+
// edge: the rows that fit between the grid's unscrolled top and the bottom
|
|
124
|
+
// of its clipping parent, or of the screen. At least one.
|
|
125
|
+
function visibleRows() {
|
|
126
|
+
const parent = gridRef.parent;
|
|
127
|
+
const parentTop = parent?.absY ?? 0;
|
|
128
|
+
const top = parentTop + (props.y ?? 0);
|
|
129
|
+
const bottom = parent?.clipping
|
|
130
|
+
? parentTop + (parent.height ?? 0)
|
|
131
|
+
: (gridRef.lng as INode).stage.root.h;
|
|
132
|
+
return Math.max(1, Math.floor((bottom - top + (props.itemOffset ?? 0)) / totalHeight()));
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// edge: the first row shown.
|
|
136
|
+
let topRow = 0;
|
|
137
|
+
const scrollY = createMemo(() => {
|
|
138
|
+
const y = props.y ?? 0;
|
|
139
|
+
if (props.scroll === "none") return y;
|
|
140
|
+
const row = Math.floor(focusedIndex() / columns());
|
|
141
|
+
if (props.scroll !== "edge") return -row * totalHeight() + y;
|
|
142
|
+
if (row < topRow) topRow = row;
|
|
143
|
+
else if (row > topRow) topRow = Math.max(topRow, row - visibleRows() + 1);
|
|
144
|
+
return -topRow * totalHeight() + y;
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
// Created once. The spread below re-runs on every vertical move (for `y`),
|
|
148
|
+
// and handlers built inline in it were new functions each time. Each runs
|
|
149
|
+
// the app's handler of the same name first (read when called, so a reactive
|
|
150
|
+
// one still applies) and stops if it returns true.
|
|
151
|
+
type HandlerName = "onUp" | "onDown" | "onLeft" | "onRight" | "onFocus";
|
|
152
|
+
function chainProp(name: HandlerName, own: () => boolean) {
|
|
153
|
+
return function (this: ElementNode, a: unknown, b: unknown, c: unknown, d?: unknown) {
|
|
154
|
+
const user = props[name] as ((...args: unknown[]) => unknown) | undefined;
|
|
155
|
+
if (typeof user === "function" && user.call(this, a, b, c, d) === true) return true;
|
|
156
|
+
return own();
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
const onUp = chainProp("onUp", () => moveFocus(-columns()));
|
|
160
|
+
const onDown = chainProp("onDown", () => moveFocus(columns()));
|
|
161
|
+
const onLeft = chainProp("onLeft", () => handleHorizontalFocus(-1));
|
|
162
|
+
const onRight = chainProp("onRight", () => handleHorizontalFocus(1));
|
|
163
|
+
const onFocus = chainProp("onFocus", () => handleHorizontalFocus(0));
|
|
120
164
|
|
|
121
165
|
let gridRef!: ElementNode;
|
|
122
|
-
|
|
166
|
+
const view = (
|
|
123
167
|
<view
|
|
124
168
|
{...props}
|
|
125
169
|
ref={chainRefs(el => gridRef = el, props.ref)}
|
|
126
170
|
transition={/* @once */ { y: true }}
|
|
127
171
|
height={totalHeight() * rows()}
|
|
128
172
|
scrollToIndex={/* @once */ scrollToIndex}
|
|
129
|
-
onUp={
|
|
130
|
-
onDown={
|
|
131
|
-
onLeft={
|
|
132
|
-
onRight={
|
|
133
|
-
onFocus={
|
|
173
|
+
onUp={/* @once */ onUp}
|
|
174
|
+
onDown={/* @once */ onDown}
|
|
175
|
+
onLeft={/* @once */ onLeft}
|
|
176
|
+
onRight={/* @once */ onRight}
|
|
177
|
+
onFocus={/* @once */ onFocus}
|
|
134
178
|
strictBounds={false}
|
|
135
|
-
y={scrollY
|
|
179
|
+
y={/* @once */ untrack(scrollY)}
|
|
136
180
|
>
|
|
137
181
|
<Index each={props.items}>
|
|
138
182
|
{(item, index) => (
|
|
@@ -148,4 +192,12 @@ export function Grid<T>(props: GridProps<T>): JSX.Element {
|
|
|
148
192
|
</Index>
|
|
149
193
|
</view>
|
|
150
194
|
);
|
|
195
|
+
|
|
196
|
+
// `y` has an effect of its own: in the spread above, every vertical move
|
|
197
|
+
// (a focusedIndex change) re-ran every prop of the spread.
|
|
198
|
+
createRenderEffect(() => {
|
|
199
|
+
gridRef.y = scrollY();
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
return view;
|
|
151
203
|
};
|
|
@@ -466,16 +466,28 @@ function createVirtual<T>(
|
|
|
466
466
|
if (layoutPending) view.updateLayout();
|
|
467
467
|
const childSize = computeSize(slice.selected);
|
|
468
468
|
|
|
469
|
+
// Not only a running one: a started animation is `scheduled` until its
|
|
470
|
+
// first frame. Left alive by a press within that frame, it outlasted
|
|
471
|
+
// the newer, shorter one and left the row at its own target (#53).
|
|
469
472
|
if (
|
|
470
473
|
cachedAnimationController &&
|
|
471
|
-
cachedAnimationController.state
|
|
474
|
+
cachedAnimationController.state !== 'stopped'
|
|
472
475
|
) {
|
|
473
476
|
cachedAnimationController.stop();
|
|
474
477
|
}
|
|
475
478
|
|
|
479
|
+
// Where the row goes: one slot per shift from where it was or, with
|
|
480
|
+
// scroll="always" and an offset, where the focused item is at `offset`,
|
|
481
|
+
// as in Row.
|
|
482
|
+
const offset = scrollType() === 'always' ? props.offset : undefined;
|
|
483
|
+
const next =
|
|
484
|
+
offset === undefined
|
|
485
|
+
? shiftPrevChildPos - active[axis] + childSize * slice.shiftBy
|
|
486
|
+
: offset - active[axis];
|
|
487
|
+
|
|
476
488
|
if (lng.Config.animationsEnabled) {
|
|
477
489
|
view.lng[axis] = shiftPrevChildPos - active[axis];
|
|
478
|
-
targetPosition =
|
|
490
|
+
targetPosition = next;
|
|
479
491
|
const settings = view.animationSettings;
|
|
480
492
|
if (settings !== shiftSettingsFrom) {
|
|
481
493
|
shiftSettings = {};
|
|
@@ -500,9 +512,8 @@ function createVirtual<T>(
|
|
|
500
512
|
.animate(shiftProps, shiftSettings)
|
|
501
513
|
.start();
|
|
502
514
|
} else {
|
|
503
|
-
view.lng[axis] =
|
|
504
|
-
|
|
505
|
-
targetPosition = view.lng[axis];
|
|
515
|
+
view.lng[axis] = next;
|
|
516
|
+
targetPosition = next;
|
|
506
517
|
}
|
|
507
518
|
}
|
|
508
519
|
|
|
@@ -591,7 +602,10 @@ function createVirtual<T>(
|
|
|
591
602
|
// the current position moved an already scrolled row a second slot.
|
|
592
603
|
let position: number = originalPosition;
|
|
593
604
|
if (shiftBy !== 0) position -= computeSize(slice.selected);
|
|
594
|
-
if (
|
|
605
|
+
if (
|
|
606
|
+
cachedAnimationController &&
|
|
607
|
+
cachedAnimationController.state !== 'stopped'
|
|
608
|
+
) {
|
|
595
609
|
cachedAnimationController.stop();
|
|
596
610
|
}
|
|
597
611
|
viewRef.lng[axis] = position;
|
|
@@ -21,9 +21,16 @@ interface MouseStateOptions {
|
|
|
21
21
|
pressedState: CustomState;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
interface UseMouseOptions {
|
|
25
|
+
customStates?: MouseStateOptions;
|
|
26
|
+
/**
|
|
27
|
+
* Hit-test children that draw outside their parent's bounds. A subtree is
|
|
28
|
+
* cut off only where a node has `clipping` set; otherwise the search keeps
|
|
29
|
+
* descending even when the pointer misses the node itself. Off by default:
|
|
30
|
+
* the default search stops at any node the pointer misses.
|
|
31
|
+
*/
|
|
32
|
+
respectClipping?: boolean;
|
|
33
|
+
}
|
|
27
34
|
|
|
28
35
|
export function addCustomStateToElement(
|
|
29
36
|
element: RenderableNode,
|
|
@@ -133,8 +140,9 @@ function findElementWithCustomState<TApp extends ElementNode>(
|
|
|
133
140
|
x: number,
|
|
134
141
|
y: number,
|
|
135
142
|
customState: CustomState,
|
|
143
|
+
respectClipping: boolean,
|
|
136
144
|
): ElementNode | undefined {
|
|
137
|
-
const path = getChildrenByPosition(myApp, x, y);
|
|
145
|
+
const path = getChildrenByPosition(myApp, x, y, respectClipping);
|
|
138
146
|
let element: ElementNode | undefined;
|
|
139
147
|
for (let i = path.length - 1; i >= 0; i--) {
|
|
140
148
|
if (hasCustomState(path[i]!, customState)) {
|
|
@@ -235,6 +243,7 @@ function handleElementClick(
|
|
|
235
243
|
|
|
236
244
|
function createHandleClick<TApp extends ElementNode>(
|
|
237
245
|
myApp: TApp,
|
|
246
|
+
respectClipping: boolean,
|
|
238
247
|
customStates?: MouseStateOptions,
|
|
239
248
|
pressedElementRef?: { current: ElementNode | null },
|
|
240
249
|
) {
|
|
@@ -245,6 +254,7 @@ function createHandleClick<TApp extends ElementNode>(
|
|
|
245
254
|
e.clientX,
|
|
246
255
|
e.clientY,
|
|
247
256
|
customStates.hoverState,
|
|
257
|
+
respectClipping,
|
|
248
258
|
)
|
|
249
259
|
: findElementByActiveElement(e);
|
|
250
260
|
|
|
@@ -258,6 +268,7 @@ function createHandleClick<TApp extends ElementNode>(
|
|
|
258
268
|
|
|
259
269
|
function createHandleMouseDown<TApp extends ElementNode>(
|
|
260
270
|
myApp: TApp,
|
|
271
|
+
respectClipping: boolean,
|
|
261
272
|
customStates?: MouseStateOptions,
|
|
262
273
|
pressedElementRef?: { current: ElementNode | null },
|
|
263
274
|
) {
|
|
@@ -271,6 +282,7 @@ function createHandleMouseDown<TApp extends ElementNode>(
|
|
|
271
282
|
e.clientX,
|
|
272
283
|
e.clientY,
|
|
273
284
|
customStates.hoverState,
|
|
285
|
+
respectClipping,
|
|
274
286
|
);
|
|
275
287
|
|
|
276
288
|
if (!pressedElement) {
|
|
@@ -318,16 +330,64 @@ function isNodeAtPosition(
|
|
|
318
330
|
);
|
|
319
331
|
}
|
|
320
332
|
|
|
333
|
+
// Depth-first search for the topmost hit, used when `respectClipping` is on.
|
|
334
|
+
// Descends through nodes the pointer misses unless they clip; pushes only
|
|
335
|
+
// nodes the pointer is over onto `path` (ancestors first). Returns whether
|
|
336
|
+
// anything in this subtree was hit.
|
|
337
|
+
function collectHitPath(
|
|
338
|
+
node: ElementNode | ElementText | TextNode,
|
|
339
|
+
px: number,
|
|
340
|
+
py: number,
|
|
341
|
+
path: ElementNode[],
|
|
342
|
+
): boolean {
|
|
343
|
+
if (!isElementNode(node) || node.alpha === 0 || node.skipFocus) {
|
|
344
|
+
return false;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
const hit = testCollision(
|
|
348
|
+
px,
|
|
349
|
+
py,
|
|
350
|
+
(node.lng.absX as number) || 0,
|
|
351
|
+
(node.lng.absY as number) || 0,
|
|
352
|
+
node.width || 0,
|
|
353
|
+
node.height || 0,
|
|
354
|
+
);
|
|
355
|
+
if (!hit && node.clipping) return false;
|
|
356
|
+
if (hit) path.push(node);
|
|
357
|
+
|
|
358
|
+
// Topmost first: higher zIndex, then later sibling (as in the default
|
|
359
|
+
// search). Index tiebreak, since old webOS engines have no stable sort.
|
|
360
|
+
const children = node.children;
|
|
361
|
+
const order: number[] = [];
|
|
362
|
+
for (let i = children.length - 1; i >= 0; i--) order.push(i);
|
|
363
|
+
order.sort(
|
|
364
|
+
(a, b) =>
|
|
365
|
+
((children[b] as ElementNode).zIndex ?? -1) -
|
|
366
|
+
((children[a] as ElementNode).zIndex ?? -1) || b - a,
|
|
367
|
+
);
|
|
368
|
+
for (const i of order) {
|
|
369
|
+
if (collectHitPath(children[i]!, px, py, path)) return true;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
return hit;
|
|
373
|
+
}
|
|
374
|
+
|
|
321
375
|
function getChildrenByPosition<TElement extends ElementNode = ElementNode>(
|
|
322
376
|
node: TElement,
|
|
323
377
|
x: number,
|
|
324
378
|
y: number,
|
|
379
|
+
respectClipping = false,
|
|
325
380
|
): TElement[] {
|
|
326
381
|
const result: TElement[] = [];
|
|
327
382
|
const precision = Config.rendererOptions?.deviceLogicalPixelRatio || 1;
|
|
328
383
|
const px = x / precision;
|
|
329
384
|
const py = y / precision;
|
|
330
385
|
|
|
386
|
+
if (respectClipping) {
|
|
387
|
+
collectHitPath(node, px, py, result);
|
|
388
|
+
return result;
|
|
389
|
+
}
|
|
390
|
+
|
|
331
391
|
let current: ElementNode | ElementText | TextNode | undefined = node;
|
|
332
392
|
while (current && isNodeAtPosition(current, px, py)) {
|
|
333
393
|
result.push(current as TElement);
|
|
@@ -360,9 +420,16 @@ export function useMouse<TApp extends ElementNode = ElementNode>(
|
|
|
360
420
|
const pressedElementRef: { current: ElementNode | null } = { current: null };
|
|
361
421
|
const customStates = options?.customStates;
|
|
362
422
|
const hoverState = customStates?.hoverState;
|
|
363
|
-
const
|
|
423
|
+
const respectClipping = options?.respectClipping ?? false;
|
|
424
|
+
const handleClick = createHandleClick(
|
|
425
|
+
myApp,
|
|
426
|
+
respectClipping,
|
|
427
|
+
customStates,
|
|
428
|
+
pressedElementRef,
|
|
429
|
+
);
|
|
364
430
|
const handleMouseDown = createHandleMouseDown(
|
|
365
431
|
myApp,
|
|
432
|
+
respectClipping,
|
|
366
433
|
customStates,
|
|
367
434
|
pressedElementRef,
|
|
368
435
|
);
|
|
@@ -382,7 +449,7 @@ export function useMouse<TApp extends ElementNode = ElementNode>(
|
|
|
382
449
|
createEffect(() => {
|
|
383
450
|
if (!scheduled()) return;
|
|
384
451
|
|
|
385
|
-
const path = getChildrenByPosition(myApp, pos.x, pos.y);
|
|
452
|
+
const path = getChildrenByPosition(myApp, pos.x, pos.y, respectClipping);
|
|
386
453
|
let activeElm: ElementNode | undefined;
|
|
387
454
|
for (let i = path.length - 1; i >= 0; i--) {
|
|
388
455
|
const el = path[i]!;
|
|
@@ -129,6 +129,25 @@ type NavWithTransitionCache = lngp.NavigableElement & {
|
|
|
129
129
|
_navLastMerged?: object;
|
|
130
130
|
};
|
|
131
131
|
|
|
132
|
+
type TransitionObject = Exclude<
|
|
133
|
+
lng.ElementNode['transition'],
|
|
134
|
+
boolean | undefined
|
|
135
|
+
>;
|
|
136
|
+
|
|
137
|
+
// The base when `transition` is not an object (unset, true or false).
|
|
138
|
+
const noTransition = {};
|
|
139
|
+
// Merged transitions per element, then per directional transition. A press
|
|
140
|
+
// reuses the merged object for its direction instead of allocating one, so
|
|
141
|
+
// the node's `transition` (and the settings object animateProp gets) stays
|
|
142
|
+
// the same while the direction and the base do. Per element, so an in-place
|
|
143
|
+
// edit of one Row's `transition` never reaches another Row; the cache is
|
|
144
|
+
// rebuilt when the element's base `transition` object changes (an in-place
|
|
145
|
+
// edit of the same base object is not picked up: assign a new object).
|
|
146
|
+
const mergedTransitions = new WeakMap<
|
|
147
|
+
object,
|
|
148
|
+
WeakMap<object, TransitionObject>
|
|
149
|
+
>();
|
|
150
|
+
|
|
132
151
|
export function handleNavigation(
|
|
133
152
|
direction: 'up' | 'right' | 'down' | 'left',
|
|
134
153
|
): lng.KeyHandler {
|
|
@@ -144,19 +163,34 @@ export function handleNavigation(
|
|
|
144
163
|
: el.transitionRight;
|
|
145
164
|
|
|
146
165
|
if (directional) {
|
|
166
|
+
const transition = el.transition;
|
|
147
167
|
const current =
|
|
148
|
-
typeof
|
|
149
|
-
?
|
|
150
|
-
:
|
|
168
|
+
typeof transition === 'object' && transition !== null
|
|
169
|
+
? transition
|
|
170
|
+
: noTransition;
|
|
151
171
|
|
|
152
172
|
// Re-snapshot the developer-supplied transition whenever el.transition
|
|
153
173
|
// doesn't match our last merge — that means it was set externally
|
|
154
|
-
// (initial render or a reactive update), not by this handler
|
|
155
|
-
|
|
174
|
+
// (initial render or a reactive update), not by this handler — and it
|
|
175
|
+
// is not the base the cache was built from.
|
|
176
|
+
let byDirectional = mergedTransitions.get(el);
|
|
177
|
+
if (
|
|
178
|
+
current !== el._navLastMerged &&
|
|
179
|
+
(current !== el._navBaseTransition || byDirectional === undefined)
|
|
180
|
+
) {
|
|
156
181
|
el._navBaseTransition = current;
|
|
182
|
+
byDirectional = new WeakMap();
|
|
183
|
+
mergedTransitions.set(el, byDirectional);
|
|
157
184
|
}
|
|
158
185
|
|
|
159
|
-
|
|
186
|
+
let merged = byDirectional!.get(directional as object);
|
|
187
|
+
if (merged === undefined) {
|
|
188
|
+
merged = {
|
|
189
|
+
...(directional as object),
|
|
190
|
+
...el._navBaseTransition,
|
|
191
|
+
} as TransitionObject;
|
|
192
|
+
byDirectional!.set(directional as object, merged);
|
|
193
|
+
}
|
|
160
194
|
el.transition = merged;
|
|
161
195
|
el._navLastMerged = merged;
|
|
162
196
|
}
|
|
@@ -93,8 +93,9 @@ export function withScrolling(isRow: boolean): Scroller {
|
|
|
93
93
|
let endOffset = componentRef.endOffset;
|
|
94
94
|
let screenOffset = componentRef._screenOffset;
|
|
95
95
|
if (screenOffset === undefined) {
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
// A Row/Column with no parent (a root) has no clipping parent.
|
|
97
|
+
const p = componentRef.parent;
|
|
98
|
+
if (p !== undefined && p !== null && p.clipping) {
|
|
98
99
|
endOffset =
|
|
99
100
|
endOffset ??
|
|
100
101
|
screenSize - ((isRow ? p.absX : p.absY) || 0) - p[dimension];
|
package/src/solidOpts.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import {
|
|
2
|
-
assertTruthy,
|
|
3
2
|
isElementText,
|
|
4
3
|
ElementNode,
|
|
5
4
|
TextNode,
|
|
@@ -21,8 +20,10 @@ export default {
|
|
|
21
20
|
log('Replace Text: ', node, value);
|
|
22
21
|
node.text = value;
|
|
23
22
|
const parent = node.parent;
|
|
24
|
-
|
|
25
|
-
parent
|
|
23
|
+
// A text node never inserted has no parent.
|
|
24
|
+
if (parent !== undefined) {
|
|
25
|
+
parent.text = parent.getText();
|
|
26
|
+
}
|
|
26
27
|
},
|
|
27
28
|
setProperty(node: ElementNode, name: string, value: any): void {
|
|
28
29
|
node[name] = value;
|
|
@@ -35,7 +36,12 @@ export default {
|
|
|
35
36
|
|
|
36
37
|
if (node instanceof ElementNode) {
|
|
37
38
|
if (node.parent!.rendered) {
|
|
39
|
+
const wasRendered = node.rendered;
|
|
38
40
|
node.render(true);
|
|
41
|
+
// render() appended the new renderer node: place it (B19).
|
|
42
|
+
if (!wasRendered && anchor && node.rendered) {
|
|
43
|
+
parent._drawInOrder(node);
|
|
44
|
+
}
|
|
39
45
|
}
|
|
40
46
|
if (prevParent !== undefined) {
|
|
41
47
|
enqueueDelete(node, 1);
|
|
@@ -67,11 +73,20 @@ export default {
|
|
|
67
73
|
return node.children[0];
|
|
68
74
|
},
|
|
69
75
|
getNextSibling(node: SolidNode): SolidNode | undefined {
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
if (
|
|
73
|
-
|
|
76
|
+
const parent = node.parent;
|
|
77
|
+
// A removed node keeps its parent link, but has no sibling there.
|
|
78
|
+
if (
|
|
79
|
+
parent === undefined ||
|
|
80
|
+
(node instanceof ElementNode && node._detached)
|
|
81
|
+
) {
|
|
82
|
+
return undefined;
|
|
83
|
+
}
|
|
84
|
+
// From the end: Solid asks for the sibling after a list's last item.
|
|
85
|
+
const children = parent.children as SolidNode[];
|
|
86
|
+
let i = children.length - 1;
|
|
87
|
+
while (i >= 0 && children[i] !== node) {
|
|
88
|
+
i--;
|
|
74
89
|
}
|
|
75
|
-
return undefined;
|
|
90
|
+
return i >= 0 ? children[i + 1] : undefined;
|
|
76
91
|
},
|
|
77
92
|
} satisfies SolidRendererOptions;
|
package/dist/src/core/flex.d.ts
DELETED