/** * zarr-metadata * * Client-side Zarr metadata parser and xarray-style HTML renderer. Reads a * store's consolidated metadata (v2 `.zmetadata` or v3 `zarr.json`) directly * in the browser and builds the same HTML representation xarray produces in a * notebook - no server round-trip required. * * Framework-agnostic: {@link loadZarrMetadataHtml} and {@link openDatasetMeta} * are plain functions, usable from any framework or none. */ /** A single Zarr array, normalized into the shape xarray exposes. */ export interface ZarrVariable { shape: number[]; chunks: number[]; dtype: string; dims: string[]; attrs: Record; /** Internal heuristic flag: a 1-D coordinate that looks like a time axis. */ _isTimeCoord?: boolean; } /** A flat Zarr dataset (one group's worth of arrays). */ export interface ZarrDataset { dims: Record; coords: Record; data_vars: Record; attrs: Record; } /** * Parsed metadata. Either a flat dataset (`groups: null`) or a map of named * groups, mirroring what {@link buildXarrayRepr} renders. */ export type ZarrMetadataResult = ({ groups: null; } & ZarrDataset) | { groups: Record; }; /** Options shared by the metadata fetchers. */ export interface ZarrMetadataOptions { /** * Override auth header injection. * Default: reads a Bearer token from the `freva_auth_token` cookie. */ getAuthHeaders?: () => Record; } /** Options for {@link injectXarrayCss}. */ export interface InjectCssOptions { /** * Base accent color (hex) used for the chunk-cube fills. Falls back to * `window.MAIN_COLOR`, then to Freva's default `#9b7a52`. */ mainColor?: string; } /** Options for {@link loadZarrMetadataHtml}. */ export interface LoadMetadataOptions extends ZarrMetadataOptions, InjectCssOptions { /** Inject the xarray CSS into `` before building HTML. Default: true. */ injectCss?: boolean; } /** * Fetches a store's consolidated metadata (v2 `.zmetadata`, falling back to * v3 `zarr.json`) and returns either a flat dataset (`groups: null`) or a * multi-group store (`groups: { name -> dataset }`). */ export declare function openDatasetMeta(url: string, options?: ZarrMetadataOptions): Promise; /** Build the xarray-style HTML repr for parsed metadata. */ export declare function buildXarrayRepr(result: ZarrMetadataResult): string; /** * Inject the xarray repr CSS into `` exactly once. The chunk-cube color * variables are derived from `mainColor` (default `window.MAIN_COLOR`, then * `#9b7a52`). A no-op outside the browser or after the first call. */ export declare function injectXarrayCss(options?: InjectCssOptions): void; /** * Convenience: fetch a store's metadata and return the xarray-style HTML repr, * injecting the CSS first (unless `injectCss: false`). This is the * framework-agnostic equivalent of the former server `/zarr-utils/html` * endpoint, and the building block for a React `useHtmlMetadata` hook. */ export declare function loadZarrMetadataHtml(url: string, options?: LoadMetadataOptions): Promise; //# sourceMappingURL=zarr-metadata.d.ts.map