Repository navigation
Description
Summary
The model-explorer-visualizer web component (custom element) doesn't expose a way for host applications to control the theme (light/dark). When a host application switches to dark mode, the visualizer remains in light mode.
Additionally, the npm package ai-edge-model-explorer-visualizer (v0.1.2, published June 2025) is significantly outdated and missing features that exist in the latest source, including dark mode support.
Analysis
Looking at the source code, the theme system works internally:
ModelGraphVisualizerhas atheme = input<string>('light')and sets[attr.data-metheme]on its host elementThemeServicemanages theme state and setsdocument.body.dataset['metheme']- CSS variables (
--me-*) are applied viabody[data-metheme='dark']selectors incolors.scss
However, the Wrapper component (custom_element/wrapper.ts) that creates the web component:
- Uses
ViewEncapsulation.ShadowDom, which blocksbody[data-metheme]CSS selectors from penetrating - Does not bind
[theme]toModelGraphVisualizerin its template (wrapper.ng.html) - Does not expose
themeas an input on the custom element
This means external applications embedding <model-explorer-visualizer> have no way to:
- Pass a theme preference (light/dark) to the visualizer
- Have CSS variables propagate into the Shadow DOM
- Synchronize the visualizer's theme with the host application's theme
Suggested Solution
- Expose
themeattribute on themodel-explorer-visualizercustom element, so host applications can use it like:
<model-explorer-visualizer theme="dark"></model-explorer-visualizer>Or dynamically via JavaScript:
const visualizer = document.querySelector('model-explorer-visualizer');
visualizer.theme = 'dark'; // or 'light'
This would require:
- Adding theme as an @input() on Wrapper component
- Binding [theme]="theme" to in wrapper.ng.html
- Optionally reflecting the theme attribute on the custom element
- Publish a new version of the ai-edge-model-explorer-visualizer npm package. The current v0.1.2 is outdated and lacks many features available in the latest source (dark mode, updated visualizer config options, etc.).
Environment
- ai-edge-model-explorer-visualizer npm package version: 0.1.2 (June 2025)
- Source: latest main branch (April 2025)
- Host application: React 19 + MUI v7, embedding via dynamic import
Workaround Attempted
Tried setting document.body.dataset['metheme'] = 'dark' from the host app, but it doesn't work due to Shadow DOM encapsulation. Also attempted using MutationObserver to set data-metheme on internal elements inside the shadow root, but Angular's internal effect cycle overrides it back.
Also tried building from source and replacing the npm package files manually, but even with the latest source build, the Wrapper component still doesn't expose theme as a configurable input.
Activity
[-][Feature] Expose `theme` input on `model-explorer-visualizer` web component for external dark mode control[/-][+][Feature request] Expose `theme` input on `model-explorer-visualizer` web component for external dark mode control[/+]sourcelite commentedon Apr 14, 2026
Hi @zhepoch, welcome here and thanks for providing such a detailed feature request + root cause analysis. we truly appreciate your efforts for digging deep with investigation into shadow dom encapsulation and also missing 'Input()' binding in wrapper component.
we would like to know about following info -
Thankyou!
github-actions commentedon Apr 22, 2026
Marking this issue as stale since it has been open for 7 days with no activity. This issue will be closed if no further activity occurs.
github-actions commentedon Apr 29, 2026
This issue was closed because it has been inactive for 14 days. Please post a new issue if you need further assistance. Thanks!