Skip to content

Conversation

@janosh
Copy link
Owner

@janosh janosh commented Jan 19, 2026

Summary

  • Replace rehype-autolink-headings and rehype-slug with heading_ids() preprocessor and heading_anchors() attachment from svelte-multiselect
  • Use matterviz ColorBar's built-in property select dropdown in DynamicScatter
  • Use interactive axis selection in ScatterPlot for x/y axis switching
  • Remove IconList component (inline the logic where needed)
  • Fix type issues with Label types between local and matterviz definitions
  • Build matterviz from source in CI to use latest features
  • Update dependencies

Changes

  • svelte.config.js: Remove hastscript, rehype-autolink-headings, rehype-slug; add heading_ids() preprocessor
  • +layout.svelte: Add heading_anchors() attachment to <main>
  • app.css: Add :target styling for headings, update comment
  • DynamicScatter.svelte: Refactor to use interactive axis selection and ColorBar property select
  • ModelAuthor.svelte: Fix Icon prop spreading type issues
  • TableControls.svelte: Use local TableColumnToggleMenu instead of matterviz ToggleMenu
  • models/[slug]/+page.svelte: Inline IconList logic for org logos
  • gh-pages.yml: Clone and build matterviz from main in CI

Test plan

  • pnpm svelte-check passes
  • pnpm vite build passes
  • Verify heading anchors work on deployed site
  • Verify DynamicScatter axis selection works

Summary by CodeRabbit

  • New Features

    • Heading anchors added across docs for easier navigation.
    • New Logo component and per-logo rendering in tables.
  • Improvements

    • Dynamic scatter plot: interactive axis options, log-scale toggles, and size controls refined.
    • Model author rendering updated for better HTML semantics.
  • Bug Fixes

    • Column toggle UI replaced with a new toggle menu integration.
  • Chores / Tests

    • Dev workflows and tests updated to accommodate external tooling and mocked modules; many tests adjusted for new DOM shapes.

✏️ Tip: You can customize this high-level summary in your review settings.

- Use heading_ids() preprocessor to add IDs to headings at build time
- Use heading_anchors() attachment in layout for runtime anchor icons
- Add :target CSS styling for headings when navigated to
- Fix link fragment in WBM readme (#links-to-wbm-files)
- Disable MD051 markdownlint rule (link defined at runtime)
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
site/src/lib/DynamicScatter.svelte (1)

467-470: Potential null reference in tooltip.

The axes object derives x and y from options_by_key[selected.x] and options_by_key[selected.y]. If data_loader is called with an invalid key not present in options_by_key, axes.x or axes.y would be undefined, causing a runtime error when accessing .label or .key.

Consider adding optional chaining or guards consistent with how color_value and size_value are handled:

Suggested fix
-        {`@html` axes.x.label}: {x_formatted}
-        {`#if` axes.x.key === `date_added` && metadata.days_ago}
+        {`@html` axes.x?.label}: {x_formatted}
+        {`#if` axes.x?.key === `date_added` && metadata.days_ago}
           <small>({metadata.days_ago} days ago)</small>{/if}<br />
-        {`@html` axes.y.label}: {y_formatted}<br />
+        {`@html` axes.y?.label}: {y_formatted}<br />
site/package.json (1)

47-49: Remove unused rehype dependencies from package.json.

The packages rehype-autolink-headings and rehype-slug are no longer used in the codebase. They have been replaced by svelte-multiselect's heading_ids() function (see site/svelte.config.js). Removing them will reduce unnecessary dependencies.

🤖 Fix all issues with AI agents
In `@site/src/lib/DynamicScatter.svelte`:
- Around line 127-138: The data_loader function accepts axis values `x | y | y2`
but only updates selected.x and selected.y; update logic to handle the `y2` case
(e.g., set selected.y2 = key) so selected state reflects the chosen axis, then
await tick() and return the same series/axis_label as done now; alternatively,
if y2 is not supported, change the function signature to remove `y2` or add a
clear comment explaining it's intentionally unsupported. Ensure references to
data_loader, selected, options_by_key, series, and tick are updated accordingly.
- Around line 237-244: The template contains a redundant expression
`${prop.label ?? prop.label}` inside the children snippet rendered via
children({ option: prop }) and format_property_path; replace the second
prop.label with the property identifier intended (use prop.key) so the path
expression becomes `${prop.path ?? ``}.${prop.key}` (matching the pattern used
elsewhere such as line 100) and keep the surrounding format_property_path and
model_counts_by_prop[prop.key] usage unchanged.

In `@site/src/lib/MetricsTable.svelte`:
- Around line 164-178: The current unsafe cast to IconName in the
affiliation_cell snippet risks runtime failure if org_logos contains an unknown
icon; instead, validate icon names where logos are constructed (e.g., in
get_org_logo()) against the set of valid matterviz IconName values (or the
labels.ts list), store a validated/icon-safe field on each logo entry, and
update affiliation_cell to use that validated field (or fall back to rendering
the img or skipping the icon) rather than using a blind `as IconName` cast;
ensure Icon and IconName references are preserved and validation logic maps
unknown names to a safe fallback or omits the icon.

In `@site/src/lib/TableColumnToggleMenu.svelte`:
- Line 2: The deleted test coverage for TableColumnToggleMenu.svelte
(site/tests/lib/TableColumnToggleMenu.svelte.test.ts) leaves
TableControls.svelte using an untested component; either restore the original
test file to re-enable coverage for TableColumnToggleMenu.svelte and ensure it
runs in CI, or create a tracking GitHub issue referencing the TODO in
TableColumnToggleMenu.svelte that documents the dependency on the matterviz
ToggleMenu release, target release/version and a removal date, and link that
issue from the TODO comment; update the test suite or CI config to reflect the
restored test or add the issue number to the TODO so the replacement isn't
forgotten.

In `@site/src/routes/models/`[slug]/+page.svelte:
- Around line 533-535: The scoped Svelte style uses :root which is outside the
component, so change the selector to use Svelte's global wrapper — replace the
current :root[data-theme='light'] rule with :global(:root[data-theme='light'])
so the --logo-brightness CSS variable (and any other theme root rules in this
block) apply at the document root (see the MetricsTable.svelte pattern for
reference).
🧹 Nitpick comments (4)
site/src/lib/DynamicScatter.svelte (2)

315-348: The {#if true} scoping pattern is functional but unconventional.

Using {#if true} to create a scope for @const declarations is valid Svelte but may confuse maintainers. Consider extracting the extent calculations into a derived state or helper function for clarity, though this is optional.

The log-scale heuristic (requiring min > 0 and at least 100× range) is reasonable.


299-299: Unconventional spread syntax for data_loader.

{...{ data_loader }} is functionally equivalent to data_loader={data_loader}. While both work, the direct prop assignment is more idiomatic and easier to read.

Suggested simplification
-    {...{ data_loader }}
+    data_loader={data_loader}
.github/workflows/gh-pages.yml (1)

24-26: Consider pinning matterviz to a specific commit or tag for reproducible builds.

Cloning main without a pinned commit hash means:

  1. Builds may break unexpectedly if matterviz introduces breaking changes
  2. Builds are not reproducible — the same workflow could produce different results on different days
  3. Harder to debug issues that arise from upstream changes
♻️ Suggested improvement
-        git clone --depth 1 https://github.com/janosh/matterviz.git ../matterviz
+        git clone --depth 1 --branch v0.2.3 https://github.com/janosh/matterviz.git ../matterviz

Or use a specific commit:

-        git clone --depth 1 https://github.com/janosh/matterviz.git ../matterviz
+        git clone https://github.com/janosh/matterviz.git ../matterviz
+        cd ../matterviz && git checkout abc1234 && cd ../site
site/src/routes/models/[slug]/+page.svelte (1)

273-284: Consider extracting shared OrgLogo component to reduce duplication.

The logo rendering logic here is identical to MetricsTable.svelte (lines 165-178), and both files also duplicate the .org-logo CSS styling. Extracting this into a shared OrgLogo.svelte component would centralize the icon vs. image conditional logic and the associated styles.

♻️ Example shared component
<!-- $lib/OrgLogo.svelte -->
<script lang="ts">
  import { Icon, type IconName } from 'matterviz'
  
  let { logo }: { logo: { id?: string; src?: string; name: string } } = $props()
</script>

{`#if` logo.id?.startsWith(`icon:`)}
  <span title={logo.name} class="org-logo">
    <Icon icon={logo.id.replace(`icon:`, ``) as IconName} />
  </span>
{:else if logo.src}
  <img src={logo.src} alt="{logo.name} logo" title={logo.name} class="org-logo" />
{/if}

<style>
  .org-logo {
    filter: grayscale(100%) brightness(var(--logo-brightness, 1));
    height: 1em;
    width: auto;
    vertical-align: middle;
    margin: 0;
  }
  :global(:root[data-theme='light']) {
    --logo-brightness: 0.5;
  }
</style>

The reusable deno-gh-pages workflow only supports pre-build and post-build
inputs, not post-install. Move matterviz symlink commands into pre-build.

Fix DynamicScatter and MetricsTable test selectors and async handling

- Update DynamicScatter tests to use .controls-row instead of .controls-grid
- Fix checkbox indexing to account for log-toggle checkboxes in DOM order
- Add tick() calls after mount in MetricsTable tests for proper rendering
- Simplify heatmap toggle test assertions
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@site/tests/lib/DynamicScatter.test.svelte.ts`:
- Around line 92-106: Replace usages of the toBeDefined() matcher on DOM queries
with null-safe assertions: for variables like controls_row, plot_container,
fullscreen_button, settings_button (and the other occurrences noted at lines
112, 160, 337–344, 377–379) change expect(<query>) .toBeDefined() to
expect(<query>) .not.toBeNull() so that querySelector() returning null will fail
the test; update each assertion referencing the querySelector results
accordingly to use not.toBeNull().
🧹 Nitpick comments (2)
site/tests/lib/DynamicScatter.test.svelte.ts (2)

242-253: Avoid index-based checkbox selection.
Offsetting into all_checkboxes makes the tests brittle if toggle order changes. Consider selecting by aria-label, name, or adding data-testid per checkbox so assertions stay stable when UI evolves.

Also applies to: 350-366


346-348: Await DOM flush after opening the settings pane.
The pane render can be async; querying immediately after the click can be flaky. Consider await tick() (or waitFor) before doc_query.

🧩 Suggested tweak
-import { mount } from 'svelte'
+import { mount, tick } from 'svelte'
...
- await settings_button?.click()
- const pane = doc_query(pane_selector)
+ await settings_button?.click()
+ await tick()
+ const pane = doc_query(pane_selector)

Now that matterviz is installed from main, use the ToggleMenu component
from matterviz instead of maintaining a local copy. Also adds SvelteKit
sync step to the CI workflow to ensure types are generated before packaging.
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@site/src/lib/TableControls.svelte`:
- Around line 2-3: The import of ToggleMenu from matterviz is invalid; remove
ToggleMenu from the import list in TableControls.svelte and delete the
corresponding <ToggleMenu bind:columns /> usage in the component (or replace it
with a valid component exported by matterviz such as one of
PeriodicTable/Structure/Composition/Trajectory/Heatmap/Scatter/ElementDetail or
a custom menu component) and update any references to the columns binding
accordingly (e.g., wire the columns state to your replacement or remove its
usage). Ensure the import line only imports valid symbols (e.g., Icon) from
matterviz and run type-check/build to confirm the error is resolved.

Repository owner deleted a comment from coderabbitai bot Jan 19, 2026
- Extract Logo component from MetricsTable and [slug]/+page.svelte
- Add icon name validation in labels.ts for matterviz icons
- Remove unused rehype-autolink-headings and rehype-slug packages
- Fix DynamicScatter type errors (remove AxisConfig casts, add y2 to data_loader)
- Add optional chaining to axes.x/y in tooltip for null safety
- Update test selectors to use label titles instead of index-based queries
- Change toBeDefined() to not.toBeNull() for querySelector results
Repository owner deleted a comment from coderabbitai bot Jan 19, 2026
@janosh janosh changed the title Use heading_anchors from svelte-multiselect, update matterviz integration Site: swap rehype-autolink-headings for heading-anchors, use ToggleMenu from matterviz, improve DynamicScatter with interactive axes labels Jan 19, 2026
@janosh janosh added site Website related refactor Refactor viz Plotting and visualization ci Continuous integration labels Jan 19, 2026
- Use importOriginal in matterviz mocks to preserve ICON_DATA export
- Save original createElement before mocking to prevent infinite recursion
- Add property field to Label type for cases where key differs from
  property name (e.g. geo_opt symmetry metrics)
- Update METADATA_COLS, HYPERPARAMS to use actual property names as keys
- Extract get_label_path/get_label_value helpers in DynamicScatter
- Add data_loader to color bar for dynamic property switching
- Update test expectations for new label structure
@coderabbitai
Copy link

coderabbitai bot commented Jan 19, 2026

Warning

Rate limit exceeded

@janosh has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 14 minutes and 56 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 20726ec and 03f79d4.

📒 Files selected for processing (3)
  • site/tests/lib/GeoOptMetricsTable.test.svelte.ts
  • site/tests/lib/TableControls.test.svelte.ts
  • site/tests/routes/LandingPage.test.ts
📝 Walkthrough

Walkthrough

Integrates matterviz into CI and tests, replaces mdsvex/rehype heading plugins with svelte-multiselect anchors, refactors logo rendering and related exports/types, restructures DynamicScatter controls/axis logic, renames several metadata keys, and updates many tests to match the new components and keys.

Changes

Cohort / File(s) Summary
CI Workflows
.github/workflows/gh-pages.yml, .github/workflows/test.yml
Add pre-build/test install steps that clone, build, deno-install, sync and symlink matterviz into node_modules for CI jobs. Attention: CI environment and symlink resolution.
Site deps & build
site/package.json, site/svelte.config.js
Bumped several dev deps; removed rehype-autolink-headings/rehype-slug; added heading_ids() from svelte-multiselect/heading-anchors to mdsvex pipeline.
Heading anchors & CSS
site/src/app.css, site/src/routes/+layout.svelte
Add :target/hover heading-anchor styles and attach heading_anchors() to <main> for runtime anchors.
Matterviz integration & exports
site/src/lib/index.ts, site/tests/index.ts
Remove IconList/TableColumnToggleMenu exports; add Logo; add test shim mocking matterviz/table.ToggleMenu.
Logo & icon handling
site/src/lib/Logo.svelte, site/src/lib/IconList.svelte (deleted), site/src/routes/models/[slug]/+page.svelte, site/src/lib/MetricsTable.svelte
Delete IconList; add Logo component that uses validated icon names or falls back to img; update pages/components to render per-logo Logo instances. Attention: icon validation/runtime mapping.
Label/type surface changes
site/src/lib/labels.ts, site/src/lib/types.ts
Add OrgLogo/validated_icon, runtime icon validation (VALID_ICON_NAMES), and add property?: string to Label; rename many metadata/hyperparam keys (e.g., "Date Added" → date_added) and adjust GEO_OPT metric keys/paths. Attention: callers expecting old keys.
Metrics assembly
site/src/lib/metrics.ts
assemble_row_data now uses dynamic key [METADATA_COLS.date_added.key] instead of literal 'Date Added'.
DynamicScatter refactor
site/src/lib/DynamicScatter.svelte
Large internal rewrite: derived axes/options maps, data_loader wrapper, log-scale toggles, new controls-row UI and responsive adjustments. Attention: behavior/regressions in plotting and controls.
Component API changes
site/src/lib/ModelAuthor.svelte, site/src/lib/PtableHeatmap.svelte, site/src/lib/TableControls.svelte
ModelAuthor: props type changed to HTML span attributes (API shape changed). PtableHeatmap: consolidated type imports. TableControls: replaced TableColumnToggleMenu usage with external ToggleMenu from matterviz/table.
Tests updated / removed
site/tests/lib/* (many files), site/tests/lib/IconList.test.svelte.ts (deleted), site/tests/lib/TableColumnToggleMenu.svelte.test.ts (deleted)
Convert several static matterviz mocks to async imports that merge original exports and override targets; update many tests to new selectors (.controls-row), await ticks, and adapt to renamed keys and new Logo component; remove tests for deleted components. Attention: test fixtures and mocks.
Docs
data/wbm/readme.md
Minor markdownlint directive added and two processing-step bullets removed.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested labels

ux, tests, types

Poem

🐇 I hopped through icons, keys, and build-time threads,

matterviz stitched in where old plugins once led.
Axes rearranged, logos verified with care,
Tests chased the new anchors — I twitched my nose in the air.
A tiny rabbit cheers for parsable metadata flair. 🎉

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically summarizes the main changes: replacing heading autolink tools, integrating ToggleMenu from matterviz, and improving DynamicScatter with interactive axes.
Description check ✅ Passed The PR description provides a clear summary of changes, detailed sections on what was modified, and a test plan. It aligns well with the actual changeset and explains the rationale.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

- Add matterviz/table mock for ToggleMenu component
- Update metadata_cols test to use keys for filtering, labels for header checks
- Update metrics test to use graph_construction_radius key
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In @.github/workflows/test.yml:
- Around line 44-49: The workflow currently clones matterviz from main which is
non-deterministic; update the install-cmd step to pin the clone to a specific
tag or commit (e.g., use git clone --branch v0.2.2 --depth 1
https://github.com/janosh/matterviz.git ../matterviz or clone then git checkout
<commit>) so the build is reproducible; keep the subsequent commands (deno
install, deno run -A npm:`@sveltejs/kit` sync, deno task package, rm -rf ..., ln
-s ...) unchanged.

In `@site/tests/lib/table-export.test.ts`:
- Around line 48-50: The top-level binding const original_create_element =
document.createElement.bind(document) can throw in non‑DOM environments (Deno)
before describe.skipIf(IS_DENO) runs; change this to guard or lazily bind inside
a setup hook: either wrap the access with if (typeof document !== 'undefined')
before assigning, or move the bind into a beforeAll/beforeEach that runs under
the describe.skipIf(IS_DENO) block so original_create_element is only created
when document exists; apply the same change for the other top‑level document
usages around the 59-70 region to avoid import-time failures.
♻️ Duplicate comments (2)
site/src/lib/TableControls.svelte (1)

2-5: Verify ToggleMenu availability via the matterviz/table subpath.
@ts-expect-error hides the type issue, but if the subpath isn’t shipped in the published package, bundlers/runtime will fail. Please confirm the package exports include it or provide a fallback.

#!/bin/bash
# Verify matterviz/table exists in the installed package
pkg_dir=$(fd -t d '^matterviz$' node_modules | head -1)
if [ -z "$pkg_dir" ]; then
  echo "matterviz not found in node_modules (run install first)"
  exit 1
fi

python - <<'PY'
import json, pathlib, sys
pkg = pathlib.Path(sys.argv[1])
print("package:", pkg)
print("exports:", json.loads(pkg.joinpath("package.json").read_text()).get("exports"))
PY "$pkg_dir"

ls -la "$pkg_dir/table" 2>/dev/null || find "$pkg_dir" -maxdepth 2 -type d -name 'table'

Also applies to: 124-124

site/src/lib/DynamicScatter.svelte (1)

10-10: Confirm y2 is never requested by the axis loader.
data_loader accepts y2 but doesn’t update selection state for it. If ScatterPlot can request y2, consider handling it or narrowing the type.

Also applies to: 142-153

🧹 Nitpick comments (3)
site/src/app.css (1)

245-265: Show heading anchors on keyboard focus, not just hover.
Consider revealing the anchor for :focus-visible/:focus-within to keep keyboard navigation discoverable.

♿ Suggested CSS tweak
 :where(h2, h3, h4, h5, h6, strong):hover a[aria-hidden='true'] {
   opacity: 1;
 }
+:where(h2, h3, h4, h5, h6, strong):focus-within a[aria-hidden='true'],
+a[aria-hidden='true']:focus-visible {
+  opacity: 1;
+}
.github/workflows/gh-pages.yml (1)

24-27: Consider pinning the matterviz clone for reproducible CI builds.

Cloning main can introduce non-deterministic builds if upstream changes land. If you don’t need moving-target builds, pin to a tag/commit or make the ref configurable.

site/src/lib/MetricsTable.svelte (1)

2-2: Per-logo rendering looks good; consider a stronger key fallback.
If a logo has neither id nor src (e.g., icon-only entries), the key can become undefined and cause duplicate-key churn. A last-resort fallback to the loop index keeps keys stable.

♻️ Optional key fallback
-{`#each` (row as ModelData).org_logos ?? [] as logo (logo.id ?? logo.src)}
+{`#each` (row as ModelData).org_logos ?? [] as logo, i (logo.id ?? logo.src ?? i)}
   <Logo {logo} />
 {/each}

Also applies to: 164-167

Comment on lines +48 to +50
// Save original createElement before any mocks
const original_create_element = document.createElement.bind(document)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Guard top‑level document access to avoid Deno import failure.
document.createElement is bound at module load time, so in Deno (or any non‑DOM env) this can throw before describe.skipIf(IS_DENO) takes effect.

✅ Suggested fix
-// Save original createElement before any mocks
-const original_create_element = document.createElement.bind(document)
+// Save original createElement before any mocks (guard for non-DOM envs)
+const original_create_element =
+  typeof document !== `undefined`
+    ? document.createElement.bind(document)
+    : null
-      .mockImplementation((tag: string) =>
+      .mockImplementation((tag: string) =>
         tag === `a`
           ? ({
             href: ``,
             download: ``,
             click: mock_click,
           } as unknown as HTMLAnchorElement)
-          : original_create_element(tag)
+          : original_create_element?.(tag)
       )

Also applies to: 59-70

🤖 Prompt for AI Agents
In `@site/tests/lib/table-export.test.ts` around lines 48 - 50, The top-level
binding const original_create_element = document.createElement.bind(document)
can throw in non‑DOM environments (Deno) before describe.skipIf(IS_DENO) runs;
change this to guard or lazily bind inside a setup hook: either wrap the access
with if (typeof document !== 'undefined') before assigning, or move the bind
into a beforeAll/beforeEach that runs under the describe.skipIf(IS_DENO) block
so original_create_element is only created when document exists; apply the same
change for the other top‑level document usages around the 59-70 region to avoid
import-time failures.

The column toggle functionality is now provided by matterviz's
ToggleMenu component which is mocked in tests. Skip tests that
depend on its internal DOM structure (.column-toggles summary).
@janosh janosh enabled auto-merge (squash) January 19, 2026 03:26
@janosh janosh merged commit 1baa596 into main Jan 19, 2026
9 of 10 checks passed
@janosh janosh deleted the heading-anchors-matterviz-updates branch January 19, 2026 03:31
janosh added a commit that referenced this pull request Jan 19, 2026
…gleMenu` from `matterviz`, improve `DynamicScatter` with interactive axes labels (#315)

* Replace rehype-autolink-headings with svelte-multiselect heading_anchors

- Use heading_ids() preprocessor to add IDs to headings at build time
- Use heading_anchors() attachment in layout for runtime anchor icons
- Add :target CSS styling for headings when navigated to
- Fix link fragment in WBM readme (#links-to-wbm-files)
- Disable MD051 markdownlint rule (link defined at runtime)

* Fix gh-pages workflow to use valid pre-build input

The reusable deno-gh-pages workflow only supports pre-build and post-build
inputs, not post-install. Move matterviz symlink commands into pre-build.

Fix DynamicScatter and MetricsTable test selectors and async handling

- Update DynamicScatter tests to use .controls-row instead of .controls-grid
- Fix checkbox indexing to account for log-toggle checkboxes in DOM order
- Add tick() calls after mount in MetricsTable tests for proper rendering
- Simplify heatmap toggle test assertions

* Delete local TableColumnToggleMenu, import ToggleMenu from matterviz

Now that matterviz is installed from main, use the ToggleMenu component
from matterviz instead of maintaining a local copy. Also adds SvelteKit
sync step to the CI workflow to ensure types are generated before packaging.

* Fix gh-pages workflow: run matterviz build in subshell to preserve working directory

* Install matterviz from main in vitest CI job

* Refactor org logos, fix DynamicScatter types, improve test stability

- Extract Logo component from MetricsTable and [slug]/+page.svelte
- Add icon name validation in labels.ts for matterviz icons
- Remove unused rehype-autolink-headings and rehype-slug packages
- Fix DynamicScatter type errors (remove AxisConfig casts, add y2 to data_loader)
- Add optional chaining to axes.x/y in tooltip for null safety
- Update test selectors to use label titles instead of index-based queries
- Change toBeDefined() to not.toBeNull() for querySelector results

* Fix test failures: matterviz mocks and table-export recursion

- Use importOriginal in matterviz mocks to preserve ICON_DATA export
- Save original createElement before mocking to prevent infinite recursion

* Refactor label keys to use property names for data access

- Add property field to Label type for cases where key differs from
  property name (e.g. geo_opt symmetry metrics)
- Update METADATA_COLS, HYPERPARAMS to use actual property names as keys
- Extract get_label_path/get_label_value helpers in DynamicScatter
- Add data_loader to color bar for dynamic property switching
- Update test expectations for new label structure

* Fix test failures from label key refactoring

- Add matterviz/table mock for ToggleMenu component
- Update metadata_cols test to use keys for filtering, labels for header checks
- Update metrics test to use graph_construction_radius key

* Skip tests for ToggleMenu component now from matterviz

The column toggle functionality is now provided by matterviz's
ToggleMenu component which is mocked in tests. Skip tests that
depend on its internal DOM structure (.column-toggles summary).

Move document binding inside describe block for Deno compatibility

The top-level document.createElement.bind(document) was throwing in
non-DOM environments (Deno) before describe.skipIf(IS_DENO) could
skip the tests. Now bound lazily in beforeAll inside the skip block.

Increase timeout for flaky MetricsTable tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continuous integration refactor Refactor site Website related viz Plotting and visualization

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants