Skip to content

Beautiful, AI-native markdown IDE and LLM wiki

Stack every cell of the frozen table row (PRD-9328) (#6199)

Andrew Mikofalvy06729d079a16
diff --git a/knip.config.ts b/knip.config.ts
index 69344114d..0004a763a 100644
--- a/knip.config.ts
+++ b/knip.config.ts
@@ -149,11 +149,15 @@ export default {
'packages/server': {
entry: ['src/**/*.test.ts', 'src/parse-worker.ts'],
project: 'src/**',
- ignoreDependencies: ['@types/shell-quote'],
+ ignoreDependencies: [
+ '@types/shell-quote',
+ ],
},
'packages/cli': {
entry: ['src/**/*.test.ts', 'scripts/*.ts', 'tests/**/*.ts', 'src/parse-worker.ts'],
- ignoreDependencies: ['yjs'],
+ ignoreDependencies: [
+ 'yjs',
+ ],
},
'packages/desktop': {
entry: [
diff --git a/packages/app/src/globals.css b/packages/app/src/globals.css
index 76a5d0d2e..61af6dea9 100644
--- a/packages/app/src/globals.css
+++ b/packages/app/src/globals.css
@@ -2421,14 +2421,19 @@
background-color: var(--background);
}
-/* The header row stacks above body rows at every scroll position. The freeze
- translates it with a compositor-driven animation; a stacking flip at the
- freeze boundary would land on the main thread, frames behind the transform,
- leaving body rows painted over the moving header during a fast scroll. */
-.ProseMirror .tableWrapper > table > tbody > tr:first-child > th {
+/* A first row holding any th is the row the freeze translates, every cell of
+ it, so it stacks above body rows at every scroll position. The freeze moves
+ it with a compositor-driven animation; a stacking flip at the freeze boundary
+ would land on the main thread, frames behind the transform, leaving body rows
+ painted over the moving row during a fast scroll. */
+.ProseMirror .tableWrapper > table > tbody > tr:first-child:has(> th) > :is(th, td) {
z-index: 2;
}
+.ProseMirror .tableWrapper > table > tbody > tr:first-child:has(> th) > td {
+ background-color: var(--background);
+}
+
/* First-column header cells in body rows (header-column tables) sit above the
sticky body column. */
.ProseMirror .tableWrapper > table > tbody > tr > th:first-child {
@@ -2436,20 +2441,20 @@
z-index: 3;
}
-/* A header cell's resize handle overhangs its right border; raise the cell
- holding it so the next header cell does not cover the overhang. */
+/* A frozen-row cell's resize handle overhangs its right border; raise the cell
+ holding it so the next cell in that row does not cover the overhang. */
.ProseMirror
.tableWrapper
> table
> tbody
- > tr:first-child
- > th:not(:first-child):has(> .column-resize-handle) {
+ > tr:first-child:has(> th)
+ > :is(th, td):not(:first-child):has(> .column-resize-handle) {
z-index: 3;
}
-/* Corner cell (first column + header row) clears the header row, a raised
+/* Corner cell (first column + frozen row) clears the frozen row, a raised
resize-handle cell and the sticky column, frozen or not. */
-.ProseMirror .tableWrapper > table > tbody > tr:first-child > th:first-child {
+.ProseMirror .tableWrapper > table > tbody > tr:first-child:has(> th) > :is(th, td):first-child {
z-index: 4;
}
@@ -2464,7 +2469,7 @@
±1px horizontal overlap closes the seams over collapsed cell borders.
height must stay >= TOOLBAR_HEIGHT (56px, frozen-table-headers.ts) so the
block spans the whole toolbar-fade slot; 80px adds margin. */
-.ProseMirror .tableWrapper > table > tbody > tr:first-child > th::before {
+.ProseMirror .tableWrapper > table > tbody > tr:first-child:has(> th) > :is(th, td)::before {
content: "";
position: absolute;
left: -1px;
@@ -2481,12 +2486,15 @@
header mid-table; !important author declarations override animation
effects in the cascade, so these win over the fills. */
@media print {
- .ProseMirror .tableWrapper > table > tbody > tr:first-child > th {
- transform: none;
- box-shadow: none;
- }
- .ProseMirror .tableWrapper > table > tbody > tr:first-child > th::before {
- opacity: 0;
+ .ProseMirror .tableWrapper > table > tbody > tr:first-child:has(> th) > :is(th, td) {
+ /* biome-ignore lint/complexity/noImportantStyles: the freeze holds transform in a WAAPI fill, which outranks every normal author declaration. */
+ transform: none !important;
+ /* biome-ignore lint/complexity/noImportantStyles: same WAAPI fill override as `transform` above. */
+ box-shadow: none !important;
+ }
+ .ProseMirror .tableWrapper > table > tbody > tr:first-child:has(> th) > :is(th, td)::before {
+ /* biome-ignore lint/complexity/noImportantStyles: the occluder's opacity is held in a WAAPI fill on ::before. */
+ opacity: 0 !important;
}
}
diff --git a/packages/app/tests/integration/bug3-source-mode-writeback.test.ts b/packages/app/tests/integration/bug3-source-mode-writeback.test.ts
index a50b00123..4549c74b3 100644
--- a/packages/app/tests/integration/bug3-source-mode-writeback.test.ts
+++ b/packages/app/tests/integration/bug3-source-mode-writeback.test.ts
@@ -1,3 +1,4 @@
+
import { readFileSync } from 'node:fs';
import { join } from 'node:path';
import { setTimeout as wait } from 'node:timers/promises';
diff --git a/packages/app/tests/integration/indented-jsx-byte-sacred.test.ts b/packages/app/tests/integration/indented-jsx-byte-sacred.test.ts
index 6fcdc23f2..4fc2c11f9 100644
--- a/packages/app/tests/integration/indented-jsx-byte-sacred.test.ts
+++ b/packages/app/tests/integration/indented-jsx-byte-sacred.test.ts
@@ -1,3 +1,4 @@
+
import { setTimeout as wait } from 'node:timers/promises';
import { normalizeBridge } from '@inkeep/open-knowledge-core';
import { updateYFragment } from '@tiptap/y-tiptap';
diff --git a/packages/app/tests/integration/interior-edit-freshness.test.ts b/packages/app/tests/integration/interior-edit-freshness.test.ts
index 40b5cdfd6..9f2f6feb6 100644
--- a/packages/app/tests/integration/interior-edit-freshness.test.ts
+++ b/packages/app/tests/integration/interior-edit-freshness.test.ts
@@ -1,3 +1,4 @@
+
import { setTimeout as wait } from 'node:timers/promises';
import { updateYFragment, yXmlFragmentToProseMirrorRootNode } from '@tiptap/y-tiptap';
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
diff --git a/packages/app/tests/integration/keystroke-cadence-danger-space.test.ts b/packages/app/tests/integration/keystroke-cadence-danger-space.test.ts
index 93666af70..2a085742b 100644
--- a/packages/app/tests/integration/keystroke-cadence-danger-space.test.ts
+++ b/packages/app/tests/integration/keystroke-cadence-danger-space.test.ts
@@ -1,3 +1,4 @@
+
import { setTimeout as wait } from 'node:timers/promises';
import { updateYFragment, yXmlFragmentToProseMirrorRootNode } from '@tiptap/y-tiptap';
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
diff --git a/packages/app/tests/integration/producer-guard-wiring.test.ts b/packages/app/tests/integration/producer-guard-wiring.test.ts
index 867598d34..878d5196b 100644
--- a/packages/app/tests/integration/producer-guard-wiring.test.ts
+++ b/packages/app/tests/integration/producer-guard-wiring.test.ts
@@ -1,3 +1,4 @@
+
import { setTimeout as wait } from 'node:timers/promises';
import { updateYFragment, yXmlFragmentToProseMirrorRootNode } from '@tiptap/y-tiptap';
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
diff --git a/packages/app/tests/integration/qa-039-reconciliation-counters-http.test.ts b/packages/app/tests/integration/qa-039-reconciliation-counters-http.test.ts
index 0970ac12f..4ada3cf26 100644
--- a/packages/app/tests/integration/qa-039-reconciliation-counters-http.test.ts
+++ b/packages/app/tests/integration/qa-039-reconciliation-counters-http.test.ts
@@ -1,3 +1,4 @@
+
import { randomUUID } from 'node:crypto';
import { afterEach, describe, expect, test } from 'vitest';
import { agentWriteMd, createTestServer, type TestServer } from './test-harness';
diff --git a/packages/app/tests/integration/qa-045-restore-after-gc.test.ts b/packages/app/tests/integration/qa-045-restore-after-gc.test.ts
index b632185e1..cbe2b705f 100644
--- a/packages/app/tests/integration/qa-045-restore-after-gc.test.ts
+++ b/packages/app/tests/integration/qa-045-restore-after-gc.test.ts
@@ -1,3 +1,4 @@
+
import { execFileSync } from 'node:child_process';
import { randomUUID } from 'node:crypto';
import { join } from 'node:path';
diff --git a/packages/app/tests/integration/qa-050-rollback-undo-shipped-path.test.ts b/packages/app/tests/integration/qa-050-rollback-undo-shipped-path.test.ts
index c530ce4ba..89bc9b4d9 100644
--- a/packages/app/tests/integration/qa-050-rollback-undo-shipped-path.test.ts
+++ b/packages/app/tests/integration/qa-050-rollback-undo-shipped-path.test.ts
@@ -1,3 +1,4 @@
+
import { randomUUID } from 'node:crypto';
import { afterAll, afterEach, beforeAll, describe, expect, test } from 'vitest';
import type * as Y from 'yjs';
diff --git a/packages/app/tests/integration/undo-after-rollback.test.ts b/packages/app/tests/integration/undo-after-rollback.test.ts
index d3767adc9..a78aeb0e4 100644
--- a/packages/app/tests/integration/undo-after-rollback.test.ts
+++ b/packages/app/tests/integration/undo-after-rollback.test.ts
@@ -1,3 +1,4 @@
+
import { ROLLBACK_ORIGIN } from '@inkeep/open-knowledge-server';
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
import * as Y from 'yjs';
diff --git a/packages/app/tests/integration/undo-recycle-reset.test.ts b/packages/app/tests/integration/undo-recycle-reset.test.ts
index b076f955c..e7cc69c3f 100644
--- a/packages/app/tests/integration/undo-recycle-reset.test.ts
+++ b/packages/app/tests/integration/undo-recycle-reset.test.ts
@@ -1,3 +1,4 @@
+
import { writeFileSync } from 'node:fs';
import { join } from 'node:path';
import { setTimeout as wait } from 'node:timers/promises';
diff --git a/packages/app/tests/integration/undo-rederive-survival.test.ts b/packages/app/tests/integration/undo-rederive-survival.test.ts
index 7935e35f8..9ddcd0730 100644
--- a/packages/app/tests/integration/undo-rederive-survival.test.ts
+++ b/packages/app/tests/integration/undo-rederive-survival.test.ts
@@ -1,3 +1,4 @@
+
import { prependFrontmatter } from '@inkeep/open-knowledge-core';
import { Plugin, PluginKey } from '@tiptap/pm/state';
import { updateYFragment, yXmlFragmentToProseMirrorRootNode } from '@tiptap/y-tiptap';
diff --git a/packages/app/tests/stress/frozen-table-headers.e2e.ts b/packages/app/tests/stress/frozen-table-headers.e2e.ts
index 8daebe441..faf93d388 100644
--- a/packages/app/tests/stress/frozen-table-headers.e2e.ts
+++ b/packages/app/tests/stress/frozen-table-headers.e2e.ts
@@ -337,6 +337,42 @@ test('no freeze before the table reaches the toolbar', async ({
};
});
expect(resizeStacking).toEqual({ handleInHovered: true, hoveredZ: '3', nextZ: '2' });
+ const mixedRowStacking = await page.evaluate(() => {
+ const host = document.createElement('div');
+ host.className = 'ProseMirror';
+ host.innerHTML =
+ '<div class="tableWrapper"><table><tbody>' +
+ '<tr><th>a</th><td>b<div class="column-resize-handle"></div></td><td>c</td></tr>' +
+ '<tr><th>d</th><td>e</td><td>f</td></tr>' +
+ '</tbody></table></div>' +
+ '<div class="tableWrapper"><table><tbody>' +
+ '<tr><td>g</td><td>h</td></tr><tr><td>i</td><td>j</td></tr>' +
+ '</tbody></table></div>';
+ document.body.append(host);
+ const z = (el: Element | null | undefined) => (el ? getComputedStyle(el).zIndex : 'missing');
+ const [mixed, plain] = Array.from(host.querySelectorAll('table'));
+ const result = {
+ mixedCorner: z(mixed.rows[0].cells[0]),
+ mixedHandleCell: z(mixed.rows[0].cells[1]),
+ mixedFrozenTd: z(mixed.rows[0].cells[2]),
+ mixedBodyTd: z(mixed.rows[1].cells[2]),
+ mixedFrozenTdOccluder: getComputedStyle(mixed.rows[0].cells[2], '::before').content,
+ mixedFrozenTdBackground: getComputedStyle(mixed.rows[0].cells[2]).backgroundColor,
+ plainFirstRowTd: z(plain.rows[0].cells[1]),
+ };
+ host.remove();
+ return result;
+ });
+ const { mixedFrozenTdBackground, ...mixedStacking } = mixedRowStacking;
+ expect(mixedStacking).toEqual({
+ mixedCorner: '4',
+ mixedHandleCell: '3',
+ mixedFrozenTd: '2',
+ mixedBodyTd: 'auto',
+ mixedFrozenTdOccluder: '""',
+ plainFirstRowTd: 'auto',
+ });
+ expect(mixedFrozenTdBackground).not.toBe('rgba(0, 0, 0, 0)');
await page.screenshot({ path: testInfo.outputPath('unscrolled.png') });
});
@@ -364,6 +400,18 @@ test('header row pins below the toolbar on mid-table scroll', async ({
expect(occluder.opacity).toBe('1');
expect(occluder.height).toBeGreaterThanOrEqual(56);
expect(await scanSlotPixels(page)).toBeLessThan(10);
+ await page.emulateMedia({ media: 'print' });
+ const printed = await page.evaluate(() => {
+ const cell = (
+ document.querySelector('.ProseMirror .tableWrapper > table > tbody tr') as HTMLTableRowElement
+ ).cells[0];
+ return {
+ transform: getComputedStyle(cell).transform,
+ occluderOpacity: getComputedStyle(cell, '::before').opacity,
+ };
+ });
+ await page.emulateMedia({ media: 'screen' });
+ expect(printed).toEqual({ transform: 'none', occluderOpacity: '0' });
await page.screenshot({ path: testInfo.outputPath('frozen-mid.png') });
});
diff --git a/packages/core/src/bridge/compose.ts b/packages/core/src/bridge/compose.ts
index f4cc8a286..2a597ec3d 100644
--- a/packages/core/src/bridge/compose.ts
+++ b/packages/core/src/bridge/compose.ts
@@ -1,3 +1,4 @@
+
import { prependFrontmatter, stripFrontmatter } from '../extensions/frontmatter.ts';
export type ComposeAdjustment = 'none' | 'body' | 'frontmatter' | 'unresolved';
diff --git a/packages/core/src/bridge/doc-boundary-space.ts b/packages/core/src/bridge/doc-boundary-space.ts
index e7e63f43d..ffd8fce06 100644
--- a/packages/core/src/bridge/doc-boundary-space.ts
+++ b/packages/core/src/bridge/doc-boundary-space.ts
@@ -1,3 +1,4 @@
+
import { FRONTMATTER_RE, stripFrontmatter } from '../extensions/frontmatter.ts';
import { carriedEdgeEmpties, type DocEdgeEmpties } from '../markdown/doc-edge-blank-runs.ts';
diff --git a/packages/core/src/markdown/comment-promoter.ts b/packages/core/src/markdown/comment-promoter.ts
index fc267cbea..fb0ba5a7c 100644
--- a/packages/core/src/markdown/comment-promoter.ts
+++ b/packages/core/src/markdown/comment-promoter.ts
@@ -1,3 +1,4 @@
+
import type { Nodes, Paragraph, PhrasingContent, Root, RootContent, Text } from 'mdast';
import { SKIP, visit } from 'unist-util-visit';
import type { VFile } from 'vfile';
diff --git a/packages/core/src/markdown/merged-walker.ts b/packages/core/src/markdown/merged-walker.ts
index bfd7e3109..fa3cfcd86 100644
--- a/packages/core/src/markdown/merged-walker.ts
+++ b/packages/core/src/markdown/merged-walker.ts
@@ -1,3 +1,4 @@
+
import type { Nodes, Parent, Root } from 'mdast';
import { SKIP, visit } from 'unist-util-visit';
import type { VFile } from 'vfile';
diff --git a/packages/core/src/markdown/safe-url.ts b/packages/core/src/markdown/safe-url.ts
index 4d3250d3a..8be632ba4 100644
--- a/packages/core/src/markdown/safe-url.ts
+++ b/packages/core/src/markdown/safe-url.ts
@@ -1,3 +1,4 @@
+
export const SAFE_URL_SCHEMES = ['https', 'http', 'mailto', 'tel', 'ftp', 'sms'] as const;
const SCHEME_ALT = SAFE_URL_SCHEMES.map((s) => `${s}:`).join('|');