@czi-sds/data-viz 2.3.0 → 2.4.0

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.
Files changed (39) hide show
  1. package/dist/HeatmapChart.cjs.d.ts +2 -0
  2. package/dist/HeatmapChart.cjs.js +8 -0
  3. package/dist/HeatmapChart.esm.d.ts +2 -0
  4. package/dist/HeatmapChart.esm.js +3 -0
  5. package/dist/ProteinStructureViewer.cjs.d.ts +2 -0
  6. package/dist/ProteinStructureViewer.cjs.js +14 -0
  7. package/dist/ProteinStructureViewer.esm.d.ts +2 -0
  8. package/dist/ProteinStructureViewer.esm.js +3 -0
  9. package/dist/StackedBarChart.cjs.d.ts +2 -0
  10. package/dist/StackedBarChart.cjs.js +8 -0
  11. package/dist/StackedBarChart.esm.d.ts +2 -0
  12. package/dist/StackedBarChart.esm.js +3 -0
  13. package/dist/colorScales.cjs.d.ts +2 -0
  14. package/dist/colorScales.cjs.js +6 -0
  15. package/dist/colorScales.esm.d.ts +2 -0
  16. package/dist/colorScales.esm.js +3 -0
  17. package/dist/index.cjs.d.ts +4 -772
  18. package/dist/index.cjs.js +16 -5765
  19. package/dist/index.esm.d.ts +4 -774
  20. package/dist/index.esm.js +4 -5719
  21. package/dist/shared/HeatmapChart.cjs.js +349 -0
  22. package/dist/shared/HeatmapChart.esm.js +342 -0
  23. package/dist/shared/ProteinStructureViewer.cjs.js +4780 -0
  24. package/dist/shared/ProteinStructureViewer.esm.js +4728 -0
  25. package/dist/shared/StackedBarChart.cjs.js +489 -0
  26. package/dist/shared/StackedBarChart.esm.js +483 -0
  27. package/dist/shared/colorScales.cjs.d.ts +45 -0
  28. package/dist/shared/colorScales.cjs.js +126 -0
  29. package/dist/shared/colorScales.esm.d.ts +45 -0
  30. package/dist/shared/colorScales.esm.js +103 -0
  31. package/dist/shared/index.cjs.d.ts +183 -0
  32. package/dist/shared/index.esm.d.ts +183 -0
  33. package/dist/shared/index2.cjs.d.ts +389 -0
  34. package/dist/shared/index2.esm.d.ts +391 -0
  35. package/dist/shared/index3.cjs.d.ts +166 -0
  36. package/dist/shared/index3.esm.d.ts +166 -0
  37. package/dist/shared/objectSpread2.cjs.js +124 -0
  38. package/dist/shared/objectSpread2.esm.js +85 -0
  39. package/package.json +64 -2
@@ -1,775 +1,5 @@
1
- /// <reference types="react" />
2
- import { DatasetComponentOption, ECharts, EChartsOption, ScatterSeriesOption } from "echarts";
3
- import { HTMLAttributes } from "react";
4
- import { DiscreteColorGeneratorOptions, TooltipProps, TooltipTableContentProps } from "@czi-sds/components";
5
- import { PluginUISpec } from "molstar/lib/mol-plugin-ui/spec";
6
- import { CustomElementProperty } from "molstar/lib/mol-model-props/common/custom-element-property";
7
-
8
- //#region src/common/colorScales.d.ts
9
- /** RGB triplet with each channel in the range 0-255. */
10
- type Rgb = [number, number, number];
11
- /** A stop on a continuous color scale, positioned at `t` in the range 0-1. */
12
- interface ContinuousColorStop {
13
- t: number;
14
- color: string;
15
- }
16
- /**
17
- * A band on a stepped color scale. `threshold` is the upper bound of the band
18
- * on the normalized 0-1 value range; `label` is rendered above the band in the
19
- * legend.
20
- */
21
- interface SteppedColorStop {
22
- threshold: number;
23
- color: string;
24
- label: string;
25
- }
26
- /**
27
- * How values map to colors, both in a visualization and in its legend. A
28
- * continuous scale interpolates between its stops and renders as a gradient
29
- * bar; a stepped scale renders as discrete bands.
30
- */
31
- type ColorScale = {
32
- kind: "continuous";
33
- stops: ContinuousColorStop[];
34
- } | {
35
- kind: "stepped";
36
- stops: SteppedColorStop[];
37
- };
38
- /**
39
- * Perceptually uniform sequential scale (matplotlib's plasma), the default for
40
- * value overlays.
41
- */
42
- declare const PLASMA_COLOR_SCALE: ColorScale;
43
- /**
44
- * Colors a raw value against a scale, normalizing it into `min`-`max` first.
45
- * Returns null when the value sits at or below `min`, or when the range is
46
- * degenerate, so callers can fall back to a neutral color.
47
- */
48
- declare function sampleColorScale(scale: ColorScale, value: number, max: number, min?: number): Rgb | null;
49
- /** CSS `linear-gradient` spanning a continuous scale, for the legend bar. */
50
- declare function toCssGradient(stops: ContinuousColorStop[]): string;
51
- //#endregion
52
- //#region src/core/HeatmapChart/hooks/utils.d.ts
53
- interface CreateChartOptionsProps {
54
- /**
55
- * The crosshair following the pointer. One object applies to both axes; a
56
- * two-entry array configures them separately.
57
- * https://echarts.apache.org/en/option.html#axisPointer
58
- */
59
- axisPointer?: EChartsOption["axisPointer"];
60
- /**
61
- * The cells, as a flat array of objects whose fields are named by `encode`.
62
- * The data point object shape can be whatever you like, but it must be consistent with the `encode` option
63
- * For example, if the data point shape is:
64
- * {
65
- * geneIndex: 0,
66
- * cellTypeIndex: 0,
67
- * percentage: 0.5
68
- * }
69
- * and you want geneIndex to be encoded to x axis and cellTypeIndex to be encoded to y axis, then make sure your encode option is:
70
- * encode: {
71
- * x: 'geneIndex',
72
- * y: 'cellTypeIndex'
73
- * }
74
- */
75
- data: DatasetComponentOption["source"];
76
- /**
77
- * ECharts' dataZoom configuration for that window, merged over the defaults
78
- * it sets. One object applies to both axes; a two-entry array configures them
79
- * separately. It reaches the chart only while `camera.active` is true.
80
- *
81
- * The `dataZoom` prop is utilized for implementing zoom functionality within a
82
- * specific area of the chart. This feature empowers users to inspect data in
83
- * granular detail, obtain an overview of the entire dataset, or eliminate
84
- * outlier points.
85
- * By applying the `dataZoom` prop while locking the zoom level, the chart
86
- * efficiently renders a confined portion of the heatmap. This selective
87
- * rendering strategy becomes especially advantageous when dealing with
88
- * extensive datasets. Instead of rendering the entire heatmap at once,
89
- * the chart dynamically loads and renders specific segments as the user
90
- * scrolls through the data. This approach optimizes performance and enables
91
- * the creation of heatmaps with large amounts of data.
92
- * https://echarts.apache.org/en/option.html#dataZoom
93
- */
94
- dataZoom?: EChartsOption["dataZoom"];
95
- /**
96
- * Renders only a window of the grid, measured in cells, and lets the pointer
97
- * pan it. Sizes are ignored unless `active` is true.
98
- *
99
- * The `camera` prop is utilized for implementing camera view port functionality
100
- * within a specific area of the chart. This feature empowers users to render
101
- * a confined portion of the heatmap. This selective rendering strategy becomes
102
- * especially advantageous when dealing with extensive datasets. Instead of
103
- * rendering the entire heatmap at once, the chart dynamically loads and renders
104
- * specific segments as the user scrolls through the data. This approach optimizes
105
- * performance and enables the creation of heatmaps with large amounts of data.
106
- *
107
- * The `height` and `width` properties are used to specify the dimensions of the
108
- * camera view port. The `active` property is used to enable or disable the camera
109
- * view port functionality.
110
- */
111
- camera?: {
112
- active: boolean;
113
- height: number;
114
- width: number;
115
- };
116
- /**
117
- * How a cell is drawn while the pointer is over it. Takes the same shape as
118
- * `itemStyle`: color, border, opacity.
119
- * https://echarts.apache.org/en/option.html#series-scatter.emphasis
120
- */
121
- emphasis?: ScatterSeriesOption["emphasis"];
122
- /**
123
- * The categories along the x axis. A cell's encoded x value is an index into
124
- * this array.
125
- * For example:
126
- * [{ value: "gene1", textStyle: { color: "red" } }, "gene2", "gene3"]
127
- */
128
- xAxisData: CategoryAxisData;
129
- /**
130
- * The categories along the y axis.
131
- * For example:
132
- * [{ value: "cellType1", textStyle: { color: "red" } }, "cellType2", "cellType3"]
133
- */
134
- yAxisData: CategoryAxisData;
135
- /**
136
- * Width of the chart in pixels. Must be greater than zero; the component
137
- * throws otherwise.
138
- */
139
- width: number;
140
- /**
141
- * Height of the chart in pixels, under the same rule.
142
- */
143
- height: number;
144
- /**
145
- * Which fields of a data item place it on each axis. Omitting it leaves
146
- * ECharts to guess from the field order.
147
- * For example, if the data is:
148
- * {
149
- * geneIndex: 0,
150
- * cellTypeIndex: 0,
151
- * percentage: 0.5
152
- * }
153
- * and we want to encode `geneIndex` to x axis and `cellTypeIndex` to y axis, then
154
- * encode: {
155
- * x: 'geneIndex',
156
- * y: 'cellTypeIndex'
157
- * }
158
- * https://echarts.apache.org/en/option.html#series-scatter.encode
159
- */
160
- encode?: {
161
- x: string;
162
- y: string;
163
- };
164
- /**
165
- * How a cell is painted. Its color accepts a callback receiving the data
166
- * item, which is how a value becomes a color.
167
- * https://echarts.apache.org/en/option.html#series-scatter.itemStyle
168
- */
169
- itemStyle?: ScatterSeriesOption["itemStyle"];
170
- /**
171
- * The shape of a cell. Circles turn the grid into a dot plot, where diameter
172
- * can carry a second measurement.
173
- */
174
- symbol?: "circle" | "rect" | "roundRect";
175
- /**
176
- * Cell size in pixels: one number, a [width, height] pair, or a callback
177
- * given the data item. Set it to the cell pitch for a solid grid.
178
- *
179
- * `symbolSize` can be set to single numbers like 10, or use an array to represent width and height. For example, [20, 10] means symbol width is 20, and height is 10.
180
- *
181
- * If size of symbols needs to be different, you can set with callback function in the following format:
182
- *
183
- * (value: Array|number, params: Object) => number|Array
184
- *
185
- * The first parameter value is the value in data, and the second parameter params is the rest parameters of data item.
186
- * https://echarts.apache.org/en/option.html#series-scatter.symbolSize
187
- */
188
- symbolSize?: ScatterSeriesOption["symbolSize"];
189
- /**
190
- * Where the plotting area sits inside the container. The function form
191
- * receives the computed default, for insetting it without recomputing the
192
- * size.
193
- * https://echarts.apache.org/en/option.html#grid
194
- */
195
- grid?: EChartsOption["grid"] | ((defaultOption: EChartsOption["grid"]) => EChartsOption["grid"]);
196
- /**
197
- * Anything else ECharts understands, merged over the generated options.
198
- * https://echarts.apache.org/en/option.html
199
- */
200
- options?: EChartsOption;
201
- /**
202
- * ECharts event listeners by name. Each handler gets the raw event, whose
203
- * data property is the cell, and the chart instance.
204
- * https://echarts.apache.org/en/api.html#events
205
- */
206
- onEvents?: Record<string, (event: unknown, chart: ECharts) => void>;
207
- }
208
- type OrdinalRawValue = string | number;
209
- /**
210
- * (thuang): This copies echarts' CategoryAxisBaseOption["data"] type, since it's not exported
211
- */
212
- type CategoryAxisData = (OrdinalRawValue | {
213
- value: OrdinalRawValue;
214
- /**
215
- * (thuang): This should be echarts `TextCommonOption` type, but it's not exported
216
- */
217
- textStyle?: never;
218
- })[];
219
- //#endregion
220
- //#region src/core/HeatmapChart/index.d.ts
221
- interface HeatmapChartProps extends HTMLAttributes<HTMLDivElement>, CreateChartOptionsProps {
222
- /**
223
- * Which renderer ECharts initialises with. Canvas copes better with very
224
- * large grids. Changing it rebuilds the chart.
225
- * @default "svg"
226
- */
227
- echartsRendererMode?: "svg" | "canvas";
228
- }
229
- declare const _default: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<HeatmapChartProps & import("react").RefAttributes<HTMLDivElement>>>;
230
- //#endregion
231
- //#region src/core/ProteinStructureViewer/ProteinStructureViewer.types.d.ts
232
- /**
233
- * Per-residue values painted onto the structure in place of the default pLDDT
234
- * coloring, along with the legend that describes them.
235
- */
236
- interface ResidueValueOverlay {
237
- /** 0-based residue index to value. Residues absent from the map read as 0. */
238
- values: Map<number, number>;
239
- /** Value mapped to the top of the color scale. */
240
- max: number;
241
- /**
242
- * Values at or below this render in a neutral gray rather than on the scale.
243
- * Values above it are normalized into `min`-`max` before being sampled, so
244
- * this is also what the legend's lower tick reports.
245
- * @default 0
246
- */
247
- min?: number;
248
- /**
249
- * Scale used to color residues and to draw the legend.
250
- * @default PLASMA_COLOR_SCALE
251
- */
252
- colorScale?: ColorScale;
253
- /** Legend caption, e.g. "Feature activation". */
254
- label?: string;
255
- /**
256
- * Title of the help tooltip on the legend caption. The common case: a
257
- * string is enough. Use `tooltipProps` when the tooltip needs a subtitle, a
258
- * custom body, or any other SDS Tooltip prop. Overrides
259
- * `tooltipProps.title` when both are set.
260
- */
261
- tooltip?: string;
262
- /**
263
- * Props forwarded to the SDS Tooltip on the legend caption. The trigger is
264
- * the caption's help icon, so `children` is omitted.
265
- */
266
- tooltipProps?: Partial<Omit<TooltipProps, "children">>;
267
- /**
268
- * Label for the per-residue readout that replaces a stat slot on hover.
269
- * @default "Value"
270
- */
271
- readoutLabel?: string;
272
- }
273
- /**
274
- * A residue the user pointed at, in each of the ways a caller might need to
275
- * address it.
276
- *
277
- * `index` is the viewer's own key: the position in `plddt` and in
278
- * `residueOverlay`'s map, and what `selectedResidue` takes. `chainId`, `seqId`
279
- * and `insCode` are what the file says, which is what the sequence panel shows
280
- * and what a system that supplied the structure will recognise. They differ
281
- * from `index` whenever the file does not number a single chain from 1 -- a
282
- * crop, or a complex -- so address a residue outside the viewer with those
283
- * three, not with `index`.
284
- *
285
- * `insCode` is rarely set but is part of the address when it is: `10` and `10A`
286
- * are different residues on the same chain, so chain and number alone do not
287
- * name one.
288
- */
289
- interface ResidueRef {
290
- /** 0-based position in the structure, counting residues in file order. */
291
- index: number;
292
- /** Three-letter residue code, e.g. `"LYS"`. */
293
- compId: string;
294
- /** Chain the residue sits on, as named in the file. */
295
- chainId: string;
296
- /** Residue number as written in the file. */
297
- seqId: number;
298
- /** Insertion code, or `""` when the residue has none. */
299
- insCode: string;
300
- }
301
- /**
302
- * A chain the viewer found in the structure it loaded, reported through
303
- * `onChainsChange` so a consumer can label, color or hide chains by name
304
- * without parsing the structure itself.
305
- *
306
- * `chainId` is the file's own name for the chain, the same one `ResidueRef`
307
- * reports, and the key every chain-keyed prop takes. A chain carrying several
308
- * symmetry operators appears once, under the first.
309
- *
310
- * Describes the chain's polymer. The ligands and ions sitting on it are drawn
311
- * and are hidden and selected with it, but are not counted here or spanned by
312
- * the range below - they are no part of the sequence. A chain holding nothing
313
- * but heteroatoms is left out altogether, having no sequence to describe.
314
- */
315
- interface ChainRef {
316
- /** Chain as named in the file (`auth_asym_id`), e.g. `"A"`. */
317
- chainId: string;
318
- /** Chain as the sequence panel captions it. */
319
- label: string;
320
- /** Lowest 0-based residue index of the chain's polymer. */
321
- startIndex: number;
322
- /** Highest 0-based residue index of the chain's polymer. */
323
- endIndex: number;
324
- /** Polymer residues the chain holds. */
325
- residueCount: number;
326
- }
327
- /**
328
- * What is selected, in the two ways a caller might say it. `null` selects
329
- * nothing.
330
- *
331
- * The two combine: `{ chains: ["A"], residues: [150] }` takes all of chain A
332
- * plus one residue elsewhere. `chains` is kept as named rather than expanded
333
- * into indices, so a whole-chain selection survives a round trip through a
334
- * consumer's state at its original size.
335
- */
336
- interface StructureSelection {
337
- /**
338
- * 0-based residue indices, counting residues in file order across the whole
339
- * structure - the same index `plddt` and `residueOverlay` are keyed by.
340
- */
341
- residues?: number[];
342
- /** Whole chains by `chainId`, each standing for every residue on it. */
343
- chains?: string[];
344
- }
345
- /**
346
- * How large a downloaded image is, in pixels.
347
- *
348
- * Named rather than given as dimensions because the aspect is Mol*'s to
349
- * choose: each of these is one of its own presets, and a size picked here
350
- * would have to be reconciled with the canvas the image is rendered from.
351
- */
352
- type DownloadResolution = "low" | "medium" | "high" | "maximum";
353
- /** Pixel dimensions each resolution produces, for documentation and labels. */
354
- declare const DOWNLOAD_RESOLUTIONS: Record<DownloadResolution, string>;
355
- /**
356
- * Turns on the capture button under the reset-camera control, and says what it
357
- * should produce. Omit it and no button is drawn.
358
- *
359
- * The image is rendered fresh at the size asked for rather than scaled up from
360
- * the canvas, so a high resolution costs time rather than sharpness - which is
361
- * why the default sits in the middle rather than at the top.
362
- */
363
- interface StructureDownload {
364
- /**
365
- * Size of the image. See `DOWNLOAD_RESOLUTIONS` for the pixel dimensions.
366
- * @default "medium"
367
- */
368
- resolution?: DownloadResolution;
369
- /**
370
- * Background behind the structure, as `#RRGGBB`. Omit for a transparent
371
- * one, which is what a figure usually wants - the viewer's own canvas color
372
- * is deliberately not inherited, since a screenshot tends to outlive the
373
- * theme it was taken under.
374
- */
375
- backgroundColor?: string;
376
- /**
377
- * Draw the orientation axes into the image. Independent of `showAxes`, which
378
- * is about the view rather than the capture: the widget orients a reader who
379
- * can turn the structure, and earns its place less in a still.
380
- * @default false
381
- */
382
- showAxes?: boolean;
383
- /**
384
- * Name for the downloaded file, without an extension. Defaults to the one
385
- * Mol* derives from the loaded structure.
386
- */
387
- filename?: string;
388
- }
389
- /** A whole-structure statistic shown along the bottom of the viewer. */
390
- interface StructureStat {
391
- value: string;
392
- label: string;
393
- }
394
- interface ProteinStructureViewerProps extends Omit<HTMLAttributes<HTMLDivElement>, "onSelect"> {
395
- /** Structure to render, as raw PDB or mmCIF (PDBx) text. */
396
- structure: string;
397
- /**
398
- * Per-residue pLDDT confidence on a 0-1 scale, ordered by residue. When
399
- * supplied the structure is colored by pLDDT unless `residueOverlay` takes
400
- * over.
401
- */
402
- plddt?: number[] | null;
403
- /**
404
- * Canvas background, as `#RRGGBB`. Defaults to the SDS theme's base
405
- * background, so the canvas follows the surrounding page in both modes.
406
- */
407
- backgroundColor?: string;
408
- /**
409
- * Sequence panel background, as any CSS color. Defaults to the SDS theme's
410
- * primary surface, so the panel follows the surrounding page in both modes.
411
- */
412
- sequenceViewerBackgroundColor?: string;
413
- /**
414
- * Show the orientation axes widget and the reset-camera button.
415
- * @default true
416
- */
417
- showAxes?: boolean;
418
- /**
419
- * Adds a capture button beneath the reset-camera control, which downloads a
420
- * PNG of the structure as it currently stands. Omit for no button.
421
- */
422
- download?: StructureDownload | null;
423
- /**
424
- * Show the sequence panel pinned along the bottom of the viewer.
425
- * @default true
426
- */
427
- showSequenceViewer?: boolean;
428
- /**
429
- * Show the stats and color scale legend overlaid on the viewer.
430
- * @default true
431
- */
432
- showLegend?: boolean;
433
- /** Per-residue values that override pLDDT coloring while set. */
434
- residueOverlay?: ResidueValueOverlay | null;
435
- /**
436
- * What is selected, or null when nothing is. Controlled: the camera frames
437
- * whatever the selection covers, and clearing it zooms back out to the
438
- * default view.
439
- *
440
- * Residues are drawn in ball-and-stick over the cartoon; whole chains are
441
- * left as they are and the chains around them dim, the same as hovering a
442
- * chain's name.
443
- */
444
- selection?: StructureSelection | null;
445
- /**
446
- * Chains hidden from the 3D view, by `chainId`. Leave undefined to let the
447
- * viewer own visibility itself, which is what the chain legend's toggles
448
- * drive; passing it takes that over, and the toggles then only report.
449
- */
450
- hiddenChains?: string[];
451
- /**
452
- * Color per chain, by `chainId`, as `#RRGGBB`. Chains left out fall back to
453
- * the viewer's palette. Only visible while chain coloring is what is on
454
- * screen, which is when neither `plddt` nor `residueOverlay` is set.
455
- */
456
- chainColors?: Record<string, string>;
457
- /**
458
- * Show the chain legend, which lists each chain with its color and a
459
- * visibility toggle. Ignored on a single-chain structure, where there is
460
- * nothing to tell apart or hide.
461
- * @default true
462
- */
463
- showChainLegend?: boolean;
464
- /**
465
- * Stop other chains from dimming in the 3D view while a chain's name is
466
- * pointed at, in the legend or above its grid in the sequence panel.
467
- *
468
- * The dim is on by default, since on a complex it is how a reader finds out
469
- * which chain is which. Turn it off where the movement is more distracting
470
- * than the answer is useful - a grid of viewers a pointer crosses on its way
471
- * somewhere else, or a page driving its own highlighting through `selection`.
472
- * @default false
473
- */
474
- disableChainHighlightOnHover?: boolean;
475
- /**
476
- * Mol* plugin spec laid over the viewer's own, which is how the whole of
477
- * Mol*'s configuration is reachable without a prop here for each setting.
478
- * Anything named here wins, so `canvas3d.postprocessing`, a `PluginConfig`
479
- * item, or `layout.initial` can all be set to something other than the
480
- * default the viewer picked.
481
- *
482
- * List-valued keys - `behaviors`, `config`, `actions`, `animations`,
483
- * `customFormats`, `customParamEditors` - are appended to rather than
484
- * replaced. For `config` that is what lets an entry override the viewer's,
485
- * since Mol* reads the list in order. It also means a behavior cannot be
486
- * taken away: the ones the viewer drops stay dropped, and the ones it keeps
487
- * cannot be removed from here.
488
- *
489
- * Read once, when the plugin is created, except for `canvas3d`, which is
490
- * re-applied whenever it changes. Creating the plugin throws away the camera,
491
- * so the rest is deliberately not reactive.
492
- */
493
- molstarSpec?: Partial<PluginUISpec>;
494
- /**
495
- * Up to three whole-structure stats shown along the bottom. A null entry
496
- * reserves its column without rendering anything, so the columns never shift
497
- * as values come and go.
498
- */
499
- stats?: (StructureStat | null)[];
500
- /** Called with the clicked residue. */
501
- onResidueClick?: (residue: ResidueRef) => void;
502
- /**
503
- * Called as the pointer moves over residues, and with `null` when it leaves
504
- * the structure.
505
- */
506
- onResidueHover?: (residue: ResidueRef | null) => void;
507
- /**
508
- * Called with the new selection whenever the user makes one - clicking a
509
- * residue, dragging across the sequence, clicking a chain caption - and with
510
- * `null` when they click empty space to clear it.
511
- *
512
- * A whole-chain selection arrives as `{ chains: [id] }` rather than as every
513
- * index on it, so echoing it straight back into `selection` costs nothing.
514
- */
515
- onSelectionChange?: (selection: StructureSelection | null) => void;
516
- /**
517
- * Called with the chains found in the structure, whenever a structure is
518
- * loaded. Fires with `[]` when the structure holds none.
519
- */
520
- onChainsChange?: (chains: ChainRef[]) => void;
521
- /**
522
- * Called with the chains now hidden when a visibility toggle is used. Fires
523
- * whether or not `hiddenChains` is controlled, so a consumer can follow the
524
- * viewer's own state without owning it.
525
- */
526
- onChainVisibilityChange?: (hiddenChains: string[]) => void;
527
- }
528
- /**
529
- * Readout that replaces the whole-structure stats while something is hovered
530
- * or selected. Covers one residue or many: a drag across the sequence and a
531
- * whole-chain selection report through this too, as a mean over what they
532
- * cover.
533
- */
534
- interface ResidueReadout {
535
- /** e.g. "PHE 17", "Chain A", or "24 residues". */
536
- label: string;
537
- /**
538
- * pLDDT on a 0-1 scale, or null when unavailable. The mean across the
539
- * residues covered when there is more than one, ignoring those without a
540
- * score.
541
- */
542
- plddt: number | null;
543
- /**
544
- * Overlay value, or null when the overlay holds none - which is also what a
545
- * structure paints neutral - or when no overlay is set. The mean across the
546
- * residues covered when there is more than one, ignoring those the overlay
547
- * says nothing about.
548
- */
549
- value: number | null;
550
- /**
551
- * Residues the readout covers, which is what makes the numbers above means
552
- * rather than readings. 1 for a single residue.
553
- */
554
- residueCount: number;
555
- }
556
- //#endregion
557
- //#region src/core/ProteinStructureViewer/utils/structureFormat.d.ts
558
- /**
559
- * Structure text formats Mol* can parse from the viewer's `structure` prop.
560
- *
561
- * `"mmcif"` covers both mmCIF and PDBx; they are the same text format, and
562
- * that is the name Mol*'s trajectory parser uses. Binary CIF (`.bcif`) is not
563
- * accepted: the prop is a string.
564
- */
565
- type StructureFormat = "pdb" | "mmcif";
566
- /**
567
- * Infers whether `text` is PDB or mmCIF (PDBx).
568
- *
569
- * mmCIF documents start with a `data_` block and name their coordinates
570
- * `_atom_site.`. PDB never does either, so either marker is enough. A leading
571
- * comment (`# ...`) before `data_` is still mmCIF.
572
- */
573
- declare function detectStructureFormat(text: string): StructureFormat;
574
- //#endregion
575
- //#region src/core/ProteinStructureViewer/utils/plddt.d.ts
576
- /**
577
- * AlphaFold's pLDDT confidence bands. Thresholds are on the 0-1 scale that
578
- * `plddt` values use, ascending from lowest to highest confidence.
579
- */
580
- declare const PLDDT_COLOR_SCALE: ColorScale;
581
- /**
582
- * Rewrites a PDB file's B-factor column with pLDDT scores so Mol* can read them
583
- * off the parsed model. B-factors occupy columns 60-66 of ATOM/HETATM lines;
584
- * scores arrive on a 0-1 scale and are stored on the conventional 0-100 one.
585
- * Residues past the end of `plddtValues` fall back to a mid-confidence 50.
586
- *
587
- * A residue is identified by chain, sequence number and insertion code. The
588
- * code has to be part of that: `10` and `10A` are two residues, Mol* counts
589
- * them as two, and treating them as one here would hand every residue after
590
- * them its neighbour's score.
591
- */
592
- declare function injectPlddtIntoPdb(pdbData: string, plddtValues: number[]): string;
593
- /**
594
- * Rewrites an mmCIF (PDBx) file's `_atom_site.B_iso_or_equiv` column with
595
- * pLDDT scores so Mol* can read them off the parsed model, the same way
596
- * `injectPlddtIntoPdb` rewrites the PDB B-factor column. Scores arrive on a
597
- * 0-1 scale and are stored on the conventional 0-100 one. Residues past the
598
- * end of `plddtValues` fall back to a mid-confidence 50.
599
- *
600
- * If the file has no B-factor column, one is appended to the atom-site loop
601
- * rather than leaving the scores behind.
602
- */
603
- declare function injectPlddtIntoMmcif(mmcifData: string, plddtValues: number[]): string;
604
- /**
605
- * Rewrites a structure file's B-factors with pLDDT scores. Dispatches to
606
- * `injectPlddtIntoPdb` or `injectPlddtIntoMmcif` from `format`, or from
607
- * detecting the format of `data` when `format` is omitted.
608
- */
609
- declare function injectPlddt(data: string, plddtValues: number[], format?: StructureFormat): string;
610
- //#endregion
611
- //#region src/core/ProteinStructureViewer/index.d.ts
612
- declare const _default$1: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<ProteinStructureViewerProps & import("react").RefAttributes<HTMLDivElement>>>;
613
- //#endregion
614
- //#region src/core/StackedBarChart/StackedBarChart.types.d.ts
615
- interface StackedBarChartDataItem {
616
- /**
617
- * The segment's label in the legend, and the key the animations track it by.
618
- * Must be unique within the chart.
619
- */
620
- name: string;
621
- /**
622
- * The quantity the segment stands for.
623
- */
624
- value: number;
625
- /**
626
- * Any CSS color. Without it the segment takes a generated palette color,
627
- * which can shift as categories come and go.
628
- */
629
- color?: string;
630
- /**
631
- * A unit for this item's counted value, for data that mixes units across
632
- * categories.
633
- */
634
- unit?: string;
635
- /**
636
- * Takes the segment and its legend item out of every interaction: no hover,
637
- * no tooltip, no selection.
638
- * @default false
639
- */
640
- disabled?: boolean;
641
- /**
642
- * Content for a TooltipTable shown above the segment on hover. Use it for the
643
- * breakdown behind the number; a segment without it has no tooltip.
644
- */
645
- tooltip?: TooltipTableContentProps;
646
- }
647
- interface StackedBarChartProps extends HTMLAttributes<HTMLDivElement> {
648
- /**
649
- * A heading above the bar. It is also what makes room for the badge; with no
650
- * title, no badge is drawn.
651
- */
652
- title?: string;
653
- /**
654
- * Overrides the badge text, which otherwise counts the data and the selection
655
- * ("7", or "3 of 7").
656
- */
657
- badge?: string;
658
- /**
659
- * Removes the badge, leaving the title on its own.
660
- * @default false
661
- */
662
- hideBadge?: boolean;
663
- /**
664
- * The segments, in the order they are drawn.
665
- */
666
- data: StackedBarChartDataItem[];
667
- /**
668
- * Any CSS width; a number is read as pixels. It sets the width of the whole
669
- * chart, legend included.
670
- * @default 100%
671
- */
672
- width?: number | string;
673
- /**
674
- * Height of the bar in pixels. Values below 1 are clamped to 1, so the bar
675
- * cannot disappear.
676
- * @default 16
677
- */
678
- barHeight?: number;
679
- /**
680
- * Draws the legend below the bar. It is the only place segment names appear,
681
- * and the only part of the chart a keyboard can reach.
682
- * @default true
683
- */
684
- showLegend?: boolean;
685
- /**
686
- * Shows each item's value beside its name in the legend.
687
- * @default true
688
- */
689
- showLegendValues?: boolean;
690
- /**
691
- * "percentage" shows the segment's share of the bar, rounded. "count" shows
692
- * the raw value followed by the item's unit, or the chart's unit if the item
693
- * has none.
694
- * @default "percentage"
695
- */
696
- legendValueFormat?: "percentage" | "count";
697
- /**
698
- * Indices into data that are currently selected. The chart is controlled: it
699
- * draws this and never changes it.
700
- */
701
- selectedIndices?: number[];
702
- /**
703
- * Called with the next selection when a segment or legend item is clicked.
704
- * Without it, clicking selects nothing.
705
- */
706
- onSelectionChange?: (selectedIndices: number[], selectedData: StackedBarChartDataItem[]) => void;
707
- /**
708
- * Called when the pointer enters a segment. The chart already syncs its own
709
- * hover highlight between bar and legend, so this is for driving something
710
- * outside it.
711
- */
712
- onSegmentMouseEnter?: (item: StackedBarChartDataItem, index: number) => void;
713
- /**
714
- * Called when the pointer leaves a segment.
715
- */
716
- onSegmentMouseLeave?: (item: StackedBarChartDataItem, index: number) => void;
717
- /**
718
- * Called when the pointer enters a legend item.
719
- */
720
- onLegendItemMouseEnter?: (item: StackedBarChartDataItem, index: number) => void;
721
- /**
722
- * Called when the pointer leaves a legend item.
723
- */
724
- onLegendItemMouseLeave?: (item: StackedBarChartDataItem, index: number) => void;
725
- /**
726
- * Fires on a segment click, alongside any selection change rather than
727
- * instead of it.
728
- */
729
- onSegmentClick?: (item: StackedBarChartDataItem, index: number) => void;
730
- /**
731
- * The same, for a click on a legend item.
732
- */
733
- onLegendItemClick?: (item: StackedBarChartDataItem, index: number) => void;
734
- /**
735
- * What a selection does to the unselected segments: fade them to 20% opacity,
736
- * or drop them from the bar and let the rest take the space.
737
- * @default "dim"
738
- */
739
- selectionBehavior?: "dim" | "hide";
740
- /**
741
- * Whether the bar shows a breakdown of the data (segments always fill it) or
742
- * progress towards maxAmount.
743
- * @default "proportional"
744
- */
745
- mode?: "proportional" | "cumulative";
746
- /**
747
- * Cumulative mode only. The value the full bar represents. Any difference
748
- * between it and the sum of the data is drawn as the Remaining segment.
749
- */
750
- maxAmount?: number;
751
- /**
752
- * Name of the grey gap segment in cumulative mode.
753
- * @default "Remaining"
754
- */
755
- remainingLabel?: string;
756
- /**
757
- * A unit for the Remaining segment's value alone.
758
- */
759
- remainingUnit?: string;
760
- /**
761
- * The unit appended to counted values, for items that do not carry one of
762
- * their own.
763
- */
764
- unit?: string;
765
- /**
766
- * Tunes the generated palette (start hue, rotations, lightness range, gamma).
767
- * Items with their own color are untouched by it.
768
- */
769
- colorGeneratorOptions?: DiscreteColorGeneratorOptions;
770
- }
771
- //#endregion
772
- //#region src/core/StackedBarChart/index.d.ts
773
- declare const StackedBarChart: (props: StackedBarChartProps) => JSX.Element;
774
- //#endregion
1
+ import { n as _default, t as HeatmapChartProps } from "./shared/index.esm.js";
2
+ import { a as sampleColorScale, i as SteppedColorStop, n as ContinuousColorStop, o as toCssGradient, r as PLASMA_COLOR_SCALE, t as ColorScale } from "./shared/colorScales.esm.js";
3
+ import { _ as StructureStat, a as injectPlddtIntoPdb, c as ChainRef, d as ProteinStructureViewerProps, f as ResidueReadout, g as StructureSelection, h as StructureDownload, i as injectPlddtIntoMmcif, l as DOWNLOAD_RESOLUTIONS, m as ResidueValueOverlay, n as PLDDT_COLOR_SCALE, o as StructureFormat, p as ResidueRef, r as injectPlddt, s as detectStructureFormat, t as _default$1, u as DownloadResolution } from "./shared/index2.esm.js";
4
+ import { n as StackedBarChartDataItem, r as StackedBarChartProps, t as StackedBarChart } from "./shared/index3.esm.js";
775
5
  export { ChainRef, type ColorScale, type ContinuousColorStop, DOWNLOAD_RESOLUTIONS, DownloadResolution, _default as HeatmapChart, HeatmapChartProps, PLASMA_COLOR_SCALE, PLDDT_COLOR_SCALE, _default$1 as ProteinStructureViewer, ProteinStructureViewerProps, ResidueReadout, ResidueRef, ResidueValueOverlay, StackedBarChart, type StackedBarChartDataItem, type StackedBarChartProps, type SteppedColorStop, StructureDownload, type StructureFormat, StructureSelection, StructureStat, detectStructureFormat, injectPlddt, injectPlddtIntoMmcif, injectPlddtIntoPdb, sampleColorScale, toCssGradient };