@genome-spy/core 0.48.2 → 0.50.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.
- package/dist/bundle/index.es.js +7434 -7107
- package/dist/bundle/index.js +116 -103
- package/dist/schema.json +3975 -2819
- package/dist/src/data/collector.test.d.ts +2 -0
- package/dist/src/data/collector.test.d.ts.map +1 -0
- package/dist/src/data/dataFlow.test.d.ts +2 -0
- package/dist/src/data/dataFlow.test.d.ts.map +1 -0
- package/dist/src/data/flow.test.d.ts +2 -0
- package/dist/src/data/flow.test.d.ts.map +1 -0
- package/dist/src/data/flow.test.js +19 -14
- package/dist/src/data/flowNode.test.d.ts +2 -0
- package/dist/src/data/flowNode.test.d.ts.map +1 -0
- package/dist/src/data/flowOptimizer.test.d.ts +2 -0
- package/dist/src/data/flowOptimizer.test.d.ts.map +1 -0
- package/dist/src/data/flowOptimizer.test.js +9 -10
- package/dist/src/data/formats/fasta.test.d.ts +2 -0
- package/dist/src/data/formats/fasta.test.d.ts.map +1 -0
- package/dist/src/data/sources/inlineSource.test.d.ts +2 -0
- package/dist/src/data/sources/inlineSource.test.d.ts.map +1 -0
- package/dist/src/data/sources/inlineSource.test.js +23 -16
- package/dist/src/data/sources/sequenceSource.test.d.ts +2 -0
- package/dist/src/data/sources/sequenceSource.test.d.ts.map +1 -0
- package/dist/src/data/sources/sequenceSource.test.js +59 -42
- package/dist/src/data/transforms/clone.test.d.ts +2 -0
- package/dist/src/data/transforms/clone.test.d.ts.map +1 -0
- package/dist/src/data/transforms/coverage.test.d.ts +2 -0
- package/dist/src/data/transforms/coverage.test.d.ts.map +1 -0
- package/dist/src/data/transforms/coverage.test.js +1 -1
- package/dist/src/data/transforms/filter.d.ts +10 -0
- package/dist/src/data/transforms/filter.d.ts.map +1 -1
- package/dist/src/data/transforms/filter.js +30 -1
- package/dist/src/data/transforms/filter.test.d.ts +2 -0
- package/dist/src/data/transforms/filter.test.d.ts.map +1 -0
- package/dist/src/data/transforms/flatten.test.d.ts +2 -0
- package/dist/src/data/transforms/flatten.test.d.ts.map +1 -0
- package/dist/src/data/transforms/flatten.test.js +10 -7
- package/dist/src/data/transforms/flattenDelimited.test.d.ts +2 -0
- package/dist/src/data/transforms/flattenDelimited.test.d.ts.map +1 -0
- package/dist/src/data/transforms/flattenDelimited.test.js +16 -13
- package/dist/src/data/transforms/flattenSequence.test.d.ts +2 -0
- package/dist/src/data/transforms/flattenSequence.test.d.ts.map +1 -0
- package/dist/src/data/transforms/flattenSequence.test.js +1 -1
- package/dist/src/data/transforms/formula.test.d.ts +2 -0
- package/dist/src/data/transforms/formula.test.d.ts.map +1 -0
- package/dist/src/data/transforms/formula.test.js +1 -1
- package/dist/src/data/transforms/identifier.test.d.ts +2 -0
- package/dist/src/data/transforms/identifier.test.d.ts.map +1 -0
- package/dist/src/data/transforms/pileup.test.d.ts +2 -0
- package/dist/src/data/transforms/pileup.test.d.ts.map +1 -0
- package/dist/src/data/transforms/project.test.d.ts +2 -0
- package/dist/src/data/transforms/project.test.d.ts.map +1 -0
- package/dist/src/data/transforms/project.test.js +1 -1
- package/dist/src/data/transforms/regexExtract.test.d.ts +2 -0
- package/dist/src/data/transforms/regexExtract.test.d.ts.map +1 -0
- package/dist/src/data/transforms/regexExtract.test.js +6 -3
- package/dist/src/data/transforms/regexFold.test.d.ts +2 -0
- package/dist/src/data/transforms/regexFold.test.d.ts.map +1 -0
- package/dist/src/data/transforms/sample.test.d.ts +2 -0
- package/dist/src/data/transforms/sample.test.d.ts.map +1 -0
- package/dist/src/data/transforms/stack.test.d.ts +2 -0
- package/dist/src/data/transforms/stack.test.d.ts.map +1 -0
- package/dist/src/data/transforms/stack.test.js +8 -8
- package/dist/src/encoder/accessor.d.ts +17 -14
- package/dist/src/encoder/accessor.d.ts.map +1 -1
- package/dist/src/encoder/accessor.js +127 -56
- package/dist/src/encoder/accessor.test.d.ts +2 -0
- package/dist/src/encoder/accessor.test.d.ts.map +1 -0
- package/dist/src/encoder/accessor.test.js +145 -31
- package/dist/src/encoder/encoder.d.ts +26 -13
- package/dist/src/encoder/encoder.d.ts.map +1 -1
- package/dist/src/encoder/encoder.js +98 -114
- package/dist/src/encoder/encoder.test.d.ts +2 -0
- package/dist/src/encoder/encoder.test.d.ts.map +1 -0
- package/dist/src/encoder/encoder.test.js +85 -82
- package/dist/src/fonts/bmFontManager.d.ts.map +1 -1
- package/dist/src/fonts/bmFontManager.js +10 -4
- package/dist/src/genome/genome.test.d.ts +2 -0
- package/dist/src/genome/genome.test.d.ts.map +1 -0
- package/dist/src/genome/scaleIndex.test.d.ts +2 -0
- package/dist/src/genome/scaleIndex.test.d.ts.map +1 -0
- package/dist/src/genome/scaleLocus.test.d.ts +2 -0
- package/dist/src/genome/scaleLocus.test.d.ts.map +1 -0
- package/dist/src/genomeSpy.d.ts +3 -2
- package/dist/src/genomeSpy.d.ts.map +1 -1
- package/dist/src/genomeSpy.js +15 -6
- package/dist/src/gl/dataToVertices.d.ts +6 -8
- package/dist/src/gl/dataToVertices.d.ts.map +1 -1
- package/dist/src/gl/dataToVertices.js +42 -33
- package/dist/src/gl/glslScaleGenerator.d.ts +84 -15
- package/dist/src/gl/glslScaleGenerator.d.ts.map +1 -1
- package/dist/src/gl/glslScaleGenerator.js +260 -73
- package/dist/src/gl/includes/common.glsl.js +1 -1
- package/dist/src/marks/link.common.glsl.js +1 -1
- package/dist/src/marks/link.d.ts +8 -1
- package/dist/src/marks/link.d.ts.map +1 -1
- package/dist/src/marks/link.fragment.glsl.js +1 -1
- package/dist/src/marks/link.js +47 -31
- package/dist/src/marks/link.vertex.glsl.js +1 -1
- package/dist/src/marks/mark.d.ts +24 -25
- package/dist/src/marks/mark.d.ts.map +1 -1
- package/dist/src/marks/mark.js +246 -118
- package/dist/src/marks/markUtils.d.ts +25 -0
- package/dist/src/marks/markUtils.d.ts.map +1 -1
- package/dist/src/marks/markUtils.js +41 -1
- package/dist/src/marks/point.common.glsl.js +1 -1
- package/dist/src/marks/point.d.ts +8 -1
- package/dist/src/marks/point.d.ts.map +1 -1
- package/dist/src/marks/point.js +34 -25
- package/dist/src/marks/point.vertex.glsl.js +1 -1
- package/dist/src/marks/rect.d.ts +8 -1
- package/dist/src/marks/rect.d.ts.map +1 -1
- package/dist/src/marks/rect.js +28 -23
- package/dist/src/marks/rule.d.ts +8 -1
- package/dist/src/marks/rule.d.ts.map +1 -1
- package/dist/src/marks/rule.js +23 -16
- package/dist/src/marks/text.d.ts +10 -1
- package/dist/src/marks/text.d.ts.map +1 -1
- package/dist/src/marks/text.fragment.glsl.js +1 -1
- package/dist/src/marks/text.js +53 -47
- package/dist/src/marks/text.vertex.glsl.js +1 -1
- package/dist/src/scale/scale.test.d.ts +2 -0
- package/dist/src/scale/scale.test.d.ts.map +1 -0
- package/dist/src/scale/scale.test.js +2 -0
- package/dist/src/scale/ticks.test.d.ts +2 -0
- package/dist/src/scale/ticks.test.d.ts.map +1 -0
- package/dist/src/scale/ticks.test.js +6 -0
- package/dist/src/selection/selection.d.ts +39 -0
- package/dist/src/selection/selection.d.ts.map +1 -0
- package/dist/src/selection/selection.js +78 -0
- package/dist/src/spec/channel.d.ts +150 -83
- package/dist/src/spec/mark.d.ts +133 -78
- package/dist/src/spec/parameter.d.ts +112 -3
- package/dist/src/spec/root.d.ts +0 -1
- package/dist/src/spec/transform.d.ts +19 -1
- package/dist/src/spec/view.d.ts +5 -10
- package/dist/src/tooltip/dataTooltipHandler.d.ts +1 -1
- package/dist/src/tooltip/dataTooltipHandler.d.ts.map +1 -1
- package/dist/src/tooltip/dataTooltipHandler.js +1 -1
- package/dist/src/tooltip/refseqGeneTooltipHandler.d.ts +1 -1
- package/dist/src/tooltip/refseqGeneTooltipHandler.d.ts.map +1 -1
- package/dist/src/types/encoder.d.ts +80 -26
- package/dist/src/types/rendering.d.ts +1 -0
- package/dist/src/types/selectionTypes.d.ts +44 -0
- package/dist/src/types/viewContext.d.ts +1 -4
- package/dist/src/utils/addBaseUrl.test.d.ts +2 -0
- package/dist/src/utils/addBaseUrl.test.d.ts.map +1 -0
- package/dist/src/utils/binnedIndex.test.d.ts +2 -0
- package/dist/src/utils/binnedIndex.test.d.ts.map +1 -0
- package/dist/src/utils/cloner.test.d.ts +2 -0
- package/dist/src/utils/cloner.test.d.ts.map +1 -0
- package/dist/src/utils/coalesce.test.d.ts +2 -0
- package/dist/src/utils/coalesce.test.d.ts.map +1 -0
- package/dist/src/utils/concatIterables.test.d.ts +2 -0
- package/dist/src/utils/concatIterables.test.d.ts.map +1 -0
- package/dist/src/utils/domainArray.test.d.ts +2 -0
- package/dist/src/utils/domainArray.test.d.ts.map +1 -0
- package/dist/src/utils/expression.d.ts +2 -2
- package/dist/src/utils/expression.d.ts.map +1 -1
- package/dist/src/utils/expression.js +11 -2
- package/dist/src/utils/indexer.test.d.ts +2 -0
- package/dist/src/utils/indexer.test.d.ts.map +1 -0
- package/dist/src/utils/inputBinding.d.ts.map +1 -1
- package/dist/src/utils/inputBinding.js +4 -0
- package/dist/src/utils/iterateNestedMaps.test.d.ts +2 -0
- package/dist/src/utils/iterateNestedMaps.test.d.ts.map +1 -0
- package/dist/src/utils/kWayMerge.test.d.ts +2 -0
- package/dist/src/utils/kWayMerge.test.d.ts.map +1 -0
- package/dist/src/utils/mergeObjects.test.d.ts +2 -0
- package/dist/src/utils/mergeObjects.test.d.ts.map +1 -0
- package/dist/src/utils/numberExtractor.test.d.ts +2 -0
- package/dist/src/utils/numberExtractor.test.d.ts.map +1 -0
- package/dist/src/utils/propertyCacher.test.d.ts +2 -0
- package/dist/src/utils/propertyCacher.test.d.ts.map +1 -0
- package/dist/src/utils/propertyCoalescer.test.d.ts +2 -0
- package/dist/src/utils/propertyCoalescer.test.d.ts.map +1 -0
- package/dist/src/utils/propertyCoalescer.test.js +3 -0
- package/dist/src/utils/radixSort.test.d.ts +2 -0
- package/dist/src/utils/radixSort.test.d.ts.map +1 -0
- package/dist/src/utils/reservationMap.test.d.ts +2 -0
- package/dist/src/utils/reservationMap.test.d.ts.map +1 -0
- package/dist/src/utils/ringBuffer.test.d.ts +2 -0
- package/dist/src/utils/ringBuffer.test.d.ts.map +1 -0
- package/dist/src/utils/topK.test.d.ts +2 -0
- package/dist/src/utils/topK.test.d.ts.map +1 -0
- package/dist/src/utils/trees.test.d.ts +2 -0
- package/dist/src/utils/trees.test.d.ts.map +1 -0
- package/dist/src/utils/trees.test.js +8 -3
- package/dist/src/utils/variableTools.test.d.ts +2 -0
- package/dist/src/utils/variableTools.test.d.ts.map +1 -0
- package/dist/src/view/axisResolution.d.ts +19 -6
- package/dist/src/view/axisResolution.d.ts.map +1 -1
- package/dist/src/view/axisResolution.js +16 -7
- package/dist/src/view/axisResolution.test.d.ts +2 -0
- package/dist/src/view/axisResolution.test.d.ts.map +1 -0
- package/dist/src/view/axisResolution.test.js +16 -11
- package/dist/src/view/axisView.js +2 -2
- package/dist/src/view/facetView.d.ts +1 -1
- package/dist/src/view/facetView.d.ts.map +1 -1
- package/dist/src/view/flowBuilder.d.ts +1 -1
- package/dist/src/view/flowBuilder.d.ts.map +1 -1
- package/dist/src/view/flowBuilder.js +34 -5
- package/dist/src/view/flowBuilder.test.d.ts +2 -0
- package/dist/src/view/flowBuilder.test.d.ts.map +1 -0
- package/dist/src/view/flowBuilder.test.js +1 -1
- package/dist/src/view/gridView.d.ts +0 -6
- package/dist/src/view/gridView.d.ts.map +1 -1
- package/dist/src/view/gridView.js +1 -1
- package/dist/src/view/layerView.d.ts +0 -6
- package/dist/src/view/layerView.d.ts.map +1 -1
- package/dist/src/view/layout/flexLayout.test.d.ts +2 -0
- package/dist/src/view/layout/flexLayout.test.d.ts.map +1 -0
- package/dist/src/view/layout/grid.test.d.ts +2 -0
- package/dist/src/view/layout/grid.test.d.ts.map +1 -0
- package/dist/src/view/layout/rectangle.test.d.ts +2 -0
- package/dist/src/view/layout/rectangle.test.d.ts.map +1 -0
- package/dist/src/view/paramMediator.d.ts +39 -5
- package/dist/src/view/paramMediator.d.ts.map +1 -1
- package/dist/src/view/paramMediator.js +120 -9
- package/dist/src/view/paramMediator.test.d.ts +2 -0
- package/dist/src/view/paramMediator.test.d.ts.map +1 -0
- package/dist/src/view/paramMediator.test.js +37 -1
- package/dist/src/view/scaleResolution.d.ts +17 -15
- package/dist/src/view/scaleResolution.d.ts.map +1 -1
- package/dist/src/view/scaleResolution.js +70 -68
- package/dist/src/view/scaleResolution.test.d.ts +2 -0
- package/dist/src/view/scaleResolution.test.d.ts.map +1 -0
- package/dist/src/view/scaleResolution.test.js +2 -0
- package/dist/src/view/testUtils.d.ts.map +1 -1
- package/dist/src/view/testUtils.js +15 -3
- package/dist/src/view/unitView.d.ts +8 -20
- package/dist/src/view/unitView.d.ts.map +1 -1
- package/dist/src/view/unitView.js +100 -102
- package/dist/src/view/view.d.ts +1 -1
- package/dist/src/view/view.d.ts.map +1 -1
- package/dist/src/view/view.test.d.ts +2 -0
- package/dist/src/view/view.test.d.ts.map +1 -0
- package/dist/src/view/view.test.js +73 -55
- package/dist/src/view/viewFactory.test.d.ts +2 -0
- package/dist/src/view/viewFactory.test.d.ts.map +1 -0
- package/dist/src/view/viewFactory.test.js +2 -2
- package/dist/src/view/viewUtils.d.ts +1 -1
- package/dist/src/view/viewUtils.d.ts.map +1 -1
- package/dist/src/view/zoom.js +2 -2
- package/package.json +5 -2
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { UNIQUE_ID_KEY } from "../data/transforms/identifier.js";
|
|
2
|
+
import { validateParameterName } from "../view/paramMediator.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @param {import("../data/flowNode.js").Datum} datum
|
|
6
|
+
* @returns {import("../types/selectionTypes.js").SinglePointSelection}
|
|
7
|
+
*/
|
|
8
|
+
export function createSinglePointSelection(datum) {
|
|
9
|
+
return {
|
|
10
|
+
type: "single",
|
|
11
|
+
datum,
|
|
12
|
+
uniqueId: datum?.[UNIQUE_ID_KEY],
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @param {import("../types/selectionTypes.js").Selection} selection
|
|
18
|
+
* @param {import("../data/flowNode.js").Datum} datum
|
|
19
|
+
* @param {boolean} [empty] evaluate to true if the selection is empty
|
|
20
|
+
*/
|
|
21
|
+
export function selectionTest(selection, datum, empty = true) {
|
|
22
|
+
if (!selection || !datum) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (isSinglePointSelection(selection)) {
|
|
27
|
+
return selection.uniqueId == null
|
|
28
|
+
? empty
|
|
29
|
+
: selection.uniqueId === datum[UNIQUE_ID_KEY];
|
|
30
|
+
} else if (isMultiPointSelection(selection)) {
|
|
31
|
+
return selection.uniqueIds.size == 0
|
|
32
|
+
? empty
|
|
33
|
+
: selection.uniqueIds.has(datum[UNIQUE_ID_KEY]);
|
|
34
|
+
} else {
|
|
35
|
+
throw new Error("Not a selection: " + JSON.stringify(selection));
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @param {{param: string, empty?: boolean}} params
|
|
41
|
+
*/
|
|
42
|
+
export function makeSelectionTestExpression(params) {
|
|
43
|
+
return `selectionTest(${validateParameterName(params.param)}, datum, ${!!(
|
|
44
|
+
params.empty ?? true
|
|
45
|
+
)})`;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* @param {import("../types/selectionTypes.js").Selection} selection
|
|
50
|
+
* @returns {selection is import("../types/selectionTypes.js").RangeSelection}
|
|
51
|
+
*/
|
|
52
|
+
export function isRangeSelection(selection) {
|
|
53
|
+
return selection.type === "range";
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* @param {import("../types/selectionTypes.js").Selection} selection
|
|
58
|
+
* @returns {selection is import("../types/selectionTypes.js").SinglePointSelection}
|
|
59
|
+
*/
|
|
60
|
+
export function isSinglePointSelection(selection) {
|
|
61
|
+
return selection.type === "single";
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* @param {import("../types/selectionTypes.js").Selection} selection
|
|
66
|
+
* @returns {selection is import("../types/selectionTypes.js").MultiPointSelection}
|
|
67
|
+
*/
|
|
68
|
+
export function isMultiPointSelection(selection) {
|
|
69
|
+
return selection.type === "multi";
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* @param {import("../types/selectionTypes.js").Selection} selection
|
|
74
|
+
* @returns {selection is import("../types/selectionTypes.js").ProjectedSelection}
|
|
75
|
+
*/
|
|
76
|
+
export function isProjectedSelection(selection) {
|
|
77
|
+
return selection.type === "projected";
|
|
78
|
+
}
|
|
@@ -12,6 +12,7 @@ import { ExprRef } from "./parameter.js";
|
|
|
12
12
|
import { Scale } from "./scale.js";
|
|
13
13
|
import { GenomeAxis } from "./axis.js";
|
|
14
14
|
|
|
15
|
+
// TODO: Rename Scalar to PrimitiveValue
|
|
15
16
|
export type Scalar = string | number | boolean;
|
|
16
17
|
export type Value = Scalar | ExprRef | null;
|
|
17
18
|
|
|
@@ -39,8 +40,7 @@ export type ChannelWithScale =
|
|
|
39
40
|
| "shape"
|
|
40
41
|
| "angle"
|
|
41
42
|
| "dx"
|
|
42
|
-
| "dy"
|
|
43
|
-
| "sample"; // Needed for collecting sample ids (domain) from multiple views
|
|
43
|
+
| "dy";
|
|
44
44
|
|
|
45
45
|
export type ChannelWithoutScale =
|
|
46
46
|
| "uniqueId"
|
|
@@ -48,7 +48,8 @@ export type ChannelWithoutScale =
|
|
|
48
48
|
| "text"
|
|
49
49
|
| "facetIndex"
|
|
50
50
|
| "semanticScore"
|
|
51
|
-
| "uniqueId"
|
|
51
|
+
| "uniqueId"
|
|
52
|
+
| "sample"; // Needed for collecting sample ids (domain) from multiple views
|
|
52
53
|
|
|
53
54
|
export type Channel = ChannelWithScale | ChannelWithoutScale;
|
|
54
55
|
|
|
@@ -96,7 +97,7 @@ export interface TypeMixins<T extends Type> {
|
|
|
96
97
|
type: T;
|
|
97
98
|
}
|
|
98
99
|
|
|
99
|
-
export interface FieldDefBase
|
|
100
|
+
export interface FieldDefBase {
|
|
100
101
|
/**
|
|
101
102
|
* __Required.__ A string defining the name of the field from which to pull a data value
|
|
102
103
|
* or an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator.
|
|
@@ -109,22 +110,20 @@ export interface FieldDefBase<F> {
|
|
|
109
110
|
* See more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html).
|
|
110
111
|
* 2) `field` is not required if `aggregate` is `count`.
|
|
111
112
|
*/
|
|
112
|
-
field?:
|
|
113
|
+
field?: string;
|
|
113
114
|
}
|
|
114
115
|
|
|
115
|
-
export type
|
|
116
|
-
|
|
117
|
-
T
|
|
118
|
-
> = FieldDefBase<F> & TitleMixins & TypeMixins<T>;
|
|
116
|
+
export type FieldDef<T extends Type = Type> =
|
|
117
|
+
| SecondaryFieldDef
|
|
118
|
+
| TypedFieldDef<T>;
|
|
119
119
|
|
|
120
|
-
export type
|
|
121
|
-
|
|
122
|
-
T
|
|
123
|
-
> &
|
|
124
|
-
ScaleMixins;
|
|
120
|
+
export type TypedFieldDef<T extends Type = Type> = FieldDefBase &
|
|
121
|
+
TitleMixins &
|
|
122
|
+
TypeMixins<T>;
|
|
125
123
|
|
|
126
|
-
export type
|
|
127
|
-
|
|
124
|
+
export type ScaleFieldDef<T extends Type> = TypedFieldDef<T> & ScaleMixins;
|
|
125
|
+
|
|
126
|
+
export type FieldDefWithoutScale = FieldDefBase & TitleMixins;
|
|
128
127
|
|
|
129
128
|
export interface ScaleMixins {
|
|
130
129
|
/**
|
|
@@ -142,8 +141,19 @@ export interface ScaleMixins {
|
|
|
142
141
|
* An alternative channel for scale resolution.
|
|
143
142
|
*
|
|
144
143
|
* This is mainly for internal use and allows using `color` channel to resolve `fill` and `stroke` channels under certain circumstances.
|
|
144
|
+
*
|
|
145
|
+
* @internal
|
|
145
146
|
*/
|
|
146
147
|
resolutionChannel?: ChannelWithScale;
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Whether the field or evaluated expr should be included in the scale's domain.
|
|
151
|
+
*
|
|
152
|
+
* **Default value:** `true`
|
|
153
|
+
*
|
|
154
|
+
* @internal
|
|
155
|
+
*/
|
|
156
|
+
contributesToScaleDomain?: boolean;
|
|
147
157
|
}
|
|
148
158
|
|
|
149
159
|
export interface ValueDefBase<V extends Value = Scalar> {
|
|
@@ -155,27 +165,31 @@ export interface ValueDefBase<V extends Value = Scalar> {
|
|
|
155
165
|
|
|
156
166
|
export type ValueDef<V extends Value = Scalar> = ValueDefBase<V> & TitleMixins;
|
|
157
167
|
|
|
158
|
-
export interface
|
|
168
|
+
export interface DatumDef<V extends Scalar | ExprRef = Scalar | ExprRef>
|
|
169
|
+
extends Partial<TypeMixins<Type>>,
|
|
170
|
+
BandMixins,
|
|
171
|
+
ScaleMixins,
|
|
172
|
+
TitleMixins {
|
|
159
173
|
/**
|
|
160
174
|
* A constant value in data domain.
|
|
161
175
|
*/
|
|
162
|
-
datum?:
|
|
176
|
+
datum?: V;
|
|
163
177
|
}
|
|
164
178
|
|
|
165
|
-
export
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
/**
|
|
179
|
+
export interface ExprDef<>extends Partial<TypeMixins<Type>>,
|
|
180
|
+
BandMixins,
|
|
181
|
+
TitleMixins {
|
|
182
|
+
/**
|
|
183
|
+
* An expression. Properties of the data can be accessed through the `datum` object.
|
|
184
|
+
*/
|
|
169
185
|
expr: string;
|
|
170
186
|
}
|
|
171
187
|
|
|
172
188
|
/**
|
|
173
189
|
* Field definition of a mark property, which can contain a legend.
|
|
174
190
|
*/
|
|
175
|
-
export type MarkPropFieldDef<
|
|
176
|
-
|
|
177
|
-
T extends Type = Type
|
|
178
|
-
> = ScaleFieldDef<F, T> & LegendMixins;
|
|
191
|
+
export type MarkPropFieldDef<T extends Type = Type> = ScaleFieldDef<T> &
|
|
192
|
+
LegendMixins;
|
|
179
193
|
|
|
180
194
|
export type MarkPropExprDef<T extends Type = Type> = ExprDef &
|
|
181
195
|
TypeMixins<T> &
|
|
@@ -186,11 +200,6 @@ export type MarkPropDatumDef<T extends Type> = LegendMixins &
|
|
|
186
200
|
ScaleDatumDef &
|
|
187
201
|
TypeMixins<T>;
|
|
188
202
|
|
|
189
|
-
export type MarkPropFieldOrDatumOrExprDef<
|
|
190
|
-
F extends Field,
|
|
191
|
-
T extends Type = Type
|
|
192
|
-
> = MarkPropFieldDef<F, T> | MarkPropDatumDef<T> | MarkPropExprDef;
|
|
193
|
-
|
|
194
203
|
export interface LegendMixins {
|
|
195
204
|
/**
|
|
196
205
|
* An object defining properties of the legend.
|
|
@@ -203,15 +212,84 @@ export interface LegendMixins {
|
|
|
203
212
|
// TODO: legend?: Legend<ExprRef | SignalRef> | null;
|
|
204
213
|
}
|
|
205
214
|
|
|
206
|
-
export type
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
215
|
+
export type ConditionalTemplate =
|
|
216
|
+
| FieldDef<any>
|
|
217
|
+
| DatumDef
|
|
218
|
+
| ValueDef<any>
|
|
219
|
+
| ExprRef;
|
|
211
220
|
|
|
212
|
-
export type
|
|
221
|
+
export type Conditional<CD extends ConditionalTemplate> =
|
|
222
|
+
ConditionalParameter<CD>;
|
|
213
223
|
|
|
214
|
-
|
|
224
|
+
// Source of ParameterPredicate: https://github.com/vega/vega-lite/blob/main/src/predicate.ts
|
|
225
|
+
export interface ParameterPredicate {
|
|
226
|
+
/**
|
|
227
|
+
* Filter using a parameter name.
|
|
228
|
+
*/
|
|
229
|
+
param: string;
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* For selection parameters, the predicate of empty selections returns true by default.
|
|
233
|
+
* Override this behavior, by setting this property `empty: false`.
|
|
234
|
+
*/
|
|
235
|
+
empty?: boolean;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export type ConditionalParameter<CD extends ConditionalTemplate> =
|
|
239
|
+
ParameterPredicate & CD;
|
|
240
|
+
|
|
241
|
+
export interface ConditionValueDefMixins<V extends Value = Value> {
|
|
242
|
+
/**
|
|
243
|
+
* One or more value definition(s) with [a parameter or a test predicate](https://vega.github.io/vega-lite/docs/condition.html).
|
|
244
|
+
*
|
|
245
|
+
* __Note:__ A field definition's `condition` property can only contain [conditional value definitions](https://vega.github.io/vega-lite/docs/condition.html#value)
|
|
246
|
+
* since Vega-Lite only allows at most one encoded field per encoding channel.
|
|
247
|
+
*/
|
|
248
|
+
condition?: Conditional<ValueDef<V>> | Conditional<ValueDef<V>>[];
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* A FieldDef with Condition<ValueDef>
|
|
253
|
+
* {
|
|
254
|
+
* condition: {value: ...},
|
|
255
|
+
* field: ...,
|
|
256
|
+
* ...
|
|
257
|
+
* }
|
|
258
|
+
*/
|
|
259
|
+
export type FieldOrDatumDefWithCondition<
|
|
260
|
+
F extends FieldDef<any> | DatumDef<any> = FieldDef<any> | DatumDef<any>,
|
|
261
|
+
V extends Value = Value
|
|
262
|
+
> = F & ConditionValueDefMixins<V | ExprRef>;
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* @minProperties 1
|
|
266
|
+
*/
|
|
267
|
+
export type ValueDefWithCondition<V extends Value = Value> = Partial<
|
|
268
|
+
ValueDef<V | ExprRef>
|
|
269
|
+
> & {
|
|
270
|
+
/**
|
|
271
|
+
* A field definition or one or more value definition(s) with a parameter predicate.
|
|
272
|
+
*/
|
|
273
|
+
condition?:
|
|
274
|
+
| Conditional<FieldDef>
|
|
275
|
+
| Conditional<DatumDef>
|
|
276
|
+
| Conditional<ValueDef<V | ExprRef>>
|
|
277
|
+
| Conditional<ValueDef<V | ExprRef>>[];
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
export type MarkPropFieldOrDatumOrExprDef<T extends Type = Type> =
|
|
281
|
+
| MarkPropFieldDef<T>
|
|
282
|
+
| MarkPropDatumDef<T>
|
|
283
|
+
| MarkPropExprDef<T>;
|
|
284
|
+
|
|
285
|
+
export type MarkPropDef<V extends Value, T extends Type = Type> =
|
|
286
|
+
| FieldOrDatumDefWithCondition<MarkPropFieldDef<T>, V>
|
|
287
|
+
| FieldOrDatumDefWithCondition<DatumDef, V>
|
|
288
|
+
| ValueDefWithCondition<V>;
|
|
289
|
+
|
|
290
|
+
export type ColorDef = MarkPropDef<string | null>;
|
|
291
|
+
|
|
292
|
+
export type SecondaryFieldDef = FieldDefBase & TitleMixins;
|
|
215
293
|
|
|
216
294
|
export type NumericValueDef = ValueDef<number>;
|
|
217
295
|
|
|
@@ -219,8 +297,7 @@ export type ScaleDatumDef = ScaleMixins & DatumDef;
|
|
|
219
297
|
|
|
220
298
|
export type PositionDatumDefBase = ScaleDatumDef & TypeMixins<Type>;
|
|
221
299
|
|
|
222
|
-
export type PositionFieldDef
|
|
223
|
-
PositionMixins;
|
|
300
|
+
export type PositionFieldDef = PositionFieldDefBase & PositionMixins;
|
|
224
301
|
|
|
225
302
|
export type PositionDatumDef = PositionDatumDefBase & PositionMixins;
|
|
226
303
|
|
|
@@ -243,7 +320,7 @@ export interface PositionMixins extends BandMixins {
|
|
|
243
320
|
axis?: GenomeAxis | null;
|
|
244
321
|
}
|
|
245
322
|
|
|
246
|
-
export type PositionFieldDefBase
|
|
323
|
+
export type PositionFieldDefBase = ScaleFieldDef<Type>;
|
|
247
324
|
|
|
248
325
|
export interface ChromPosDefBase extends BandMixins {
|
|
249
326
|
/**
|
|
@@ -278,39 +355,29 @@ export type ChromPosDef = SecondaryChromPosDef &
|
|
|
278
355
|
TypeMixins<"locus"> &
|
|
279
356
|
ScaleMixins;
|
|
280
357
|
|
|
281
|
-
export type PositionDef
|
|
282
|
-
| PositionFieldDef
|
|
358
|
+
export type PositionDef =
|
|
359
|
+
| PositionFieldDef
|
|
283
360
|
| ChromPosDef
|
|
284
361
|
| PositionDatumDef
|
|
285
362
|
| PositionExprDef
|
|
286
363
|
| PositionValueDef;
|
|
287
364
|
|
|
288
|
-
export type Position2Def
|
|
289
|
-
| (SecondaryFieldDef
|
|
365
|
+
export type Position2Def =
|
|
366
|
+
| (SecondaryFieldDef & BandMixins)
|
|
290
367
|
| SecondaryChromPosDef
|
|
291
368
|
| (DatumDef & BandMixins)
|
|
292
369
|
| (ExprDef & BandMixins)
|
|
293
370
|
| PositionValueDef;
|
|
294
371
|
|
|
295
|
-
export type NumericMarkPropDef
|
|
372
|
+
export type NumericMarkPropDef = MarkPropDef<number>;
|
|
296
373
|
|
|
297
|
-
export type ShapeDef
|
|
298
|
-
F,
|
|
299
|
-
string | null,
|
|
300
|
-
TypeForShape
|
|
301
|
-
>;
|
|
374
|
+
export type ShapeDef = MarkPropDef<string | null, TypeForShape>;
|
|
302
375
|
|
|
303
|
-
export interface StringFieldDef
|
|
304
|
-
extends FieldDefWithoutScale<F>,
|
|
305
|
-
FormatMixins {}
|
|
376
|
+
export interface StringFieldDef extends FieldDefWithoutScale, FormatMixins {}
|
|
306
377
|
|
|
307
|
-
export type TextDef
|
|
308
|
-
| StringFieldDef<F>
|
|
309
|
-
| StringDatumDef
|
|
310
|
-
| ExprDef;
|
|
378
|
+
export type TextDef = StringFieldDef | StringDatumDef | ExprDef; // TODO: Conditions
|
|
311
379
|
|
|
312
|
-
export type ChannelDef
|
|
313
|
-
Encoding<F>[keyof Encoding<F>];
|
|
380
|
+
export type ChannelDef = Encoding[keyof Encoding];
|
|
314
381
|
|
|
315
382
|
// TODO: Does this make sense?
|
|
316
383
|
export type ChannelDefWithScale = ScaleMixins & TypeMixins<Type>;
|
|
@@ -328,37 +395,37 @@ export interface XIndexDef {
|
|
|
328
395
|
buildIndex?: boolean;
|
|
329
396
|
}
|
|
330
397
|
|
|
331
|
-
export interface Encoding
|
|
398
|
+
export interface Encoding {
|
|
332
399
|
/**
|
|
333
400
|
* X coordinates of the marks.
|
|
334
401
|
*
|
|
335
402
|
* The `value` of this channel can be a number between zero and one.
|
|
336
403
|
*/
|
|
337
|
-
x?: PositionDef
|
|
404
|
+
x?: PositionDef & XIndexDef;
|
|
338
405
|
|
|
339
406
|
/**
|
|
340
407
|
* Y coordinates of the marks.
|
|
341
408
|
*
|
|
342
409
|
* The `value` of this channel can be a number between zero and one.
|
|
343
410
|
*/
|
|
344
|
-
y?: PositionDef
|
|
411
|
+
y?: PositionDef;
|
|
345
412
|
|
|
346
413
|
/**
|
|
347
414
|
* X2 coordinates of the marks.
|
|
348
415
|
*
|
|
349
416
|
* The `value` of this channel can be a number between zero and one.
|
|
350
417
|
*/
|
|
351
|
-
x2?: Position2Def
|
|
418
|
+
x2?: Position2Def;
|
|
352
419
|
|
|
353
420
|
/**
|
|
354
421
|
* Y2 coordinates of the marks.
|
|
355
422
|
*
|
|
356
423
|
* The `value` of this channel can be a number between zero and one.
|
|
357
424
|
*/
|
|
358
|
-
y2?: Position2Def
|
|
425
|
+
y2?: Position2Def;
|
|
359
426
|
|
|
360
|
-
dx?: NumericMarkPropDef
|
|
361
|
-
dy?: NumericMarkPropDef
|
|
427
|
+
dx?: NumericMarkPropDef; // TODO: Not a mark property. Fix types.
|
|
428
|
+
dy?: NumericMarkPropDef;
|
|
362
429
|
|
|
363
430
|
/**
|
|
364
431
|
* Color of the marks – either fill or stroke color based on the `filled` property of mark definition.
|
|
@@ -367,14 +434,14 @@ export interface Encoding<F extends Field = string> {
|
|
|
367
434
|
* 1) For fine-grained control over both fill and stroke colors of the marks, please use the `fill` and `stroke` channels. The `fill` or `stroke` encodings have higher precedence than `color`, thus may override the `color` encoding if conflicting encodings are specified.
|
|
368
435
|
* 2) See the scale documentation for more information about customizing [color scheme](https://vega.github.io/vega-lite/docs/scale.html#scheme).
|
|
369
436
|
*/
|
|
370
|
-
color?: ColorDef
|
|
437
|
+
color?: ColorDef;
|
|
371
438
|
|
|
372
439
|
/**
|
|
373
440
|
* Fill color of the marks.
|
|
374
441
|
*
|
|
375
442
|
* _Note:_ The `fill` encoding has higher precedence than `color`, thus may override the `color` encoding if conflicting encodings are specified.
|
|
376
443
|
*/
|
|
377
|
-
fill?: ColorDef
|
|
444
|
+
fill?: ColorDef;
|
|
378
445
|
|
|
379
446
|
/**
|
|
380
447
|
* Stroke color of the marks.
|
|
@@ -382,39 +449,39 @@ export interface Encoding<F extends Field = string> {
|
|
|
382
449
|
* _Note:_ The `stroke` encoding has higher precedence than `color`, thus may override the `color` encoding if conflicting encodings are specified.
|
|
383
450
|
*/
|
|
384
451
|
|
|
385
|
-
stroke?: ColorDef
|
|
452
|
+
stroke?: ColorDef;
|
|
386
453
|
|
|
387
454
|
/**
|
|
388
455
|
* Opacity of the marks.
|
|
389
456
|
*/
|
|
390
|
-
opacity?: NumericMarkPropDef
|
|
457
|
+
opacity?: NumericMarkPropDef;
|
|
391
458
|
|
|
392
459
|
/**
|
|
393
460
|
* Fill opacity of the marks.
|
|
394
461
|
*/
|
|
395
|
-
fillOpacity?: NumericMarkPropDef
|
|
462
|
+
fillOpacity?: NumericMarkPropDef;
|
|
396
463
|
|
|
397
464
|
/**
|
|
398
465
|
* Stroke opacity of the marks.
|
|
399
466
|
*/
|
|
400
|
-
strokeOpacity?: NumericMarkPropDef
|
|
467
|
+
strokeOpacity?: NumericMarkPropDef;
|
|
401
468
|
|
|
402
469
|
/**
|
|
403
470
|
* Stroke width of the marks.
|
|
404
471
|
*/
|
|
405
|
-
strokeWidth?: NumericMarkPropDef
|
|
472
|
+
strokeWidth?: NumericMarkPropDef;
|
|
406
473
|
|
|
407
474
|
/**
|
|
408
475
|
* Size of the mark.
|
|
409
476
|
* - For `"point"` – the symbol size, or pixel area of the mark.
|
|
410
477
|
* - For `"text"` – the text's font size.
|
|
411
478
|
*/
|
|
412
|
-
size?: NumericMarkPropDef
|
|
479
|
+
size?: NumericMarkPropDef;
|
|
413
480
|
|
|
414
481
|
/**
|
|
415
482
|
* Rotation angle of point and text marks.
|
|
416
483
|
*/
|
|
417
|
-
angle?: NumericMarkPropDef
|
|
484
|
+
angle?: NumericMarkPropDef;
|
|
418
485
|
|
|
419
486
|
/**
|
|
420
487
|
* Shape of the mark.
|
|
@@ -423,32 +490,32 @@ export interface Encoding<F extends Field = string> {
|
|
|
423
490
|
* - plotting shapes: `"circle"`, `"square"`, `"cross"`, `"diamond"`, `"triangle-up"`, `"triangle-down"`, `"triangle-right"`, or `"triangle-left"`.
|
|
424
491
|
* - centered directional shape `"triangle"`
|
|
425
492
|
*/
|
|
426
|
-
shape?: ShapeDef
|
|
493
|
+
shape?: ShapeDef;
|
|
427
494
|
|
|
428
495
|
/**
|
|
429
496
|
* Text of the `text` mark.
|
|
430
497
|
*/
|
|
431
|
-
text?: TextDef
|
|
498
|
+
text?: TextDef;
|
|
432
499
|
|
|
433
500
|
/**
|
|
434
501
|
* Facet identifier for interactive filtering, sorting, and grouping in the App.
|
|
435
502
|
*/
|
|
436
|
-
sample?: FieldDefWithoutScale
|
|
503
|
+
sample?: FieldDefWithoutScale;
|
|
437
504
|
|
|
438
505
|
/**
|
|
439
506
|
* For internal use
|
|
440
507
|
*/
|
|
441
508
|
// TODO: proper type
|
|
442
|
-
uniqueId?: FieldDefWithoutScale
|
|
509
|
+
uniqueId?: FieldDefWithoutScale;
|
|
443
510
|
|
|
444
511
|
// TODO: proper type
|
|
445
|
-
search?: FieldDefWithoutScale
|
|
512
|
+
search?: FieldDefWithoutScale;
|
|
446
513
|
|
|
447
514
|
/**
|
|
448
515
|
* For internal use
|
|
449
516
|
*/
|
|
450
517
|
// TODO: proper type
|
|
451
|
-
facetIndex?: FieldDefWithoutScale
|
|
518
|
+
facetIndex?: FieldDefWithoutScale;
|
|
452
519
|
|
|
453
|
-
semanticScore?: FieldDefWithoutScale
|
|
520
|
+
semanticScore?: FieldDefWithoutScale;
|
|
454
521
|
}
|