@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.
Files changed (244) hide show
  1. package/dist/bundle/index.es.js +7434 -7107
  2. package/dist/bundle/index.js +116 -103
  3. package/dist/schema.json +3975 -2819
  4. package/dist/src/data/collector.test.d.ts +2 -0
  5. package/dist/src/data/collector.test.d.ts.map +1 -0
  6. package/dist/src/data/dataFlow.test.d.ts +2 -0
  7. package/dist/src/data/dataFlow.test.d.ts.map +1 -0
  8. package/dist/src/data/flow.test.d.ts +2 -0
  9. package/dist/src/data/flow.test.d.ts.map +1 -0
  10. package/dist/src/data/flow.test.js +19 -14
  11. package/dist/src/data/flowNode.test.d.ts +2 -0
  12. package/dist/src/data/flowNode.test.d.ts.map +1 -0
  13. package/dist/src/data/flowOptimizer.test.d.ts +2 -0
  14. package/dist/src/data/flowOptimizer.test.d.ts.map +1 -0
  15. package/dist/src/data/flowOptimizer.test.js +9 -10
  16. package/dist/src/data/formats/fasta.test.d.ts +2 -0
  17. package/dist/src/data/formats/fasta.test.d.ts.map +1 -0
  18. package/dist/src/data/sources/inlineSource.test.d.ts +2 -0
  19. package/dist/src/data/sources/inlineSource.test.d.ts.map +1 -0
  20. package/dist/src/data/sources/inlineSource.test.js +23 -16
  21. package/dist/src/data/sources/sequenceSource.test.d.ts +2 -0
  22. package/dist/src/data/sources/sequenceSource.test.d.ts.map +1 -0
  23. package/dist/src/data/sources/sequenceSource.test.js +59 -42
  24. package/dist/src/data/transforms/clone.test.d.ts +2 -0
  25. package/dist/src/data/transforms/clone.test.d.ts.map +1 -0
  26. package/dist/src/data/transforms/coverage.test.d.ts +2 -0
  27. package/dist/src/data/transforms/coverage.test.d.ts.map +1 -0
  28. package/dist/src/data/transforms/coverage.test.js +1 -1
  29. package/dist/src/data/transforms/filter.d.ts +10 -0
  30. package/dist/src/data/transforms/filter.d.ts.map +1 -1
  31. package/dist/src/data/transforms/filter.js +30 -1
  32. package/dist/src/data/transforms/filter.test.d.ts +2 -0
  33. package/dist/src/data/transforms/filter.test.d.ts.map +1 -0
  34. package/dist/src/data/transforms/flatten.test.d.ts +2 -0
  35. package/dist/src/data/transforms/flatten.test.d.ts.map +1 -0
  36. package/dist/src/data/transforms/flatten.test.js +10 -7
  37. package/dist/src/data/transforms/flattenDelimited.test.d.ts +2 -0
  38. package/dist/src/data/transforms/flattenDelimited.test.d.ts.map +1 -0
  39. package/dist/src/data/transforms/flattenDelimited.test.js +16 -13
  40. package/dist/src/data/transforms/flattenSequence.test.d.ts +2 -0
  41. package/dist/src/data/transforms/flattenSequence.test.d.ts.map +1 -0
  42. package/dist/src/data/transforms/flattenSequence.test.js +1 -1
  43. package/dist/src/data/transforms/formula.test.d.ts +2 -0
  44. package/dist/src/data/transforms/formula.test.d.ts.map +1 -0
  45. package/dist/src/data/transforms/formula.test.js +1 -1
  46. package/dist/src/data/transforms/identifier.test.d.ts +2 -0
  47. package/dist/src/data/transforms/identifier.test.d.ts.map +1 -0
  48. package/dist/src/data/transforms/pileup.test.d.ts +2 -0
  49. package/dist/src/data/transforms/pileup.test.d.ts.map +1 -0
  50. package/dist/src/data/transforms/project.test.d.ts +2 -0
  51. package/dist/src/data/transforms/project.test.d.ts.map +1 -0
  52. package/dist/src/data/transforms/project.test.js +1 -1
  53. package/dist/src/data/transforms/regexExtract.test.d.ts +2 -0
  54. package/dist/src/data/transforms/regexExtract.test.d.ts.map +1 -0
  55. package/dist/src/data/transforms/regexExtract.test.js +6 -3
  56. package/dist/src/data/transforms/regexFold.test.d.ts +2 -0
  57. package/dist/src/data/transforms/regexFold.test.d.ts.map +1 -0
  58. package/dist/src/data/transforms/sample.test.d.ts +2 -0
  59. package/dist/src/data/transforms/sample.test.d.ts.map +1 -0
  60. package/dist/src/data/transforms/stack.test.d.ts +2 -0
  61. package/dist/src/data/transforms/stack.test.d.ts.map +1 -0
  62. package/dist/src/data/transforms/stack.test.js +8 -8
  63. package/dist/src/encoder/accessor.d.ts +17 -14
  64. package/dist/src/encoder/accessor.d.ts.map +1 -1
  65. package/dist/src/encoder/accessor.js +127 -56
  66. package/dist/src/encoder/accessor.test.d.ts +2 -0
  67. package/dist/src/encoder/accessor.test.d.ts.map +1 -0
  68. package/dist/src/encoder/accessor.test.js +145 -31
  69. package/dist/src/encoder/encoder.d.ts +26 -13
  70. package/dist/src/encoder/encoder.d.ts.map +1 -1
  71. package/dist/src/encoder/encoder.js +98 -114
  72. package/dist/src/encoder/encoder.test.d.ts +2 -0
  73. package/dist/src/encoder/encoder.test.d.ts.map +1 -0
  74. package/dist/src/encoder/encoder.test.js +85 -82
  75. package/dist/src/fonts/bmFontManager.d.ts.map +1 -1
  76. package/dist/src/fonts/bmFontManager.js +10 -4
  77. package/dist/src/genome/genome.test.d.ts +2 -0
  78. package/dist/src/genome/genome.test.d.ts.map +1 -0
  79. package/dist/src/genome/scaleIndex.test.d.ts +2 -0
  80. package/dist/src/genome/scaleIndex.test.d.ts.map +1 -0
  81. package/dist/src/genome/scaleLocus.test.d.ts +2 -0
  82. package/dist/src/genome/scaleLocus.test.d.ts.map +1 -0
  83. package/dist/src/genomeSpy.d.ts +3 -2
  84. package/dist/src/genomeSpy.d.ts.map +1 -1
  85. package/dist/src/genomeSpy.js +15 -6
  86. package/dist/src/gl/dataToVertices.d.ts +6 -8
  87. package/dist/src/gl/dataToVertices.d.ts.map +1 -1
  88. package/dist/src/gl/dataToVertices.js +42 -33
  89. package/dist/src/gl/glslScaleGenerator.d.ts +84 -15
  90. package/dist/src/gl/glslScaleGenerator.d.ts.map +1 -1
  91. package/dist/src/gl/glslScaleGenerator.js +260 -73
  92. package/dist/src/gl/includes/common.glsl.js +1 -1
  93. package/dist/src/marks/link.common.glsl.js +1 -1
  94. package/dist/src/marks/link.d.ts +8 -1
  95. package/dist/src/marks/link.d.ts.map +1 -1
  96. package/dist/src/marks/link.fragment.glsl.js +1 -1
  97. package/dist/src/marks/link.js +47 -31
  98. package/dist/src/marks/link.vertex.glsl.js +1 -1
  99. package/dist/src/marks/mark.d.ts +24 -25
  100. package/dist/src/marks/mark.d.ts.map +1 -1
  101. package/dist/src/marks/mark.js +246 -118
  102. package/dist/src/marks/markUtils.d.ts +25 -0
  103. package/dist/src/marks/markUtils.d.ts.map +1 -1
  104. package/dist/src/marks/markUtils.js +41 -1
  105. package/dist/src/marks/point.common.glsl.js +1 -1
  106. package/dist/src/marks/point.d.ts +8 -1
  107. package/dist/src/marks/point.d.ts.map +1 -1
  108. package/dist/src/marks/point.js +34 -25
  109. package/dist/src/marks/point.vertex.glsl.js +1 -1
  110. package/dist/src/marks/rect.d.ts +8 -1
  111. package/dist/src/marks/rect.d.ts.map +1 -1
  112. package/dist/src/marks/rect.js +28 -23
  113. package/dist/src/marks/rule.d.ts +8 -1
  114. package/dist/src/marks/rule.d.ts.map +1 -1
  115. package/dist/src/marks/rule.js +23 -16
  116. package/dist/src/marks/text.d.ts +10 -1
  117. package/dist/src/marks/text.d.ts.map +1 -1
  118. package/dist/src/marks/text.fragment.glsl.js +1 -1
  119. package/dist/src/marks/text.js +53 -47
  120. package/dist/src/marks/text.vertex.glsl.js +1 -1
  121. package/dist/src/scale/scale.test.d.ts +2 -0
  122. package/dist/src/scale/scale.test.d.ts.map +1 -0
  123. package/dist/src/scale/scale.test.js +2 -0
  124. package/dist/src/scale/ticks.test.d.ts +2 -0
  125. package/dist/src/scale/ticks.test.d.ts.map +1 -0
  126. package/dist/src/scale/ticks.test.js +6 -0
  127. package/dist/src/selection/selection.d.ts +39 -0
  128. package/dist/src/selection/selection.d.ts.map +1 -0
  129. package/dist/src/selection/selection.js +78 -0
  130. package/dist/src/spec/channel.d.ts +150 -83
  131. package/dist/src/spec/mark.d.ts +133 -78
  132. package/dist/src/spec/parameter.d.ts +112 -3
  133. package/dist/src/spec/root.d.ts +0 -1
  134. package/dist/src/spec/transform.d.ts +19 -1
  135. package/dist/src/spec/view.d.ts +5 -10
  136. package/dist/src/tooltip/dataTooltipHandler.d.ts +1 -1
  137. package/dist/src/tooltip/dataTooltipHandler.d.ts.map +1 -1
  138. package/dist/src/tooltip/dataTooltipHandler.js +1 -1
  139. package/dist/src/tooltip/refseqGeneTooltipHandler.d.ts +1 -1
  140. package/dist/src/tooltip/refseqGeneTooltipHandler.d.ts.map +1 -1
  141. package/dist/src/types/encoder.d.ts +80 -26
  142. package/dist/src/types/rendering.d.ts +1 -0
  143. package/dist/src/types/selectionTypes.d.ts +44 -0
  144. package/dist/src/types/viewContext.d.ts +1 -4
  145. package/dist/src/utils/addBaseUrl.test.d.ts +2 -0
  146. package/dist/src/utils/addBaseUrl.test.d.ts.map +1 -0
  147. package/dist/src/utils/binnedIndex.test.d.ts +2 -0
  148. package/dist/src/utils/binnedIndex.test.d.ts.map +1 -0
  149. package/dist/src/utils/cloner.test.d.ts +2 -0
  150. package/dist/src/utils/cloner.test.d.ts.map +1 -0
  151. package/dist/src/utils/coalesce.test.d.ts +2 -0
  152. package/dist/src/utils/coalesce.test.d.ts.map +1 -0
  153. package/dist/src/utils/concatIterables.test.d.ts +2 -0
  154. package/dist/src/utils/concatIterables.test.d.ts.map +1 -0
  155. package/dist/src/utils/domainArray.test.d.ts +2 -0
  156. package/dist/src/utils/domainArray.test.d.ts.map +1 -0
  157. package/dist/src/utils/expression.d.ts +2 -2
  158. package/dist/src/utils/expression.d.ts.map +1 -1
  159. package/dist/src/utils/expression.js +11 -2
  160. package/dist/src/utils/indexer.test.d.ts +2 -0
  161. package/dist/src/utils/indexer.test.d.ts.map +1 -0
  162. package/dist/src/utils/inputBinding.d.ts.map +1 -1
  163. package/dist/src/utils/inputBinding.js +4 -0
  164. package/dist/src/utils/iterateNestedMaps.test.d.ts +2 -0
  165. package/dist/src/utils/iterateNestedMaps.test.d.ts.map +1 -0
  166. package/dist/src/utils/kWayMerge.test.d.ts +2 -0
  167. package/dist/src/utils/kWayMerge.test.d.ts.map +1 -0
  168. package/dist/src/utils/mergeObjects.test.d.ts +2 -0
  169. package/dist/src/utils/mergeObjects.test.d.ts.map +1 -0
  170. package/dist/src/utils/numberExtractor.test.d.ts +2 -0
  171. package/dist/src/utils/numberExtractor.test.d.ts.map +1 -0
  172. package/dist/src/utils/propertyCacher.test.d.ts +2 -0
  173. package/dist/src/utils/propertyCacher.test.d.ts.map +1 -0
  174. package/dist/src/utils/propertyCoalescer.test.d.ts +2 -0
  175. package/dist/src/utils/propertyCoalescer.test.d.ts.map +1 -0
  176. package/dist/src/utils/propertyCoalescer.test.js +3 -0
  177. package/dist/src/utils/radixSort.test.d.ts +2 -0
  178. package/dist/src/utils/radixSort.test.d.ts.map +1 -0
  179. package/dist/src/utils/reservationMap.test.d.ts +2 -0
  180. package/dist/src/utils/reservationMap.test.d.ts.map +1 -0
  181. package/dist/src/utils/ringBuffer.test.d.ts +2 -0
  182. package/dist/src/utils/ringBuffer.test.d.ts.map +1 -0
  183. package/dist/src/utils/topK.test.d.ts +2 -0
  184. package/dist/src/utils/topK.test.d.ts.map +1 -0
  185. package/dist/src/utils/trees.test.d.ts +2 -0
  186. package/dist/src/utils/trees.test.d.ts.map +1 -0
  187. package/dist/src/utils/trees.test.js +8 -3
  188. package/dist/src/utils/variableTools.test.d.ts +2 -0
  189. package/dist/src/utils/variableTools.test.d.ts.map +1 -0
  190. package/dist/src/view/axisResolution.d.ts +19 -6
  191. package/dist/src/view/axisResolution.d.ts.map +1 -1
  192. package/dist/src/view/axisResolution.js +16 -7
  193. package/dist/src/view/axisResolution.test.d.ts +2 -0
  194. package/dist/src/view/axisResolution.test.d.ts.map +1 -0
  195. package/dist/src/view/axisResolution.test.js +16 -11
  196. package/dist/src/view/axisView.js +2 -2
  197. package/dist/src/view/facetView.d.ts +1 -1
  198. package/dist/src/view/facetView.d.ts.map +1 -1
  199. package/dist/src/view/flowBuilder.d.ts +1 -1
  200. package/dist/src/view/flowBuilder.d.ts.map +1 -1
  201. package/dist/src/view/flowBuilder.js +34 -5
  202. package/dist/src/view/flowBuilder.test.d.ts +2 -0
  203. package/dist/src/view/flowBuilder.test.d.ts.map +1 -0
  204. package/dist/src/view/flowBuilder.test.js +1 -1
  205. package/dist/src/view/gridView.d.ts +0 -6
  206. package/dist/src/view/gridView.d.ts.map +1 -1
  207. package/dist/src/view/gridView.js +1 -1
  208. package/dist/src/view/layerView.d.ts +0 -6
  209. package/dist/src/view/layerView.d.ts.map +1 -1
  210. package/dist/src/view/layout/flexLayout.test.d.ts +2 -0
  211. package/dist/src/view/layout/flexLayout.test.d.ts.map +1 -0
  212. package/dist/src/view/layout/grid.test.d.ts +2 -0
  213. package/dist/src/view/layout/grid.test.d.ts.map +1 -0
  214. package/dist/src/view/layout/rectangle.test.d.ts +2 -0
  215. package/dist/src/view/layout/rectangle.test.d.ts.map +1 -0
  216. package/dist/src/view/paramMediator.d.ts +39 -5
  217. package/dist/src/view/paramMediator.d.ts.map +1 -1
  218. package/dist/src/view/paramMediator.js +120 -9
  219. package/dist/src/view/paramMediator.test.d.ts +2 -0
  220. package/dist/src/view/paramMediator.test.d.ts.map +1 -0
  221. package/dist/src/view/paramMediator.test.js +37 -1
  222. package/dist/src/view/scaleResolution.d.ts +17 -15
  223. package/dist/src/view/scaleResolution.d.ts.map +1 -1
  224. package/dist/src/view/scaleResolution.js +70 -68
  225. package/dist/src/view/scaleResolution.test.d.ts +2 -0
  226. package/dist/src/view/scaleResolution.test.d.ts.map +1 -0
  227. package/dist/src/view/scaleResolution.test.js +2 -0
  228. package/dist/src/view/testUtils.d.ts.map +1 -1
  229. package/dist/src/view/testUtils.js +15 -3
  230. package/dist/src/view/unitView.d.ts +8 -20
  231. package/dist/src/view/unitView.d.ts.map +1 -1
  232. package/dist/src/view/unitView.js +100 -102
  233. package/dist/src/view/view.d.ts +1 -1
  234. package/dist/src/view/view.d.ts.map +1 -1
  235. package/dist/src/view/view.test.d.ts +2 -0
  236. package/dist/src/view/view.test.d.ts.map +1 -0
  237. package/dist/src/view/view.test.js +73 -55
  238. package/dist/src/view/viewFactory.test.d.ts +2 -0
  239. package/dist/src/view/viewFactory.test.d.ts.map +1 -0
  240. package/dist/src/view/viewFactory.test.js +2 -2
  241. package/dist/src/view/viewUtils.d.ts +1 -1
  242. package/dist/src/view/viewUtils.d.ts.map +1 -1
  243. package/dist/src/view/zoom.js +2 -2
  244. package/package.json +5 -2
@@ -5,17 +5,91 @@ import { Tooltip } from "./tooltip.js";
5
5
 
6
6
  export type MarkType = "rect" | "point" | "rule" | "text" | "link";
7
7
 
8
+ export interface MarkPropsBase {
9
+ type: MarkType;
10
+
11
+ // Channels.
12
+
13
+ x?: number | ExprRef;
14
+ y?: number | ExprRef;
15
+ color?: string | ExprRef;
16
+ opacity?: number | ExprRef;
17
+
18
+ /**
19
+ * If true, the mark is clipped to the UnitView's rectangle. By default, clipping
20
+ * is enabled for marks that have zoomable positional scales.
21
+ */
22
+ clip?: boolean | "never";
23
+
24
+ /**
25
+ * Offsets of the `x` and `x2` coordinates in pixels. The offset is applied
26
+ * after the viewport scaling and translation.
27
+ *
28
+ * **Default value:** `0`
29
+ */
30
+ xOffset?: number;
31
+
32
+ /**
33
+ * Offsets of the `y` and `y2` coordinates in pixels. The offset is applied
34
+ * after the viewport scaling and translation.
35
+ *
36
+ * **Default value:** `0`
37
+ */
38
+ yOffset?: number;
39
+
40
+ /**
41
+ * Minimum size for WebGL buffers (number of data items).
42
+ * Allows for using `bufferSubData()` to update graphics.
43
+ *
44
+ * This property is intended for internal use.
45
+ *
46
+ * @internal
47
+ */
48
+ minBufferSize?: number;
49
+
50
+ /**
51
+ * Tooltip handler. If `null`, no tooltip is shown.
52
+ */
53
+ tooltip?: Tooltip;
54
+ }
55
+
56
+ export interface SizeProps {
57
+ /**
58
+ * Stroke width of `"link"` and `"rule"` marks in pixels, the area of the
59
+ * bounding square of `"point"` mark, or the font size of `"text"` mark.
60
+ */
61
+ size?: number | ExprRef;
62
+ }
63
+
8
64
  export interface FillAndStrokeProps {
9
- /** The fill color */
65
+ /**
66
+ * The stroke width in pixels.
67
+ */
68
+ strokeWidth?: number | ExprRef;
69
+
70
+ /**
71
+ * Whether the `color` represents the `fill` color (`true`) or the `stroke` color (`false`).
72
+ */
73
+ filled?: boolean;
74
+
75
+ /**
76
+ * The fill color
77
+ */
10
78
  fill?: string | ExprRef;
11
79
 
12
- /** The fill opacity. Value between [0, 1]. */
80
+ /**
81
+ * The fill opacity. Value between [0, 1].
82
+ */
13
83
  fillOpacity?: number | ExprRef;
14
84
 
15
- /** The stroke color */
85
+ /**
86
+ * The stroke color
87
+ */
16
88
  stroke?: string | ExprRef;
17
89
 
18
- /** The stroke opacity. Value between [0, 1]. */
90
+ /**
91
+ * The stroke opacity. Value between [0, 1].
92
+ */
19
93
  strokeOpacity?: number | ExprRef;
20
94
  }
21
95
 
@@ -33,6 +107,17 @@ export interface AngleProps {
33
107
  angle?: number | ExprRef;
34
108
  }
35
109
 
110
+ export interface MinPickingSizeProps {
111
+ /**
112
+ * The minimum picking size invisibly increases the stroke width or point diameter
113
+ * of marks when pointing them with the mouse cursor, making it easier to select them.
114
+ * The valus is the minimum size in pixels.
115
+ *
116
+ * **Default value:** `3.0` for `"link"` and `2.0` for `"point"`
117
+ */
118
+ minPickingSize?: number | ExprRef;
119
+ }
120
+
36
121
  /**
37
122
  * Specifies how mark should be faded at the viewport edges.
38
123
  * This is mainly used to make axis labels pretty.
@@ -49,7 +134,12 @@ export interface ViewportEdgeFadeProps {
49
134
  viewportEdgeFadeDistanceLeft?: number;
50
135
  }
51
136
 
52
- export interface RectProps extends SecondaryPositionProps {
137
+ export interface RectProps
138
+ extends MarkPropsBase,
139
+ SecondaryPositionProps,
140
+ FillAndStrokeProps {
141
+ type: "rect";
142
+
53
143
  /**
54
144
  * Clamps the minimum size-dependent opacity. The property does not affect the
55
145
  * `opacity` channel. Valid values are between `0` and `1`.
@@ -120,7 +210,12 @@ export interface RectProps extends SecondaryPositionProps {
120
210
  cornerRadiusBottomRight?: number | ExprRef;
121
211
  }
122
212
 
123
- export interface RuleProps extends SecondaryPositionProps {
213
+ export interface RuleProps
214
+ extends MarkPropsBase,
215
+ SecondaryPositionProps,
216
+ SizeProps {
217
+ type: "rule";
218
+
124
219
  /**
125
220
  * The minimum length of the rule in pixels. Use this property to ensure that
126
221
  * very short ranged rules remain visible even when the user zooms out.
@@ -152,9 +247,13 @@ export interface RuleProps extends SecondaryPositionProps {
152
247
  }
153
248
 
154
249
  export interface TextProps
155
- extends SecondaryPositionProps,
250
+ extends MarkPropsBase,
251
+ SecondaryPositionProps,
156
252
  AngleProps,
157
- ViewportEdgeFadeProps {
253
+ ViewportEdgeFadeProps,
254
+ SizeProps {
255
+ type: "text";
256
+
158
257
  /**
159
258
  * The text to display. The format of numeric data can be customized by
160
259
  * setting a [format specifier](https://github.com/d3/d3-format#locale_format)
@@ -276,7 +375,14 @@ export interface TextProps
276
375
  logoLetters?: boolean | ExprRef;
277
376
  }
278
377
 
279
- export interface PointProps extends AngleProps {
378
+ export interface PointProps
379
+ extends MarkPropsBase,
380
+ FillAndStrokeProps,
381
+ AngleProps,
382
+ SizeProps,
383
+ MinPickingSizeProps {
384
+ type: "point";
385
+
280
386
  /**
281
387
  * One of `"circle"`, `"square"`, `"cross"`, `"diamond"`, `"triangle-up"`,
282
388
  * `"triangle-down"`, `"triangle-right"`, or `"triangle-left"`.
@@ -318,7 +424,13 @@ export interface PointProps extends AngleProps {
318
424
  geometricZoomBound?: number;
319
425
  }
320
426
 
321
- export interface LinkProps extends SecondaryPositionProps {
427
+ export interface LinkProps
428
+ extends MarkPropsBase,
429
+ SecondaryPositionProps,
430
+ SizeProps,
431
+ MinPickingSizeProps {
432
+ type: "link";
433
+
322
434
  /**
323
435
  * The shape of the link path. Either `"arc"`, `"diagonal"`, `"line"`, or `"dome"`.
324
436
  *
@@ -387,75 +499,18 @@ export interface LinkProps extends SecondaryPositionProps {
387
499
  arcFadingDistance?: [number, number] | false | ExprRef;
388
500
 
389
501
  /**
390
- * The minimum stroke width of the links when pointing with the mouse cursor.
391
- * Allows making very thin links easier to point at.
502
+ * Disables fading of the link when an mark instance is subject to any point selection.
503
+ * As the fading distance is unavailable as a visual channel, this property allows for
504
+ * enhancing the visibility of the selected links.
392
505
  *
393
- * **Default value:** `3.0`
394
- */
395
- minPickingSize?: number | ExprRef;
396
- }
397
-
398
- // TODO: Mark-specific configs
399
- export interface MarkProps
400
- extends PointProps,
401
- RectProps,
402
- TextProps,
403
- RuleProps,
404
- LinkProps,
405
- FillAndStrokeProps {
406
- // Channels.
407
- x?: number | ExprRef;
408
- y?: number | ExprRef;
409
- color?: string | ExprRef;
410
- opacity?: number | ExprRef;
411
- size?: number | ExprRef;
412
-
413
- /**
414
- * Whether the `color` represents the `fill` color (`true`) or the `stroke` color (`false`).
415
- */
416
- filled?: boolean;
417
-
418
- /**
419
- * If true, the mark is clipped to the UnitView's rectangle. By default, clipping
420
- * is enabled for marks that have zoomable positional scales.
421
- */
422
- clip?: boolean | "never";
423
-
424
- /**
425
- * Offsets of the `x` and `x2` coordinates in pixels. The offset is applied
426
- * after the viewport scaling and translation.
427
- *
428
- * **Default value:** `0`
429
- */
430
- xOffset?: number;
431
-
432
- /**
433
- * Offsets of the `y` and `y2` coordinates in pixels. The offset is applied
434
- * after the viewport scaling and translation.
435
- *
436
- * **Default value:** `0`
437
- */
438
- yOffset?: number;
439
-
440
- /**
441
- * TODO
442
- */
443
- tooltip?: Tooltip;
444
-
445
- /**
446
- * The stroke width in pixels.
447
- */
448
- strokeWidth?: number | ExprRef;
449
-
450
- /**
451
- * Minimum size for WebGL buffers (number of data items).
452
- * Allows for using `bufferSubData()` to update graphics.
453
- *
454
- * This property is intended for internal use.
506
+ * **Default value:** `true`
455
507
  */
456
- minBufferSize?: number;
508
+ noFadingOnPointSelection?: boolean | ExprRef;
457
509
  }
458
510
 
459
- export interface MarkConfigAndType extends MarkProps {
460
- type: MarkType;
461
- }
511
+ export type MarkProps =
512
+ | RectProps
513
+ | TextProps
514
+ | RuleProps
515
+ | LinkProps
516
+ | PointProps;
@@ -1,3 +1,5 @@
1
+ import { ChannelWithScale, Scalar } from "./channel.js";
2
+
1
3
  export interface ExprRef {
2
4
  /**
3
5
  * The expression string.
@@ -5,9 +7,7 @@ export interface ExprRef {
5
7
  expr: string;
6
8
  }
7
9
 
8
- // Adapted from: https://github.com/vega/vega-lite/blob/main/src/parameter.ts
9
-
10
- export interface VariableParameter {
10
+ export interface ParameterBase {
11
11
  /**
12
12
  * A unique name for the variable parameter. Parameter names should be valid
13
13
  * JavaScript identifiers: they should contain only alphanumeric characters
@@ -16,6 +16,12 @@ export interface VariableParameter {
16
16
  */
17
17
  name: string;
18
18
 
19
+ push?: "outer";
20
+ }
21
+
22
+ // Adapted from: https://github.com/vega/vega-lite/blob/main/src/parameter.ts
23
+
24
+ export interface VariableParameter extends ParameterBase {
19
25
  /**
20
26
  * The [initial value](http://vega.github.io/vega-lite/docs/value.html) of the parameter.
21
27
  *
@@ -144,3 +150,106 @@ export interface BindDirect {
144
150
  }
145
151
 
146
152
  export type Binding = BindCheckbox | BindRadioSelect | BindRange | BindInput;
153
+
154
+ // ----------------------------------------------------------------------------
155
+ // Adapted from: https://github.com/vega/vega-lite/blob/main/src/selection.ts
156
+
157
+ type Vector2<T> = [T, T];
158
+
159
+ export type SelectionType = "point" | "interval";
160
+ export type SelectionInit = Scalar;
161
+ export type SelectionInitInterval =
162
+ | Vector2<boolean>
163
+ | Vector2<number>
164
+ | Vector2<string>;
165
+
166
+ export type InteractionEventType = "click" | "dblclick" | "mouseover";
167
+
168
+ export interface BaseSelectionConfig<T extends SelectionType = SelectionType> {
169
+ /**
170
+ * Determines the default event processing and data query for the selection. Vega-Lite currently supports two selection types:
171
+ *
172
+ * - `"point"` -- to select multiple discrete data values; the first value is selected on `click` and additional values toggled on shift-click.
173
+ * - `"interval"` -- to select a continuous range of data values on `drag`.
174
+ */
175
+ type: T;
176
+
177
+ /**
178
+ */
179
+ on?: "click" | "mouseover" | "pointerover";
180
+
181
+ /**
182
+ * An array of encoding channels. The corresponding data field values
183
+ * must match for a data tuple to fall within the selection.
184
+ *
185
+ * __See also:__ The [projection with `encodings` and `fields` section](https://vega.github.io/vega-lite/docs/selection.html#project) in the documentation.
186
+ */
187
+ encodings?: ChannelWithScale[];
188
+
189
+ /**
190
+ * An array of field names whose values must match for a data tuple to
191
+ * fall within the selection.
192
+ *
193
+ * __See also:__ The [projection with `encodings` and `fields` section](https://vega.github.io/vega-lite/docs/selection.html#project) in the documentation.
194
+ */
195
+ fields?: string[];
196
+ }
197
+
198
+ export interface PointSelectionConfig extends BaseSelectionConfig<"point"> {
199
+ /**
200
+ * Controls whether data values should be toggled (inserted or removed from a point selection)
201
+ * when clicking with the shift key pressed.
202
+ *
203
+ * - `true` -- additional values can be selected by shift-clicking.
204
+ * - `false` -- only a single value can be selected at a time.
205
+ *
206
+ * __Default value:__ `true`
207
+ */
208
+ // TODO TODO TODO TODO TODO TODO TODO TODO
209
+ //toggle?: boolean;
210
+ /**
211
+ * A set of fields that uniquely identify a tuple. Used for bookmarking point selections
212
+ * in the GenomeSpy App. Still work in progress.
213
+ *
214
+ * TODO: Or maybe use the `key` channel? https://vega.github.io/vega-lite/docs/encoding.html#key
215
+ */
216
+ //keyFields?: string[];
217
+ }
218
+
219
+ export interface IntervalSelectionConfig
220
+ extends BaseSelectionConfig<"interval"> {
221
+ // TODO
222
+ }
223
+
224
+ export interface SelectionParameter<T extends SelectionType = SelectionType>
225
+ extends ParameterBase {
226
+ /**
227
+ * Determines the default event processing and data query for the selection. Vega-Lite currently supports two selection types:
228
+ *
229
+ * - `"point"` -- to select multiple discrete data values; the first value is selected on `click` and additional values toggled on shift-click.
230
+ * - `"interval"` -- to select a continuous range of data values on `drag`.
231
+ */
232
+ select:
233
+ | T
234
+ | (T extends "point"
235
+ ? PointSelectionConfig
236
+ : T extends "interval"
237
+ ? IntervalSelectionConfig
238
+ : never);
239
+
240
+ /*
241
+ * Initialize the selection with a mapping between [projected channels or field names](https://vega.github.io/vega-lite/docs/selection.html#project) and initial values.
242
+ *
243
+ * __See also:__ [`init`](https://vega.github.io/vega-lite/docs/value.html) documentation.
244
+ */
245
+ /*
246
+ // TODO TODO TODO TODO TODO TODO TODO TODO
247
+ value?: T extends "point"
248
+ ? SelectionInit | SelectionInitMapping[]
249
+ : T extends "interval"
250
+ ? SelectionInitIntervalMapping
251
+ : never;
252
+ */
253
+ }
254
+
255
+ export type Parameter = VariableParameter | SelectionParameter;
@@ -1,5 +1,4 @@
1
1
  import { GenomeConfig } from "./genome.js";
2
- import { VariableParameter } from "./parameter.js";
3
2
  import { ViewSpec } from "./view.js";
4
3
 
5
4
  interface RootConfig {
@@ -17,13 +17,31 @@ export interface IdentifierParams extends TransformParamsBase {
17
17
  */
18
18
  as?: string;
19
19
  }
20
- export interface FilterParams extends TransformParamsBase {
20
+ export interface ExprFilterParams extends TransformParamsBase {
21
21
  type: "filter";
22
22
 
23
23
  /** An expression string. The data object is removed if the expression evaluates to false. */
24
24
  expr: string;
25
25
  }
26
26
 
27
+ export interface SelectionFilterParams extends TransformParamsBase {
28
+ type: "filter";
29
+
30
+ /**
31
+ * A selection parameter. The data object is removed if it is not part of the selection.
32
+ */
33
+ param: string;
34
+
35
+ /**
36
+ * If true, the filter retains all data objects when the selection is empty.
37
+
38
+ * **Default:** `true`
39
+ */
40
+ empty?: boolean;
41
+ }
42
+
43
+ export type FilterParams = ExprFilterParams | SelectionFilterParams;
44
+
27
45
  export interface FormulaParams extends TransformParamsBase {
28
46
  type: "formula";
29
47
 
@@ -6,16 +6,11 @@ import {
6
6
  FacetFieldDef,
7
7
  PrimaryPositionalChannel,
8
8
  } from "./channel.js";
9
- import {
10
- FillAndStrokeProps,
11
- MarkConfigAndType,
12
- MarkType,
13
- RectProps,
14
- } from "./mark.js";
9
+ import { FillAndStrokeProps, MarkProps, MarkType, RectProps } from "./mark.js";
15
10
  import { ExprRef } from "./parameter.js";
16
11
  import { Title } from "./title.js";
17
12
  import { SampleSpec } from "./sampleView.js";
18
- import { VariableParameter } from "./parameter.js";
13
+ import { Parameter } from "./parameter.js";
19
14
 
20
15
  export interface SizeDef {
21
16
  /** Size in pixels */
@@ -112,7 +107,7 @@ export interface ViewSpecBase extends ResolveSpec {
112
107
  /**
113
108
  * Dynamic variables that parameterize a visualization.
114
109
  */
115
- params?: VariableParameter[];
110
+ params?: Parameter[];
116
111
 
117
112
  data?: Data;
118
113
  transform?: TransformParams[];
@@ -166,7 +161,7 @@ export interface ViewSpecBase extends ResolveSpec {
166
161
 
167
162
  export interface UnitSpec extends ViewSpecBase, AggregateSamplesSpec {
168
163
  view?: ViewBackground;
169
- mark: MarkType | MarkConfigAndType;
164
+ mark: MarkType | MarkProps;
170
165
  }
171
166
 
172
167
  export interface AggregateSamplesSpec {
@@ -255,7 +250,7 @@ export interface ImportSpec {
255
250
  * Dynamic variables that parameterize a visualization. Parameters defined
256
251
  * here override the parameters defined in the imported specification.
257
252
  */
258
- params?: VariableParameter[] | Record<string, any>;
253
+ params?: Parameter[] | Record<string, any>;
259
254
 
260
255
  /**
261
256
  * The method to import a specification.
@@ -1,2 +1,2 @@
1
- export default function dataTooltipHandler(datum: Record<string, any>, mark: import("../marks/mark.js").default, params?: Record<string, any>): Promise<string | HTMLElement | import("lit-html").TemplateResult>;
1
+ export default function dataTooltipHandler(datum: Record<string, any>, mark: import("../marks/mark.js").default<import("../spec/mark.js").MarkProps>, params?: Record<string, any>): Promise<string | HTMLElement | import("lit-html").TemplateResult>;
2
2
  //# sourceMappingURL=dataTooltipHandler.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dataTooltipHandler.d.ts","sourceRoot":"","sources":["../../../src/tooltip/dataTooltipHandler.js"],"names":[],"mappings":"AAMoC,kNAMa"}
1
+ {"version":3,"file":"dataTooltipHandler.d.ts","sourceRoot":"","sources":["../../../src/tooltip/dataTooltipHandler.js"],"names":[],"mappings":"AAMoC,uPAMa"}
@@ -11,7 +11,7 @@ export default async function dataTooltipHandler(datum, mark, params) {
11
11
  */
12
12
  const legend = (key, datum) => {
13
13
  for (const [channel, encoder] of Object.entries(mark.encoders)) {
14
- if (encoder?.accessor?.fields.includes(key)) {
14
+ if (encoder?.dataAccessor?.fields.includes(key)) {
15
15
  switch (channel) {
16
16
  case "color":
17
17
  case "fill":
@@ -1,2 +1,2 @@
1
- export default function refseqGeneTooltipHandler(datum: Record<string, any>, mark: import("../marks/mark.js").default, params?: Record<string, any>): Promise<string | HTMLElement | import("lit-html").TemplateResult>;
1
+ export default function refseqGeneTooltipHandler(datum: Record<string, any>, mark: import("../marks/mark.js").default<import("../spec/mark.js").MarkProps>, params?: Record<string, any>): Promise<string | HTMLElement | import("lit-html").TemplateResult>;
2
2
  //# sourceMappingURL=refseqGeneTooltipHandler.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"refseqGeneTooltipHandler.d.ts","sourceRoot":"","sources":["../../../src/tooltip/refseqGeneTooltipHandler.js"],"names":[],"mappings":"AAOC,wNAQW"}
1
+ {"version":3,"file":"refseqGeneTooltipHandler.d.ts","sourceRoot":"","sources":["../../../src/tooltip/refseqGeneTooltipHandler.js"],"names":[],"mappings":"AAOC,6PAQW"}
@@ -15,57 +15,109 @@ import {
15
15
  ScaleDiverging,
16
16
  ScaleContinuousNumeric,
17
17
  } from "d3-scale";
18
- import { ChannelDef } from "../spec/channel.js";
18
+ import { Channel, ChannelDef, ChannelWithScale } from "../spec/channel.js";
19
19
  import { ScaleLocus } from "../genome/scaleLocus.js";
20
20
  import { ScaleIndex } from "../genome/scaleIndex.js";
21
21
  import { Scalar } from "../spec/channel.js";
22
+ import { Datum } from "../data/flowNode.js";
23
+ import { ExprRefFunction } from "../view/paramMediator.js";
22
24
 
23
- export interface AccessorMetadata {
24
- /** True if the accessor returns the same value for all objects */
25
+ export interface Accessor<T = Scalar> {
26
+ (datum: Datum): T;
27
+
28
+ /**
29
+ * Returns a new accessor that returns the same value as this accessor,
30
+ * but typed as a number
31
+ */
32
+ asNumberAccessor(): Accessor<number>;
33
+
34
+ /**
35
+ * True if the accessor returns the same value for all objects
36
+ */
25
37
  constant: boolean;
26
38
 
27
- /** The fields that the return value is based on (if any) */
39
+ /**
40
+ * The fields that the return value is based on (if any)
41
+ */
28
42
  fields: string[];
29
- }
30
43
 
31
- export type Accessor = ((datum: any) => any) & AccessorMetadata;
44
+ /**
45
+ * The channel that the accessor is based on
46
+ */
47
+ channel: Channel;
48
+
49
+ /**
50
+ * If the accessed data needs to be passed to a scale function
51
+ * before visual encoding, indicates with channel has the scale.
52
+ * If no scale is needed, this is undefined.
53
+ */
54
+ scaleChannel: ChannelWithScale;
55
+
56
+ /**
57
+ * The ChannelDef that the accessor is based on
58
+ */
59
+ channelDef: ChannelDef;
32
60
 
33
- export interface EncoderMetadata {
34
- /** True if the accessor returns the same value for all objects */
35
- constant: boolean;
61
+ /**
62
+ * This accessor should be used when the predicate is true
63
+ */
64
+ predicate: Predicate;
65
+ }
66
+
67
+ export interface Predicate extends ExprRefFunction {
68
+ /**
69
+ * The parameter the predicate is based on
70
+ */
71
+ param?: string;
72
+
73
+ /**
74
+ * If true, the predicate is true for empty selections.
75
+ *
76
+ * **Default:** `true`
77
+ */
78
+ empty?: boolean;
79
+ }
36
80
 
37
- /** True the encoder returns a "value" without a scale */
38
- constantValue: boolean;
81
+ /**
82
+ * Wraps one or more accessors, uses an optional scale to encode the data.
83
+ */
84
+ export interface Encoder {
85
+ (datum: Datum): Scalar;
39
86
 
40
- invert: (value: Scalar) => Scalar;
87
+ /**
88
+ * True if the accessor returns the same value for all objects
89
+ */
90
+ constant: boolean;
41
91
 
92
+ /**
93
+ * Scale, if the encoder has one
94
+ */
42
95
  scale?: VegaScale;
43
96
 
44
- accessor: Accessor;
97
+ /**
98
+ * An accessor, or if the ChannelDef has conditions, all the accessors.
99
+ */
100
+ accessors: Accessor[];
45
101
 
46
- /** Converts ordinal values to index numbers */
47
- indexer?: (value: any) => number;
102
+ /**
103
+ * The encoded channel may have a maximum of one accessor accessing the
104
+ * data fields. It's this one.
105
+ */
106
+ dataAccessor?: Accessor;
48
107
 
108
+ /**
109
+ * The ChannelDef that the encoder is based on
110
+ */
49
111
  channelDef: ChannelDef;
50
-
51
- /** Copies metadata to the target function */
52
- applyMetadata: (target: Function) => void;
53
112
  }
54
113
 
55
- export type Encoder = ((datum: object) => Scalar) & EncoderMetadata;
56
-
57
- export type NumberEncoder = ((datum: object) => number) & EncoderMetadata;
58
-
59
114
  export interface ScaleMetadata {
60
115
  /** Scale type */
61
116
  type: string;
62
-
63
- /** Whether to use emulated 64 bit floating point in WebGL */
64
- fp64?: boolean;
65
117
  }
66
118
 
67
119
  export type D3Scale =
68
- | ScaleContinuousNumeric<any, any>
120
+ | ScaleContinuousNumeric<any, any, any>
69
121
  | ScaleLinear<any, any>
70
122
  | ScalePower<any, any>
71
123
  | ScaleLogarithmic<any, any>
@@ -81,4 +133,6 @@ export type D3Scale =
81
133
  | ScaleBand<any>
82
134
  | ScalePoint<any>;
83
135
 
136
+ export type GenericScale = any;
137
+
84
138
  export type VegaScale = (D3Scale | ScaleIndex | ScaleLocus) & ScaleMetadata;
@@ -1,6 +1,7 @@
1
1
  import Mark from "../marks/mark.js";
2
2
  import { LocSize } from "../view/layout/flexLayout.js";
3
3
  import Rectangle from "../view/layout/rectangle.js";
4
+ import ViewRenderingContext from "../view/renderingContext/viewRenderingContext.js";
4
5
 
5
6
  /**
6
7
  * Describes the location of a sample facet. Left is the primary pos, right is for