Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions .github/actions/install-deps/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,17 @@ runs:
shell: bash
run: echo "CMAKE_GENERATOR=Ninja" >> "$GITHUB_ENV"

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Install pnpm
uses: pnpm/action-setup@v3
uses: pnpm/action-setup@v6
with:
version: 9
version: 12
cache: true
cache_dependency_path: pnpm-lock.yaml

# emsdk installs to `<workspace>/.emsdk` (`install_emsdk.mjs`), and
# the emscripten sysroot libraries generated during the first build
Expand Down Expand Up @@ -166,13 +173,6 @@ runs:
# pip debug --verbose
# shell: bash

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "pnpm"
cache-dependency-path: pnpm-lock.yaml

- name: Install rust
uses: dtolnay/rust-toolchain@nightly
if: ${{ inputs.rust == 'true' && inputs.arch != 'aarch64' }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ jobs:
path: rust/perspective-python/perspective/widget/static

- name: Python Build Pyodide
run: pnpm install && pnpm run build
run: pnpm install && node tools/scripts/install_emsdk.mjs && pnpm run build
env:
PSP_PYODIDE: 1
PACKAGE: "python"
Expand Down
93 changes: 0 additions & 93 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 10 additions & 7 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,10 @@ Deviating from this specific version of Emscripten specified in the project's
`package.json` can introduce various errors that are extremely difficult to
debug.

To install a specific version of Emscripten (e.g. `4.0.9`):
To install a specific version of Emscripten (e.g. `5.0.3`):

```bash
./emsdk install 4.0.9
./emsdk install 5.0.3
```

Set `PSP_SKIP_EMSDK_INSTALL=1` to prevent `pnpm install` from downloading the
Expand All @@ -168,8 +168,7 @@ this within a virtual environment.

To build for [Pyodide](https://pyodide.org/), select
`perspective-python (pyodide)` in `pnpm run setup` and install the pinned
Pyodide distribution with `pnpm run install_pyodide`. Pyodide builds use the
separate `pyodide_emscripten` version pinned in `package.json`.
Pyodide distribution with `pnpm run install_pyodide`.

### `perspective-jupyterlab`

Expand Down Expand Up @@ -288,9 +287,9 @@ tests are run with `PACKAGE=jupyterlab pnpm run test --jupyter`.

Many UI tests compare against screenshot and DOM snapshots, which live in
`tools/test/dist/snapshots` and are not checked in to this repository. CI
fetches them from a separate snapshots repository. To regenerate
snapshots locally after an intentional rendering change, or to generate them
for the first time from a known-passing (in CI) build you've checked out:
fetches them from a separate snapshots repository. To regenerate snapshots
locally after an intentional rendering change, or to generate them for the first
time from a known-passing (in CI) build you've checked out:

```bash
pnpm run test --update-snapshots
Expand All @@ -310,6 +309,10 @@ are forwarded to `pytest`.
With `rust` selected, `pnpm run test` runs `cargo test` for the `perspective`
and `perspective-client` crates.

`perspective-viewer` and `perspective-js` deliberately carry no Rust unit tests;
their behavior is tested through the Playwright suites, against the public
JavaScript API.

## Lint

```bash
Expand Down
65 changes: 35 additions & 30 deletions docs/build.collage.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const COLLAGE_GAP = 2;

const COLLAGE_BG = { light: "#ffffff", dark: "#242526" };

const COLLAGE_SEED = 0x5eed;
const COLLAGE_SEED = 0xdeadbeef;

function shuffled(items, seed) {
let state = seed;
Expand Down Expand Up @@ -55,27 +55,33 @@ function pngSize(file) {
}
}

/// Pick the column count whose natural tile aspect lands closest to filling the
/// frame, then stretch the rows so the grid covers it exactly.
function bestFitGrid(count, aspect, width, height) {
let best;
for (let cols = 1; cols <= count; cols++) {
const rows = Math.ceil(count / cols);
const tileWidth = Math.floor((width - (cols - 1) * COLLAGE_GAP) / cols);
if (tileWidth <= 0) {
break;
}

const natural =
rows * Math.round(tileWidth / aspect) + (rows - 1) * COLLAGE_GAP;

const tileHeight = Math.round(tileWidth / aspect);
const contentHeight = rows * tileHeight + (rows - 1) * COLLAGE_GAP;
if (contentHeight <= height && tileHeight > (best?.tileHeight ?? 0)) {
best = { cols, rows, tileWidth, tileHeight };
const drift = Math.abs(natural - height);
if (best === undefined || drift < best.drift) {
best = { cols, rows, tileWidth, drift };
}
}

return (
best ?? {
cols: count,
rows: 1,
tileWidth: Math.floor(height * aspect),
tileHeight: height,
}
);
const { cols, rows, tileWidth } = best;
return {
cols,
rows,
tileWidth,
tileHeight: Math.ceil((height - (rows - 1) * COLLAGE_GAP) / rows),
};
}

export async function collage(page, ids, theme, { out, port }) {
Expand All @@ -99,12 +105,12 @@ export async function collage(page, ids, theme, { out, port }) {
height,
);

const tiles = present
.map(
(id) =>
`<img src="http://localhost:${port}/projects/${theme}/${id}.png" />`,
)
.join("");
const cells = cols * rows;
const tiles = Array.from(
{ length: cells },
(_, i) =>
`<img src="http://localhost:${port}/projects/${theme}/${present[i % present.length]}.png" />`,
).join("");

await page.setViewport({ width: COLLAGE_WIDTH, height });
await page.setContent(
Expand All @@ -113,18 +119,17 @@ export async function collage(page, ids, theme, { out, port }) {
.collage {
width: ${COLLAGE_WIDTH}px;
height: ${height}px;
display: flex;
flex-wrap: wrap;
align-content: center;
justify-content: center;
display: grid;
grid-template-columns: repeat(${cols}, 1fr);
grid-auto-rows: ${tileHeight}px;
gap: ${COLLAGE_GAP}px;
overflow: hidden;
}
.collage img {
width: ${tileWidth}px;
width: 100%;
height: ${tileHeight}px;
/* The tile box shares the screenshots' aspect, so \`cover\`
only absorbs the sub-pixel rounding — no visible crop. */
/* Rows are stretched to fill the frame exactly, so \`cover\`
absorbs the difference from the screenshots' own aspect. */
object-fit: cover;
display: block;
}
Expand All @@ -134,9 +139,9 @@ export async function collage(page, ids, theme, { out, port }) {
);

const tiles_found = await page.$$eval(".collage img", (x) => x.length);
if (tiles_found !== present.length) {
if (tiles_found !== cells) {
throw new Error(
`collage page has ${tiles_found} tiles, expected ${present.length}`,
`collage page has ${tiles_found} tiles, expected ${cells}`,
);
}

Expand All @@ -159,8 +164,8 @@ export async function collage(page, ids, theme, { out, port }) {

fs.writeFileSync(path.join(dir, COLLAGE), await page.screenshot());
console.log(
`Collage (${theme}): ${present.length} thumbnails, ${cols}×${rows} ` +
`grid of ${tileWidth}×${tileHeight} tiles, ` +
`Collage (${theme}): ${present.length} thumbnails in ${cells} cells, ` +
`${cols}×${rows} grid of ${tileWidth}×${tileHeight} tiles, ` +
`${COLLAGE_WIDTH}×${height}.`,
);
}
1 change: 1 addition & 0 deletions docs/md/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
- [`expressions`](./explanation/view/config/expressions.md)
- [Window Columns](./explanation/view/config/windows.md)
- [Advanced View Operations](./explanation/view/advanced.md)
- [Derived `Table`s](./explanation/derived_table.md)
- [`Join`](./explanation/join.md)
- [Join Types](./explanation/join/join_types.md)
- [Join Options](./explanation/join/options.md)
Expand Down
Loading
Loading