@genome-spy/core 0.67.0 → 0.69.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 (290) hide show
  1. package/dist/bundle/index.es.js +15884 -13130
  2. package/dist/bundle/index.js +130 -149
  3. package/dist/schema.json +6498 -6191
  4. package/dist/src/data/collector.d.ts +20 -0
  5. package/dist/src/data/collector.d.ts.map +1 -1
  6. package/dist/src/data/collector.js +148 -0
  7. package/dist/src/data/dataFlow.d.ts +6 -0
  8. package/dist/src/data/dataFlow.d.ts.map +1 -1
  9. package/dist/src/data/dataFlow.js +20 -0
  10. package/dist/src/data/flowInit.d.ts.map +1 -1
  11. package/dist/src/data/flowInit.js +2 -3
  12. package/dist/src/data/flowNode.d.ts +33 -10
  13. package/dist/src/data/flowNode.d.ts.map +1 -1
  14. package/dist/src/data/flowNode.js +84 -13
  15. package/dist/src/data/flowTestUtils.d.ts +2 -2
  16. package/dist/src/data/flowTestUtils.d.ts.map +1 -1
  17. package/dist/src/data/flowTestUtils.js +5 -4
  18. package/dist/src/data/keyIndex.d.ts +18 -0
  19. package/dist/src/data/keyIndex.d.ts.map +1 -0
  20. package/dist/src/data/keyIndex.js +241 -0
  21. package/dist/src/data/keyIndex.test.d.ts +2 -0
  22. package/dist/src/data/keyIndex.test.d.ts.map +1 -0
  23. package/dist/src/data/sources/dataSource.d.ts.map +1 -1
  24. package/dist/src/data/sources/dataSource.js +7 -3
  25. package/dist/src/data/sources/dataSourceFactory.d.ts +14 -12
  26. package/dist/src/data/sources/dataSourceFactory.d.ts.map +1 -1
  27. package/dist/src/data/sources/dataSourceFactory.js +52 -16
  28. package/dist/src/data/sources/lazy/bigBedSource.d.ts.map +1 -1
  29. package/dist/src/data/sources/lazy/bigBedSource.js +11 -10
  30. package/dist/src/data/sources/lazy/bigWigSource.d.ts.map +1 -1
  31. package/dist/src/data/sources/lazy/bigWigSource.js +11 -10
  32. package/dist/src/data/sources/lazy/mockLazySource.d.ts +29 -0
  33. package/dist/src/data/sources/lazy/mockLazySource.d.ts.map +1 -0
  34. package/dist/src/data/sources/lazy/mockLazySource.js +44 -0
  35. package/dist/src/data/sources/lazy/singleAxisLazySource.d.ts +22 -1
  36. package/dist/src/data/sources/lazy/singleAxisLazySource.d.ts.map +1 -1
  37. package/dist/src/data/sources/lazy/singleAxisLazySource.js +34 -2
  38. package/dist/src/data/sources/lazy/singleAxisWindowedSource.d.ts.map +1 -1
  39. package/dist/src/data/sources/lazy/singleAxisWindowedSource.js +16 -1
  40. package/dist/src/data/sources/lazy/tabixSource.d.ts +0 -1
  41. package/dist/src/data/sources/lazy/tabixSource.d.ts.map +1 -1
  42. package/dist/src/data/sources/lazy/tabixSource.js +56 -16
  43. package/dist/src/data/sources/sequenceSource.d.ts.map +1 -1
  44. package/dist/src/data/sources/sequenceSource.js +5 -3
  45. package/dist/src/data/sources/urlSource.d.ts.map +1 -1
  46. package/dist/src/data/sources/urlSource.js +7 -3
  47. package/dist/src/data/transforms/filter.d.ts +4 -4
  48. package/dist/src/data/transforms/filter.d.ts.map +1 -1
  49. package/dist/src/data/transforms/filter.js +13 -7
  50. package/dist/src/data/transforms/filterScoredLabels.d.ts.map +1 -1
  51. package/dist/src/data/transforms/filterScoredLabels.js +11 -6
  52. package/dist/src/data/transforms/filterScoredLabels.test.d.ts +2 -0
  53. package/dist/src/data/transforms/filterScoredLabels.test.d.ts.map +1 -0
  54. package/dist/src/data/transforms/formula.d.ts +4 -4
  55. package/dist/src/data/transforms/formula.d.ts.map +1 -1
  56. package/dist/src/data/transforms/formula.js +12 -6
  57. package/dist/src/data/transforms/measureText.d.ts +2 -2
  58. package/dist/src/data/transforms/measureText.d.ts.map +1 -1
  59. package/dist/src/data/transforms/measureText.js +16 -12
  60. package/dist/src/data/transforms/stack.d.ts.map +1 -1
  61. package/dist/src/data/transforms/stack.js +1 -0
  62. package/dist/src/data/transforms/transform.d.ts +2 -2
  63. package/dist/src/data/transforms/transform.d.ts.map +1 -1
  64. package/dist/src/data/transforms/transform.js +3 -3
  65. package/dist/src/encoder/accessor.d.ts +51 -4
  66. package/dist/src/encoder/accessor.d.ts.map +1 -1
  67. package/dist/src/encoder/accessor.js +174 -10
  68. package/dist/src/encoder/encoder.d.ts +11 -2
  69. package/dist/src/encoder/encoder.d.ts.map +1 -1
  70. package/dist/src/encoder/encoder.js +29 -9
  71. package/dist/src/encoder/metadataChannels.d.ts +15 -0
  72. package/dist/src/encoder/metadataChannels.d.ts.map +1 -0
  73. package/dist/src/encoder/metadataChannels.js +65 -0
  74. package/dist/src/encoder/metadataChannels.test.d.ts +2 -0
  75. package/dist/src/encoder/metadataChannels.test.d.ts.map +1 -0
  76. package/dist/src/genome/genome.d.ts +8 -0
  77. package/dist/src/genome/genome.d.ts.map +1 -1
  78. package/dist/src/genome/genome.js +16 -1
  79. package/dist/src/genome/scaleLocus.d.ts.map +1 -1
  80. package/dist/src/genome/scaleLocus.js +14 -1
  81. package/dist/src/genomeSpy/containerUi.d.ts +0 -1
  82. package/dist/src/genomeSpy/containerUi.d.ts.map +1 -1
  83. package/dist/src/genomeSpy/containerUi.js +0 -14
  84. package/dist/src/genomeSpy/inputBindingManager.js +1 -1
  85. package/dist/src/genomeSpy/interactionController.d.ts.map +1 -1
  86. package/dist/src/genomeSpy/interactionController.js +7 -1
  87. package/dist/src/genomeSpy/loadingIndicatorManager.d.ts +3 -7
  88. package/dist/src/genomeSpy/loadingIndicatorManager.d.ts.map +1 -1
  89. package/dist/src/genomeSpy/loadingIndicatorManager.js +68 -20
  90. package/dist/src/genomeSpy/loadingStatusRegistry.d.ts +52 -0
  91. package/dist/src/genomeSpy/loadingStatusRegistry.d.ts.map +1 -0
  92. package/dist/src/genomeSpy/loadingStatusRegistry.js +86 -0
  93. package/dist/src/genomeSpy/viewContextFactory.d.ts.map +1 -1
  94. package/dist/src/genomeSpy/viewContextFactory.js +0 -1
  95. package/dist/src/genomeSpy/viewDataInit.d.ts.map +1 -1
  96. package/dist/src/genomeSpy/viewDataInit.js +56 -11
  97. package/dist/src/genomeSpy.d.ts +0 -2
  98. package/dist/src/genomeSpy.d.ts.map +1 -1
  99. package/dist/src/genomeSpy.js +47 -27
  100. package/dist/src/gl/glslScaleGenerator.js +1 -1
  101. package/dist/src/marks/mark.d.ts.map +1 -1
  102. package/dist/src/marks/mark.js +40 -41
  103. package/dist/src/marks/markUtils.js +1 -1
  104. package/dist/src/marks/point.d.ts.map +1 -1
  105. package/dist/src/marks/point.js +4 -6
  106. package/dist/src/paramRuntime/expressionCompiler.d.ts +7 -0
  107. package/dist/src/paramRuntime/expressionCompiler.d.ts.map +1 -0
  108. package/dist/src/paramRuntime/expressionCompiler.js +10 -0
  109. package/dist/src/paramRuntime/expressionRef.d.ts +20 -0
  110. package/dist/src/paramRuntime/expressionRef.d.ts.map +1 -0
  111. package/dist/src/paramRuntime/expressionRef.js +95 -0
  112. package/dist/src/paramRuntime/expressionRef.test.d.ts +2 -0
  113. package/dist/src/paramRuntime/expressionRef.test.d.ts.map +1 -0
  114. package/dist/src/paramRuntime/graphRuntime.d.ts +176 -0
  115. package/dist/src/paramRuntime/graphRuntime.d.ts.map +1 -0
  116. package/dist/src/paramRuntime/graphRuntime.js +628 -0
  117. package/dist/src/paramRuntime/graphRuntime.test.d.ts +2 -0
  118. package/dist/src/paramRuntime/graphRuntime.test.d.ts.map +1 -0
  119. package/dist/src/paramRuntime/index.d.ts +9 -0
  120. package/dist/src/paramRuntime/index.d.ts.map +1 -0
  121. package/dist/src/paramRuntime/index.js +8 -0
  122. package/dist/src/paramRuntime/lifecycleRegistry.d.ts +27 -0
  123. package/dist/src/paramRuntime/lifecycleRegistry.d.ts.map +1 -0
  124. package/dist/src/paramRuntime/lifecycleRegistry.js +54 -0
  125. package/dist/src/paramRuntime/paramRuntime.d.ts +165 -0
  126. package/dist/src/paramRuntime/paramRuntime.d.ts.map +1 -0
  127. package/dist/src/paramRuntime/paramRuntime.js +222 -0
  128. package/dist/src/paramRuntime/paramRuntime.test.d.ts +2 -0
  129. package/dist/src/paramRuntime/paramRuntime.test.d.ts.map +1 -0
  130. package/dist/src/paramRuntime/paramStore.d.ts +68 -0
  131. package/dist/src/paramRuntime/paramStore.d.ts.map +1 -0
  132. package/dist/src/paramRuntime/paramStore.js +148 -0
  133. package/dist/src/paramRuntime/paramStore.test.d.ts +2 -0
  134. package/dist/src/paramRuntime/paramStore.test.d.ts.map +1 -0
  135. package/dist/src/paramRuntime/paramUtils.d.ts +86 -0
  136. package/dist/src/paramRuntime/paramUtils.d.ts.map +1 -0
  137. package/dist/src/paramRuntime/paramUtils.js +272 -0
  138. package/dist/src/paramRuntime/selectionStore.d.ts +6 -0
  139. package/dist/src/paramRuntime/selectionStore.d.ts.map +1 -0
  140. package/dist/src/paramRuntime/selectionStore.js +13 -0
  141. package/dist/src/paramRuntime/types.d.ts +16 -0
  142. package/dist/src/paramRuntime/types.d.ts.map +1 -0
  143. package/dist/src/paramRuntime/types.js +25 -0
  144. package/dist/src/paramRuntime/viewParamRuntime.d.ts +164 -0
  145. package/dist/src/paramRuntime/viewParamRuntime.d.ts.map +1 -0
  146. package/dist/src/paramRuntime/viewParamRuntime.js +443 -0
  147. package/dist/src/scale/scale.d.ts +6 -1
  148. package/dist/src/scale/scale.d.ts.map +1 -1
  149. package/dist/src/scale/scale.js +83 -23
  150. package/dist/src/scales/axisResolution.d.ts.map +1 -1
  151. package/dist/src/scales/axisResolution.js +10 -0
  152. package/dist/src/scales/{scaleDomainAggregator.d.ts → domainPlanner.d.ts} +6 -3
  153. package/dist/src/scales/domainPlanner.d.ts.map +1 -0
  154. package/dist/src/scales/{scaleDomainAggregator.js → domainPlanner.js} +128 -10
  155. package/dist/src/scales/domainPlanner.test.d.ts +2 -0
  156. package/dist/src/scales/domainPlanner.test.d.ts.map +1 -0
  157. package/dist/src/scales/scaleInstanceManager.d.ts +6 -3
  158. package/dist/src/scales/scaleInstanceManager.d.ts.map +1 -1
  159. package/dist/src/scales/scaleInstanceManager.js +17 -11
  160. package/dist/src/scales/scaleInteractionController.d.ts +6 -0
  161. package/dist/src/scales/scaleInteractionController.d.ts.map +1 -1
  162. package/dist/src/scales/scaleInteractionController.js +41 -3
  163. package/dist/src/scales/scaleResolution.d.ts +20 -17
  164. package/dist/src/scales/scaleResolution.d.ts.map +1 -1
  165. package/dist/src/scales/scaleResolution.js +188 -71
  166. package/dist/src/scales/scaleResolution.test.d.ts.map +1 -1
  167. package/dist/src/selection/selection.d.ts +21 -0
  168. package/dist/src/selection/selection.d.ts.map +1 -1
  169. package/dist/src/selection/selection.js +83 -1
  170. package/dist/src/spec/channel.d.ts +52 -15
  171. package/dist/src/spec/coreSchemaRoot.d.ts +53 -0
  172. package/dist/src/spec/data.d.ts +4 -0
  173. package/dist/src/spec/parameter.d.ts +16 -11
  174. package/dist/src/spec/root.d.ts +1 -1
  175. package/dist/src/spec/testing.d.ts +12 -0
  176. package/dist/src/spec/testing.d.ts.map +1 -0
  177. package/dist/src/spec/testing.js +20 -0
  178. package/dist/src/spec/view.d.ts +157 -41
  179. package/dist/src/styles/genome-spy.css +3 -31
  180. package/dist/src/styles/genome-spy.css.d.ts +1 -1
  181. package/dist/src/styles/genome-spy.css.d.ts.map +1 -1
  182. package/dist/src/styles/genome-spy.css.js +0 -29
  183. package/dist/src/tooltip/dataTooltipHandler.d.ts +1 -1
  184. package/dist/src/tooltip/dataTooltipHandler.js +23 -32
  185. package/dist/src/tooltip/dataTooltipHandler.test.d.ts +2 -0
  186. package/dist/src/tooltip/dataTooltipHandler.test.d.ts.map +1 -0
  187. package/dist/src/tooltip/flattenDatumRows.d.ts +13 -0
  188. package/dist/src/tooltip/flattenDatumRows.d.ts.map +1 -0
  189. package/dist/src/tooltip/flattenDatumRows.js +47 -0
  190. package/dist/src/tooltip/flattenDatumRows.test.d.ts +2 -0
  191. package/dist/src/tooltip/flattenDatumRows.test.d.ts.map +1 -0
  192. package/dist/src/tooltip/refseqGeneTooltipHandler.d.ts +1 -1
  193. package/dist/src/tooltip/refseqGeneTooltipHandler.js +7 -1
  194. package/dist/src/tooltip/tooltipContext.d.ts +13 -0
  195. package/dist/src/tooltip/tooltipContext.d.ts.map +1 -0
  196. package/dist/src/tooltip/tooltipContext.js +543 -0
  197. package/dist/src/tooltip/tooltipContext.test.d.ts +2 -0
  198. package/dist/src/tooltip/tooltipContext.test.d.ts.map +1 -0
  199. package/dist/src/tooltip/tooltipHandler.d.ts +40 -1
  200. package/dist/src/tooltip/tooltipHandler.d.ts.map +1 -1
  201. package/dist/src/tooltip/tooltipHandler.ts +62 -1
  202. package/dist/src/types/encoder.d.ts +38 -3
  203. package/dist/src/types/rendering.d.ts +4 -3
  204. package/dist/src/types/viewContext.d.ts +0 -14
  205. package/dist/src/utils/inputBinding.d.ts +10 -2
  206. package/dist/src/utils/inputBinding.d.ts.map +1 -1
  207. package/dist/src/utils/inputBinding.js +12 -3
  208. package/dist/src/utils/throttle.d.ts +4 -1
  209. package/dist/src/utils/throttle.d.ts.map +1 -1
  210. package/dist/src/utils/throttle.js +54 -23
  211. package/dist/src/utils/throttle.test.d.ts +2 -0
  212. package/dist/src/utils/throttle.test.d.ts.map +1 -0
  213. package/dist/src/utils/transition.d.ts +21 -0
  214. package/dist/src/utils/transition.d.ts.map +1 -1
  215. package/dist/src/utils/transition.js +28 -0
  216. package/dist/src/utils/ui/tooltip.d.ts.map +1 -1
  217. package/dist/src/utils/ui/tooltip.js +7 -1
  218. package/dist/src/utils/ui/tooltip.test.d.ts +2 -0
  219. package/dist/src/utils/ui/tooltip.test.d.ts.map +1 -0
  220. package/dist/src/view/axisGridView.d.ts.map +1 -1
  221. package/dist/src/view/axisGridView.js +22 -5
  222. package/dist/src/view/axisView.d.ts.map +1 -1
  223. package/dist/src/view/axisView.js +20 -5
  224. package/dist/src/view/concatView.js +3 -3
  225. package/dist/src/view/containerMutationHelper.js +1 -1
  226. package/dist/src/view/containerView.d.ts +9 -5
  227. package/dist/src/view/containerView.d.ts.map +1 -1
  228. package/dist/src/view/containerView.js +34 -9
  229. package/dist/src/view/dataReadiness.d.ts +46 -0
  230. package/dist/src/view/dataReadiness.d.ts.map +1 -0
  231. package/dist/src/view/dataReadiness.js +267 -0
  232. package/dist/src/view/dataReadiness.test.d.ts +2 -0
  233. package/dist/src/view/dataReadiness.test.d.ts.map +1 -0
  234. package/dist/src/view/facetView.d.ts.map +1 -1
  235. package/dist/src/view/facetView.js +7 -5
  236. package/dist/src/view/flowBuilder.d.ts.map +1 -1
  237. package/dist/src/view/flowBuilder.js +17 -4
  238. package/dist/src/view/gridView/gridChild.d.ts.map +1 -1
  239. package/dist/src/view/gridView/gridChild.js +16 -3
  240. package/dist/src/view/gridView/gridView.d.ts.map +1 -1
  241. package/dist/src/view/gridView/gridView.js +119 -2
  242. package/dist/src/view/gridView/scrollbar.d.ts.map +1 -1
  243. package/dist/src/view/gridView/scrollbar.js +3 -0
  244. package/dist/src/view/gridView/selectionRect.d.ts +6 -10
  245. package/dist/src/view/gridView/selectionRect.d.ts.map +1 -1
  246. package/dist/src/view/gridView/selectionRect.js +22 -24
  247. package/dist/src/view/gridView/separatorView.d.ts +51 -0
  248. package/dist/src/view/gridView/separatorView.d.ts.map +1 -0
  249. package/dist/src/view/gridView/separatorView.js +275 -0
  250. package/dist/src/view/layerView.d.ts.map +1 -1
  251. package/dist/src/view/layerView.js +7 -5
  252. package/dist/src/view/layout/flexLayout.d.ts +0 -30
  253. package/dist/src/view/layout/flexLayout.d.ts.map +1 -1
  254. package/dist/src/view/layout/flexLayout.js +0 -86
  255. package/dist/src/view/multiscale.d.ts +35 -0
  256. package/dist/src/view/multiscale.d.ts.map +1 -0
  257. package/dist/src/view/multiscale.js +233 -0
  258. package/dist/src/view/multiscale.test.d.ts +2 -0
  259. package/dist/src/view/multiscale.test.d.ts.map +1 -0
  260. package/dist/src/view/testUtils.d.ts.map +1 -1
  261. package/dist/src/view/testUtils.js +6 -1
  262. package/dist/src/view/unitView.d.ts +8 -13
  263. package/dist/src/view/unitView.d.ts.map +1 -1
  264. package/dist/src/view/unitView.js +120 -45
  265. package/dist/src/view/view.d.ts +27 -18
  266. package/dist/src/view/view.d.ts.map +1 -1
  267. package/dist/src/view/view.js +298 -37
  268. package/dist/src/view/viewFactory.d.ts +0 -12
  269. package/dist/src/view/viewFactory.d.ts.map +1 -1
  270. package/dist/src/view/viewFactory.js +55 -25
  271. package/dist/src/view/viewParamRuntime.test.d.ts +2 -0
  272. package/dist/src/view/viewParamRuntime.test.d.ts.map +1 -0
  273. package/dist/src/view/viewSelectors.d.ts +148 -0
  274. package/dist/src/view/viewSelectors.d.ts.map +1 -0
  275. package/dist/src/view/viewSelectors.js +776 -0
  276. package/dist/src/view/viewSelectors.test.d.ts +2 -0
  277. package/dist/src/view/viewSelectors.test.d.ts.map +1 -0
  278. package/dist/src/view/viewUtils.d.ts +0 -8
  279. package/dist/src/view/viewUtils.d.ts.map +1 -1
  280. package/dist/src/view/viewUtils.js +1 -21
  281. package/package.json +4 -4
  282. package/dist/src/scales/scaleDomainAggregator.d.ts.map +0 -1
  283. package/dist/src/scales/scaleDomainAggregator.test.d.ts +0 -2
  284. package/dist/src/scales/scaleDomainAggregator.test.d.ts.map +0 -1
  285. package/dist/src/spec/sampleView.d.ts +0 -197
  286. package/dist/src/view/paramMediator.d.ts +0 -149
  287. package/dist/src/view/paramMediator.d.ts.map +0 -1
  288. package/dist/src/view/paramMediator.js +0 -478
  289. package/dist/src/view/paramMediator.test.d.ts +0 -2
  290. package/dist/src/view/paramMediator.test.d.ts.map +0 -1
@@ -1,10 +1,12 @@
1
1
  /**
2
2
  * @param {import("../spec/channel.js").Channel} channel
3
3
  * @param {import("../spec/channel.js").ChannelDef | import("../spec/channel.js").Conditional<import("../spec/channel.js").ChannelDef>} channelDef
4
- * @param {import("../view/paramMediator.js").default} paramMediator
4
+ * @param {{ createExpression: (expr: string) => import("../paramRuntime/types.js").ExprRefFunction }} paramRuntime
5
5
  * @returns {import("../types/encoder.js").Accessor}
6
6
  */
7
- export function createAccessor(channel: import("../spec/channel.js").Channel, channelDef: import("../spec/channel.js").ChannelDef | import("../spec/channel.js").Conditional<import("../spec/channel.js").ChannelDef>, paramMediator: import("../view/paramMediator.js").default): import("../types/encoder.js").Accessor;
7
+ export function createAccessor(channel: import("../spec/channel.js").Channel, channelDef: import("../spec/channel.js").ChannelDef | import("../spec/channel.js").Conditional<import("../spec/channel.js").ChannelDef>, paramRuntime: {
8
+ createExpression: (expr: string) => import("../paramRuntime/types.js").ExprRefFunction;
9
+ }): import("../types/encoder.js").Accessor;
8
10
  /**
9
11
  * Returns an array of acessors and their predicates. A returned array with
10
12
  * a single element indicates that no conditions are present.
@@ -12,7 +14,52 @@ export function createAccessor(channel: import("../spec/channel.js").Channel, ch
12
14
  *
13
15
  * @param {import("../spec/channel.js").Channel} channel
14
16
  * @param {import("../spec/channel.js").ChannelDef} channelDef
15
- * @param {import("../view/paramMediator.js").default} paramMediator
17
+ * @param {{ createExpression: (expr: string) => import("../paramRuntime/types.js").ExprRefFunction }} paramRuntime
16
18
  */
17
- export function createConditionalAccessors(channel: import("../spec/channel.js").Channel, channelDef: import("../spec/channel.js").ChannelDef, paramMediator: import("../view/paramMediator.js").default): import("../types/encoder.js").Accessor<import("../spec/channel.js").Scalar>[];
19
+ export function createConditionalAccessors(channel: import("../spec/channel.js").Channel, channelDef: import("../spec/channel.js").ChannelDef, paramRuntime: {
20
+ createExpression: (expr: string) => import("../paramRuntime/types.js").ExprRefFunction;
21
+ }): import("../types/encoder.js").Accessor<import("../spec/channel.js").Scalar>[];
22
+ /**
23
+ * @param {import("../types/encoder.js").Accessor} accessor
24
+ * @returns {accessor is import("../types/encoder.js").ScaleAccessor}
25
+ */
26
+ export function isScaleAccessor(accessor: import("../types/encoder.js").Accessor): accessor is import("../types/encoder.js").ScaleAccessor;
27
+ /**
28
+ * Builds domain key strings in the format:
29
+ * - domainKeyBase: <scaleChannel>|<kind>|<value>
30
+ * - domainKey: <type>|<domainKeyBase>
31
+ *
32
+ * @param {object} options
33
+ * @param {import("../spec/channel.js").ChannelWithScale} options.scaleChannel
34
+ * @param {DomainKeySource} options.source
35
+ * @param {import("../spec/channel.js").Type} [options.type]
36
+ * @returns {{ domainKeyBase: string, domainKey?: string }}
37
+ */
38
+ export function buildDomainKey({ scaleChannel, source, type }: {
39
+ scaleChannel: import("../spec/channel.js").ChannelWithScale;
40
+ source: DomainKeySource;
41
+ type?: import("../spec/channel.js").Type;
42
+ }): {
43
+ domainKeyBase: string;
44
+ domainKey?: string;
45
+ };
46
+ /**
47
+ * @param {import("../types/encoder.js").ScaleAccessor} accessor
48
+ * @param {import("../spec/channel.js").Type} type
49
+ * @returns {string}
50
+ */
51
+ export function getAccessorDomainKey(accessor: import("../types/encoder.js").ScaleAccessor, type: import("../spec/channel.js").Type): string;
52
+ export type DomainKeySource = {
53
+ kind: "field";
54
+ value: string;
55
+ } | {
56
+ kind: "expr";
57
+ value: string;
58
+ } | {
59
+ kind: "datum";
60
+ value: import("../spec/channel.js").Scalar | import("../spec/parameter.js").ExprRef;
61
+ } | {
62
+ kind: "value";
63
+ value: import("../spec/channel.js").Scalar | import("../spec/parameter.js").ExprRef;
64
+ };
18
65
  //# sourceMappingURL=accessor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"accessor.d.ts","sourceRoot":"","sources":["../../../src/encoder/accessor.js"],"names":[],"mappings":"AAaA;;;;;GAKG;AACH,wCALW,OAAO,oBAAoB,EAAE,OAAO,cACpC,OAAO,oBAAoB,EAAE,UAAU,GAAG,OAAO,oBAAoB,EAAE,WAAW,CAAC,OAAO,oBAAoB,EAAE,UAAU,CAAC,iBAC3H,OAAO,0BAA0B,EAAE,OAAO,GACxC,OAAO,qBAAqB,EAAE,QAAQ,CA+FlD;AAED;;;;;;;;GAQG;AACH,oDAJW,OAAO,oBAAoB,EAAE,OAAO,cACpC,OAAO,oBAAoB,EAAE,UAAU,iBACvC,OAAO,0BAA0B,EAAE,OAAO,iFAgCpD"}
1
+ {"version":3,"file":"accessor.d.ts","sourceRoot":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,EAAE,OAAO,CAAC;CACvF,GAAG;IACA,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,OAAO,oBAAoB,EAAE,MAAM,GAAG,OAAO,sBAAsB,EAAE,OAAO,CAAC;CACvF"}
@@ -9,15 +9,15 @@ import {
9
9
  isValueDefWithCondition,
10
10
  } from "./encoder.js";
11
11
  import { field } from "../utils/field.js";
12
- import { isExprRef, makeConstantExprRef } from "../view/paramMediator.js";
12
+ import { isExprRef, makeConstantExprRef } from "../paramRuntime/paramUtils.js";
13
13
 
14
14
  /**
15
15
  * @param {import("../spec/channel.js").Channel} channel
16
16
  * @param {import("../spec/channel.js").ChannelDef | import("../spec/channel.js").Conditional<import("../spec/channel.js").ChannelDef>} channelDef
17
- * @param {import("../view/paramMediator.js").default} paramMediator
17
+ * @param {{ createExpression: (expr: string) => import("../paramRuntime/types.js").ExprRefFunction }} paramRuntime
18
18
  * @returns {import("../types/encoder.js").Accessor}
19
19
  */
20
- export function createAccessor(channel, channelDef, paramMediator) {
20
+ export function createAccessor(channel, channelDef, paramRuntime) {
21
21
  /**
22
22
  * @typedef {import("../data/flowNode.js").Datum} Datum
23
23
  * @typedef {import("../spec/channel.js").Scalar} Scalar
@@ -38,6 +38,7 @@ export function createAccessor(channel, channelDef, paramMediator) {
38
38
  a.constant = a.fields.length === 0;
39
39
  a.channelDef = channelDef;
40
40
  a.channel = channel;
41
+ a.sourceKey = buildAccessorSourceKey(channelDef);
41
42
 
42
43
  a.scaleChannel =
43
44
  ((isChannelDefWithScale(channelDef) &&
@@ -45,10 +46,17 @@ export function createAccessor(channel, channelDef, paramMediator) {
45
46
  (isChannelWithScale(channel) && channel)) ||
46
47
  undefined;
47
48
 
49
+ if (a.scaleChannel !== undefined) {
50
+ a.domainKeyBase = buildDomainKey({
51
+ scaleChannel: a.scaleChannel,
52
+ source: getDomainKeySource(channelDef),
53
+ }).domainKeyBase;
54
+ }
55
+
48
56
  if ("param" in channelDef) {
49
57
  // TODO: Figure out how to fix it. Interval selection depends on FIELDS!
50
58
  /*
51
- a.predicate = paramMediator.createExpression(
59
+ a.predicate = paramRuntime.createExpression(
52
60
  makeSelectionTestExpression(channelDef)
53
61
  );
54
62
  a.predicate.param = channelDef.param;
@@ -62,6 +70,18 @@ export function createAccessor(channel, channelDef, paramMediator) {
62
70
  a.predicate.empty = false;
63
71
  }
64
72
 
73
+ a.equals = (other) => {
74
+ if (!other) {
75
+ return false;
76
+ } else {
77
+ return (
78
+ a === other ||
79
+ (a.sourceKey !== undefined &&
80
+ a.sourceKey === other.sourceKey)
81
+ );
82
+ }
83
+ };
84
+
65
85
  a.asNumberAccessor = () =>
66
86
  /** @type {import("../types/encoder.js").Accessor<number>} */ (a);
67
87
 
@@ -75,7 +95,7 @@ export function createAccessor(channel, channelDef, paramMediator) {
75
95
  function potentialExprRefToAccessor(potentialExprRef) {
76
96
  if (isExprRef(potentialExprRef)) {
77
97
  const a = asAccessor(
78
- paramMediator.createExpression(potentialExprRef.expr)
98
+ paramRuntime.createExpression(potentialExprRef.expr)
79
99
  );
80
100
  if (a.fields.length > 0) {
81
101
  throw new Error(
@@ -98,7 +118,7 @@ export function createAccessor(channel, channelDef, paramMediator) {
98
118
  }
99
119
  } else if (isExprDef(channelDef)) {
100
120
  // TODO: If parameters change, the data should be re-evaluated
101
- return asAccessor(paramMediator.createExpression(channelDef.expr));
121
+ return asAccessor(paramRuntime.createExpression(channelDef.expr));
102
122
  } else if (isDatumDef(channelDef)) {
103
123
  return potentialExprRefToAccessor(channelDef.datum);
104
124
  } else if (isValueDef(channelDef)) {
@@ -119,9 +139,9 @@ export function createAccessor(channel, channelDef, paramMediator) {
119
139
  *
120
140
  * @param {import("../spec/channel.js").Channel} channel
121
141
  * @param {import("../spec/channel.js").ChannelDef} channelDef
122
- * @param {import("../view/paramMediator.js").default} paramMediator
142
+ * @param {{ createExpression: (expr: string) => import("../paramRuntime/types.js").ExprRefFunction }} paramRuntime
123
143
  */
124
- export function createConditionalAccessors(channel, channelDef, paramMediator) {
144
+ export function createConditionalAccessors(channel, channelDef, paramRuntime) {
125
145
  /** @type {import("../types/encoder.js").Accessor[]} */
126
146
  const conditionalAccessors = [];
127
147
 
@@ -136,13 +156,13 @@ export function createConditionalAccessors(channel, channelDef, paramMediator) {
136
156
 
137
157
  for (const condition of conditions) {
138
158
  conditionalAccessors.push(
139
- createAccessor(channel, condition, paramMediator)
159
+ createAccessor(channel, condition, paramRuntime)
140
160
  );
141
161
  }
142
162
  }
143
163
 
144
164
  conditionalAccessors.push(
145
- createAccessor(channel, channelDef, paramMediator)
165
+ createAccessor(channel, channelDef, paramRuntime)
146
166
  );
147
167
 
148
168
  if (conditionalAccessors.filter((a) => !a.constant).length > 1) {
@@ -152,3 +172,147 @@ export function createConditionalAccessors(channel, channelDef, paramMediator) {
152
172
  }
153
173
  return conditionalAccessors;
154
174
  }
175
+
176
+ /**
177
+ * @param {import("../types/encoder.js").Accessor} accessor
178
+ * @returns {accessor is import("../types/encoder.js").ScaleAccessor}
179
+ */
180
+ export function isScaleAccessor(accessor) {
181
+ return accessor.scaleChannel !== undefined;
182
+ }
183
+
184
+ /**
185
+ * @typedef {{
186
+ * kind: "field",
187
+ * value: string,
188
+ * } | {
189
+ * kind: "expr",
190
+ * value: string,
191
+ * } | {
192
+ * kind: "datum",
193
+ * value: import("../spec/channel.js").Scalar | import("../spec/parameter.js").ExprRef,
194
+ * } | {
195
+ * kind: "value",
196
+ * value: import("../spec/channel.js").Scalar | import("../spec/parameter.js").ExprRef,
197
+ * }} DomainKeySource
198
+ */
199
+
200
+ /**
201
+ * @param {import("../spec/channel.js").ChannelDef} channelDef
202
+ * @returns {DomainKeySource}
203
+ */
204
+ function getDomainKeySource(channelDef) {
205
+ if (isFieldDef(channelDef)) {
206
+ return { kind: "field", value: channelDef.field };
207
+ }
208
+
209
+ if (isExprDef(channelDef)) {
210
+ return { kind: "expr", value: channelDef.expr };
211
+ }
212
+
213
+ if (isDatumDef(channelDef)) {
214
+ return { kind: "datum", value: channelDef.datum };
215
+ }
216
+
217
+ if (isValueDef(channelDef)) {
218
+ return { kind: "value", value: channelDef.value };
219
+ }
220
+
221
+ throw new Error(
222
+ "Cannot derive a domain key from channel definition: " +
223
+ JSON.stringify(channelDef)
224
+ );
225
+ }
226
+
227
+ /**
228
+ * Builds a key for accessor equality. This is a structural heuristic based on
229
+ * the data source definition and ignores channel, predicate, and scale.
230
+ *
231
+ * @param {import("../spec/channel.js").ChannelDef} channelDef
232
+ * @returns {string}
233
+ */
234
+ function buildAccessorSourceKey(channelDef) {
235
+ const source = getDomainKeySource(channelDef);
236
+ if (source.kind === "datum" || source.kind === "value") {
237
+ return "constant|" + stringifyDomainValue(source.value);
238
+ }
239
+
240
+ return source.kind + "|" + stringifyDomainSource(source);
241
+ }
242
+
243
+ /**
244
+ * Builds domain key strings in the format:
245
+ * - domainKeyBase: <scaleChannel>|<kind>|<value>
246
+ * - domainKey: <type>|<domainKeyBase>
247
+ *
248
+ * @param {object} options
249
+ * @param {import("../spec/channel.js").ChannelWithScale} options.scaleChannel
250
+ * @param {DomainKeySource} options.source
251
+ * @param {import("../spec/channel.js").Type} [options.type]
252
+ * @returns {{ domainKeyBase: string, domainKey?: string }}
253
+ */
254
+ export function buildDomainKey({ scaleChannel, source, type }) {
255
+ if (!scaleChannel) {
256
+ throw new Error("Cannot build a domain key without a scale channel.");
257
+ }
258
+
259
+ const domainKeyBase =
260
+ scaleChannel + "|" + source.kind + "|" + stringifyDomainSource(source);
261
+ const domainKey = type ? type + "|" + domainKeyBase : undefined;
262
+
263
+ return { domainKeyBase, domainKey };
264
+ }
265
+
266
+ /**
267
+ * @param {import("../types/encoder.js").ScaleAccessor} accessor
268
+ * @param {import("../spec/channel.js").Type} type
269
+ * @returns {string}
270
+ */
271
+ export function getAccessorDomainKey(accessor, type) {
272
+ const { domainKey, domainKeyBase } = buildDomainKey({
273
+ scaleChannel: accessor.scaleChannel,
274
+ source: getDomainKeySource(accessor.channelDef),
275
+ type,
276
+ });
277
+ if (!domainKey) {
278
+ throw new Error(
279
+ "Cannot finalize a domain key without a resolved type."
280
+ );
281
+ }
282
+ accessor.domainKeyBase = domainKeyBase;
283
+ accessor.domainKey = domainKey;
284
+ return domainKey;
285
+ }
286
+
287
+ /**
288
+ * @param {DomainKeySource} source
289
+ * @returns {string}
290
+ */
291
+ function stringifyDomainSource(source) {
292
+ switch (source.kind) {
293
+ case "field":
294
+ case "expr":
295
+ return source.value;
296
+ case "datum":
297
+ case "value":
298
+ return stringifyDomainValue(source.value);
299
+ default:
300
+ throw new Error("Unknown domain key source.");
301
+ }
302
+ }
303
+
304
+ /**
305
+ * @param {import("../spec/channel.js").Scalar | import("../spec/parameter.js").ExprRef} value
306
+ * @returns {string}
307
+ */
308
+ function stringifyDomainValue(value) {
309
+ if (isExprRef(value)) {
310
+ return "expr:" + value.expr;
311
+ }
312
+
313
+ if (value === undefined) {
314
+ return "undefined";
315
+ }
316
+
317
+ return JSON.stringify(value);
318
+ }
@@ -8,6 +8,15 @@
8
8
  * @returns {Partial<Record<Channel, Encoder>>}
9
9
  */
10
10
  export default function createEncoders(unitView: import("../view/unitView.js").default, encoding: import("../spec/channel.js").Encoding): Partial<Record<import("../spec/channel.js").Channel, import("../types/encoder.js").Encoder>>;
11
+ /**
12
+ * Channels that are present in encoding but are not direct mark properties.
13
+ * Keep this centralized so metadata channels (for example tooltip) can reuse
14
+ * the same handling path.
15
+ *
16
+ * @param {import("../spec/channel.js").Channel} channel
17
+ * @returns {boolean}
18
+ */
19
+ export function isNonMarkPropertyChannel(channel: import("../spec/channel.js").Channel): boolean;
11
20
  /**
12
21
  * @param {import("../types/encoder.js").Accessor[]} accessors
13
22
  * @param {(channel: import("../spec/channel.js").ChannelWithScale) => import("../types/encoder.js").VegaScale} scaleSource
@@ -45,12 +54,12 @@ export function isChannelDefWithScale(channelDef: import("../spec/channel.js").C
45
54
  /**
46
55
  * @param {import("../spec/channel.js").ChannelDef} channelDef
47
56
  */
48
- export function findChannelDefWithScale(channelDef: import("../spec/channel.js").ChannelDef): import("../spec/channel.js").FieldOrDatumDefWithCondition<import("../spec/channel.js").MarkPropFieldDef<import("../spec/channel.js").Type>, string> | import("../spec/channel.js").PositionFieldDef | import("../spec/channel.js").PositionDatumDef | import("../spec/channel.js").ChromPosDef | import("../spec/channel.js").FieldOrDatumDefWithCondition<import("../spec/channel.js").MarkPropFieldDef<import("../spec/channel.js").Type>, number> | (import("../spec/channel.js").ParameterPredicate & import("../spec/channel.js").FieldDefBase & import("../spec/channel.js").TitleMixins & import("../spec/channel.js").ScaleMixins & import("../spec/channel.js").TypeMixins<import("../spec/channel.js").Type>) | (import("../spec/channel.js").ParameterPredicate & import("../spec/channel.js").DatumDef<import("../spec/parameter.js").ExprRef | import("../spec/channel.js").Scalar> & import("../spec/channel.js").ScaleMixins & import("../spec/channel.js").TypeMixins<import("../spec/channel.js").Type>) | (import("../spec/channel.js").ParameterPredicate & import("../spec/channel.js").ValueDefBase<string | import("../spec/parameter.js").ExprRef> & import("../spec/channel.js").TitleMixins & import("../spec/channel.js").ScaleMixins & import("../spec/channel.js").TypeMixins<import("../spec/channel.js").Type>) | (import("../spec/channel.js").ParameterPredicate & import("../spec/channel.js").ValueDefBase<number | import("../spec/parameter.js").ExprRef> & import("../spec/channel.js").TitleMixins & import("../spec/channel.js").ScaleMixins & import("../spec/channel.js").TypeMixins<import("../spec/channel.js").Type>);
57
+ export function findChannelDefWithScale(channelDef: import("../spec/channel.js").ChannelDef): import("../spec/channel.js").FieldOrDatumDefWithCondition<import("../spec/channel.js").MarkPropFieldDef<import("../spec/channel.js").Type>, string> | import("../spec/channel.js").PositionFieldDef | import("../spec/channel.js").PositionDatumDef | import("../spec/channel.js").ChromPosDef | import("../spec/channel.js").FieldOrDatumDefWithCondition<import("../spec/channel.js").MarkPropFieldDef<import("../spec/channel.js").Type>, number> | (import("../spec/channel.js").ParameterPredicate & import("../spec/channel.js").FieldDefBase & import("../spec/channel.js").TitleMixins & import("../spec/channel.js").DomainContributionMixins & import("../spec/channel.js").ScaleMixins & import("../spec/channel.js").TypeMixins<import("../spec/channel.js").Type>) | (import("../spec/channel.js").ParameterPredicate & import("../spec/channel.js").DatumDef<import("../spec/parameter.js").ExprRef | import("../spec/channel.js").Scalar> & import("../spec/channel.js").ScaleMixins & import("../spec/channel.js").TypeMixins<import("../spec/channel.js").Type> & import("../spec/channel.js").DomainContributionMixins) | (import("../spec/channel.js").ParameterPredicate & import("../spec/channel.js").ValueDefBase<string | import("../spec/parameter.js").ExprRef> & import("../spec/channel.js").TitleMixins & import("../spec/channel.js").ScaleMixins & import("../spec/channel.js").TypeMixins<import("../spec/channel.js").Type> & import("../spec/channel.js").DomainContributionMixins) | (import("../spec/channel.js").ParameterPredicate & import("../spec/channel.js").ValueDefBase<number | import("../spec/parameter.js").ExprRef> & import("../spec/channel.js").TitleMixins & import("../spec/channel.js").ScaleMixins & import("../spec/channel.js").TypeMixins<import("../spec/channel.js").Type> & import("../spec/channel.js").DomainContributionMixins);
49
58
  /**
50
59
  * @param {import("../view/unitView.js").default} view
51
60
  * @param {import("../spec/channel.js").Channel} channel
52
61
  */
53
- export function getChannelDefWithScale(view: import("../view/unitView.js").default, channel: import("../spec/channel.js").Channel): import("../spec/channel.js").FieldOrDatumDefWithCondition<import("../spec/channel.js").MarkPropFieldDef<import("../spec/channel.js").Type>, string> | import("../spec/channel.js").PositionFieldDef | import("../spec/channel.js").PositionDatumDef | import("../spec/channel.js").ChromPosDef | import("../spec/channel.js").FieldOrDatumDefWithCondition<import("../spec/channel.js").MarkPropFieldDef<import("../spec/channel.js").Type>, number> | import("../spec/channel.js").FieldOrDatumDefWithCondition<import("../spec/channel.js").MarkPropFieldDef<import("../spec/channel.js").TypeForShape>, string> | (import("../spec/channel.js").FieldDefBase & import("../spec/channel.js").TitleMixins & import("../spec/channel.js").TypeMixins<import("../spec/channel.js").Type> & import("../spec/channel.js").ScaleMixins & import("../spec/channel.js").PositionMixins & import("../spec/channel.js").XIndexDef) | (import("../spec/channel.js").ScaleMixins & import("../spec/channel.js").DatumDef<import("../spec/parameter.js").ExprRef | import("../spec/channel.js").Scalar> & import("../spec/channel.js").TypeMixins<import("../spec/channel.js").Type> & import("../spec/channel.js").PositionMixins & import("../spec/channel.js").XIndexDef) | (import("../spec/channel.js").ChromPosDefBase & import("../spec/channel.js").TitleMixins & import("../spec/channel.js").PositionMixins & import("../spec/channel.js").TypeMixins<"locus"> & import("../spec/channel.js").ScaleMixins & import("../spec/channel.js").XIndexDef);
62
+ export function getChannelDefWithScale(view: import("../view/unitView.js").default, channel: import("../spec/channel.js").Channel): import("../spec/channel.js").FieldOrDatumDefWithCondition<import("../spec/channel.js").MarkPropFieldDef<import("../spec/channel.js").Type>, string> | import("../spec/channel.js").PositionFieldDef | import("../spec/channel.js").PositionDatumDef | import("../spec/channel.js").ChromPosDef | import("../spec/channel.js").FieldOrDatumDefWithCondition<import("../spec/channel.js").MarkPropFieldDef<import("../spec/channel.js").Type>, number> | import("../spec/channel.js").FieldOrDatumDefWithCondition<import("../spec/channel.js").MarkPropFieldDef<import("../spec/channel.js").TypeForShape>, string> | (import("../spec/channel.js").FieldDefBase & import("../spec/channel.js").TitleMixins & import("../spec/channel.js").TypeMixins<import("../spec/channel.js").Type> & import("../spec/channel.js").ScaleMixins & import("../spec/channel.js").DomainContributionMixins & import("../spec/channel.js").PositionMixins & import("../spec/channel.js").XIndexDef) | (import("../spec/channel.js").ScaleMixins & import("../spec/channel.js").DatumDef<import("../spec/parameter.js").ExprRef | import("../spec/channel.js").Scalar> & import("../spec/channel.js").DomainContributionMixins & import("../spec/channel.js").TypeMixins<import("../spec/channel.js").Type> & import("../spec/channel.js").PositionMixins & import("../spec/channel.js").XIndexDef) | (import("../spec/channel.js").ChromPosDefBase & import("../spec/channel.js").TitleMixins & import("../spec/channel.js").PositionMixins & import("../spec/channel.js").DomainContributionMixins & import("../spec/channel.js").TypeMixins<"locus"> & import("../spec/channel.js").ScaleMixins & import("../spec/channel.js").XIndexDef);
54
63
  /**
55
64
  * @param {import("../spec/channel.js").ChannelDef} channelDef
56
65
  * @returns {channelDef is import("../spec/channel.js").TypeMixins<import("../spec/channel.js").Type>}
@@ -1 +1 @@
1
- {"version":3,"file":"encoder.d.ts","sourceRoot":"","sources":["../../../src/encoder/encoder.js"],"names":[],"mappings":"AAwDA;;;;;;;;GAQG;AACH,iDAJW,OAAO,qBAAqB,EAAE,OAAO,YACrC,OAAO,oBAAoB,EAAE,QAAQ,GACnC,OAAO,CAAC,MAAM,6EAAkB,CAAC,CAgC7C;AAED;;;;GAIG;AACH,4DAJW,OAAO,qBAAqB,EAAE,QAAQ,EAAE,eACxC,CAAC,OAAO,EAAE,OAAO,oBAAoB,EAAE,gBAAgB,KAAK,OAAO,qBAAqB,EAAE,SAAS,yCAqC7G;AAED;;;;GAIG;AACH,kIAHW,CAAC,OAAO,EAAE,OAAO,oBAAoB,EAAE,gBAAgB,KAAK,OAAO,qBAAqB,EAAE,SAAS,yCAqC7G;AAED;;;;;GAKG;AACH,uCAHW,OAAO,oBAAoB,EAAE,UAAU,GACrC,UAAU,IAAI,OAAO,oBAAoB,EAAE,QAAQ,CAI/D;AAED;;;GAGG;AACH,uCAHW,OAAO,oBAAoB,EAAE,UAAU,GACrC,UAAU,IAAI,OAAO,oBAAoB,EAAE,YAAY,CAInE;AAED;;;GAGG;AACH,uCAHW,OAAO,oBAAoB,EAAE,UAAU,GACrC,UAAU,IAAI,OAAO,oBAAoB,EAAE,QAAQ,CAI/D;AAED;;;GAGG;AACH,kDAHW,OAAO,oBAAoB,EAAE,UAAU,GACrC,UAAU,IAAI,OAAO,oBAAoB,EAAE,mBAAmB,CAU1E;AAED;;GAEG;AACH,oDAFW,OAAO,oBAAoB,EAAE,UAAU,qkDAWjD;AAED;;;GAGG;AACH,6CAHW,OAAO,qBAAqB,EAAE,OAAO,WACrC,OAAO,oBAAoB,EAAE,OAAO,s9CAS9C;AAED;;;GAGG;AACH,iDAHW,OAAO,oBAAoB,EAAE,UAAU,GACrC,UA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oBAAoB,EAAE,iBAAiB,CAKrE;AAqBD;;;GAGG;AACH,4CAFW,MAAM,WAIhB;AAED;;;;GAIG;AACH,oDAFW,OAAO,oBAAoB,EAAE,OAAO,2DAS9C;AAED;;;;;GAKG;AACH,2CAFW,OAAO,oBAAoB,EAAE,OAAO,wCAI9C;AAED;;;;GAIG;AACH,kDAFW,OAAO,oBAAoB,EAAE,OAAO,0CAM9C;AAED;;GAEG;AACH,wCAFW,OAAO,oBAAoB,EAAE,OAAO,WAI9C;AAED;;;;GAIG;AACH,2CAFW,OAAO,oBAAoB,EAAE,OAAO,WAI9C;AAED;;;GAGG;AACH,4CAHW,OAAO,oBAAoB,EAAE,OAAO,GAClC,OAAO,IAAI,OAAO,oBAAoB,EAAE,gBAAgB,CAsBpE;AAED;;;;;GAKG;AACH,0CAHW,OAAO,oBAAoB,EAAE,OAAO,GAClC,GAAG,EAAE,CAsBjB;AAED;;;GAGG;AACH,gDAHW,OAAO,oBAAoB,EAAE,OAAO,GAClC,CAAS,IAAG,EAAH,GAAG,KAAE,MAAM,CAmBhC;AA7LD;;GAEG;AACH,wCAFU,OAAO,oBAAoB,EAAE,wBAAwB,EAAE,CAEb;AAEpD;;GAEG;AACH,0CAFU,OAAO,oBAAoB,EAAE,0BAA0B,EAAE,CAEX;AAExD;;GAEG;AACH,iCAFU,OAAO,oBAAoB,EAAE,iBAAiB,EAAE,CAKxD;AAoBF;;;;GAIG;AACH,gCAFU,OAAO,CAAC,MAAM,CAAC,OAAO,oBAAoB,EAAE,OAAO,EAAE,OAAO,oBAAoB,EAAE,0BAA0B,CAAC,CAAC,CAKtH;AAEF;;;;GAIG;AACH,8BAFU,OAAO,CAAC,MAAM,CAAC,OAAO,oBAAoB,EAAE,OAAO,EAAE,OAAO,oBAAoB,EAAE,OAAO,CAAC,CAAC,CAInG"}
@@ -11,14 +11,14 @@ import { createConditionalAccessors } from "./accessor.js";
11
11
  *
12
12
  * @param {string} param
13
13
  * @param {import("../spec/channel.js").Encoding} encoding
14
- * @param {import("../view/paramMediator.js").default} paramMediator
14
+ * @param {{ findValue: (param: string) => any, createExpression: (expr: string) => import("../paramRuntime/types.js").ExprRefFunction }} paramRuntime
15
15
  * @param {boolean} empty
16
16
  */
17
17
  // eslint-disable-next-line no-unused-vars
18
- function createSelectionPredicate(param, encoding, paramMediator, empty) {
18
+ function createSelectionPredicate(param, encoding, paramRuntime, empty) {
19
19
  const selection =
20
20
  /** @type {import("../types/selectionTypes.js").Selection} */ (
21
- paramMediator.findValue(param)
21
+ paramRuntime.findValue(param)
22
22
  );
23
23
  if (!selection) {
24
24
  throw new Error(`No selection parameter found: ${param}`);
@@ -51,7 +51,7 @@ function createSelectionPredicate(param, encoding, paramMediator, empty) {
51
51
  selection
52
52
  );
53
53
 
54
- return paramMediator.createExpression(expr);
54
+ return paramRuntime.createExpression(expr);
55
55
  }
56
56
 
57
57
  /**
@@ -82,11 +82,19 @@ export default function createEncoders(unitView, encoding) {
82
82
  continue;
83
83
  }
84
84
 
85
- encoders[channel] = createSimpleOrConditionalEncoder(
85
+ /** @type {Channel} */
86
+ const typedChannel = /** @type {Channel} */ (channel);
87
+ if (isNonMarkPropertyChannel(typedChannel)) {
88
+ continue;
89
+ }
90
+
91
+ const typedChannelDef =
92
+ /** @type {import("../spec/channel.js").ChannelDef} */ (channelDef);
93
+ encoders[typedChannel] = createSimpleOrConditionalEncoder(
86
94
  createConditionalAccessors(
87
- channel,
88
- channelDef,
89
- unitView.paramMediator
95
+ typedChannel,
96
+ typedChannelDef,
97
+ unitView.paramRuntime
90
98
  ),
91
99
  scaleSource
92
100
  );
@@ -95,6 +103,18 @@ export default function createEncoders(unitView, encoding) {
95
103
  return encoders;
96
104
  }
97
105
 
106
+ /**
107
+ * Channels that are present in encoding but are not direct mark properties.
108
+ * Keep this centralized so metadata channels (for example tooltip) can reuse
109
+ * the same handling path.
110
+ *
111
+ * @param {import("../spec/channel.js").Channel} channel
112
+ * @returns {boolean}
113
+ */
114
+ export function isNonMarkPropertyChannel(channel) {
115
+ return channel === "key" || channel === "search";
116
+ }
117
+
98
118
  /**
99
119
  * @param {import("../types/encoder.js").Accessor[]} accessors
100
120
  * @param {(channel: import("../spec/channel.js").ChannelWithScale) => import("../types/encoder.js").VegaScale} scaleSource
@@ -237,7 +257,7 @@ export function findChannelDefWithScale(channelDef) {
237
257
  */
238
258
  export function getChannelDefWithScale(view, channel) {
239
259
  const channelDef = view.mark.encoding[channel];
240
- if (isChannelDefWithScale(channelDef)) {
260
+ if (!Array.isArray(channelDef) && isChannelDefWithScale(channelDef)) {
241
261
  return channelDef;
242
262
  } else {
243
263
  throw new Error("Not a channel def with scale!");
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Returns key fields used for point selections, if configured.
3
+ *
4
+ * @param {import("../spec/channel.js").Encoding} encoding
5
+ * @returns {string[] | undefined}
6
+ */
7
+ export function getEncodingKeyFields(encoding: import("../spec/channel.js").Encoding): string[] | undefined;
8
+ /**
9
+ * Returns search fields configured in encoding.search, if any.
10
+ *
11
+ * @param {import("../spec/channel.js").Encoding} encoding
12
+ * @returns {string[] | undefined}
13
+ */
14
+ export function getEncodingSearchFields(encoding: import("../spec/channel.js").Encoding): string[] | undefined;
15
+ //# sourceMappingURL=metadataChannels.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metadataChannels.d.ts","sourceRoot":"","sources":["../../../src/encoder/metadataChannels.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,+CAHW,OAAO,oBAAoB,EAAE,QAAQ,GACnC,MAAM,EAAE,GAAG,SAAS,CAIhC;AAED;;;;;GAKG;AACH,kDAHW,OAAO,oBAAoB,EAAE,QAAQ,GACnC,MAAM,EAAE,GAAG,SAAS,CAIhC"}
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Returns key fields used for point selections, if configured.
3
+ *
4
+ * @param {import("../spec/channel.js").Encoding} encoding
5
+ * @returns {string[] | undefined}
6
+ */
7
+ export function getEncodingKeyFields(encoding) {
8
+ return getNormalizedFieldsFromChannel(encoding?.key, "key");
9
+ }
10
+
11
+ /**
12
+ * Returns search fields configured in encoding.search, if any.
13
+ *
14
+ * @param {import("../spec/channel.js").Encoding} encoding
15
+ * @returns {string[] | undefined}
16
+ */
17
+ export function getEncodingSearchFields(encoding) {
18
+ return getNormalizedFieldsFromChannel(encoding?.search, "search");
19
+ }
20
+
21
+ /**
22
+ * @param {import("../spec/channel.js").FieldDefWithoutScale | import("../spec/channel.js").FieldDefWithoutScale[] | undefined} channelDef
23
+ * @param {"key" | "search"} channelName
24
+ * @returns {string[] | undefined}
25
+ */
26
+ function getNormalizedFieldsFromChannel(channelDef, channelName) {
27
+ if (!channelDef) {
28
+ return;
29
+ }
30
+
31
+ const definitions = Array.isArray(channelDef) ? channelDef : [channelDef];
32
+ if (definitions.length === 0) {
33
+ throw new Error(
34
+ "The " + channelName + " channel array must not be empty."
35
+ );
36
+ }
37
+
38
+ /** @type {string[]} */
39
+ const fields = [];
40
+ for (const definition of definitions) {
41
+ if (
42
+ !definition ||
43
+ typeof definition !== "object" ||
44
+ !("field" in definition)
45
+ ) {
46
+ throw new Error(
47
+ "The " +
48
+ channelName +
49
+ " channel must be a field definition or an array of field definitions."
50
+ );
51
+ }
52
+
53
+ const fieldName = definition.field;
54
+ if (typeof fieldName !== "string") {
55
+ throw new Error(
56
+ "The " +
57
+ channelName +
58
+ " channel field definition must include a string field name."
59
+ );
60
+ }
61
+ fields.push(fieldName);
62
+ }
63
+
64
+ return fields;
65
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=metadataChannels.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metadataChannels.test.d.ts","sourceRoot":"","sources":["../../../src/encoder/metadataChannels.test.js"],"names":[],"mappings":""}
@@ -124,6 +124,14 @@ export default class Genome {
124
124
  * @returns {string}
125
125
  */
126
126
  formatInterval(interval: number[]): string;
127
+ /**
128
+ * Returns a UCSC Genome Browser -style string presentation of a single
129
+ * position.
130
+ *
131
+ * @param {number} continuousPos
132
+ * @returns {string}
133
+ */
134
+ formatLocus(continuousPos: number): string;
127
135
  /**
128
136
  * @param {number[]} interval
129
137
  * @returns {[ChromosomalLocus, ChromosomalLocus]}
@@ -1 +1 @@
1
- {"version":3,"file":"genome.d.ts","sourceRoot":"","sources":["../../../src/genome/genome.js"],"names":[],"mappings":"AAwWA;;;GAGG;AACH,gDAFW,MAAM;;;IAOhB;AAED;;;;GAIG;AACH,0CAHW,GAAG,GACF,KAAK,IAAI,gBAAgB,CAIpC;AAED;;;;GAIG;AACH,kDAHW,GAAG,EAAE,GACJ,KAAK,IAAI,gBAAgB,EAAE,CAItC;AAED;;;GAGG;AACH,sCAHW,GAAG,GACD,KAAK,IAAI,YAAY,CASjC;AAED;;;GAGG;AACH,yCAHW,GAAG,GACD,KAAK,IAAI,OAAO,mBAAmB,EAAE,eAAe,CAIhE;AAED;;;GAGG;AACH,4CAHW,GAAG,GACD,KAAK,IAAI,OAAO,mBAAmB,EAAE,kBAAkB,CAInE;AAzZD;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH;IACI;;OAEG;IACH,oBAFW,YAAY,EA6CtB;IA1CG;;;;;;;;MAA2C;IAc3C,oDAAoD;IACpD,aADW,CAAC,UAAU,GAAG,oBAAoB,CAAC,EAAE,CAC3B;IAErB,2CAA2C;IAC3C,0BADW,GAAG,CAAC,MAAM,GAAG,MAAM,EAAE,MAAM,CAAC,CACE;IAEzC,sEAAsE;IACtE,mBADW,GAAG,CAAC,MAAM,GAAG,MAAM,EAAE,UAAU,GAAG,oBAAoB,CAAC,CAChC;IAElC,uBAAuB;IACvB,cADW,MAAM,EAAE,CACG;IAEtB,kBAAkB;IAkBtB,mBAEC;IAED;;OAEG;IACH,cAFW,MAAM,iBAmBhB;IAED,wBAEC;IAED;;;OAGG;IACH,0BAFW,UAAU,EAAE,QA2CtB;IAED,sBAEC;IAED;;;;;OAKG;IACH,oBAHW,MAAM,GAAG,MAAM,OACf,MAAM,UAShB;IAED;;;OAGG;IACH,4BAFW,MAAM,qCAgBhB;IAED;;;;OAIG;IACH,6BAHW,MAAM,GACJ,gBAAgB,CAY5B;IAED;;;OAGG;IACH,oBAFW,MAAM,qCAIhB;IAED;;;;;;;;;;OAUG;IACH,yBAHW,MAAM,EAAE,GACN,MAAM,CAIlB;IAED;;;OAGG;IACH,gCAHW,MAAM,EAAE,GACN,CAAC,gBAAgB,EAAE,gBAAgB,CAAC,CAUhD;IAED;;;;;;OAMG;IACH,kCAFW,gBAAgB,EAAE,YAgB5B;IAED;;;;;OAKG;IACH,wCAHW,CAAC,gBAAgB,EAAE,gBAAgB,CAAC,GAClC,0BAA0B,EAAE,CAiCxC;IAED;;;;OAIG;IACH,4DAFW,MAAM,EAAE,gCAOlB;IAED;;;;OAIG;IACH,mBAHW,MAAM,GACJ,CAAC,MAAM,EAAE,MAAM,CAAC,CAgC5B;CACJ;2BA9VY,OAAO,mBAAmB,EAAE,YAAY;+BACxC,OAAO,mBAAmB,EAAE,gBAAgB;;UAG/C,MAAM;UACN,MAAM;;;;;;WAGN,MAAM;;;;YACN,MAAM;;;;qBACN,MAAM;;;;mBACN,MAAM;wBACN,MAAM,EAAE;;;;SACR,OAAO;;;WAGP,MAAM;cACN,MAAM;YACN,MAAM"}
1
+ {"version":3,"file":"genome.d.ts","sourceRoot":"","sources":["../../../src/genome/genome.js"],"names":[],"mappings":"AAuXA;;;GAGG;AACH,gDAFW,MAAM;;;IAOhB;AAED;;;;GAIG;AACH,0CAHW,GAAG,GACF,KAAK,IAAI,gBAAgB,CAIpC;AAED;;;;GAIG;AACH,kDAHW,GAAG,EAAE,GACJ,KAAK,IAAI,gBAAgB,EAAE,CAItC;AAED;;;GAGG;AACH,sCAHW,GAAG,GACD,KAAK,IAAI,YAAY,CASjC;AAED;;;GAGG;AACH,yCAHW,GAAG,GACD,KAAK,IAAI,OAAO,mBAAmB,EAAE,eAAe,CAIhE;AAED;;;GAGG;AACH,4CAHW,GAAG,GACD,KAAK,IAAI,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C5B;CACJ;2BA7WY,OAAO,mBAAmB,EAAE,YAAY;+BACxC,OAAO,mBAAmB,EAAE,gBAAgB;;UAG/C,MAAM;UACN,MAAM;;;;;;WAGN,MAAM;;;;YACN,MAAM;;;;qBACN,MAAM;;;;mBACN,MAAM;wBACN,MAAM,EAAE;;;;SACR,OAAO;;;WAGP,MAAM;cACN,MAAM;YACN,MAAM"}
@@ -1,7 +1,7 @@
1
1
  import { bisect } from "d3-array";
2
2
  import { tsvParseRows } from "d3-dsv";
3
3
  import { isObject } from "vega-util";
4
- import { formatRange } from "./locusFormat.js";
4
+ import { formatLocus as formatLocusLabel, formatRange } from "./locusFormat.js";
5
5
  import { getContigs } from "./genomes.js";
6
6
  import { concatUrl } from "../utils/url.js";
7
7
 
@@ -232,6 +232,21 @@ export default class Genome {
232
232
  return formatRange(...this.toChromosomalInterval(interval));
233
233
  }
234
234
 
235
+ /**
236
+ * Returns a UCSC Genome Browser -style string presentation of a single
237
+ * position.
238
+ *
239
+ * @param {number} continuousPos
240
+ * @returns {string}
241
+ */
242
+ formatLocus(continuousPos) {
243
+ const locus = this.toChromosomal(continuousPos);
244
+ if (!locus) {
245
+ return undefined;
246
+ }
247
+ return formatLocusLabel(locus);
248
+ }
249
+
235
250
  /**
236
251
  * @param {number[]} interval
237
252
  * @returns {[ChromosomalLocus, ChromosomalLocus]}
@@ -1 +1 @@
1
- {"version":3,"file":"scaleLocus.d.ts","sourceRoot":"","sources":["../../../src/genome/scaleLocus.js"],"names":[],"mappings":"AAMA,2EAyFC;;AASD;;;;GAIG;AACH,8CAJW,OAAO,aAAa,EAAE,OAAO,GAAG;IAAE,MAAM,CAAC,EAAE,MAAM,OAAO,aAAa,EAAE,OAAO,CAAA;CAAE,GAAG,SAAS,SAC5F,MAAM,GACJ,MAAM,GAAG,OAAO,aAAa,EAAE,gBAAgB,CAK3D;AAED;;;;GAIG;AACH,gDAJW,OAAO,aAAa,EAAE,OAAO,GAAG;IAAE,MAAM,CAAC,EAAE,MAA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