@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
|
@@ -35,6 +35,8 @@ export function buildDataFlow(root, existingFlow) {
|
|
|
35
35
|
|
|
36
36
|
/** @type {FlowNode[]} "Current nodes" on the path from view root to the current view */
|
|
37
37
|
const nodeStack = [];
|
|
38
|
+
/** @type {{view: View, nodeStackDepth: number}[]} */
|
|
39
|
+
const viewStack = [];
|
|
38
40
|
|
|
39
41
|
/** @type {FlowNode} */
|
|
40
42
|
let currentNode;
|
|
@@ -59,6 +61,7 @@ export function buildDataFlow(root, existingFlow) {
|
|
|
59
61
|
}
|
|
60
62
|
currentNode.addChild(node);
|
|
61
63
|
currentNode = node;
|
|
64
|
+
nodeStack.push(node);
|
|
62
65
|
return node;
|
|
63
66
|
}
|
|
64
67
|
|
|
@@ -108,10 +111,16 @@ export function buildDataFlow(root, existingFlow) {
|
|
|
108
111
|
}
|
|
109
112
|
}
|
|
110
113
|
|
|
114
|
+
function isInBranchWithIdentifier() {
|
|
115
|
+
return (
|
|
116
|
+
nodeStack.findLastIndex(
|
|
117
|
+
(node) => node instanceof IdentifierTransform
|
|
118
|
+
) > nodeStack.findLastIndex((node) => node instanceof DataSource)
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
|
|
111
122
|
/** @param {View} view */
|
|
112
123
|
const processView = (view) => {
|
|
113
|
-
nodeStack.push(currentNode);
|
|
114
|
-
|
|
115
124
|
if (view.spec.data) {
|
|
116
125
|
const dataSource = isNamedData(view.spec.data)
|
|
117
126
|
? new NamedSource(
|
|
@@ -122,6 +131,7 @@ export function buildDataFlow(root, existingFlow) {
|
|
|
122
131
|
: createDataSource(view.spec.data, view);
|
|
123
132
|
|
|
124
133
|
currentNode = dataSource;
|
|
134
|
+
nodeStack.push(dataSource);
|
|
125
135
|
dataFlow.addDataSource(dataSource, view);
|
|
126
136
|
}
|
|
127
137
|
|
|
@@ -148,13 +158,24 @@ export function buildDataFlow(root, existingFlow) {
|
|
|
148
158
|
}
|
|
149
159
|
}
|
|
150
160
|
|
|
151
|
-
if (
|
|
161
|
+
if (
|
|
162
|
+
view.mark.isPickingParticipant() &&
|
|
163
|
+
!isInBranchWithIdentifier()
|
|
164
|
+
) {
|
|
165
|
+
// TODO: If two branches receive the same data, they should have
|
|
166
|
+
// a shared identifier transform. However, unique ids cannot be
|
|
167
|
+
// assigned right after the data source, because some transforms,
|
|
168
|
+
// (e.g, RegexFold) may generate new tuples.
|
|
169
|
+
//
|
|
152
170
|
appendTransform(new CloneTransform());
|
|
153
171
|
appendTransform(
|
|
154
172
|
new IdentifierTransform({ type: "identifier" })
|
|
155
173
|
);
|
|
156
174
|
}
|
|
157
175
|
|
|
176
|
+
// TODO: Handle cases where the spec contains terminal collector nodes
|
|
177
|
+
// (with custom sort configuration, for example). Now a new collector
|
|
178
|
+
// is always appended to the end of the current branch.
|
|
158
179
|
const collector = new Collector({
|
|
159
180
|
type: "collect",
|
|
160
181
|
groupby: view.getFacetFields(),
|
|
@@ -178,10 +199,18 @@ export function buildDataFlow(root, existingFlow) {
|
|
|
178
199
|
|
|
179
200
|
for (const dataTree of dataTrees) {
|
|
180
201
|
visitTree(dataTree, {
|
|
181
|
-
preOrder: (node) =>
|
|
202
|
+
preOrder: (node) => {
|
|
203
|
+
viewStack.push({
|
|
204
|
+
view: node.ref,
|
|
205
|
+
nodeStackDepth: nodeStack.length,
|
|
206
|
+
});
|
|
207
|
+
processView(node.ref);
|
|
208
|
+
},
|
|
182
209
|
// eslint-disable-next-line no-loop-func
|
|
183
210
|
postOrder: () => {
|
|
184
|
-
|
|
211
|
+
const { nodeStackDepth } = viewStack.pop();
|
|
212
|
+
nodeStack.length = nodeStackDepth;
|
|
213
|
+
currentNode = nodeStack.at(-1);
|
|
185
214
|
},
|
|
186
215
|
});
|
|
187
216
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flowBuilder.test.d.ts","sourceRoot":"","sources":["../../../src/view/flowBuilder.test.js"],"names":[],"mappings":""}
|
|
@@ -66,12 +66,6 @@ export default class GridView extends ContainerView {
|
|
|
66
66
|
* @protected
|
|
67
67
|
*/
|
|
68
68
|
protected createAxes(): Promise<void[]>;
|
|
69
|
-
/**
|
|
70
|
-
* @param {import("./renderingContext/viewRenderingContext.js").default} context
|
|
71
|
-
* @param {import("./layout/rectangle.js").default} coords
|
|
72
|
-
* @param {import("../types/rendering.js").RenderingOptions} [options]
|
|
73
|
-
*/
|
|
74
|
-
render(context: import("./renderingContext/viewRenderingContext.js").default, coords: import("./layout/rectangle.js").default, options?: import("../types/rendering.js").RenderingOptions): void;
|
|
75
69
|
#private;
|
|
76
70
|
}
|
|
77
71
|
export class GridChild {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gridView.d.ts","sourceRoot":"","sources":["../../../src/view/gridView.js"],"names":[],"mappings":"AAswBA;;;GAGG;AACH,iDAHW,OAAO,iBAAiB,EAAE,cAAc,GACtC,OAAO,iBAAiB,EAAE,QAAQ,CAwB9C;AAED;;;GAGG;AACH,uDAHW,OAAO,iBAAiB,EAAE,cAAc,GACtC,OAAO,iBAAiB,EAAE,QAAQ,CA6C9C;AA2BD;;GAEG;AACH,8EAUC;AAED;;;;;GAKG;AACH,4CAJW,OAAO,uBAAuB,EAAE,OAAO,UACvC,OAAO,iBAAiB,EAAE,UAAU,YACpC,QAAQ,aAmBlB;AA53BD;;;;;;;;;;;;;;;GAeG;AACH;IA6BI;;;;;;;;;OASG;IACH,kBARW,OAAO,iBAAiB,EAAE,aAAa,WACvC,OAAO,yBAAyB,EAAE,OAAO,gBACzC,aAAa,iDAEb,MAAM,WACN,MAAM,YACN,OAAO,WAAW,EAAE,WAAW,EAoBzC;IARG,8CAAgB;IAOhB,uBAA0B;IAG9B;;OAEG;IACH,qDAIC;IAeD;;OAEG;IACH,wDAKC;IAqBD;;OAEG;IACH,8CAEC;IAED,yBAEC;IAED;;OAEG;IACH,wCAmCC
|
|
1
|
+
{"version":3,"file":"gridView.d.ts","sourceRoot":"","sources":["../../../src/view/gridView.js"],"names":[],"mappings":"AAswBA;;;GAGG;AACH,iDAHW,OAAO,iBAAiB,EAAE,cAAc,GACtC,OAAO,iBAAiB,EAAE,QAAQ,CAwB9C;AAED;;;GAGG;AACH,uDAHW,OAAO,iBAAiB,EAAE,cAAc,GACtC,OAAO,iBAAiB,EAAE,QAAQ,CA6C9C;AA2BD;;GAEG;AACH,8EAUC;AAED;;;;;GAKG;AACH,4CAJW,OAAO,uBAAuB,EAAE,OAAO,UACvC,OAAO,iBAAiB,EAAE,UAAU,YACpC,QAAQ,aAmBlB;AA53BD;;;;;;;;;;;;;;;GAeG;AACH;IA6BI;;;;;;;;;OASG;IACH,kBARW,OAAO,iBAAiB,EAAE,aAAa,WACvC,OAAO,yBAAyB,EAAE,OAAO,gBACzC,aAAa,iDAEb,MAAM,WACN,MAAM,YACN,OAAO,WAAW,EAAE,WAAW,EAoBzC;IARG,8CAAgB;IAOhB,uBAA0B;IAG9B;;OAEG;IACH,qDAIC;IAeD;;OAEG;IACH,wDAKC;IAqBD;;OAEG;IACH,8CAEC;IAED,yBAEC;IAED;;OAEG;IACH,wCAmCC;;CA+jBJ;AAgJD;IACI;;;;OAIG;IACH,6DAHW,aAAa,UACb,MAAM,EAoFhB;IAjFG,4BAAgC;IAChC,kCAAgB;IAChB,eAAoB;IAEpB,uBAAuB;IACvB,YADW,QAAQ,CACQ;IAE3B,uBAAuB;IACvB,kBADW,QAAQ,CACc;IAEjC,mFAAmF;IACnF,MADW,QAAQ,OAAO,OAAO,iBAAiB,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC,CAC5D;IAEd,4FAA4F;IAC5F,WADW,QAAQ,OAAO,OAAO,iBAAiB,EAAE,UAAU,EAAE,YAAY,CAAC,CAAC,CAC3D;IAEnB,0DAA0D;IAC1D,kEAAoB;IAEpB,uBAAuB;IACvB,OADW,QAAQ,CACG;IAEtB,wBAAwB;IACxB,QADW,SAAS,CACQ;IA4DhC,uEAcC;IAED;;OAEG;IACH,4BAkKC;IAED,uBAqBC;IAED,iCAEC;CACJ;qBAlrC0D,eAAe;sBAFpD,uBAAuB;0BAGnB,oBAAoB;qBAGzB,eAAe;yBALX,mBAAmB;AAqrC5C;IAeI;;;OAGG;IACH,uBAHW,SAAS,8CA6FnB;IAhGD,uBAAmB;IAsCf;;;MAAoB;IAIpB;;;;MAQC;IAgDL,2BAKC;IAWD;;;;OAIG;IACH,gCAHW,SAAS,UACT,SAAS,QA8CnB;;CACJ;oBAx2CmB,qBAAqB"}
|
|
@@ -835,7 +835,7 @@ export function createBackgroundStroke(viewBackground) {
|
|
|
835
835
|
size: viewBackground.strokeWidth ?? 1.0,
|
|
836
836
|
color: viewBackground.stroke ?? "lightgray",
|
|
837
837
|
strokeCap: "square",
|
|
838
|
-
|
|
838
|
+
opacity: viewBackground.strokeOpacity ?? 1.0,
|
|
839
839
|
type: "rule",
|
|
840
840
|
clip: false,
|
|
841
841
|
tooltip: null,
|
|
@@ -11,12 +11,6 @@ export default class LayerView extends ContainerView {
|
|
|
11
11
|
constructor(spec: import("../spec/view.js").LayerSpec, context: import("../types/viewContext.js").default, layoutParent: ContainerView, dataParent: import("./view.js").default, name: string, options?: import("./view.js").ViewOptions);
|
|
12
12
|
spec: import("../spec/view.js").LayerSpec;
|
|
13
13
|
get children(): (import("./unitView.js").default | LayerView)[];
|
|
14
|
-
/**
|
|
15
|
-
* @param {import("./renderingContext/viewRenderingContext.js").default} context
|
|
16
|
-
* @param {import("./layout/rectangle.js").default} coords
|
|
17
|
-
* @param {import("../types/rendering.js").RenderingOptions} [options]
|
|
18
|
-
*/
|
|
19
|
-
render(context: import("./renderingContext/viewRenderingContext.js").default, coords: import("./layout/rectangle.js").default, options?: import("../types/rendering.js").RenderingOptions): void;
|
|
20
14
|
#private;
|
|
21
15
|
}
|
|
22
16
|
import ContainerView from "./containerView.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layerView.d.ts","sourceRoot":"","sources":["../../../src/view/layerView.js"],"names":[],"mappings":"AAIA;IAQI;;;;;;;;OAQG;IACH,kBAPW,OAAO,iBAAiB,EAAE,SAAS,WACnC,OAAO,yBAAyB,EAAE,OAAO,gBACzC,aAAa,cACb,OAAO,WAAW,EAAE,OAAO,QAC3B,MAAM,YACN,OAAO,WAAW,EAAE,WAAW,EAQzC;IAHG,0CAAgB;IAoCpB,gEAEC
|
|
1
|
+
{"version":3,"file":"layerView.d.ts","sourceRoot":"","sources":["../../../src/view/layerView.js"],"names":[],"mappings":"AAIA;IAQI;;;;;;;;OAQG;IACH,kBAPW,OAAO,iBAAiB,EAAE,SAAS,WACnC,OAAO,yBAAyB,EAAE,OAAO,gBACzC,aAAa,cACb,OAAO,WAAW,EAAE,OAAO,QAC3B,MAAM,YACN,OAAO,WAAW,EAAE,WAAW,EAQzC;IAHG,0CAAgB;IAoCpB,gEAEC;;CA6CJ;0BA1GyB,oBAAoB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flexLayout.test.d.ts","sourceRoot":"","sources":["../../../../src/view/layout/flexLayout.test.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grid.test.d.ts","sourceRoot":"","sources":["../../../../src/view/layout/grid.test.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rectangle.test.d.ts","sourceRoot":"","sources":["../../../../src/view/layout/rectangle.test.js"],"names":[],"mappings":""}
|
|
@@ -11,7 +11,17 @@ export function isExprRef(x: any): x is import("../spec/parameter.js").ExprRef;
|
|
|
11
11
|
* @template T
|
|
12
12
|
* @returns {T}
|
|
13
13
|
*/
|
|
14
|
-
export function withoutExprRef<T>(x:
|
|
14
|
+
export function withoutExprRef<T>(x: import("../spec/parameter.js").ExprRef | T): T;
|
|
15
|
+
/**
|
|
16
|
+
* @param {Parameter} param
|
|
17
|
+
* @returns {param is import("../spec/parameter.js").VariableParameter}
|
|
18
|
+
*/
|
|
19
|
+
export function isVariableParameter(param: import("../spec/parameter.js").Parameter): param is import("../spec/parameter.js").VariableParameter;
|
|
20
|
+
/**
|
|
21
|
+
* @param {Parameter} param
|
|
22
|
+
* @returns {param is import("../spec/parameter.js").SelectionParameter}
|
|
23
|
+
*/
|
|
24
|
+
export function isSelectionParameter(param: import("../spec/parameter.js").Parameter): param is import("../spec/parameter.js").SelectionParameter<import("../spec/parameter.js").SelectionType>;
|
|
15
25
|
/**
|
|
16
26
|
* Takes a record of properties that may have ExprRefs as values. Converts the
|
|
17
27
|
* ExprRefs to getters and setups a listener that is called when any of the
|
|
@@ -24,6 +34,23 @@ export function withoutExprRef<T>(x: T | import("../spec/parameter.js").ExprRef)
|
|
|
24
34
|
* @template {Record<string, any | import("../spec/parameter.js").ExprRef>} T
|
|
25
35
|
*/
|
|
26
36
|
export function activateExprRefProps<T extends Record<string, any>>(paramMediator: ParamMediator, props: T, listener?: (props: (keyof T)[]) => void): T;
|
|
37
|
+
/**
|
|
38
|
+
* Validates a parameter name. If the name is invalid, throws an error.
|
|
39
|
+
* Otherwise, returns the name.
|
|
40
|
+
*
|
|
41
|
+
* @param {string} name
|
|
42
|
+
* @returns {string} the name
|
|
43
|
+
*/
|
|
44
|
+
export function validateParameterName(name: string): string;
|
|
45
|
+
/**
|
|
46
|
+
* Creates a function that always returns the same value.
|
|
47
|
+
* Provides functionality for creating a constant expression reference.
|
|
48
|
+
* They just do nothing.
|
|
49
|
+
*
|
|
50
|
+
* @param {any} value
|
|
51
|
+
* @returns {ExprRefFunction}
|
|
52
|
+
*/
|
|
53
|
+
export function makeConstantExprRef(value: any): ExprRefFunction;
|
|
27
54
|
/**
|
|
28
55
|
* A class that manages parameters and expressions.
|
|
29
56
|
* Supports nesting and scoped parameters.
|
|
@@ -44,10 +71,10 @@ export default class ParamMediator {
|
|
|
44
71
|
*/
|
|
45
72
|
protected paramListeners: Map<string, Set<() => void>>;
|
|
46
73
|
/**
|
|
47
|
-
* @param {
|
|
74
|
+
* @param {Parameter} param
|
|
48
75
|
* @returns {ParameterSetter}
|
|
49
76
|
*/
|
|
50
|
-
registerParam(param: import("../spec/parameter.js").
|
|
77
|
+
registerParam(param: import("../spec/parameter.js").Parameter): (value: any) => void;
|
|
51
78
|
/**
|
|
52
79
|
*
|
|
53
80
|
* @param {string} paramName
|
|
@@ -75,7 +102,7 @@ export default class ParamMediator {
|
|
|
75
102
|
/**
|
|
76
103
|
* Returns configs for all parameters that have been registered using `registerParam`.
|
|
77
104
|
*/
|
|
78
|
-
get paramConfigs(): ReadonlyMap<string, import("../spec/parameter.js").
|
|
105
|
+
get paramConfigs(): ReadonlyMap<string, import("../spec/parameter.js").Parameter>;
|
|
79
106
|
/**
|
|
80
107
|
*
|
|
81
108
|
* @param {string} paramName
|
|
@@ -95,13 +122,20 @@ export default class ParamMediator {
|
|
|
95
122
|
* @param {string} expr
|
|
96
123
|
*/
|
|
97
124
|
evaluateAndGet(expr: string): any;
|
|
125
|
+
/**
|
|
126
|
+
* Returns true if this ParamMediator has any parameters that are point selections.
|
|
127
|
+
* Point selections necessitate the use of uniqueIds in the data.
|
|
128
|
+
*
|
|
129
|
+
* @returns {boolean}
|
|
130
|
+
*/
|
|
131
|
+
hasPointSelections(): boolean;
|
|
98
132
|
#private;
|
|
99
133
|
}
|
|
100
134
|
/**
|
|
101
135
|
* A class that manages parameters and expressions.
|
|
102
136
|
* Supports nesting and scoped parameters.
|
|
103
137
|
*/
|
|
104
|
-
export type ExprRefFunction = ((datum?:
|
|
138
|
+
export type ExprRefFunction = ((datum?: import("../data/flowNode.js").Datum) => any) & import("../utils/expression.js").ExpressionProps & {
|
|
105
139
|
addListener: (listener: () => void) => void;
|
|
106
140
|
invalidate: () => void;
|
|
107
141
|
identifier: () => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paramMediator.d.ts","sourceRoot":"","sources":["../../../src/view/paramMediator.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"paramMediator.d.ts","sourceRoot":"","sources":["../../../src/view/paramMediator.js"],"names":[],"mappings":"AAkUA;;;GAGG;AACH,6BAHW,GAAG,+CAKb;AAED;;;;;;;GAOG;AACH,oFASC;AAED;;;GAGG;AACH,gJAEC;AAED;;;GAGG;AACH,gMAEC;AAED;;;;;;;;;;GAUG;AACH,mFANW,aAAa,+CAEW,IAAI,KAwCtC;AAED;;;;;;GAMG;AACH,4CAHW,MAAM,GACJ,MAAM,CAUlB;AAED;;;;;;;GAOG;AACH,2CAHW,GAAG,GACD,eAAe,CAW3B;AA5bD;;;;;GAKG;AACH;IA2BI;;;;;OAKG;IACH,2BALW,MAAM,aAAa,EAU7B;IA7BD;;;OAGG;IACH,0BAHU,IAAI,MAAM,EAAE,IAAI,MAAM,IAAI,CAAC,CAAC,CAGvB;IA2Bf;;;OAGG;IACH,wEAzCqB,GAAG,KAAK,IAAI,CAmGhC;IAED;;;;;;;OAOG;IACH,6BANW,MAAM,6BAEN,OAAO,iBACS,IAAI,CAgC9B;IAED;;;OAGG;IACH,qBAFW,MAAM,WAlIc,GAAG,KAAK,IAAI,CA0I1C;IAED;;;OAGG;IACH,oBAFW,MAAM,OAIhB;IAED;;;OAGG;IACH,qBAFW,MAAM,OAKhB;IAED;;OAEG;IACH,kFAIC;IAED;;;;;OAKG;IACH,0CAJW,MAAM,GACJ,aAAa,CASzB;IAID;;;;OAIG;IACH,uBAFW,MAAM,mBA4EhB;IAED;;;;OAIG;IACH,qBAFW,MAAM,OAKhB;IAED;;;;;OAKG;IACH,sBAFa,OAAO,CAiBnB;;CACJ;;;;;;4BAxT4F,MAAM,IAAI,KAAK,IAAI;gBAAc,MAAM,IAAI;gBAAc,MAAM,MAAM"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { isString } from "vega-util";
|
|
2
2
|
import createFunction from "../utils/expression.js";
|
|
3
|
+
import { createSinglePointSelection } from "../selection/selection.js";
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* A class that manages parameters and expressions.
|
|
@@ -9,7 +10,7 @@ import createFunction from "../utils/expression.js";
|
|
|
9
10
|
*/
|
|
10
11
|
export default class ParamMediator {
|
|
11
12
|
/**
|
|
12
|
-
* @typedef {import("../spec/parameter.js").
|
|
13
|
+
* @typedef {import("../spec/parameter.js").Parameter} Parameter
|
|
13
14
|
* @typedef {(value: any) => void} ParameterSetter
|
|
14
15
|
*/
|
|
15
16
|
|
|
@@ -28,7 +29,7 @@ export default class ParamMediator {
|
|
|
28
29
|
/** @type {Map<string, ExprRefFunction>} */
|
|
29
30
|
#expressions = new Map();
|
|
30
31
|
|
|
31
|
-
/** @type {Map<string,
|
|
32
|
+
/** @type {Map<string, Parameter>} */
|
|
32
33
|
#paramConfigs = new Map();
|
|
33
34
|
|
|
34
35
|
/** @type {() => ParamMediator} */
|
|
@@ -48,32 +49,65 @@ export default class ParamMediator {
|
|
|
48
49
|
}
|
|
49
50
|
|
|
50
51
|
/**
|
|
51
|
-
* @param {
|
|
52
|
+
* @param {Parameter} param
|
|
52
53
|
* @returns {ParameterSetter}
|
|
53
54
|
*/
|
|
54
55
|
registerParam(param) {
|
|
56
|
+
const name = param.name;
|
|
57
|
+
|
|
55
58
|
if ("value" in param && "expr" in param) {
|
|
56
59
|
throw new Error(
|
|
57
|
-
"
|
|
60
|
+
`The parameter "${name}" must not have both value and expr properties!`
|
|
58
61
|
);
|
|
59
62
|
}
|
|
60
63
|
|
|
61
64
|
/** @type {ParameterSetter} */
|
|
62
65
|
let setter;
|
|
63
66
|
|
|
64
|
-
if ("
|
|
65
|
-
|
|
67
|
+
if (param.push == "outer") {
|
|
68
|
+
const outerMediator = this.findMediatorForParam(name);
|
|
69
|
+
if (!outerMediator) {
|
|
70
|
+
throw new Error(
|
|
71
|
+
`Parameter "${name}" not found in outer scope!`
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const outerProps = outerMediator.paramConfigs.get(name);
|
|
76
|
+
if ("expr" in outerProps || "select" in outerProps) {
|
|
77
|
+
throw new Error(
|
|
78
|
+
`The outer parameter "${name}" must not have expr or select properties!`
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
setter = outerMediator.getSetter(name);
|
|
82
|
+
// The following will become a bit fragile if the view hierarchy is going to
|
|
83
|
+
// support mutation (i.e. adding/removing children) in future.
|
|
84
|
+
this.#allocatedSetters.set(name, setter);
|
|
85
|
+
} else if ("value" in param) {
|
|
86
|
+
setter = this.allocateSetter(name, param.value);
|
|
66
87
|
} else if ("expr" in param) {
|
|
67
88
|
const expr = this.createExpression(param.expr);
|
|
68
89
|
// TODO: getSetter(param) should return a setter that throws if
|
|
69
90
|
// modifying the value is attempted.
|
|
70
|
-
const realSetter = this.allocateSetter(
|
|
91
|
+
const realSetter = this.allocateSetter(name, expr(null));
|
|
71
92
|
expr.addListener(() => realSetter(expr(null)));
|
|
72
93
|
// NOP
|
|
73
94
|
setter = (_) => undefined;
|
|
95
|
+
} else {
|
|
96
|
+
setter = this.allocateSetter(name, null);
|
|
74
97
|
}
|
|
75
98
|
|
|
76
|
-
|
|
99
|
+
if ("select" in param) {
|
|
100
|
+
const type = isString(param.select)
|
|
101
|
+
? param.select
|
|
102
|
+
: param.select.type;
|
|
103
|
+
|
|
104
|
+
// Set initial value so that production rules in shaders can be generated, etc.
|
|
105
|
+
if (type == "point") {
|
|
106
|
+
setter(createSinglePointSelection(null));
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
this.#paramConfigs.set(name, param);
|
|
77
111
|
|
|
78
112
|
return setter;
|
|
79
113
|
}
|
|
@@ -87,6 +121,8 @@ export default class ParamMediator {
|
|
|
87
121
|
* @template T
|
|
88
122
|
*/
|
|
89
123
|
allocateSetter(paramName, initialValue, passive = false) {
|
|
124
|
+
validateParameterName(paramName);
|
|
125
|
+
|
|
90
126
|
if (this.#allocatedSetters.has(paramName)) {
|
|
91
127
|
throw new Error(
|
|
92
128
|
"Setter already allocated for parameter: " + paramName
|
|
@@ -148,7 +184,7 @@ export default class ParamMediator {
|
|
|
148
184
|
* Returns configs for all parameters that have been registered using `registerParam`.
|
|
149
185
|
*/
|
|
150
186
|
get paramConfigs() {
|
|
151
|
-
return /** @type {ReadonlyMap<string,
|
|
187
|
+
return /** @type {ReadonlyMap<string, Parameter>} */ (
|
|
152
188
|
this.#paramConfigs
|
|
153
189
|
);
|
|
154
190
|
}
|
|
@@ -259,6 +295,29 @@ export default class ParamMediator {
|
|
|
259
295
|
const fn = this.createExpression(expr);
|
|
260
296
|
return fn();
|
|
261
297
|
}
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Returns true if this ParamMediator has any parameters that are point selections.
|
|
301
|
+
* Point selections necessitate the use of uniqueIds in the data.
|
|
302
|
+
*
|
|
303
|
+
* @returns {boolean}
|
|
304
|
+
*/
|
|
305
|
+
hasPointSelections() {
|
|
306
|
+
for (const param of this.#paramConfigs.values()) {
|
|
307
|
+
if (isSelectionParameter(param)) {
|
|
308
|
+
const select = param.select;
|
|
309
|
+
if (isString(select)) {
|
|
310
|
+
if (select == "point") {
|
|
311
|
+
return true;
|
|
312
|
+
}
|
|
313
|
+
} else if (select.type == "point") {
|
|
314
|
+
return true;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
return false;
|
|
320
|
+
}
|
|
262
321
|
}
|
|
263
322
|
|
|
264
323
|
/**
|
|
@@ -288,6 +347,22 @@ export function withoutExprRef(x) {
|
|
|
288
347
|
return /** @type {T} */ (x);
|
|
289
348
|
}
|
|
290
349
|
|
|
350
|
+
/**
|
|
351
|
+
* @param {Parameter} param
|
|
352
|
+
* @returns {param is import("../spec/parameter.js").VariableParameter}
|
|
353
|
+
*/
|
|
354
|
+
export function isVariableParameter(param) {
|
|
355
|
+
return ("expr" in param || "bind" in param) && !("select" in param);
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* @param {Parameter} param
|
|
360
|
+
* @returns {param is import("../spec/parameter.js").SelectionParameter}
|
|
361
|
+
*/
|
|
362
|
+
export function isSelectionParameter(param) {
|
|
363
|
+
return !("expr" in param || "bind" in param) && "select" in param;
|
|
364
|
+
}
|
|
365
|
+
|
|
291
366
|
/**
|
|
292
367
|
* Takes a record of properties that may have ExprRefs as values. Converts the
|
|
293
368
|
* ExprRefs to getters and setups a listener that is called when any of the
|
|
@@ -336,3 +411,39 @@ export function activateExprRefProps(paramMediator, props, listener) {
|
|
|
336
411
|
|
|
337
412
|
return /** @type {T} */ (activatedProps);
|
|
338
413
|
}
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
* Validates a parameter name. If the name is invalid, throws an error.
|
|
417
|
+
* Otherwise, returns the name.
|
|
418
|
+
*
|
|
419
|
+
* @param {string} name
|
|
420
|
+
* @returns {string} the name
|
|
421
|
+
*/
|
|
422
|
+
export function validateParameterName(name) {
|
|
423
|
+
if (!/^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(name)) {
|
|
424
|
+
throw new Error(
|
|
425
|
+
`Invalid parameter name: ${name}. Must be a valid JavaScript identifier.`
|
|
426
|
+
);
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
return name;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
/**
|
|
433
|
+
* Creates a function that always returns the same value.
|
|
434
|
+
* Provides functionality for creating a constant expression reference.
|
|
435
|
+
* They just do nothing.
|
|
436
|
+
*
|
|
437
|
+
* @param {any} value
|
|
438
|
+
* @returns {ExprRefFunction}
|
|
439
|
+
*/
|
|
440
|
+
export function makeConstantExprRef(value) {
|
|
441
|
+
return Object.assign(() => value, {
|
|
442
|
+
addListener: () => undefined,
|
|
443
|
+
invalidate: () => undefined,
|
|
444
|
+
identifier: () => "constant",
|
|
445
|
+
fields: [],
|
|
446
|
+
globals: [],
|
|
447
|
+
code: JSON.stringify(value),
|
|
448
|
+
});
|
|
449
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paramMediator.test.d.ts","sourceRoot":"","sources":["../../../src/view/paramMediator.test.js"],"names":[],"mappings":""}
|
|
@@ -173,6 +173,22 @@ describe("Nested ParamMediators", () => {
|
|
|
173
173
|
childSetter(20);
|
|
174
174
|
expect(result).toBe(30);
|
|
175
175
|
});
|
|
176
|
+
|
|
177
|
+
test("Pushing to outer parameter", () => {
|
|
178
|
+
const parent = new ParamMediator();
|
|
179
|
+
const child = new ParamMediator(() => parent);
|
|
180
|
+
|
|
181
|
+
parent.registerParam({ name: "foo", value: 1 });
|
|
182
|
+
const childSetter = child.registerParam({ name: "foo", push: "outer" });
|
|
183
|
+
|
|
184
|
+
expect(parent.findValue("foo")).toBe(1);
|
|
185
|
+
expect(child.findValue("foo")).toBe(1);
|
|
186
|
+
|
|
187
|
+
childSetter(2);
|
|
188
|
+
|
|
189
|
+
expect(parent.findValue("foo")).toBe(2);
|
|
190
|
+
expect(child.findValue("foo")).toBe(2);
|
|
191
|
+
});
|
|
176
192
|
});
|
|
177
193
|
|
|
178
194
|
test("activateExprRefProps", async () => {
|
|
@@ -181,7 +197,7 @@ test("activateExprRefProps", async () => {
|
|
|
181
197
|
const fooSetter = pm.registerParam({ name: "foo", value: 7 });
|
|
182
198
|
const barSetter = pm.registerParam({ name: "bar", value: 11 });
|
|
183
199
|
|
|
184
|
-
/** @type {Record<string, any | import("../spec/parameter.js").ExprRef} */
|
|
200
|
+
/** @type {Record<string, any | import("../spec/parameter.js").ExprRef>} */
|
|
185
201
|
const props = {
|
|
186
202
|
a: 42,
|
|
187
203
|
b: { expr: "foo" },
|
|
@@ -222,3 +238,23 @@ test("activateExprRefProps", async () => {
|
|
|
222
238
|
c: 2,
|
|
223
239
|
});
|
|
224
240
|
});
|
|
241
|
+
|
|
242
|
+
describe("hasPointSelections()", () => {
|
|
243
|
+
test("false if there are no point selections", () => {
|
|
244
|
+
const pm = new ParamMediator();
|
|
245
|
+
pm.registerParam({ name: "foo", value: 42 });
|
|
246
|
+
expect(pm.hasPointSelections()).toBe(false);
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
test("true if there are point selections (1/2)", () => {
|
|
250
|
+
const pm = new ParamMediator();
|
|
251
|
+
pm.registerParam({ name: "foo", select: "point" });
|
|
252
|
+
expect(pm.hasPointSelections()).toBe(true);
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
test("true if there are point selections (2/2)", () => {
|
|
256
|
+
const pm = new ParamMediator();
|
|
257
|
+
pm.registerParam({ name: "foo", select: { type: "point" } });
|
|
258
|
+
expect(pm.hasPointSelections()).toBe(true);
|
|
259
|
+
});
|
|
260
|
+
});
|
|
@@ -17,8 +17,12 @@ export const LOCUS: "locus";
|
|
|
17
17
|
export const INDEX: "index";
|
|
18
18
|
/**
|
|
19
19
|
* @template {ChannelWithScale}[T=ChannelWithScale]
|
|
20
|
-
* @typedef {{view: import("./unitView.js").default, channel: T}} ResolutionMember
|
|
21
20
|
*
|
|
21
|
+
* @typedef {object} ScaleResolutionMember
|
|
22
|
+
* @prop {import("./unitView.js").default} view TODO: Get rid of the view reference
|
|
23
|
+
* @prop {T} channel
|
|
24
|
+
* @prop {import("../spec/channel.js").ChannelDefWithScale} channelDef
|
|
25
|
+
* @prop {(channel: ChannelWithScale, type: import("../spec/channel.js").Type) => DomainArray} dataDomainSource
|
|
22
26
|
*/
|
|
23
27
|
/**
|
|
24
28
|
* Resolution takes care of merging domains and scales from multiple views.
|
|
@@ -34,10 +38,10 @@ export default class ScaleResolution implements ScaleResolutionApi {
|
|
|
34
38
|
*/
|
|
35
39
|
constructor(channel: import("../spec/channel.js").Channel);
|
|
36
40
|
channel: import("../spec/channel.js").Channel;
|
|
37
|
-
/** @type {
|
|
38
|
-
members:
|
|
39
|
-
/** @type {
|
|
40
|
-
type:
|
|
41
|
+
/** @type {ScaleResolutionMember[]} The involved views */
|
|
42
|
+
members: ScaleResolutionMember[];
|
|
43
|
+
/** @type {import("../spec/channel.js").Type} Data type (quantitative, nominal, etc...) */
|
|
44
|
+
type: import("../spec/channel.js").Type;
|
|
41
45
|
/** @type {string} An optional unique identifier for the scale */
|
|
42
46
|
name: string;
|
|
43
47
|
/**
|
|
@@ -58,16 +62,9 @@ export default class ScaleResolution implements ScaleResolutionApi {
|
|
|
58
62
|
* Add a view to this resolution.
|
|
59
63
|
* N.B. This is expected to be called in depth-first order
|
|
60
64
|
*
|
|
61
|
-
* @param {
|
|
62
|
-
* @param {ChannelWithScale} channel
|
|
65
|
+
* @param {ScaleResolutionMember} newMember
|
|
63
66
|
*/
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Unions the configured domains of all participating views.
|
|
67
|
-
*
|
|
68
|
-
* @return { DomainArray }
|
|
69
|
-
*/
|
|
70
|
-
getConfiguredDomain(): import("../utils/domainArray.js").DomainArray;
|
|
67
|
+
addMember(newMember: ScaleResolutionMember): void;
|
|
71
68
|
/**
|
|
72
69
|
* Extracts and unions the data domains of all participating views.
|
|
73
70
|
*
|
|
@@ -157,8 +154,13 @@ export default class ScaleResolution implements ScaleResolutionApi {
|
|
|
157
154
|
fromComplexInterval(interval: import("../spec/scale.js").ScalarDomain | import("../spec/scale.js").ComplexDomain): number[];
|
|
158
155
|
#private;
|
|
159
156
|
}
|
|
160
|
-
export type
|
|
157
|
+
export type ScaleResolutionMember<T extends import("../spec/channel.js").ChannelWithScale = import("../spec/channel.js").ChannelWithScale> = {
|
|
158
|
+
/**
|
|
159
|
+
* TODO: Get rid of the view reference
|
|
160
|
+
*/
|
|
161
161
|
view: import("./unitView.js").default;
|
|
162
162
|
channel: T;
|
|
163
|
+
channelDef: import("../spec/channel.js").ChannelDefWithScale;
|
|
164
|
+
dataDomainSource: (channel: import("../spec/channel.js").ChannelWithScale, type: import("../spec/channel.js").Type) => import("../utils/domainArray.js").DomainArray;
|
|
163
165
|
};
|
|
164
166
|
//# sourceMappingURL=scaleResolution.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scaleResolution.d.ts","sourceRoot":"","sources":["../../../src/view/scaleResolution.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"scaleResolution.d.ts","sourceRoot":"","sources":["../../../src/view/scaleResolution.js"],"names":[],"mappings":"AAg7BA;;;;;;;;;;GAUG;AACH,6CAFW,OAAO,WAAW,EAAE,OAAO,GAAG,OAAO,WAAW,EAAE,OAAO,EAAE,QA4BrE;AAx6BD,0CAA2C;AAC3C,gCAAiC;AACjC,gCAAiC;AACjC,4BAA6B;AAC7B,4BAA6B;AAE7B;;;;;;;;GAQG;AACH;;;;;;;GAOG;AACH;IAyCI;;OAEG;IACH,2DASC;IARG,8CAAsB;IACtB,yDAAyD;IACzD,SADW,qBAAqB,EAAE,CACjB;IACjB,0FAA0F;IAC1F,MADW,OAAO,oBAAoB,EAAE,IAAI,CAC5B;IAEhB,iEAAiE;IACjE,MADW,MAAM,CACI;IAWzB;;;;;;;OAOG;IACH,4KAEC;IAED;;;OAGG;IACH,+KAEC;IAcD;;;;;OAKG;IACH,qBAFW,qBAAqB,QA4B/B;IA8MD;;;;OAIG;IACH,+DAOC;IAED;;OAEG;IACH,oBAyCC;IAED;;OAEG;IACH;eA5XkC,OAAO,kBAAkB,EAAE,KAAK;MAwajE;IAED,mBAEC;IAED;;OAEG;IACH,oBAFa,mFAA6B,CAOzC;IAED;;;;OAIG;IACH,oBAKC;IAED;;OAEG;IACH,sBAGC;IAUD;;;;;;;OAOG;IACH,kBALW,MAAM,eACN,MAAM,OACN,MAAM,GACJ,OAAO,CAwEnB;IAED;;;;;;OAMG;IACH,eAJW,mFAA6B,aAC7B,OAAO,GAAG,MAAM,iBA0D1B;IAED;;;;OAIG;IACH,qBAcC;IAED;;;;;OAKG;IACH,uBAOC;IA8DD;;;OAGG;IACH,aAFa,OAAO,qBAAqB,EAAE,OAAO,CAajD;IAID;;;;;OAKG;IACH,uBAFW,MAAM,yDAUhB;IAED;;OAEG;IACH,iBAFW,MAAM,yDAKhB;IAED;;;OAGG;IACH,6EAFa,MAAM,CAQlB;IAED;;;OAGG;IACH,mHAFa,MAAM,EAAE,CAOpB;;CACJ;;;;;UAlyBS,OAAO,eAAe,EAAE,OAAO;aAC/B,CAAC;gBACD,OAAO,oBAAoB,EAAE,mBAAmB;qFACd,OAAO,oBAAoB,EAAE,IAAI"}
|