@solidtv/solid 1.7.2 → 1.7.3
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/dist/src/core/dom-renderer/domRenderer.js +7 -1
- package/dist/src/core/dom-renderer/domRenderer.js.map +1 -1
- package/dist/src/primitives/Virtual.jsx +5 -1
- package/dist/src/primitives/Virtual.jsx.map +1 -1
- package/dist/src/primitives/VirtualGrid.jsx +6 -2
- package/dist/src/primitives/VirtualGrid.jsx.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/core/dom-renderer/domRenderer.ts +6 -1
- package/src/primitives/Virtual.tsx +7 -1
- package/src/primitives/VirtualGrid.tsx +6 -2
package/package.json
CHANGED
|
@@ -334,7 +334,12 @@ function updateNodeStyles(node: DOMNode | DOMText) {
|
|
|
334
334
|
|
|
335
335
|
if (props.alpha !== 1) style += `opacity: ${props.alpha};`;
|
|
336
336
|
|
|
337
|
-
if (props.clipping) {
|
|
337
|
+
if (Array.isArray(props.clipping)) {
|
|
338
|
+
// [top, right, bottom, left] margins grow the clip box past the node's
|
|
339
|
+
// bounds, as in the WebGL renderer. Legacy `clip` (every node is absolute)
|
|
340
|
+
const [t, r, b, l] = props.clipping;
|
|
341
|
+
style += `clip: rect(${-t}px, ${props.w + r}px, ${props.h + b}px, ${-l}px);`;
|
|
342
|
+
} else if (props.clipping) {
|
|
338
343
|
style += `overflow: hidden;`;
|
|
339
344
|
}
|
|
340
345
|
|
|
@@ -147,7 +147,13 @@ function createVirtual<T>(
|
|
|
147
147
|
const total = itemCount();
|
|
148
148
|
if (total === 0) return applySlice(0, noItems, 0, delta, 0, true, 0);
|
|
149
149
|
|
|
150
|
-
|
|
150
|
+
// Everything is mounted and the row does not scroll. Not for auto without
|
|
151
|
+
// wrap at exactly displaySize items: there, as for a longer list, the
|
|
152
|
+
// last item ends one slot short of displaySize, so the row scrolls.
|
|
153
|
+
if (
|
|
154
|
+
total < props.displaySize ||
|
|
155
|
+
(total === props.displaySize && (props.wrap || scrollType() !== 'auto'))
|
|
156
|
+
) {
|
|
151
157
|
const clamped = utils.clamp(c, 0, total - 1);
|
|
152
158
|
return applySlice(
|
|
153
159
|
0,
|
|
@@ -121,6 +121,10 @@ export function VirtualGrid<T>(props: VirtualGridProps<T>): s.JSX.Element {
|
|
|
121
121
|
setCursor(prevStart + idx);
|
|
122
122
|
if (newRowIndex === prevRowIndex) return;
|
|
123
123
|
|
|
124
|
+
// Read before the window changes: the post-mutation flex pass can run
|
|
125
|
+
// before applyShift, and active.y read there is already the new layout,
|
|
126
|
+
// so the rows jumped a row instead of animating once the window slid.
|
|
127
|
+
shiftPrevRowY = this.y + active.y;
|
|
124
128
|
setSlice(items().slice(start(), end()));
|
|
125
129
|
|
|
126
130
|
// this.selected is relative to the slice
|
|
@@ -149,14 +153,14 @@ export function VirtualGrid<T>(props: VirtualGridProps<T>): s.JSX.Element {
|
|
|
149
153
|
let shiftActive!: lng.ElementNode;
|
|
150
154
|
let shiftIdx = 0;
|
|
151
155
|
let shiftLastIdx: number | undefined;
|
|
156
|
+
let shiftPrevRowY = 0;
|
|
152
157
|
function applyShift() {
|
|
153
158
|
const view = shiftView;
|
|
154
159
|
const active = shiftActive;
|
|
155
|
-
const prevRowY = view.y + active.y;
|
|
156
160
|
// One flex pass per window shift: lay out here only if the post-mutation
|
|
157
161
|
// layout has not already run since the window changed.
|
|
158
162
|
if (layoutPending) view.updateLayout();
|
|
159
|
-
view.lng.y =
|
|
163
|
+
view.lng.y = shiftPrevRowY - active.y;
|
|
160
164
|
columnScroll(shiftIdx, view, active, shiftLastIdx);
|
|
161
165
|
}
|
|
162
166
|
|