Keep preview tiles from reflowing
@@ -187,8 +187,8 @@
187
187
- animateRect(el, fromRect, toRect, opts) - Helper that animates element rectangle (left/top/width/height) for expand/collapse transitions.
188
188
- openExpandedTilePreview(item, tileEl, sourceSvgEl, blob, objectUrl) - Reparents the real file tile to body, expands it to viewport preview, injects close/download controls.
189
189
- openExpandedTilePreview(item, tileEl, sourceSvgEl, blob, objectUrl) - Reparents tile to body, shows spinner during expand animation, renders content after animation; applies file-type accent colour to tile border and outline glow.
190
- openExpandedTilePreview(item, tileEl, sourceSvgEl, loadPreviewContent) - Adds preview action buttons for Download and Share; Share opens the same modal flow as sidebar sharing.
191
- closeExpandedTilePreview() - Collapses expanded tile preview back to original grid position and restores original icon markup.
190
- openExpandedTilePreview(item, tileEl, sourceSvgEl, loadPreviewContent) - Preserves the tile's original grid slot with a hidden placeholder while preview is open, then adds preview action buttons for Download and Share.
191
- closeExpandedTilePreview() - Collapses expanded tile preview back to the original grid slot, restores original icon markup, and removes the preview placeholder.
192
192
- closePreview() - Closes either expanded-tile preview or overlay preview, then revokes active preview object URL.
193
193
- closePreview() - Closes expanded-tile preview and revokes active preview object URL.
194
194
- openMovePicker(item) - Opens Move To selector modal with expandable folder tree across all writable roots and executes /api/files/move.
@@ -187,8 +187,8 @@187
- animateRect(el, fromRect, toRect, opts) - Helper that animates element rectangle (left/top/width/height) for expand/collapse transitions.
187
- animateRect(el, fromRect, toRect, opts) - Helper that animates element rectangle (left/top/width/height) for expand/collapse transitions.
188
- openExpandedTilePreview(item, tileEl, sourceSvgEl, blob, objectUrl) - Reparents the real file tile to body, expands it to viewport preview, injects close/download controls.
188
- openExpandedTilePreview(item, tileEl, sourceSvgEl, blob, objectUrl) - Reparents the real file tile to body, expands it to viewport preview, injects close/download controls.
189
- openExpandedTilePreview(item, tileEl, sourceSvgEl, blob, objectUrl) - Reparents tile to body, shows spinner during expand animation, renders content after animation; applies file-type accent colour to tile border and outline glow.
189
- openExpandedTilePreview(item, tileEl, sourceSvgEl, blob, objectUrl) - Reparents tile to body, shows spinner during expand animation, renders content after animation; applies file-type accent colour to tile border and outline glow.
190
- openExpandedTilePreview(item, tileEl, sourceSvgEl, loadPreviewContent) - Adds preview action buttons for Download and Share; Share opens the same modal flow as sidebar sharing.
190
- openExpandedTilePreview(item, tileEl, sourceSvgEl, loadPreviewContent) - Preserves the tile's original grid slot with a hidden placeholder while preview is open, then adds preview action buttons for Download and Share.
191
- closeExpandedTilePreview() - Collapses expanded tile preview back to original grid position and restores original icon markup.
191
- closeExpandedTilePreview() - Collapses expanded tile preview back to the original grid slot, restores original icon markup, and removes the preview placeholder.
192
- closePreview() - Closes either expanded-tile preview or overlay preview, then revokes active preview object URL.
192
- closePreview() - Closes either expanded-tile preview or overlay preview, then revokes active preview object URL.
193
- closePreview() - Closes expanded-tile preview and revokes active preview object URL.
193
- closePreview() - Closes expanded-tile preview and revokes active preview object URL.
194
- openMovePicker(item) - Opens Move To selector modal with expandable folder tree across all writable roots and executes /api/files/move.
194
- openMovePicker(item) - Opens Move To selector modal with expandable folder tree across all writable roots and executes /api/files/move.
@@ -52,6 +52,7 @@
52
52
53
53
## `test/page.load.test.js`
54
54
- `page load smoke test`
55
- `expanded file preview keeps the surrounding tiles in place`
55
56
56
57
---
57
58
@@ -52,6 +52,7 @@52
52
53
## `test/page.load.test.js`53
## `test/page.load.test.js`54
- `page load smoke test`54
- `page load smoke test`55
- `expanded file preview keeps the surrounding tiles in place`55
56
56
---57
---57
58
@@ -3152,6 +3152,15 @@ async function openExpandedTilePreview (item, tileEl, sourceSvgEl, loadPreviewCo
3152
3152
const nextSibling = tileEl.nextSibling;
3153
3153
const iconHtml = iconEl.innerHTML;
3154
3154
const originalIconSvg = iconEl.querySelector('svg');
3155
const placeholder = document.createElement('div');
3156
placeholder.className = 'file-item file-item--preview-placeholder';
3157
placeholder.style.width = `${startRect.width}px`;
3158
placeholder.style.height = `${startRect.height}px`;
3159
3160
if (parent)
3161
{
3162
parent.insertBefore(placeholder, tileEl);
3163
}
3155
3164
3156
3165
tileEl.remove();
3157
3166
document.body.appendChild(tileEl);
@@ -3245,6 +3254,7 @@ async function openExpandedTilePreview (item, tileEl, sourceSvgEl, loadPreviewCo
3245
3254
iconHtml,
3246
3255
nameEl,
3247
3256
backdrop,
3257
placeholder,
3248
3258
closeBtn,
3249
3259
dlBtn,
3250
3260
shareBtn,
@@ -3317,7 +3327,11 @@ async function closeExpandedTilePreview ()
3317
3327
if (st.iconEl) st.iconEl.innerHTML = st.iconHtml;
3318
3328
if (st.nameEl) st.nameEl.style.display = '';
3319
3329
3320
if (st.parent)
3330
if (st.placeholder && st.placeholder.parentNode)
3331
{
3332
st.placeholder.parentNode.insertBefore(st.tileEl, st.placeholder);
3333
st.placeholder.remove();
3334
} else if (st.parent)
3321
3335
{
3322
3336
if (st.nextSibling && st.nextSibling.parentNode === st.parent)
3323
3337
{
@@ -3152,6 +3152,15 @@ async function openExpandedTilePreview (item, tileEl, sourceSvgEl, loadPreviewCo3152
const nextSibling = tileEl.nextSibling;3152
const nextSibling = tileEl.nextSibling;3153
const iconHtml = iconEl.innerHTML;3153
const iconHtml = iconEl.innerHTML;3154
const originalIconSvg = iconEl.querySelector('svg');3154
const originalIconSvg = iconEl.querySelector('svg');3155
const placeholder = document.createElement('div');3156
placeholder.className = 'file-item file-item--preview-placeholder';3157
placeholder.style.width = `${startRect.width}px`;3158
placeholder.style.height = `${startRect.height}px`;3159
3160
if (parent)3161
{3162
parent.insertBefore(placeholder, tileEl);3163
}3155
3164
3156
tileEl.remove();3165
tileEl.remove();3157
document.body.appendChild(tileEl);3166
document.body.appendChild(tileEl);@@ -3245,6 +3254,7 @@ async function openExpandedTilePreview (item, tileEl, sourceSvgEl, loadPreviewCo3245
iconHtml,3254
iconHtml,3246
nameEl,3255
nameEl,3247
backdrop,3256
backdrop,3257
placeholder,3248
closeBtn,3258
closeBtn,3249
dlBtn,3259
dlBtn,3250
shareBtn,3260
shareBtn,@@ -3317,7 +3327,11 @@ async function closeExpandedTilePreview ()3317
if (st.iconEl) st.iconEl.innerHTML = st.iconHtml;3327
if (st.iconEl) st.iconEl.innerHTML = st.iconHtml;3318
if (st.nameEl) st.nameEl.style.display = '';3328
if (st.nameEl) st.nameEl.style.display = '';3319
3329
3320
if (st.parent)3330
if (st.placeholder && st.placeholder.parentNode)3331
{3332
st.placeholder.parentNode.insertBefore(st.tileEl, st.placeholder);3333
st.placeholder.remove();3334
} else if (st.parent)3321
{3335
{3322
if (st.nextSibling && st.nextSibling.parentNode === st.parent)3336
if (st.nextSibling && st.nextSibling.parentNode === st.parent)3323
{3337
{@@ -298,6 +298,11 @@ button.danger:hover {
298
298
border-color: var(--border);
299
299
}
300
300
301
.file-item.file-item--preview-placeholder {
302
visibility: hidden;
303
pointer-events: none;
304
}
305
301
306
.file-item.selected {
302
307
background: var(--surface2);
303
308
border-color: var(--accent);
@@ -298,6 +298,11 @@ button.danger:hover {298
border-color: var(--border);
298
border-color: var(--border);
299
}
299
}
300
300
301
.file-item.file-item--preview-placeholder {
302
visibility: hidden;
303
pointer-events: none;
304
}
305
301
.file-item.selected {
306
.file-item.selected {
302
background: var(--surface2);
307
background: var(--surface2);
303
border-color: var(--accent);
308
border-color: var(--accent);
@@ -1047,6 +1047,48 @@ describe('page load smoke test', () =>
1047
1047
dom.window.close();
1048
1048
});
1049
1049
1050
test('expanded file preview keeps the surrounding tiles in place', async () =>
1051
{
1052
listFixture['/data'] = [
1053
{
1054
name: 'alpha.txt',
1055
path: '/data/alpha.txt',
1056
isDir: false,
1057
size: 12,
1058
mtime: Date.now(),
1059
},
1060
{
1061
name: 'beta.txt',
1062
path: '/data/beta.txt',
1063
isDir: false,
1064
size: 12,
1065
mtime: Date.now(),
1066
},
1067
];
1068
downloadFixture['/data/alpha.txt'] = {
1069
type: 'text/plain',
1070
body: 'hello preview',
1071
};
1072
1073
const { dom, runtimeErrors } = await bootClient();
1074
expect(runtimeErrors).toEqual([]);
1075
1076
await waitFor(dom, () => !!dom.window.document.querySelector('.file-item[data-path="/data/alpha.txt"]'));
1077
1078
const firstTile = dom.window.document.querySelector('.file-item[data-path="/data/alpha.txt"]');
1079
firstTile.dispatchEvent(new dom.window.MouseEvent('dblclick', { bubbles: true }));
1080
1081
await waitFor(dom, () => !!dom.window.document.querySelector('.file-item--preview'));
1082
1083
const grid = dom.window.document.getElementById('file-grid');
1084
expect(grid.children.length).toBe(2);
1085
expect(grid.children[0].classList.contains('file-item--preview-placeholder')).toBe(true);
1086
expect(grid.children[1].dataset.path).toBe('/data/beta.txt');
1087
expect(dom.window.document.body.querySelector('.file-item--preview')).toBeTruthy();
1088
1089
dom.window.close();
1090
});
1091
1050
1092
test('expanded video preview uses a stream session and video.js', async () =>
1051
1093
{
1052
1094
listFixture['/data'] = [
@@ -1047,6 +1047,48 @@ describe('page load smoke test', () =>1047
dom.window.close();
1047
dom.window.close();
1048
});
1048
});
1049
1049
1050
test('expanded file preview keeps the surrounding tiles in place', async () =>
1051
{
1052
listFixture['/data'] = [
1053
{
1054
name: 'alpha.txt',
1055
path: '/data/alpha.txt',
1056
isDir: false,
1057
size: 12,
1058
mtime: Date.now(),
1059
},
1060
{
1061
name: 'beta.txt',
1062
path: '/data/beta.txt',
1063
isDir: false,
1064
size: 12,
1065
mtime: Date.now(),
1066
},
1067
];
1068
downloadFixture['/data/alpha.txt'] = {
1069
type: 'text/plain',
1070
body: 'hello preview',
1071
};
1072
1073
const { dom, runtimeErrors } = await bootClient();
1074
expect(runtimeErrors).toEqual([]);
1075
1076
await waitFor(dom, () => !!dom.window.document.querySelector('.file-item[data-path="/data/alpha.txt"]'));
1077
1078
const firstTile = dom.window.document.querySelector('.file-item[data-path="/data/alpha.txt"]');
1079
firstTile.dispatchEvent(new dom.window.MouseEvent('dblclick', { bubbles: true }));
1080
1081
await waitFor(dom, () => !!dom.window.document.querySelector('.file-item--preview'));
1082
1083
const grid = dom.window.document.getElementById('file-grid');
1084
expect(grid.children.length).toBe(2);
1085
expect(grid.children[0].classList.contains('file-item--preview-placeholder')).toBe(true);
1086
expect(grid.children[1].dataset.path).toBe('/data/beta.txt');
1087
expect(dom.window.document.body.querySelector('.file-item--preview')).toBeTruthy();
1088
1089
dom.window.close();
1090
});
1091
1050
test('expanded video preview uses a stream session and video.js', async () =>
1092
test('expanded video preview uses a stream session and video.js', async () =>
1051
{
1093
{
1052
listFixture['/data'] = [
1094
listFixture['/data'] = [