@populationgenomics/gene-glyph 0.0.0-stage → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +58 -2
- package/dist/adapters/clinvar.d.ts +34 -0
- package/dist/adapters/clinvar.d.ts.map +1 -0
- package/dist/adapters/clinvar.test.d.ts +2 -0
- package/dist/adapters/clinvar.test.d.ts.map +1 -0
- package/dist/adapters/rmc.d.ts +31 -0
- package/dist/adapters/rmc.d.ts.map +1 -0
- package/dist/adapters/rmc.test.d.ts +2 -0
- package/dist/adapters/rmc.test.d.ts.map +1 -0
- package/dist/chrome/default-minimap.d.ts +26 -0
- package/dist/chrome/default-minimap.d.ts.map +1 -0
- package/dist/chrome/default-minimap.test.d.ts +2 -0
- package/dist/chrome/default-minimap.test.d.ts.map +1 -0
- package/dist/chrome/default-track-chevron.d.ts +37 -0
- package/dist/chrome/default-track-chevron.d.ts.map +1 -0
- package/dist/chrome/default-track-chevron.test.d.ts +2 -0
- package/dist/chrome/default-track-chevron.test.d.ts.map +1 -0
- package/dist/coordinate-mapper.d.ts +13 -0
- package/dist/coordinate-mapper.d.ts.map +1 -0
- package/dist/coordinate-mapper.test.d.ts +2 -0
- package/dist/coordinate-mapper.test.d.ts.map +1 -0
- package/dist/data-source.d.ts +24 -0
- package/dist/data-source.d.ts.map +1 -0
- package/dist/data-source.test.d.ts +2 -0
- package/dist/data-source.test.d.ts.map +1 -0
- package/dist/debug-leash.d.ts +73 -0
- package/dist/debug-leash.d.ts.map +1 -0
- package/dist/export.d.ts +69 -0
- package/dist/export.d.ts.map +1 -0
- package/dist/export.test.d.ts +2 -0
- package/dist/export.test.d.ts.map +1 -0
- package/dist/feature-id-hash.d.ts +26 -0
- package/dist/feature-id-hash.d.ts.map +1 -0
- package/dist/feature-id-hash.test.d.ts +2 -0
- package/dist/feature-id-hash.test.d.ts.map +1 -0
- package/dist/figure-scale.d.ts +145 -0
- package/dist/figure-scale.d.ts.map +1 -0
- package/dist/figure-scale.test.d.ts +2 -0
- package/dist/figure-scale.test.d.ts.map +1 -0
- package/dist/gutter.test.d.ts +2 -0
- package/dist/gutter.test.d.ts.map +1 -0
- package/dist/index.d.ts +62 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7910 -0
- package/dist/index.js.map +1 -0
- package/dist/layout-engine.d.ts +52 -0
- package/dist/layout-engine.d.ts.map +1 -0
- package/dist/layout-engine.test.d.ts +2 -0
- package/dist/layout-engine.test.d.ts.map +1 -0
- package/dist/pack-lanes.d.ts +27 -0
- package/dist/pack-lanes.d.ts.map +1 -0
- package/dist/pack-lanes.test.d.ts +2 -0
- package/dist/pack-lanes.test.d.ts.map +1 -0
- package/dist/painter/index.d.ts +4 -0
- package/dist/painter/index.d.ts.map +1 -0
- package/dist/painter/svg-painter.d.ts +6 -0
- package/dist/painter/svg-painter.d.ts.map +1 -0
- package/dist/painter/svg-painter.test.d.ts +2 -0
- package/dist/painter/svg-painter.test.d.ts.map +1 -0
- package/dist/projection-frame.d.ts +92 -0
- package/dist/projection-frame.d.ts.map +1 -0
- package/dist/projection-frame.test.d.ts +2 -0
- package/dist/projection-frame.test.d.ts.map +1 -0
- package/dist/segments.d.ts +86 -0
- package/dist/segments.d.ts.map +1 -0
- package/dist/slots.test.d.ts +2 -0
- package/dist/slots.test.d.ts.map +1 -0
- package/dist/styles.css +1127 -0
- package/dist/symbol-encoding.d.ts +103 -0
- package/dist/symbol-encoding.d.ts.map +1 -0
- package/dist/symbol-encoding.test.d.ts +2 -0
- package/dist/symbol-encoding.test.d.ts.map +1 -0
- package/dist/test-setup.d.ts +2 -0
- package/dist/test-setup.d.ts.map +1 -0
- package/dist/tracks/aa-track.d.ts +67 -0
- package/dist/tracks/aa-track.d.ts.map +1 -0
- package/dist/tracks/aa-track.test.d.ts +2 -0
- package/dist/tracks/aa-track.test.d.ts.map +1 -0
- package/dist/tracks/clinvar-summary-track.d.ts +29 -0
- package/dist/tracks/clinvar-summary-track.d.ts.map +1 -0
- package/dist/tracks/clinvar-summary-track.test.d.ts +2 -0
- package/dist/tracks/clinvar-summary-track.test.d.ts.map +1 -0
- package/dist/tracks/clinvar-track.d.ts +161 -0
- package/dist/tracks/clinvar-track.d.ts.map +1 -0
- package/dist/tracks/clinvar-track.test.d.ts +2 -0
- package/dist/tracks/clinvar-track.test.d.ts.map +1 -0
- package/dist/tracks/exon-track.d.ts +25 -0
- package/dist/tracks/exon-track.d.ts.map +1 -0
- package/dist/tracks/exon-track.test.d.ts +2 -0
- package/dist/tracks/exon-track.test.d.ts.map +1 -0
- package/dist/tracks/interpro-track.d.ts +69 -0
- package/dist/tracks/interpro-track.d.ts.map +1 -0
- package/dist/tracks/interpro-track.test.d.ts +2 -0
- package/dist/tracks/interpro-track.test.d.ts.map +1 -0
- package/dist/tracks/nucleotide-track.d.ts +84 -0
- package/dist/tracks/nucleotide-track.d.ts.map +1 -0
- package/dist/tracks/nucleotide-track.test.d.ts +2 -0
- package/dist/tracks/nucleotide-track.test.d.ts.map +1 -0
- package/dist/tracks/overview-track.d.ts +50 -0
- package/dist/tracks/overview-track.d.ts.map +1 -0
- package/dist/tracks/overview-track.test.d.ts +2 -0
- package/dist/tracks/overview-track.test.d.ts.map +1 -0
- package/dist/tracks/parse-user-variants.d.ts +55 -0
- package/dist/tracks/parse-user-variants.d.ts.map +1 -0
- package/dist/tracks/parse-user-variants.test.d.ts +2 -0
- package/dist/tracks/parse-user-variants.test.d.ts.map +1 -0
- package/dist/tracks/pfam-track.d.ts +33 -0
- package/dist/tracks/pfam-track.d.ts.map +1 -0
- package/dist/tracks/pfam-track.test.d.ts +2 -0
- package/dist/tracks/pfam-track.test.d.ts.map +1 -0
- package/dist/tracks/profile-track.d.ts +133 -0
- package/dist/tracks/profile-track.d.ts.map +1 -0
- package/dist/tracks/profile-track.test.d.ts +2 -0
- package/dist/tracks/profile-track.test.d.ts.map +1 -0
- package/dist/tracks/scale-track.d.ts +70 -0
- package/dist/tracks/scale-track.d.ts.map +1 -0
- package/dist/tracks/scale-track.test.d.ts +2 -0
- package/dist/tracks/scale-track.test.d.ts.map +1 -0
- package/dist/tracks/segment-band-track.d.ts +86 -0
- package/dist/tracks/segment-band-track.d.ts.map +1 -0
- package/dist/tracks/segment-band-track.test.d.ts +2 -0
- package/dist/tracks/segment-band-track.test.d.ts.map +1 -0
- package/dist/tracks/user-variant-track.d.ts +50 -0
- package/dist/tracks/user-variant-track.d.ts.map +1 -0
- package/dist/tracks/user-variant-track.test.d.ts +2 -0
- package/dist/tracks/user-variant-track.test.d.ts.map +1 -0
- package/dist/tracks/variant-summary-track.d.ts +24 -0
- package/dist/tracks/variant-summary-track.d.ts.map +1 -0
- package/dist/tracks/variant-summary-track.test.d.ts +2 -0
- package/dist/tracks/variant-summary-track.test.d.ts.map +1 -0
- package/dist/tracks/variant-track.d.ts +89 -0
- package/dist/tracks/variant-track.d.ts.map +1 -0
- package/dist/tracks/variant-track.test.d.ts +2 -0
- package/dist/tracks/variant-track.test.d.ts.map +1 -0
- package/dist/types.d.ts +671 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/use-viewport-interactions.d.ts +49 -0
- package/dist/use-viewport-interactions.d.ts.map +1 -0
- package/dist/viewer-interactions.test.d.ts +2 -0
- package/dist/viewer-interactions.test.d.ts.map +1 -0
- package/dist/viewer-overlay.test.d.ts +2 -0
- package/dist/viewer-overlay.test.d.ts.map +1 -0
- package/dist/viewer-selection-range.test.d.ts +2 -0
- package/dist/viewer-selection-range.test.d.ts.map +1 -0
- package/dist/viewer.d.ts +319 -0
- package/dist/viewer.d.ts.map +1 -0
- package/dist/viewer.test.d.ts +2 -0
- package/dist/viewer.test.d.ts.map +1 -0
- package/dist/viewport.d.ts +352 -0
- package/dist/viewport.d.ts.map +1 -0
- package/dist/viewport.test.d.ts +2 -0
- package/dist/viewport.test.d.ts.map +1 -0
- package/package.json +65 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Centre for Population Genomics
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,59 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @populationgenomics/gene-glyph
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Gene-level annotation viewer for React with multi-coordinate alignment,
|
|
4
|
+
pluggable data tracks, and camera-ready vector export.
|
|
5
|
+
|
|
6
|
+
- **Live playground**: [populationgenomics.github.io/gene-glyph](https://populationgenomics.github.io/gene-glyph/)
|
|
7
|
+
- **Repository**: [github.com/populationgenomics/gene-glyph](https://github.com/populationgenomics/gene-glyph)
|
|
8
|
+
- **Changelog**: [`CHANGELOG.md`](https://github.com/populationgenomics/gene-glyph/blob/main/CHANGELOG.md)
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
npm install @populationgenomics/gene-glyph
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Peer deps: `react`, `react-dom` (>=18, <20).
|
|
17
|
+
|
|
18
|
+
## Minimal usage
|
|
19
|
+
|
|
20
|
+
```tsx
|
|
21
|
+
import { GeneGlyph, exonTrack, variantTrack } from '@populationgenomics/gene-glyph';
|
|
22
|
+
import '@populationgenomics/gene-glyph/styles.css';
|
|
23
|
+
|
|
24
|
+
export function MyPage({ transcript, variants }) {
|
|
25
|
+
return (
|
|
26
|
+
<GeneGlyph
|
|
27
|
+
transcript={transcript}
|
|
28
|
+
tracks={[exonTrack({}), variantTrack({ source: variants })]}
|
|
29
|
+
/>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
The viewer is a compound component — tracks, slots, and controlled state
|
|
35
|
+
plug in around the core element.
|
|
36
|
+
|
|
37
|
+
## Default mouse / keyboard bindings
|
|
38
|
+
|
|
39
|
+
| Gesture | Action |
|
|
40
|
+
| ---------------------------------- | -------------------------------------------------------------------------------------- |
|
|
41
|
+
| Drag | Box-zoom: snap viewport to the dragged screen-x interval (live preview; `Esc` cancels) |
|
|
42
|
+
| Space + drag | Pan (Adobe Hand-tool pattern). Touch / pen drag pans without the modifier |
|
|
43
|
+
| Wheel | Pan horizontally (falls through to the page at the pan limit) |
|
|
44
|
+
| Cmd/Ctrl + wheel | Zoom, cursor-anchored |
|
|
45
|
+
| Pinch | Zoom, cursor-anchored |
|
|
46
|
+
| Shift + drag (or right-click drag) | Brush-select a range — surfaced via `onBrushChange` |
|
|
47
|
+
| Arrows / WASD | Pan / zoom |
|
|
48
|
+
| `1` | Fit gene |
|
|
49
|
+
|
|
50
|
+
## Documentation
|
|
51
|
+
|
|
52
|
+
See the [repository README](https://github.com/populationgenomics/gene-glyph#readme)
|
|
53
|
+
for the longer overview, including track folding with summary representations,
|
|
54
|
+
and the playground for runnable scenarios covering ClinVar, gnomAD, sequence,
|
|
55
|
+
and user-supplied variant tracks.
|
|
56
|
+
|
|
57
|
+
## License
|
|
58
|
+
|
|
59
|
+
MIT. See [`LICENSE`](./LICENSE).
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type ClinVarRecord } from '../tracks/clinvar-track.js';
|
|
2
|
+
import type { DataSource, Transcript, ViewportQuery } from '../types.js';
|
|
3
|
+
export interface CreateClinVarDataSourceOptions {
|
|
4
|
+
/** Transcript used to constrain the search. The adapter fetches by gene
|
|
5
|
+
* symbol and filters to the transcript's chromosome on the host side. */
|
|
6
|
+
transcript: Transcript;
|
|
7
|
+
/** Override the NCBI eutils base URL — useful for testing against a stub
|
|
8
|
+
* and for hosts that route through a proxy. */
|
|
9
|
+
baseUrl?: string;
|
|
10
|
+
/** Records per esummary batch. Defaults to 200; NCBI caps at 500. */
|
|
11
|
+
pageSize?: number;
|
|
12
|
+
/** Injectable fetch — defaults to the global `fetch`. Tests swap in a fake
|
|
13
|
+
* to drive paginated responses deterministically. */
|
|
14
|
+
fetchImpl?: typeof fetch;
|
|
15
|
+
/** Soft cap on the in-memory cache. Forwarded to
|
|
16
|
+
* {@link createCachedDataSource}; ClinVar queries vary by transcript so 16
|
|
17
|
+
* entries comfortably covers a paper-report workspace. */
|
|
18
|
+
maxEntries?: number;
|
|
19
|
+
}
|
|
20
|
+
/** Build a `DataSource<ViewportQuery, ClinVarRecord[]>` backed by NCBI eutils.
|
|
21
|
+
* The adapter caches by `transcriptId` because ClinVar data is gene-scoped —
|
|
22
|
+
* the viewport's mode and range don't change what's available, so a pan or
|
|
23
|
+
* zoom never re-fetches. The query path:
|
|
24
|
+
*
|
|
25
|
+
* 1. `esearch` for `{geneSymbol}[gene]`, paging through all hits.
|
|
26
|
+
* 2. `esummary` in {@link pageSize}-sized batches, parsing the JSON into
|
|
27
|
+
* {@link ClinVarRecord}.
|
|
28
|
+
* 3. Filter to records on the transcript's chromosome — `MT` / contig
|
|
29
|
+
* mismatches are silently dropped (rare but they do exist).
|
|
30
|
+
*
|
|
31
|
+
* Network failure throws; the caching wrapper evicts the failed key so the
|
|
32
|
+
* next caller retries. */
|
|
33
|
+
export declare function createClinVarDataSource(opts: CreateClinVarDataSourceOptions): DataSource<ViewportQuery, ClinVarRecord[]>;
|
|
34
|
+
//# sourceMappingURL=clinvar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clinvar.d.ts","sourceRoot":"","sources":["../../src/adapters/clinvar.ts"],"names":[],"mappings":"AACA,OAAO,EAA4B,KAAK,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC1F,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAKzE,MAAM,WAAW,8BAA8B;IAC7C;8EAC0E;IAC1E,UAAU,EAAE,UAAU,CAAC;IACvB;oDACgD;IAChD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qEAAqE;IACrE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;0DACsD;IACtD,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;IACzB;;+DAE2D;IAC3D,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;;;;2BAY2B;AAC3B,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,8BAA8B,GACnC,UAAU,CAAC,aAAa,EAAE,aAAa,EAAE,CAAC,CAqC5C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clinvar.test.d.ts","sourceRoot":"","sources":["../../src/adapters/clinvar.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Slice 40 — Regional Missense Constraint helpers.
|
|
3
|
+
*
|
|
4
|
+
* gnomAD v2 exposes RMC via the `gene.gnomad_v2_regional_missense_
|
|
5
|
+
* constraint.regions` GraphQL field. Each region carries protein-coord
|
|
6
|
+
* endpoints in three-letter codon strings (e.g. `"Lys2009"`) plus a
|
|
7
|
+
* pair `(obs_exp, p_value)` that bins the region into one of five
|
|
8
|
+
* intolerance tiers (plus a grey `not-significant` fallback when
|
|
9
|
+
* `p_value > 0.001`).
|
|
10
|
+
*
|
|
11
|
+
* The helpers here are pure functions over the upstream shapes so they
|
|
12
|
+
* can be unit-tested without a GraphQL round-trip; the playground's
|
|
13
|
+
* gnomAD adapter wires them into the live data path.
|
|
14
|
+
*/
|
|
15
|
+
/** Six-bin category used by the RMC strip. Five intolerance tiers
|
|
16
|
+
* ordered from most-intolerant (red, lowest obs/exp) to least
|
|
17
|
+
* (light green, highest obs/exp); plus `not-significant` for regions
|
|
18
|
+
* whose `p_value > 0.001`. */
|
|
19
|
+
export type RmcCategory = 'intol-1' | 'intol-2' | 'intol-3' | 'intol-4' | 'intol-5' | 'not-significant';
|
|
20
|
+
/** Parse a gnomAD RMC `aa_start` / `aa_stop` string (e.g. `"Lys2009"`)
|
|
21
|
+
* into its integer position. Handles all 20 canonical three-letter
|
|
22
|
+
* codes plus `Ter` (stop), `Sec` (selenocysteine), and `Pyl`
|
|
23
|
+
* (pyrrolysine). Returns `null` for malformed input so callers can
|
|
24
|
+
* skip rather than throw on a dirty row. */
|
|
25
|
+
export declare function parseAaStart(s: string): number | null;
|
|
26
|
+
/** Assign an RMC region to one of the five intolerance bins, or to
|
|
27
|
+
* `'not-significant'` when `p_value > 0.001`. The p-value override
|
|
28
|
+
* fires first — a region with high obs/exp but high p_value still
|
|
29
|
+
* reads as uninformative grey rather than a bin colour. */
|
|
30
|
+
export declare function rmcCategoryFor(obsExp: number, pValue: number): RmcCategory;
|
|
31
|
+
//# sourceMappingURL=rmc.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rmc.d.ts","sourceRoot":"","sources":["../../src/adapters/rmc.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;;+BAG+B;AAC/B,MAAM,MAAM,WAAW,GACrB,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,iBAAiB,CAAC;AA8BhF;;;;6CAI6C;AAC7C,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAWrD;AAED;;;4DAG4D;AAC5D,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,WAAW,CAQ1E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rmc.test.d.ts","sourceRoot":"","sources":["../../src/adapters/rmc.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type RefObject } from 'react';
|
|
2
|
+
import type { GeneGlyphRef } from '../viewer.js';
|
|
3
|
+
export interface DefaultMinimapProps {
|
|
4
|
+
/** Ref handed to `<GeneGlyph>`. The minimap subscribes to viewer changes
|
|
5
|
+
* and writes pan / zoom back via `panByDisplayPx` and `fitTo`. */
|
|
6
|
+
viewerRef: RefObject<GeneGlyphRef | null>;
|
|
7
|
+
/** Pixel width of the thumbnail SVG. Default 480. */
|
|
8
|
+
width?: number;
|
|
9
|
+
/** Pixel height of the thumbnail SVG. Default 28. */
|
|
10
|
+
height?: number;
|
|
11
|
+
/** Optional className appended to the root container. */
|
|
12
|
+
className?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Display-space minimap. Renders the figure in the **current** static
|
|
16
|
+
* layout (scaled to the minimap's width), so the brush rectangle
|
|
17
|
+
* represents exactly what the viewport sees in display pixels. Under
|
|
18
|
+
* pure pan the brush slides uniformly with no scale change in either
|
|
19
|
+
* view; under handle drag the zoom changes smoothly.
|
|
20
|
+
*
|
|
21
|
+
* Built on the viewer's public API: `subscribe()` for state changes,
|
|
22
|
+
* `panByDisplayPx()` for the pan gesture, and `fitTo({range})` for
|
|
23
|
+
* resize-induced zoom.
|
|
24
|
+
*/
|
|
25
|
+
export declare function DefaultMinimap({ viewerRef, width, height, className, }: DefaultMinimapProps): import("react").JSX.Element;
|
|
26
|
+
//# sourceMappingURL=default-minimap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default-minimap.d.ts","sourceRoot":"","sources":["../../src/chrome/default-minimap.tsx"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,YAAY,EAAgB,MAAM,cAAc,CAAC;AAqD/D,MAAM,WAAW,mBAAmB;IAClC;uEACmE;IACnE,SAAS,EAAE,SAAS,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;IAC1C,qDAAqD;IACrD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qDAAqD;IACrD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,yDAAyD;IACzD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAwBD;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,EAC7B,SAAS,EACT,KAAW,EACX,MAAW,EACX,SAAS,GACV,EAAE,mBAAmB,+BAkPrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default-minimap.test.d.ts","sourceRoot":"","sources":["../../src/chrome/default-minimap.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { GutterItem } from '../viewer.js';
|
|
3
|
+
export interface DefaultTrackChevronProps {
|
|
4
|
+
/** The gutter item this chevron toggles. Used for the label, the
|
|
5
|
+
* `aria-controls` link to the corresponding track group, and to scope
|
|
6
|
+
* `data-vv-item-id` for tests. */
|
|
7
|
+
item: GutterItem;
|
|
8
|
+
/** Whether the corresponding track/group is currently collapsed (hidden
|
|
9
|
+
* from the figure). The host owns this state; the chevron only renders
|
|
10
|
+
* the toggle UI. */
|
|
11
|
+
collapsed: boolean;
|
|
12
|
+
/** Fires on click or Enter/Space when the chevron is focused. The host
|
|
13
|
+
* flips `collapsed` and updates its `tracks` prop accordingly. */
|
|
14
|
+
onToggle: () => void;
|
|
15
|
+
/** Optional override for the visible label. Defaults to `item.label` for
|
|
16
|
+
* groups and `item.id` for tracks. */
|
|
17
|
+
label?: ReactNode;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Slice 20 — chrome convenience component for the LeftGutter. Renders a
|
|
21
|
+
* single chevron button with the item's label; the host wires the collapse
|
|
22
|
+
* state and the matching `tracks` edit.
|
|
23
|
+
*
|
|
24
|
+
* The chevron is purely presentational — it has no opinion about how the
|
|
25
|
+
* host implements collapsing. The canonical pattern (RD-1110) is for
|
|
26
|
+
* `onToggle` to call into the viewer's collapse API — either through the
|
|
27
|
+
* imperative ref (`viewerRef.current?.toggleGroup(item.id)`) or by
|
|
28
|
+
* updating the host's mirror of `collapsedGroupIds` — rather than editing
|
|
29
|
+
* the `tracks` prop. Wrapping the detail tracks in a `TrackGroup` with a
|
|
30
|
+
* `summaryTrack` then lets the figure swap the stacked detail for a
|
|
31
|
+
* one-row summary while the chevron is in the folded state, instead of
|
|
32
|
+
* removing the rows entirely.
|
|
33
|
+
*
|
|
34
|
+
* Built using only the public API.
|
|
35
|
+
*/
|
|
36
|
+
export declare function DefaultTrackChevron({ item, collapsed, onToggle, label, }: DefaultTrackChevronProps): import("react").JSX.Element;
|
|
37
|
+
//# sourceMappingURL=default-track-chevron.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default-track-chevron.d.ts","sourceRoot":"","sources":["../../src/chrome/default-track-chevron.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,MAAM,WAAW,wBAAwB;IACvC;;uCAEmC;IACnC,IAAI,EAAE,UAAU,CAAC;IACjB;;yBAEqB;IACrB,SAAS,EAAE,OAAO,CAAC;IACnB;uEACmE;IACnE,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB;2CACuC;IACvC,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,IAAI,EACJ,SAAS,EACT,QAAQ,EACR,KAAK,GACN,EAAE,wBAAwB,+BAsB1B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default-track-chevron.test.d.ts","sourceRoot":"","sources":["../../src/chrome/default-track-chevron.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { CollapsedRegion, CoordinateMapper, Transcript } from './types.js';
|
|
2
|
+
/** Default soft-collapse spec — one region per intron, compressing
|
|
3
|
+
* everything except the first `flankBp` and last `flankBp` of each
|
|
4
|
+
* intron. The 10bp default matches the conventional "splice-site
|
|
5
|
+
* preservation" window so the donor / acceptor consensus sequences
|
|
6
|
+
* stay linear under zoom while the deep-intron bulk stays at a
|
|
7
|
+
* fixed pixel budget. Hosts can pass their own
|
|
8
|
+
* `collapsedRegions` prop to override this — leaving an intronic
|
|
9
|
+
* range out of the spec keeps it linear (i.e., expanded); adding a
|
|
10
|
+
* range covering exonic bp compresses that too. */
|
|
11
|
+
export declare function defaultCollapsedRegions(transcript: Transcript, flankBp?: number): CollapsedRegion[];
|
|
12
|
+
export declare function createCoordinateMapper(transcript: Transcript): CoordinateMapper;
|
|
13
|
+
//# sourceMappingURL=coordinate-mapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coordinate-mapper.d.ts","sourceRoot":"","sources":["../src/coordinate-mapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,eAAe,EACf,gBAAgB,EAIhB,UAAU,EACX,MAAM,YAAY,CAAC;AAEpB;;;;;;;;oDAQoD;AACpD,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,UAAU,EAAE,OAAO,SAAK,GAAG,eAAe,EAAE,CAa/F;AAED,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,UAAU,GAAG,gBAAgB,CAyI/E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coordinate-mapper.test.d.ts","sourceRoot":"","sources":["../src/coordinate-mapper.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { DataSource, DataSourceFreshness } from './types.js';
|
|
2
|
+
export declare function resolveSequence<TQuery extends {
|
|
3
|
+
transcriptId: string;
|
|
4
|
+
}>(source: string | DataSource<TQuery, string>, queryArgs: TQuery, signal: AbortSignal): Promise<string>;
|
|
5
|
+
export declare function resolveSourceData<TQuery, TResult>(source: TResult[] | DataSource<TQuery, TResult[]>, query: TQuery, signal: AbortSignal): Promise<TResult[]>;
|
|
6
|
+
export interface CachedDataSourceOptions<TQuery, TResult> {
|
|
7
|
+
readonly id: string;
|
|
8
|
+
cacheKey(query: TQuery): string;
|
|
9
|
+
query(query: TQuery, signal: AbortSignal): Promise<TResult>;
|
|
10
|
+
freshness?: DataSourceFreshness;
|
|
11
|
+
/** Soft cap on retained cache entries. LRU eviction keeps the in-memory
|
|
12
|
+
* cache bounded for sources whose queries vary across many windows (e.g.
|
|
13
|
+
* ClinVar pan/zoom workflows). Default 64; pass `Infinity` to disable. */
|
|
14
|
+
maxEntries?: number;
|
|
15
|
+
}
|
|
16
|
+
/** Wrap a user `query` function with in-memory caching keyed by `cacheKey`.
|
|
17
|
+
* Two tracks given the same returned `DataSource` instance auto-share fetched
|
|
18
|
+
* data — the second call resolves from cache without re-running `query`.
|
|
19
|
+
* The per-call `signal` is honoured for the *caller* (their wait aborts) but
|
|
20
|
+
* doesn't cancel the underlying fetch, since other waiters may still need
|
|
21
|
+
* the result. Failures are not cached: a rejected lookup is evicted so a
|
|
22
|
+
* subsequent caller can retry. Slice 18. */
|
|
23
|
+
export declare function createCachedDataSource<TQuery, TResult>(opts: CachedDataSourceOptions<TQuery, TResult>): DataSource<TQuery, TResult>;
|
|
24
|
+
//# sourceMappingURL=data-source.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-source.d.ts","sourceRoot":"","sources":["../src/data-source.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAElE,wBAAsB,eAAe,CAAC,MAAM,SAAS;IAAE,YAAY,EAAE,MAAM,CAAA;CAAE,EAC3E,MAAM,EAAE,MAAM,GAAG,UAAU,CAAC,MAAM,EAAE,MAAM,CAAC,EAC3C,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,WAAW,GAClB,OAAO,CAAC,MAAM,CAAC,CAMjB;AAED,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,OAAO,EACrD,MAAM,EAAE,OAAO,EAAE,GAAG,UAAU,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC,EACjD,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,WAAW,GAClB,OAAO,CAAC,OAAO,EAAE,CAAC,CAKpB;AAED,MAAM,WAAW,uBAAuB,CAAC,MAAM,EAAE,OAAO;IACtD,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IAChC,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC5D,SAAS,CAAC,EAAE,mBAAmB,CAAC;IAChC;;+EAE2E;IAC3E,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAID;;;;;;6CAM6C;AAC7C,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,OAAO,EACpD,IAAI,EAAE,uBAAuB,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7C,UAAU,CAAC,MAAM,EAAE,OAAO,CAAC,CAiC7B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-source.test.d.ts","sourceRoot":"","sources":["../src/data-source.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dev-only "loop leash" + structured logs for the rAF pollers and any other
|
|
3
|
+
* tight-loop call sites. The pollers (overview-track, default-minimap, viewer
|
|
4
|
+
* tooltip-anchor, playground scenarios) drive ~60 fps work to keep auxiliary
|
|
5
|
+
* widgets in sync with the figure's animated viewport — but if their work
|
|
6
|
+
* itself trips a re-render of the polling component (state-in-effect, dep
|
|
7
|
+
* churn, etc.), the poll can pile work onto an already-overloaded event loop
|
|
8
|
+
* and tank the page. The leash watches each loop for:
|
|
9
|
+
*
|
|
10
|
+
* 1. Total frame count crossing a hard cap (default 600 000 ticks ≈ 167
|
|
11
|
+
* minutes at 60 fps). Past that we cancel the loop and console.error
|
|
12
|
+
* so the page recovers instead of dragging on indefinitely.
|
|
13
|
+
* 2. Frame-time runaway — a single tick taking longer than the runaway
|
|
14
|
+
* budget (default 250 ms) means the work itself, not the loop, is
|
|
15
|
+
* pathological; emit a warning and a stack hint.
|
|
16
|
+
* 3. Periodic heartbeat (default every 600 ticks) so a developer watching
|
|
17
|
+
* DevTools can see whether a poller is still alive without staring at
|
|
18
|
+
* the profiler.
|
|
19
|
+
*
|
|
20
|
+
* Disabled by default in production builds (`import.meta.env.PROD`); enabled
|
|
21
|
+
* automatically in dev. Hosts can override at runtime via
|
|
22
|
+
* `window.__GENE_GLYPH_DEBUG_LEASH__`.
|
|
23
|
+
*/
|
|
24
|
+
declare global {
|
|
25
|
+
interface Window {
|
|
26
|
+
__GENE_GLYPH_DEBUG_LEASH__?: boolean | Partial<LeashedRafOptions>;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export interface LeashedRafOptions {
|
|
30
|
+
/** Cancel + error after this many total ticks. */
|
|
31
|
+
maxTicks: number;
|
|
32
|
+
/** Per-tick work exceeding this (ms) emits a warning. */
|
|
33
|
+
runawayMs: number;
|
|
34
|
+
/** Heartbeat every N ticks (0 = never). */
|
|
35
|
+
heartbeatEvery: number;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Drop-in replacement for the typical rAF-loop pattern:
|
|
39
|
+
*
|
|
40
|
+
* let raf = 0;
|
|
41
|
+
* const tick = () => {
|
|
42
|
+
* // …work…
|
|
43
|
+
* raf = requestAnimationFrame(tick);
|
|
44
|
+
* };
|
|
45
|
+
* raf = requestAnimationFrame(tick);
|
|
46
|
+
* return () => cancelAnimationFrame(raf);
|
|
47
|
+
*
|
|
48
|
+
* becomes
|
|
49
|
+
*
|
|
50
|
+
* const leash = leashedRaf('overview-poll', () => { …work… });
|
|
51
|
+
* return () => leash.cancel();
|
|
52
|
+
*
|
|
53
|
+
* The leash logs ticks, work duration, and runaway / max-tick events with
|
|
54
|
+
* a stable label so multiple pollers stay distinguishable in the console.
|
|
55
|
+
*/
|
|
56
|
+
export declare function leashedRaf(label: string, work: () => void): {
|
|
57
|
+
cancel: () => void;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Guarded counter for any non-rAF tight loop that could spin (CSS-variable
|
|
61
|
+
* publish reentries, layout recomputes triggered from render, etc.). Wrap a
|
|
62
|
+
* function with a recursion budget; each entry decrements the budget, and
|
|
63
|
+
* exceeding it logs + throws so the developer sees the call stack instead
|
|
64
|
+
* of the page hanging.
|
|
65
|
+
*/
|
|
66
|
+
export declare function leashedRecursion<TArgs extends readonly unknown[], TRet>(label: string, fn: (...args: TArgs) => TRet, maxDepth?: number): (...args: TArgs) => TRet;
|
|
67
|
+
/**
|
|
68
|
+
* Detects setState storms: if the same callsite calls `notify` more than
|
|
69
|
+
* `maxPerWindow` times within `windowMs`, emit one warning per window so
|
|
70
|
+
* the developer notices without flooding the console.
|
|
71
|
+
*/
|
|
72
|
+
export declare function createStormDetector(label: string, maxPerWindow?: number, windowMs?: number): () => void;
|
|
73
|
+
//# sourceMappingURL=debug-leash.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debug-leash.d.ts","sourceRoot":"","sources":["../src/debug-leash.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,0BAA0B,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;KACnE;CACF;AAED,MAAM,WAAW,iBAAiB;IAChC,kDAAkD;IAClD,QAAQ,EAAE,MAAM,CAAC;IACjB,yDAAyD;IACzD,SAAS,EAAE,MAAM,CAAC;IAClB,2CAA2C;IAC3C,cAAc,EAAE,MAAM,CAAC;CACxB;AA8BD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,IAAI,GAAG;IAAE,MAAM,EAAE,MAAM,IAAI,CAAA;CAAE,CAiElF;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,SAAS,SAAS,OAAO,EAAE,EAAE,IAAI,EACrE,KAAK,EAAE,MAAM,EACb,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,KAAK,KAAK,IAAI,EAC5B,QAAQ,SAAK,GACZ,CAAC,GAAG,IAAI,EAAE,KAAK,KAAK,IAAI,CAkB1B;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,MAAM,EACb,YAAY,SAAM,EAClB,QAAQ,SAAQ,GACf,MAAM,IAAI,CAqBZ"}
|
package/dist/export.d.ts
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Slice 19 — camera-ready SVG/PNG export.
|
|
3
|
+
*
|
|
4
|
+
* `exportSVG` builds a portable, self-contained SVG string from the live
|
|
5
|
+
* figure DOM: CSS-variable-driven transforms collapse to concrete
|
|
6
|
+
* `transform="matrix(...)"` attributes, theme colours resolve to hex, and
|
|
7
|
+
* transient affordances (loading shimmer, cursor styles, data-* hit-test
|
|
8
|
+
* hooks) are stripped. The result opens cleanly in Inkscape / Illustrator
|
|
9
|
+
* without any of gene-glyph's stylesheet attached.
|
|
10
|
+
*
|
|
11
|
+
* The work happens on a clone mounted in an offscreen wrapper styled with the
|
|
12
|
+
* host's `.gene-glyph` class (and optionally `data-vv-print=""` for the
|
|
13
|
+
* print theme). Mounting the clone lets `getComputedStyle` resolve the active
|
|
14
|
+
* cascade against the requested theme — without touching the live figure or
|
|
15
|
+
* triggering a paint flash for the user.
|
|
16
|
+
*/
|
|
17
|
+
/** Public arg shape from design §10. `truncation` is plumbed for symmetry
|
|
18
|
+
* with the design doc but is a no-op today — every currently-shipped track
|
|
19
|
+
* reports `didTruncate: false`, so `expand` and `as-shown` produce the same
|
|
20
|
+
* layout. The branch lights up when a truncating track lands. */
|
|
21
|
+
export interface ExportArgs {
|
|
22
|
+
/** `'current'` resolves CSS vars to the values active in the host page;
|
|
23
|
+
* `'print'` resolves them against the dedicated print palette. Default
|
|
24
|
+
* `'print'`. */
|
|
25
|
+
theme?: 'current' | 'print';
|
|
26
|
+
/** Reserved for tracks that truncate to fit a height budget. Default
|
|
27
|
+
* `'as-shown'` (mirror the screen view). `'expand'` will rerun layout
|
|
28
|
+
* without truncation once a truncating track ships. */
|
|
29
|
+
truncation?: 'as-shown' | 'expand';
|
|
30
|
+
/** Pixel width of the exported SVG `<svg width="…">`. Defaults to the
|
|
31
|
+
* figure's viewBox width — Inkscape opens at logical units regardless. */
|
|
32
|
+
width?: number;
|
|
33
|
+
/** Accessibility label written into `<title>`. Defaults to the same string
|
|
34
|
+
* the live SVG carries on `aria-label`. */
|
|
35
|
+
ariaLabel?: string;
|
|
36
|
+
/** Embedded font handling. `'google'` injects a `@import` so the SVG self-
|
|
37
|
+
* renders Inter when opened in a browser; `'none'` skips it (the figure
|
|
38
|
+
* falls back to the platform font stack). Default `'google'`. */
|
|
39
|
+
fontImport?: 'google' | 'none';
|
|
40
|
+
/** Optional human-readable description for `<desc>`. Defaults to a short
|
|
41
|
+
* string built from the transcript metadata. */
|
|
42
|
+
description?: string;
|
|
43
|
+
}
|
|
44
|
+
export interface PrepareExportInput {
|
|
45
|
+
/** The live figure SVG to clone. */
|
|
46
|
+
svg: SVGSVGElement;
|
|
47
|
+
/** String written into `<title>` when `args.ariaLabel` is not supplied. */
|
|
48
|
+
ariaLabel: string;
|
|
49
|
+
/** Default description written into `<desc>`. */
|
|
50
|
+
description: string;
|
|
51
|
+
args?: ExportArgs;
|
|
52
|
+
}
|
|
53
|
+
/** Produce a stand-alone SVG string. Runs only in a browser-ish DOM (needs
|
|
54
|
+
* `getComputedStyle` + a writable `document.body`). Callers in JSDOM hit a
|
|
55
|
+
* noop fallback that returns the cloned outerHTML untouched. */
|
|
56
|
+
export declare function exportSvgString(input: PrepareExportInput): string;
|
|
57
|
+
/** Rasterise an SVG string to a PNG Blob at the requested pixel width. The
|
|
58
|
+
* height is derived from the SVG's intrinsic aspect ratio so callers control
|
|
59
|
+
* resolution with a single number (design §10: "1800px for 6-inch @ 300dpi,
|
|
60
|
+
* 2400px for 8-inch"). White background painted in to avoid the transparent
|
|
61
|
+
* PNG quirk where journal layouts composite against grey. */
|
|
62
|
+
export declare function exportPngBlob(args: {
|
|
63
|
+
svgString: string;
|
|
64
|
+
widthPx: number;
|
|
65
|
+
viewBoxWidth: number;
|
|
66
|
+
viewBoxHeight: number;
|
|
67
|
+
background?: string;
|
|
68
|
+
}): Promise<Blob>;
|
|
69
|
+
//# sourceMappingURL=export.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export.d.ts","sourceRoot":"","sources":["../src/export.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAOH;;;kEAGkE;AAClE,MAAM,WAAW,UAAU;IACzB;;qBAEiB;IACjB,KAAK,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC;IAC5B;;4DAEwD;IACxD,UAAU,CAAC,EAAE,UAAU,GAAG,QAAQ,CAAC;IACnC;+EAC2E;IAC3E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;gDAC4C;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;sEAEkE;IAClE,UAAU,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC;IAC/B;qDACiD;IACjD,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,kBAAkB;IACjC,oCAAoC;IACpC,GAAG,EAAE,aAAa,CAAC;IACnB,2EAA2E;IAC3E,SAAS,EAAE,MAAM,CAAC;IAClB,iDAAiD;IACjD,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB;AAED;;iEAEiE;AACjE,wBAAgB,eAAe,CAAC,KAAK,EAAE,kBAAkB,GAAG,MAAM,CAsDjE;AAED;;;;8DAI8D;AAC9D,wBAAsB,aAAa,CAAC,IAAI,EAAE;IACxC,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GAAG,OAAO,CAAC,IAAI,CAAC,CAkChB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export.test.d.ts","sourceRoot":"","sources":["../src/export.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** Slice 35 — short stable hash for canonical feature ids when round-
|
|
2
|
+
* tripping selection through the URL. The gnomAD-style variant ids
|
|
3
|
+
* (`17-7674212-C-T`, or `11-5226947-ACCT…CCTGC-A` for big deletions)
|
|
4
|
+
* can be hundreds of characters; we'd rather not stamp those into
|
|
5
|
+
* `?selected=` verbatim. FNV-1a 32-bit → 8 hex chars is short, has
|
|
6
|
+
* no external dependencies, and collides rarely enough at our scale
|
|
7
|
+
* (a few hundred records per figure) that the URL→state lookup
|
|
8
|
+
* pairs the hash with a canonical id table built at placement time.
|
|
9
|
+
*
|
|
10
|
+
* This is an obfuscation / shortening hash — not a cryptographic one.
|
|
11
|
+
* Hosts must always tolerate the raw canonical id in the URL too
|
|
12
|
+
* (backward compat with pre-Slice-35 share links). */
|
|
13
|
+
export declare function fnv1a32Hex(input: string): string;
|
|
14
|
+
/** Build a map keyed by `fnv1a32Hex(id)` → id. Hosts pass the iterable
|
|
15
|
+
* of canonical ids they want to round-trip through the URL; the
|
|
16
|
+
* resolver tries the raw URL value first (backward compat) and falls
|
|
17
|
+
* back to looking the hash up here. */
|
|
18
|
+
export declare function buildFeatureIdHashMap(ids: Iterable<string>): Map<string, string>;
|
|
19
|
+
/** Resolve a URL `?selected=` value into the canonical id it referred
|
|
20
|
+
* to, given the set of currently-known ids. The lookup tries the raw
|
|
21
|
+
* value first so pre-Slice-35 share links (canonical id verbatim)
|
|
22
|
+
* keep working; only if that misses do we fall back to the hash
|
|
23
|
+
* table. Returns `null` when neither path matches — selection is
|
|
24
|
+
* silently dropped. */
|
|
25
|
+
export declare function resolveSelectedId(urlValue: string, knownIds: Iterable<string>): string | null;
|
|
26
|
+
//# sourceMappingURL=feature-id-hash.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature-id-hash.d.ts","sourceRoot":"","sources":["../src/feature-id-hash.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;uDAWuD;AAKvD,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAShD;AAED;;;wCAGwC;AACxC,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAIhF;AAED;;;;;wBAKwB;AACxB,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,MAAM,GAAG,IAAI,CAS7F"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature-id-hash.test.d.ts","sourceRoot":"","sources":["../src/feature-id-hash.test.ts"],"names":[],"mappings":""}
|