+
+ Open in Agent Trace Vis ↗
+
0">
No matches found for:
@@ -146,7 +154,7 @@
,
+ isEmbedRoute = false,
): UrlUiConfig {
+ const embed = isEmbedRoute || parseBoolFlag(getParamFromMap(params, ['embed']), false);
+ const defaultChromeVisible = !embed;
+ const sidebarState = parseSidebarState(getParamFromMap(params, ['sidebar']), embed);
+ const panelState = parsePanelState(getParamFromMap(params, ['panel']), embed);
+ const legendState = parseLegendState(getParamFromMap(params, ['legend']), embed);
const searchMode = parseSearchMode(
getParamFromMap(params, ['searchMode', 'search_mode']),
);
@@ -256,6 +346,18 @@ export function parseUrlUiConfig(
const rawMark = getParamFromMap(params, ['mark'])?.trim();
return {
+ embed,
+ headerVisible: parseVisibilityFlag(
+ getParamFromMap(params, ['header']),
+ defaultChromeVisible,
+ ),
+ toolbarVisible: parseVisibilityFlag(
+ getParamFromMap(params, ['toolbar']),
+ defaultChromeVisible,
+ ),
+ panelVisible: panelState.panelVisible,
+ sidebarHidden: sidebarState.sidebarHidden,
+ legendHidden: legendState.legendHidden,
axis: parseAxisMode(getParamFromMap(params, ['axis', 'xAxis', 'x_axis'])),
wait: parseBoolFlag(
getParamFromMap(params, ['wait', 'showUserWait', 'show_user_wait']),
@@ -281,9 +383,9 @@ export function parseUrlUiConfig(
searchMode,
activeIndex,
markId: rawMark ? rawMark : null,
- legendCollapsed: parseCollapsed(getParamFromMap(params, ['legend'])),
- sidebarCollapsed: parseCollapsed(getParamFromMap(params, ['sidebar'])),
- panelCollapsed: parseCollapsed(getParamFromMap(params, ['panel'])),
+ legendCollapsed: legendState.legendCollapsed,
+ sidebarCollapsed: sidebarState.sidebarCollapsed,
+ panelCollapsed: panelState.panelCollapsed,
sidebarFilter: getParamFromMap(params, ['filter']) ?? '',
};
}
@@ -294,6 +396,7 @@ export function parseUrlUiConfig(
*/
export function serializeUrlUiConfig(
config: UrlUiConfig,
+ isEmbedRoute = false,
): Record {
const canonicalTokens = VALID_TOKEN_METRICS.filter(m =>
config.tokens.includes(m),
@@ -301,8 +404,45 @@ export function serializeUrlUiConfig(
const isDefaultTokens =
canonicalTokens.length === DEFAULT_TOKEN_METRICS.length &&
canonicalTokens.every((t, i) => t === DEFAULT_TOKEN_METRICS[i]);
+ const defaultVisible = !config.embed;
+
+ let sidebarParam: string | null;
+ if (!config.embed) {
+ sidebarParam = config.sidebarHidden ? 'hidden' : config.sidebarCollapsed ? 'collapsed' : null;
+ } else {
+ sidebarParam = config.sidebarHidden ? null : config.sidebarCollapsed ? 'collapsed' : '1';
+ }
+
+ let panelParam: string | null;
+ if (!config.embed) {
+ panelParam = !config.panelVisible ? '0' : config.panelCollapsed ? 'collapsed' : null;
+ } else {
+ panelParam = !config.panelVisible ? null : config.panelCollapsed ? 'collapsed' : '1';
+ }
+
+ let legendParam: string | null;
+ if (config.legendHidden) {
+ legendParam = 'hidden';
+ } else if (!config.embed) {
+ legendParam = config.legendCollapsed ? 'collapsed' : null;
+ } else {
+ legendParam = config.legendCollapsed ? null : 'open';
+ }
return {
+ embed: config.embed && !isEmbedRoute ? '1' : null,
+ header:
+ config.headerVisible === defaultVisible
+ ? null
+ : config.headerVisible
+ ? '1'
+ : '0',
+ toolbar:
+ config.toolbarVisible === defaultVisible
+ ? null
+ : config.toolbarVisible
+ ? '1'
+ : '0',
axis:
config.axis === 'time'
? null
@@ -334,13 +474,74 @@ export function serializeUrlUiConfig(
? String(config.activeIndex)
: null,
mark: config.markId ? config.markId : null,
- legend: config.legendCollapsed ? 'collapsed' : null,
- sidebar: config.sidebarCollapsed ? 'collapsed' : null,
- panel: config.panelCollapsed ? 'collapsed' : null,
+ legend: legendParam,
+ sidebar: sidebarParam,
+ panel: panelParam,
filter: config.sidebarFilter.trim() ? config.sidebarFilter.trim() : null,
};
}
+const COLAB_PORT_PROXY_HOST_RE =
+ /^.+-([1-9]\d{0,4})-colab(?:\.corp)?\.googleusercontent\.com$/i;
+
+/**
+ * Rewrites ephemeral Colab kernel `proxyPort` iframe origins back to
+ * `http://localhost:` so "Open in Agent Trace Vis" links open a working
+ * standalone tab outside Colab's service-worker sandbox.
+ */
+function resolveColabProxyPort(hostname: string): number | null {
+ const match = COLAB_PORT_PROXY_HOST_RE.exec(hostname);
+ if (!match) return null;
+ const port = Number(match[1]);
+ return Number.isInteger(port) && port >= 1 && port <= 65535 ? port : null;
+}
+
+/** Builds a full-viewer URL from an embed URL by leaving `/embed` and stripping chrome-hiding flags. */
+export function buildFullAppUrl(href: string): string {
+ if (!href) return '/';
+ try {
+ const url = new URL(href, 'https://example.com');
+ const colabPort = resolveColabProxyPort(url.hostname);
+ if (colabPort !== null) {
+ url.protocol = 'http:';
+ url.hostname = 'localhost';
+ url.port = String(colabPort);
+ }
+ if (url.pathname.replace(/\/+$/, '') === '/embed') {
+ url.pathname = '/';
+ } else if (url.pathname.replace(/\/+$/, '').endsWith('/embed')) {
+ url.pathname = url.pathname.replace(/\/embed\/?$/, '/');
+ }
+
+ const embedKeys = ['embed', 'header', 'toolbar', 'panel', 'sidebar', 'legend'];
+ for (const key of embedKeys) {
+ url.searchParams.delete(key);
+ }
+
+ if (url.hash) {
+ const qIdx = url.hash.indexOf('?');
+ const hashPath = (qIdx >= 0 ? url.hash.slice(0, qIdx) : url.hash).replace(
+ /^#\/embed(?=\/|$)/,
+ '#/agentic-traces',
+ );
+ if (qIdx >= 0) {
+ const hashParams = new URLSearchParams(url.hash.slice(qIdx + 1));
+ for (const key of embedKeys) {
+ hashParams.delete(key);
+ }
+ const qs = hashParams.toString();
+ url.hash = qs ? `${hashPath}?${qs}` : hashPath === '#/' ? '' : hashPath;
+ } else {
+ url.hash = hashPath === '#/' ? '' : hashPath;
+ }
+ }
+
+ return url.toString();
+ } catch {
+ return '/';
+ }
+}
+
/** Input to `resolvePendingUrlSelection`. */
export interface PendingUrlSelectionInput {
pendingActiveIndex: number | null;
diff --git a/src/app/app.routes.ts b/src/app/app.routes.ts
index 3a6040a..c6cd30b 100644
--- a/src/app/app.routes.ts
+++ b/src/app/app.routes.ts
@@ -27,6 +27,7 @@ import { AgenticTracesComponent } from './agentic-traces/agentic-traces';
export const routes: Routes = [
{ path: '', component: HomeComponent },
{ path: 'agentic-traces', component: AgenticTracesComponent },
+ { path: 'embed', component: AgenticTracesComponent },
];
diff --git a/src/app/app.ts b/src/app/app.ts
index 4a106e3..ef2a2c5 100644
--- a/src/app/app.ts
+++ b/src/app/app.ts
@@ -19,26 +19,30 @@
* @fileoverview Root AppComponent. Renders the top-level header and router outlet.
*/
-import { Component } from '@angular/core';
-import { RouterOutlet, RouterLink } from '@angular/router';
-import { UrlParamService } from './shared/url-param.service';
+import {Component, inject} from '@angular/core';
+import {RouterLink, RouterOutlet} from '@angular/router';
+
+import {EmbedStateService} from './shared/embed-state.service';
+import {UrlParamService} from './shared/url-param.service';
@Component({
selector: 'app-root',
standalone: true,
imports: [RouterOutlet, RouterLink],
template: `
-
-
+ @if (embedState.headerVisible()) {
+
+
+ }
@@ -78,6 +82,8 @@ import { UrlParamService } from './shared/url-param.service';
`]
})
export class AppComponent {
+ readonly embedState = inject(EmbedStateService);
+
constructor(private urlParamService: UrlParamService) {
this.urlParamService.processUrlParameters();
}
diff --git a/src/app/shared/embed-state.service.ts b/src/app/shared/embed-state.service.ts
new file mode 100644
index 0000000..23b50cf
--- /dev/null
+++ b/src/app/shared/embed-state.service.ts
@@ -0,0 +1,87 @@
+/**
+ * @license
+ * Copyright 2026 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @fileoverview Shared reactive state for iframe embed mode and chrome
+ * visibility flags across the root shell and trace viewer.
+ */
+
+import {Injectable, signal} from '@angular/core';
+
+import {
+ buildFullAppUrl,
+ isEmbedLocation,
+ parseUrlUiConfig,
+ UrlUiConfig,
+} from '../agentic-traces/url-config';
+import {parseLocationQueryParams} from './url-params';
+
+/**
+ * Holds reactive iframe embed mode and UI chrome visibility state parsed from
+ * the current route and URL query parameters.
+ */
+@Injectable({providedIn: 'root'})
+export class EmbedStateService {
+ readonly embed = signal(false);
+ readonly isEmbedRoute = signal(false);
+ readonly headerVisible = signal(true);
+ readonly toolbarVisible = signal(true);
+ readonly panelVisible = signal(true);
+ readonly sidebarHidden = signal(false);
+ readonly legendHidden = signal(false);
+ readonly fullAppUrl = signal('/');
+
+ constructor() {
+ if (typeof window !== 'undefined') {
+ this.syncFromLocation(window.location.href);
+ }
+ }
+
+ /** Synchronizes embed chrome signals directly from a URL and optional route path. */
+ syncFromLocation(
+ href: string,
+ routePath?: string,
+ routeParams?: Readonly>,
+ ): UrlUiConfig {
+ const onEmbedRoute = isEmbedLocation(href, routePath);
+ const params = parseLocationQueryParams(href, routeParams);
+ const config = parseUrlUiConfig(params, onEmbedRoute);
+ this.applyUiConfig(config, href, onEmbedRoute);
+ return config;
+ }
+
+ /** Applies already-parsed UI config chrome flags and updates the full-viewer link. */
+ applyUiConfig(
+ config: UrlUiConfig,
+ href: string,
+ onEmbedRoute = this.isEmbedRoute(),
+ ): void {
+ this.isEmbedRoute.set(onEmbedRoute);
+ this.embed.set(config.embed);
+ this.headerVisible.set(config.headerVisible);
+ this.toolbarVisible.set(config.toolbarVisible);
+ this.panelVisible.set(config.panelVisible);
+ this.sidebarHidden.set(config.sidebarHidden);
+ this.legendHidden.set(config.legendHidden);
+ this.updateFullAppUrl(href);
+ }
+
+ /** Refreshes the "open in full viewer" URL from the current browser location. */
+ updateFullAppUrl(href: string): void {
+ this.fullAppUrl.set(buildFullAppUrl(href));
+ }
+}
diff --git a/src/app/shared/preserve-search-hash-location.strategy.ts b/src/app/shared/preserve-search-hash-location.strategy.ts
index d2e66f5..9d6c12d 100644
--- a/src/app/shared/preserve-search-hash-location.strategy.ts
+++ b/src/app/shared/preserve-search-hash-location.strategy.ts
@@ -38,9 +38,18 @@ export class PreserveSearchHashLocationStrategy extends HashLocationStrategy {
override prepareExternalUrl(internal: string): string {
const hashUrl = super.prepareExternalUrl(internal);
+ if (hashUrl && !hashUrl.startsWith('#')) {
+ return hashUrl;
+ }
const rawSearch = this.platformLocation.search || '';
- if (!rawSearch) return hashUrl;
- const search = rawSearch.startsWith('?') ? rawSearch : `?${rawSearch}`;
- return hashUrl ? `${search}${hashUrl}` : search;
+ const search = rawSearch
+ ? (rawSearch.startsWith('?') ? rawSearch : `?${rawSearch}`)
+ : '';
+ // Keep pathname (e.g. /embed) across replaceState calls so
+ // never drops it during initial hash navigation or query-param updates.
+ const pathname = this.platformLocation.pathname || '';
+ const base = `${pathname}${search}`;
+ if (!base) return hashUrl;
+ return hashUrl ? `${base}${hashUrl}` : base;
}
}
0"
+ *ngIf="legendEntries().length > 0 && !embedState.legendHidden()"
[class.collapsed]="isLegendCollapsed()"
(click)="$event.stopPropagation()">
-
Use “+ Add dataset” on the left to open a demo trace or your own trace files.
+
+ Open in Agent Trace Vis ↗
+
diff --git a/src/app/agentic-traces/agentic-traces.ts b/src/app/agentic-traces/agentic-traces.ts
index 551b5e1..a73e207 100644
--- a/src/app/agentic-traces/agentic-traces.ts
+++ b/src/app/agentic-traces/agentic-traces.ts
@@ -34,7 +34,10 @@ import {
} from "@angular/core";
import { CommonModule } from "@angular/common";
import { FormsModule } from "@angular/forms";
-import { ActivatedRoute } from "@angular/router";
+import { ActivatedRoute, NavigationEnd, Router } from "@angular/router";
+import { Subscription } from "rxjs";
+import { filter } from "rxjs/operators";
+import { EmbedStateService } from "../shared/embed-state.service";
import { EXTRA_MANAGED_URL_PARAMS, UrlParamService } from "../shared/url-param.service";
import { getParamFromMap, getParamValuesFromMap } from "../shared/url-params";
import { TELEMETRY_TRACKER } from "../shared/telemetry.service";
@@ -45,6 +48,7 @@ import { INITIAL_DATASET_REFS } from "../data/initial-refs";
import { DatasetRef, parseDatasetRef, parseIndices } from "../data/dataset-refs";
import {
CustomSearchSpec,
+ isEmbedLocation,
LEGACY_CONFIG_PARAM_ALIASES,
MANAGED_URL_PARAM_KEYS,
parseUrlUiConfig,
@@ -106,9 +110,15 @@ interface LegendEntry {
providers: [AnalysisLayersService],
templateUrl: './agentic-traces.html',
styleUrls: ['./agentic-traces.css'],
+ host: {
+ '[class.embed-mode]': 'embedState.embed()',
+ '[class.no-header]': '!embedState.headerVisible()',
+ '[class.no-toolbar]': '!embedState.toolbarVisible()',
+ },
})
export class AgenticTracesComponent implements OnInit, OnDestroy {
readonly workspace = inject(WorkspaceService);
+ readonly embedState = inject(EmbedStateService);
private readonly initialRefs = inject(INITIAL_DATASET_REFS, { optional: true });
private readonly extraManagedParams = inject(EXTRA_MANAGED_URL_PARAMS, { optional: true }) ?? [];
private readonly telemetry = inject(TELEMETRY_TRACKER, { optional: true });
@@ -302,6 +312,7 @@ export class AgenticTracesComponent implements OnInit, OnDestroy {
/** Re-lays out the rows when the timeline area changes width. */
private resizeObserver = new ResizeObserver(([entry]) => this.onScrollAreaResize(entry.contentRect.width));
private scrollArea?: HTMLElement;
+ private routerEventsSub?: Subscription;
/** The scroll area comes and goes with the loading screen; observe whichever is current. */
@ViewChild('visScrollArea', { static: false })
@@ -457,8 +468,17 @@ export class AgenticTracesComponent implements OnInit, OnDestroy {
public layersService: AnalysisLayersService,
public chaptersService: ChaptersService,
private route: ActivatedRoute,
+ private router: Router,
private urlParamService: UrlParamService,
) {
+ this.routerEventsSub = this.router.events
+ .pipe(filter((e): e is NavigationEnd => e instanceof NavigationEnd))
+ .subscribe(() => {
+ if (typeof window !== 'undefined') {
+ this.embedState.updateFullAppUrl(window.location.href);
+ }
+ });
+
this.currentUrlConfigParams = computed(() => {
const presetByName = new Map(ANALYSIS_PRESETS.map(p => [p.name, p]));
const presets: string[] = [];
@@ -478,6 +498,12 @@ export class AgenticTracesComponent implements OnInit, OnDestroy {
const activeIdx = activeId ? traces.findIndex(t => t.id === activeId) : -1;
return serializeUrlUiConfig({
+ embed: this.embedState.embed(),
+ headerVisible: this.embedState.headerVisible(),
+ toolbarVisible: this.embedState.toolbarVisible(),
+ panelVisible: this.embedState.panelVisible(),
+ sidebarHidden: this.embedState.sidebarHidden(),
+ legendHidden: this.embedState.legendHidden(),
axis: this.yAxisMode(),
wait: this.showUserWait(),
fill: this.stretch(),
@@ -497,7 +523,7 @@ export class AgenticTracesComponent implements OnInit, OnDestroy {
sidebarCollapsed: this.workspace.sidebarCollapsed(),
panelCollapsed: this.panelCollapsed(),
sidebarFilter: this.workspace.sidebarFilter(),
- });
+ }, this.embedState.isEmbedRoute());
});
// Show the workspace's selected traces, keeping any row order the user dragged.
effect(() => {
@@ -550,15 +576,24 @@ export class AgenticTracesComponent implements OnInit, OnDestroy {
ngOnInit() {
const w = window as DevWindow;
w.clearCache = w.clearcache = this.clearCacheFn;
- this.telemetry?.trackPageView?.('/');
+ const href = typeof window !== 'undefined' ? window.location.href : '';
+ const onEmbedRoute = isEmbedLocation(href, this.route.snapshot?.routeConfig?.path);
+ const initialConfig = this.embedState.syncFromLocation(
+ href,
+ this.route.snapshot?.routeConfig?.path,
+ this.route.snapshot?.queryParams,
+ );
+ this.telemetry?.trackPageView?.(initialConfig.embed ? '/embed' : '/');
- void this.initWorkspace();
+ void this.initWorkspace(onEmbedRoute);
}
/** Restores the workspace and UI configuration from the URL, then loads defaults if empty. */
- private async initWorkspace() {
+ private async initWorkspace(onEmbedRoute = false) {
const allParams = this.urlParamService.readAllQueryParams(this.route);
- const uiConfig = parseUrlUiConfig(allParams);
+ const uiConfig = parseUrlUiConfig(allParams, onEmbedRoute);
+ const href = typeof window !== 'undefined' ? window.location.href : '';
+ this.embedState.applyUiConfig(uiConfig, href, onEmbedRoute);
this.yAxisMode.set(uiConfig.axis);
this.showUserWait.set(uiConfig.wait);
@@ -665,6 +700,7 @@ export class AgenticTracesComponent implements OnInit, OnDestroy {
}
ngOnDestroy() {
+ this.routerEventsSub?.unsubscribe();
this.resizeObserver.disconnect();
const w = window as DevWindow;
if (w.clearCache === this.clearCacheFn) {
diff --git a/src/app/agentic-traces/url-config.ts b/src/app/agentic-traces/url-config.ts
index d51686d..10501ca 100644
--- a/src/app/agentic-traces/url-config.ts
+++ b/src/app/agentic-traces/url-config.ts
@@ -38,6 +38,10 @@ export const DEFAULT_TOKEN_METRICS: readonly string[] = ['output_tokens'];
/** UI configuration URL parameter keys managed by `serializeUrlUiConfig`. */
export const MANAGED_URL_PARAM_KEYS: readonly string[] = [
+ 'embed',
+ 'header',
+ 'toolbar',
+ 'panel',
'axis',
'wait',
'fill',
@@ -57,7 +61,6 @@ export const MANAGED_URL_PARAM_KEYS: readonly string[] = [
'mark',
'legend',
'sidebar',
- 'panel',
'filter',
];
@@ -83,6 +86,12 @@ export interface CustomSearchSpec {
/** Complete set of URL-backed UI configuration settings for `AgenticTracesComponent`. */
export interface UrlUiConfig {
+ embed: boolean;
+ headerVisible: boolean;
+ toolbarVisible: boolean;
+ panelVisible: boolean;
+ sidebarHidden: boolean;
+ legendHidden: boolean;
axis: AxisMode;
wait: boolean;
fill: boolean;
@@ -110,9 +119,15 @@ export interface UrlUiConfig {
sidebarFilter: string;
}
-/** Returns the default UI configuration matching an unadorned app load. */
-export function defaultUrlUiConfig(): UrlUiConfig {
+/** Returns the default UI configuration matching an unadorned app load (or embed route). */
+export function defaultUrlUiConfig(embed = false): UrlUiConfig {
return {
+ embed,
+ headerVisible: !embed,
+ toolbarVisible: !embed,
+ panelVisible: !embed,
+ sidebarHidden: embed,
+ legendHidden: false,
axis: 'time',
wait: false,
fill: false,
@@ -128,13 +143,30 @@ export function defaultUrlUiConfig(): UrlUiConfig {
searchMode: 'semantic',
activeIndex: null,
markId: null,
- legendCollapsed: false,
+ legendCollapsed: embed,
sidebarCollapsed: false,
panelCollapsed: false,
sidebarFilter: '',
};
}
+/** Returns true when `href` or Angular `routePath` targets the `/embed` view. */
+export function isEmbedLocation(href: string, routePath?: string): boolean {
+ if (routePath === 'embed') return true;
+ if (!href) return false;
+ try {
+ const url = new URL(href, 'https://example.com');
+ const cleanPath = url.pathname.replace(/\/+$/, '');
+ if (cleanPath === '/embed' || cleanPath.endsWith('/embed')) {
+ return true;
+ }
+ const hashPath = url.hash.startsWith('#') ? url.hash.slice(1).split('?')[0].replace(/\/+$/, '') : '';
+ return hashPath === '/embed';
+ } catch {
+ return false;
+ }
+}
+
function parseBoolFlag(raw: string | undefined, fallback: boolean): boolean {
if (raw === undefined) return fallback;
const v = raw.trim().toLowerCase();
@@ -143,6 +175,18 @@ function parseBoolFlag(raw: string | undefined, fallback: boolean): boolean {
return fallback;
}
+function parseVisibilityFlag(raw: string | undefined, fallback: boolean): boolean {
+ if (raw === undefined) return fallback;
+ const v = raw.trim().toLowerCase();
+ if (v === '1' || v === 'true' || v === 'yes' || v === 'on' || v === 'open' || v === 'expanded' || v === 'shown') {
+ return true;
+ }
+ if (v === '0' || v === 'false' || v === 'no' || v === 'off' || v === 'hidden' || v === 'none') {
+ return false;
+ }
+ return fallback;
+}
+
function parseAxisMode(raw: string | undefined): AxisMode {
const v = (raw ?? '').trim().toLowerCase();
if (v === 'tokens') return 'tokens';
@@ -177,10 +221,50 @@ function parseExpandAll(raw: string | undefined): boolean {
return true;
}
-function parseCollapsed(raw: string | undefined): boolean {
- if (raw === undefined) return false;
+function parseTriStateChrome(
+ raw: string | undefined,
+ collapseOnHide: boolean,
+ defaultHidden: boolean,
+ defaultCollapsed: boolean,
+): { hidden: boolean; collapsed: boolean } {
+ if (raw === undefined) {
+ return { hidden: defaultHidden, collapsed: defaultCollapsed };
+ }
const v = raw.trim().toLowerCase();
- return v === 'collapsed' || v === '1' || v === 'true' || v === 'hidden';
+ if (v === 'hidden' || v === '0' || v === 'false' || v === 'off' || v === 'none') {
+ return { hidden: true, collapsed: collapseOnHide };
+ }
+ if (v === 'collapsed') {
+ return { hidden: false, collapsed: true };
+ }
+ if (v === '1' || v === 'true' || v === 'on' || v === 'open' || v === 'expanded' || v === 'shown') {
+ return { hidden: false, collapsed: false };
+ }
+ return { hidden: defaultHidden, collapsed: defaultCollapsed };
+}
+
+function parseSidebarState(
+ raw: string | undefined,
+ embedDefaultHidden: boolean,
+): { sidebarHidden: boolean; sidebarCollapsed: boolean } {
+ const { hidden, collapsed } = parseTriStateChrome(raw, false, embedDefaultHidden, false);
+ return { sidebarHidden: hidden, sidebarCollapsed: collapsed };
+}
+
+function parsePanelState(
+ raw: string | undefined,
+ embedDefaultHidden: boolean,
+): { panelVisible: boolean; panelCollapsed: boolean } {
+ const { hidden, collapsed } = parseTriStateChrome(raw, false, embedDefaultHidden, false);
+ return { panelVisible: !hidden, panelCollapsed: collapsed };
+}
+
+function parseLegendState(
+ raw: string | undefined,
+ embedDefaultCollapsed: boolean,
+): { legendHidden: boolean; legendCollapsed: boolean } {
+ const { hidden, collapsed } = parseTriStateChrome(raw, true, false, embedDefaultCollapsed);
+ return { legendHidden: hidden, legendCollapsed: collapsed };
}
function parseSearchMode(raw: string | undefined): 'fuzzy' | 'semantic' {
@@ -244,7 +328,13 @@ function parseCustomSearches(
/** Parses all UI configuration parameters from a merged query parameter map. */
export function parseUrlUiConfig(
params: ReadonlyMap
@@ -272,11 +280,12 @@
-