@genome-spy/core 0.72.0 → 0.74.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 (396) hide show
  1. package/LICENSE +1 -1
  2. package/dist/bundle/AbortablePromiseCache-3gHJdF3E.js +96 -0
  3. package/dist/bundle/browser-BTgw5ieH.js +126 -0
  4. package/dist/bundle/chunk-DmhlhrBa.js +11 -0
  5. package/dist/bundle/esm-BDFRLEuD.js +1248 -0
  6. package/dist/bundle/esm-BygJiwh0.js +573 -0
  7. package/dist/bundle/esm-CGX-qz1d.js +155 -0
  8. package/dist/bundle/esm-CgfVIRJ-.js +121 -0
  9. package/dist/bundle/esm-CuMSzCHy.js +298 -0
  10. package/dist/bundle/esm-DMXpJXM4.js +369 -0
  11. package/dist/bundle/esm-DQiq2Zhd.js +1426 -0
  12. package/dist/bundle/esm-DtE8VqAv.js +1015 -0
  13. package/dist/bundle/esm-sIoQYZ21.js +461 -0
  14. package/dist/bundle/index.es.js +21078 -24556
  15. package/dist/bundle/index.js +379 -383
  16. package/dist/bundle/parquetRead-DG_-F5j5.js +1609 -0
  17. package/dist/schema.json +13349 -7082
  18. package/dist/src/config/axisConfig.d.ts +16 -0
  19. package/dist/src/config/axisConfig.d.ts.map +1 -0
  20. package/dist/src/config/axisConfig.js +84 -0
  21. package/dist/src/config/defaultConfig.d.ts +3 -0
  22. package/dist/src/config/defaultConfig.d.ts.map +1 -0
  23. package/dist/src/config/defaultConfig.js +38 -0
  24. package/dist/src/config/defaults/axisDefaults.d.ts +5 -0
  25. package/dist/src/config/defaults/axisDefaults.d.ts.map +1 -0
  26. package/dist/src/config/defaults/axisDefaults.js +72 -0
  27. package/dist/src/config/defaults/markDefaults.d.ts +15 -0
  28. package/dist/src/config/defaults/markDefaults.d.ts.map +1 -0
  29. package/dist/src/config/defaults/markDefaults.js +121 -0
  30. package/dist/src/config/defaults/scaleDefaults.d.ts +5 -0
  31. package/dist/src/config/defaults/scaleDefaults.d.ts.map +1 -0
  32. package/dist/src/config/defaults/scaleDefaults.js +18 -0
  33. package/dist/src/config/defaults/titleDefaults.d.ts +5 -0
  34. package/dist/src/config/defaults/titleDefaults.d.ts.map +1 -0
  35. package/dist/src/config/defaults/titleDefaults.js +47 -0
  36. package/dist/src/config/defaults/viewDefaults.d.ts +3 -0
  37. package/dist/src/config/defaults/viewDefaults.d.ts.map +1 -0
  38. package/dist/src/config/defaults/viewDefaults.js +2 -0
  39. package/dist/src/config/markConfig.d.ts +8 -0
  40. package/dist/src/config/markConfig.d.ts.map +1 -0
  41. package/dist/src/config/markConfig.js +27 -0
  42. package/dist/src/config/mergeConfig.d.ts +8 -0
  43. package/dist/src/config/mergeConfig.d.ts.map +1 -0
  44. package/dist/src/config/mergeConfig.js +81 -0
  45. package/dist/src/config/resolveConfig.d.ts +22 -0
  46. package/dist/src/config/resolveConfig.d.ts.map +1 -0
  47. package/dist/src/config/resolveConfig.js +32 -0
  48. package/dist/src/config/scaleConfig.d.ts +40 -0
  49. package/dist/src/config/scaleConfig.d.ts.map +1 -0
  50. package/dist/src/config/scaleConfig.js +220 -0
  51. package/dist/src/config/styleUtils.d.ts +6 -0
  52. package/dist/src/config/styleUtils.d.ts.map +1 -0
  53. package/dist/src/config/styleUtils.js +10 -0
  54. package/dist/src/config/themes.d.ts +15 -0
  55. package/dist/src/config/themes.d.ts.map +1 -0
  56. package/dist/src/config/themes.js +293 -0
  57. package/dist/src/config/titleConfig.d.ts +12 -0
  58. package/dist/src/config/titleConfig.d.ts.map +1 -0
  59. package/dist/src/config/titleConfig.js +42 -0
  60. package/dist/src/config/viewConfig.d.ts +7 -0
  61. package/dist/src/config/viewConfig.d.ts.map +1 -0
  62. package/dist/src/config/viewConfig.js +29 -0
  63. package/dist/src/data/flowNode.d.ts +22 -1
  64. package/dist/src/data/flowNode.d.ts.map +1 -1
  65. package/dist/src/data/flowNode.js +37 -1
  66. package/dist/src/data/formats/bed.d.ts +8 -0
  67. package/dist/src/data/formats/bed.d.ts.map +1 -0
  68. package/dist/src/data/formats/bed.js +58 -0
  69. package/dist/src/data/formats/bedpe.d.ts +8 -0
  70. package/dist/src/data/formats/bedpe.d.ts.map +1 -0
  71. package/dist/src/data/formats/bedpe.js +164 -0
  72. package/dist/src/data/formats/fasta.d.ts.map +1 -1
  73. package/dist/src/data/formats/fasta.js +4 -0
  74. package/dist/src/data/formats/parquet.d.ts.map +1 -1
  75. package/dist/src/data/formats/parquet.js +4 -0
  76. package/dist/src/data/sources/dataSourceFactory.d.ts +2 -13
  77. package/dist/src/data/sources/dataSourceFactory.d.ts.map +1 -1
  78. package/dist/src/data/sources/dataSourceFactory.js +5 -141
  79. package/dist/src/data/sources/dataUtils.d.ts +16 -0
  80. package/dist/src/data/sources/dataUtils.d.ts.map +1 -1
  81. package/dist/src/data/sources/dataUtils.js +53 -3
  82. package/dist/src/data/sources/lazy/axisGenomeSource.d.ts.map +1 -1
  83. package/dist/src/data/sources/lazy/axisGenomeSource.js +11 -0
  84. package/dist/src/data/sources/lazy/axisTickSource.d.ts +1 -1
  85. package/dist/src/data/sources/lazy/axisTickSource.d.ts.map +1 -1
  86. package/dist/src/data/sources/lazy/axisTickSource.js +19 -8
  87. package/dist/src/data/sources/lazy/bamSource.d.ts.map +1 -1
  88. package/dist/src/data/sources/lazy/bamSource.js +11 -0
  89. package/dist/src/data/sources/lazy/bigBedSource.d.ts.map +1 -1
  90. package/dist/src/data/sources/lazy/bigBedSource.js +12 -1
  91. package/dist/src/data/sources/lazy/bigWigSource.d.ts.map +1 -1
  92. package/dist/src/data/sources/lazy/bigWigSource.js +11 -0
  93. package/dist/src/data/sources/lazy/gff3Source.d.ts.map +1 -1
  94. package/dist/src/data/sources/lazy/gff3Source.js +12 -1
  95. package/dist/src/data/sources/lazy/indexedFastaSource.d.ts.map +1 -1
  96. package/dist/src/data/sources/lazy/indexedFastaSource.js +11 -0
  97. package/dist/src/data/sources/lazy/lazyDataSourceRegistry.d.ts +27 -0
  98. package/dist/src/data/sources/lazy/lazyDataSourceRegistry.d.ts.map +1 -0
  99. package/dist/src/data/sources/lazy/lazyDataSourceRegistry.js +65 -0
  100. package/dist/src/data/sources/lazy/registerBuiltInLazySources.d.ts +2 -0
  101. package/dist/src/data/sources/lazy/registerBuiltInLazySources.d.ts.map +1 -0
  102. package/dist/src/data/sources/lazy/registerBuiltInLazySources.js +8 -0
  103. package/dist/src/data/sources/lazy/singleAxisLazySource.d.ts.map +1 -1
  104. package/dist/src/data/sources/lazy/singleAxisLazySource.js +11 -2
  105. package/dist/src/data/sources/lazy/vcfSource.d.ts.map +1 -1
  106. package/dist/src/data/sources/lazy/vcfSource.js +11 -0
  107. package/dist/src/data/sources/urlSource.d.ts +4 -0
  108. package/dist/src/data/sources/urlSource.d.ts.map +1 -1
  109. package/dist/src/data/sources/urlSource.js +138 -16
  110. package/dist/src/data/transforms/aggregate.d.ts +1 -0
  111. package/dist/src/data/transforms/aggregate.d.ts.map +1 -1
  112. package/dist/src/data/transforms/aggregate.js +30 -8
  113. package/dist/src/data/transforms/aggregateOps.d.ts.map +1 -1
  114. package/dist/src/data/transforms/aggregateOps.js +12 -1
  115. package/dist/src/data/transforms/coverage.js +2 -2
  116. package/dist/src/data/transforms/filter.js +1 -1
  117. package/dist/src/data/transforms/filterScoredLabels.d.ts +6 -0
  118. package/dist/src/data/transforms/filterScoredLabels.d.ts.map +1 -1
  119. package/dist/src/data/transforms/filterScoredLabels.js +9 -0
  120. package/dist/src/data/transforms/measureText.d.ts +1 -0
  121. package/dist/src/data/transforms/measureText.d.ts.map +1 -1
  122. package/dist/src/data/transforms/measureText.js +14 -5
  123. package/dist/src/data/transforms/pileup.d.ts.map +1 -1
  124. package/dist/src/data/transforms/pileup.js +1 -2
  125. package/dist/src/data/transforms/regexFold.d.ts.map +1 -1
  126. package/dist/src/data/transforms/regexFold.js +0 -1
  127. package/dist/src/embedFactory.d.ts +13 -0
  128. package/dist/src/embedFactory.d.ts.map +1 -0
  129. package/dist/src/embedFactory.js +127 -0
  130. package/dist/src/encoder/accessor.d.ts +3 -12
  131. package/dist/src/encoder/accessor.d.ts.map +1 -1
  132. package/dist/src/encoder/accessor.js +10 -65
  133. package/dist/src/encoder/encoder.d.ts +51 -8
  134. package/dist/src/encoder/encoder.d.ts.map +1 -1
  135. package/dist/src/encoder/encoder.js +179 -55
  136. package/dist/src/fonts/bmFontManager.js +1 -1
  137. package/dist/src/full.d.ts +2 -0
  138. package/dist/src/full.d.ts.map +1 -0
  139. package/dist/src/full.js +2 -0
  140. package/dist/src/genome/assemblyPreflight.d.ts +31 -0
  141. package/dist/src/genome/assemblyPreflight.d.ts.map +1 -0
  142. package/dist/src/genome/assemblyPreflight.js +99 -0
  143. package/dist/src/genome/genome.d.ts +10 -2
  144. package/dist/src/genome/genome.d.ts.map +1 -1
  145. package/dist/src/genome/genome.js +20 -2
  146. package/dist/src/genome/genomeStore.d.ts +34 -3
  147. package/dist/src/genome/genomeStore.d.ts.map +1 -1
  148. package/dist/src/genome/genomeStore.js +409 -18
  149. package/dist/src/genome/rootGenomeConfig.d.ts +26 -0
  150. package/dist/src/genome/rootGenomeConfig.d.ts.map +1 -0
  151. package/dist/src/genome/rootGenomeConfig.js +98 -0
  152. package/dist/src/genome/scaleLocus.d.ts.map +1 -1
  153. package/dist/src/genome/scaleLocus.js +26 -7
  154. package/dist/src/genomeSpy/cursorManager.d.ts +69 -0
  155. package/dist/src/genomeSpy/cursorManager.d.ts.map +1 -0
  156. package/dist/src/genomeSpy/cursorManager.js +131 -0
  157. package/dist/src/genomeSpy/headlessBootstrap.d.ts +113 -0
  158. package/dist/src/genomeSpy/headlessBootstrap.d.ts.map +1 -0
  159. package/dist/src/genomeSpy/headlessBootstrap.js +246 -0
  160. package/dist/src/genomeSpy/interactionController.d.ts +10 -1
  161. package/dist/src/genomeSpy/interactionController.d.ts.map +1 -1
  162. package/dist/src/genomeSpy/interactionController.js +448 -40
  163. package/dist/src/genomeSpy/interactionDispatcher.d.ts +50 -0
  164. package/dist/src/genomeSpy/interactionDispatcher.d.ts.map +1 -0
  165. package/dist/src/genomeSpy/interactionDispatcher.js +203 -0
  166. package/dist/src/genomeSpy/renderCoordinator.js +1 -1
  167. package/dist/src/genomeSpy/viewContextFactory.d.ts +4 -2
  168. package/dist/src/genomeSpy/viewContextFactory.d.ts.map +1 -1
  169. package/dist/src/genomeSpy/viewContextFactory.js +12 -4
  170. package/dist/src/genomeSpy/viewDataInit.d.ts.map +1 -1
  171. package/dist/src/genomeSpy/viewDataInit.js +7 -3
  172. package/dist/src/genomeSpy.d.ts +1 -114
  173. package/dist/src/genomeSpy.d.ts.map +1 -1
  174. package/dist/src/genomeSpy.js +7 -614
  175. package/dist/src/genomeSpyBase.d.ts +133 -0
  176. package/dist/src/genomeSpyBase.d.ts.map +1 -0
  177. package/dist/src/genomeSpyBase.js +719 -0
  178. package/dist/src/gl/arrayBuilder.d.ts.map +1 -1
  179. package/dist/src/gl/arrayBuilder.js +0 -3
  180. package/dist/src/gl/canvasSizeHelper.d.ts +74 -0
  181. package/dist/src/gl/canvasSizeHelper.d.ts.map +1 -0
  182. package/dist/src/gl/canvasSizeHelper.js +203 -0
  183. package/dist/src/gl/colorUtils.d.ts.map +1 -1
  184. package/dist/src/gl/colorUtils.js +3 -0
  185. package/dist/src/gl/dataToVertices.d.ts.map +1 -1
  186. package/dist/src/gl/dataToVertices.js +13 -8
  187. package/dist/src/gl/glslScaleGenerator.d.ts +2 -2
  188. package/dist/src/gl/glslScaleGenerator.d.ts.map +1 -1
  189. package/dist/src/gl/glslScaleGenerator.js +5 -7
  190. package/dist/src/gl/webGLHelper.d.ts +25 -11
  191. package/dist/src/gl/webGLHelper.d.ts.map +1 -1
  192. package/dist/src/gl/webGLHelper.js +59 -33
  193. package/dist/src/index.d.ts +3 -9
  194. package/dist/src/index.d.ts.map +1 -1
  195. package/dist/src/index.js +5 -111
  196. package/dist/src/marks/__snapshots__/shaderSnapshot.test.js.snap +4462 -0
  197. package/dist/src/marks/link.d.ts.map +1 -1
  198. package/dist/src/marks/link.js +5 -26
  199. package/dist/src/marks/mark.d.ts +8 -1
  200. package/dist/src/marks/mark.d.ts.map +1 -1
  201. package/dist/src/marks/mark.js +67 -21
  202. package/dist/src/marks/markUtils.d.ts +18 -1
  203. package/dist/src/marks/markUtils.d.ts.map +1 -1
  204. package/dist/src/marks/markUtils.js +52 -4
  205. package/dist/src/marks/point.d.ts.map +1 -1
  206. package/dist/src/marks/point.js +6 -26
  207. package/dist/src/marks/rect.d.ts.map +1 -1
  208. package/dist/src/marks/rect.js +13 -21
  209. package/dist/src/marks/rule.d.ts +7 -2
  210. package/dist/src/marks/rule.d.ts.map +1 -1
  211. package/dist/src/marks/rule.js +125 -16
  212. package/dist/src/marks/text.d.ts.map +1 -1
  213. package/dist/src/marks/text.js +5 -47
  214. package/dist/src/minimal.d.ts +8 -0
  215. package/dist/src/minimal.d.ts.map +1 -0
  216. package/dist/src/minimal.js +21 -0
  217. package/dist/src/paramRuntime/viewParamRuntime.d.ts +19 -0
  218. package/dist/src/paramRuntime/viewParamRuntime.d.ts.map +1 -1
  219. package/dist/src/paramRuntime/viewParamRuntime.js +35 -0
  220. package/dist/src/scale/scale.d.ts.map +1 -1
  221. package/dist/src/scale/scale.js +13 -7
  222. package/dist/src/scales/axisResolution.d.ts.map +1 -1
  223. package/dist/src/scales/axisResolution.js +9 -5
  224. package/dist/src/scales/domainPlanner.d.ts +58 -7
  225. package/dist/src/scales/domainPlanner.d.ts.map +1 -1
  226. package/dist/src/scales/domainPlanner.js +395 -40
  227. package/dist/src/scales/indexLikeDomainUtils.d.ts +29 -0
  228. package/dist/src/scales/indexLikeDomainUtils.d.ts.map +1 -0
  229. package/dist/src/scales/indexLikeDomainUtils.js +67 -0
  230. package/dist/src/scales/resolutionMemberOrder.d.ts +15 -0
  231. package/dist/src/scales/resolutionMemberOrder.d.ts.map +1 -0
  232. package/dist/src/scales/resolutionMemberOrder.js +22 -0
  233. package/dist/src/scales/scaleInstanceManager.d.ts +2 -1
  234. package/dist/src/scales/scaleInstanceManager.d.ts.map +1 -1
  235. package/dist/src/scales/scaleInstanceManager.js +10 -11
  236. package/dist/src/scales/scaleInteractionController.d.ts.map +1 -1
  237. package/dist/src/scales/scaleInteractionController.js +59 -18
  238. package/dist/src/scales/scalePropsResolver.d.ts +3 -1
  239. package/dist/src/scales/scalePropsResolver.d.ts.map +1 -1
  240. package/dist/src/scales/scalePropsResolver.js +83 -6
  241. package/dist/src/scales/scaleResolution.d.ts +39 -0
  242. package/dist/src/scales/scaleResolution.d.ts.map +1 -1
  243. package/dist/src/scales/scaleResolution.js +504 -82
  244. package/dist/src/scales/scaleResolutionTestUtils.d.ts +21 -0
  245. package/dist/src/scales/scaleResolutionTestUtils.d.ts.map +1 -0
  246. package/dist/src/scales/scaleResolutionTestUtils.js +37 -0
  247. package/dist/src/scales/scaleRules.d.ts.map +1 -1
  248. package/dist/src/scales/scaleRules.js +16 -2
  249. package/dist/src/scales/selectionDomainUtils.d.ts +52 -0
  250. package/dist/src/scales/selectionDomainUtils.d.ts.map +1 -0
  251. package/dist/src/scales/selectionDomainUtils.js +194 -0
  252. package/dist/src/scales/zoomDomainUtils.d.ts +18 -0
  253. package/dist/src/scales/zoomDomainUtils.d.ts.map +1 -0
  254. package/dist/src/scales/zoomDomainUtils.js +69 -0
  255. package/dist/src/screenshotHarness.d.ts +16 -0
  256. package/dist/src/screenshotHarness.d.ts.map +1 -0
  257. package/dist/src/screenshotHarness.js +241 -0
  258. package/dist/src/singlePageApp.js +1 -1
  259. package/dist/src/spec/axis.d.ts +41 -30
  260. package/dist/src/spec/channel.d.ts +15 -9
  261. package/dist/src/spec/config.d.ts +264 -0
  262. package/dist/src/spec/data.d.ts +30 -3
  263. package/dist/src/spec/decoration.d.ts +51 -0
  264. package/dist/src/spec/exampleFiles.d.ts +12 -0
  265. package/dist/src/spec/exampleFiles.d.ts.map +1 -0
  266. package/dist/src/spec/exampleFiles.js +52 -0
  267. package/dist/src/spec/font.d.ts +1 -1
  268. package/dist/src/spec/genome.d.ts +22 -2
  269. package/dist/src/spec/mark.d.ts +97 -13
  270. package/dist/src/spec/parameter.d.ts +62 -5
  271. package/dist/src/spec/root.d.ts +34 -1
  272. package/dist/src/spec/scale.d.ts +46 -5
  273. package/dist/src/spec/title.d.ts +13 -2
  274. package/dist/src/spec/tooltip.d.ts +1 -1
  275. package/dist/src/spec/transform.d.ts +39 -4
  276. package/dist/src/spec/view.d.ts +67 -19
  277. package/dist/src/styles/genome-spy.css +63 -55
  278. package/dist/src/styles/genome-spy.css.d.ts +1 -1
  279. package/dist/src/styles/genome-spy.css.d.ts.map +1 -1
  280. package/dist/src/styles/genome-spy.css.js +31 -22
  281. package/dist/src/testSetup.d.ts +2 -0
  282. package/dist/src/testSetup.d.ts.map +1 -0
  283. package/dist/src/testSetup.js +5 -0
  284. package/dist/src/tooltip/dataTooltipHandler.js +66 -11
  285. package/dist/src/tooltip/tooltipContext.d.ts.map +1 -1
  286. package/dist/src/tooltip/tooltipContext.js +3 -2
  287. package/dist/src/types/embedApi.d.ts +26 -0
  288. package/dist/src/types/encoder.d.ts +17 -15
  289. package/dist/src/types/scaleResolutionApi.d.ts +20 -0
  290. package/dist/src/types/viewContext.d.ts +23 -1
  291. package/dist/src/utils/expression.d.ts +2 -2
  292. package/dist/src/utils/expression.d.ts.map +1 -1
  293. package/dist/src/utils/expression.js +63 -8
  294. package/dist/src/utils/field.d.ts.map +1 -1
  295. package/dist/src/utils/field.js +0 -1
  296. package/dist/src/utils/inertia.d.ts.map +1 -1
  297. package/dist/src/utils/inertia.js +0 -1
  298. package/dist/src/utils/inferSpecBaseUrl.d.ts +14 -0
  299. package/dist/src/utils/inferSpecBaseUrl.d.ts.map +1 -0
  300. package/dist/src/utils/inferSpecBaseUrl.js +73 -0
  301. package/dist/src/utils/inputBinding.d.ts +1 -1
  302. package/dist/src/utils/interaction.d.ts +109 -0
  303. package/dist/src/utils/interaction.d.ts.map +1 -0
  304. package/dist/src/utils/interaction.js +200 -0
  305. package/dist/src/utils/interactionEvent.d.ts +62 -33
  306. package/dist/src/utils/interactionEvent.d.ts.map +1 -1
  307. package/dist/src/utils/interactionEvent.js +86 -48
  308. package/dist/src/utils/kWayMerge.js +1 -1
  309. package/dist/src/utils/mergeObjects.d.ts.map +1 -1
  310. package/dist/src/utils/mergeObjects.js +0 -2
  311. package/dist/src/utils/radixSort.d.ts.map +1 -1
  312. package/dist/src/utils/radixSort.js +0 -2
  313. package/dist/src/utils/throttle.d.ts.map +1 -1
  314. package/dist/src/utils/throttle.js +0 -2
  315. package/dist/src/utils/ui/tooltip.d.ts +1 -0
  316. package/dist/src/utils/ui/tooltip.d.ts.map +1 -1
  317. package/dist/src/utils/ui/tooltip.js +1 -0
  318. package/dist/src/utils/url.js +1 -1
  319. package/dist/src/view/axisGridView.d.ts +1 -1
  320. package/dist/src/view/axisGridView.d.ts.map +1 -1
  321. package/dist/src/view/axisGridView.js +2 -47
  322. package/dist/src/view/axisView.d.ts +2 -3
  323. package/dist/src/view/axisView.d.ts.map +1 -1
  324. package/dist/src/view/axisView.js +251 -106
  325. package/dist/src/view/concatView.d.ts +2 -1
  326. package/dist/src/view/concatView.d.ts.map +1 -1
  327. package/dist/src/view/concatView.js +4 -2
  328. package/dist/src/view/containerMutationHelper.d.ts +3 -0
  329. package/dist/src/view/containerMutationHelper.d.ts.map +1 -1
  330. package/dist/src/view/containerMutationHelper.js +12 -1
  331. package/dist/src/view/dataReadiness.d.ts +2 -2
  332. package/dist/src/view/dataReadiness.d.ts.map +1 -1
  333. package/dist/src/view/dataReadiness.js +63 -58
  334. package/dist/src/view/facetView.d.ts +1 -1
  335. package/dist/src/view/facetView.js +4 -4
  336. package/dist/src/view/flowBuilder.js +2 -2
  337. package/dist/src/view/gridView/gridChild.d.ts +13 -0
  338. package/dist/src/view/gridView/gridChild.d.ts.map +1 -1
  339. package/dist/src/view/gridView/gridChild.js +247 -49
  340. package/dist/src/view/gridView/gridView.d.ts.map +1 -1
  341. package/dist/src/view/gridView/gridView.js +296 -99
  342. package/dist/src/view/gridView/keyboardZoomController.d.ts +2 -2
  343. package/dist/src/view/gridView/keyboardZoomController.d.ts.map +1 -1
  344. package/dist/src/view/gridView/keyboardZoomController.js +1 -1
  345. package/dist/src/view/gridView/scrollbar.d.ts.map +1 -1
  346. package/dist/src/view/gridView/scrollbar.js +4 -2
  347. package/dist/src/view/gridView/selectionRect.d.ts +4 -0
  348. package/dist/src/view/gridView/selectionRect.d.ts.map +1 -1
  349. package/dist/src/view/gridView/selectionRect.js +20 -1
  350. package/dist/src/view/gridView/separatorView.d.ts +1 -0
  351. package/dist/src/view/gridView/separatorView.d.ts.map +1 -1
  352. package/dist/src/view/gridView/separatorView.js +9 -0
  353. package/dist/src/view/interactionRouting.d.ts +20 -0
  354. package/dist/src/view/interactionRouting.d.ts.map +1 -0
  355. package/dist/src/view/interactionRouting.js +53 -0
  356. package/dist/src/view/layerView.d.ts.map +1 -1
  357. package/dist/src/view/layerView.js +12 -9
  358. package/dist/src/view/layout/grid.js +1 -1
  359. package/dist/src/view/renderingContext/bufferedViewRenderingContext.d.ts.map +1 -1
  360. package/dist/src/view/renderingContext/bufferedViewRenderingContext.js +0 -2
  361. package/dist/src/view/testUtils.d.ts +17 -3
  362. package/dist/src/view/testUtils.d.ts.map +1 -1
  363. package/dist/src/view/testUtils.js +62 -69
  364. package/dist/src/view/title.d.ts +8 -1
  365. package/dist/src/view/title.d.ts.map +1 -1
  366. package/dist/src/view/title.js +66 -76
  367. package/dist/src/view/unitView.d.ts +1 -1
  368. package/dist/src/view/unitView.d.ts.map +1 -1
  369. package/dist/src/view/unitView.js +67 -17
  370. package/dist/src/view/view.d.ts +76 -30
  371. package/dist/src/view/view.d.ts.map +1 -1
  372. package/dist/src/view/view.js +136 -47
  373. package/dist/src/view/viewFactory.d.ts +11 -3
  374. package/dist/src/view/viewFactory.d.ts.map +1 -1
  375. package/dist/src/view/viewFactory.js +37 -11
  376. package/dist/src/view/viewUtils.d.ts.map +1 -1
  377. package/dist/src/view/viewUtils.js +41 -5
  378. package/dist/src/view/zoom.d.ts +15 -3
  379. package/dist/src/view/zoom.d.ts.map +1 -1
  380. package/dist/src/view/zoom.js +375 -80
  381. package/package.json +20 -10
  382. package/dist/bundle/AbortablePromiseCache-Dj0vzLnp.js +0 -149
  383. package/dist/bundle/browser-0iNU5Wit.js +0 -138
  384. package/dist/bundle/index-BYsZN7b0.js +0 -1597
  385. package/dist/bundle/index-C3kClAEN.js +0 -1771
  386. package/dist/bundle/index-C7wOh6y1.js +0 -657
  387. package/dist/bundle/index-CRaQAuki.js +0 -326
  388. package/dist/bundle/index-D9v1PCj9.js +0 -507
  389. package/dist/bundle/index-GDOuv_D5.js +0 -266
  390. package/dist/bundle/index-Gt44EOIH.js +0 -628
  391. package/dist/bundle/inflate-GtwLkvSP.js +0 -1048
  392. package/dist/bundle/parquetRead-BnAGCa4_.js +0 -1663
  393. package/dist/bundle/unzip-Bac01w6X.js +0 -1492
  394. package/dist/src/config/scaleDefaults.d.ts +0 -8
  395. package/dist/src/config/scaleDefaults.d.ts.map +0 -1
  396. package/dist/src/config/scaleDefaults.js +0 -45
@@ -1,17 +1,18 @@
1
1
  const css = `
2
- :root {
2
+ @scope {
3
+ :scope {
3
4
  --genome-spy-basic-spacing: 10px;
4
- --genome-spy-font-family: system-ui, "Segoe UI", Roboto, Helvetica, Arial,
5
- sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
6
- }
5
+ --genome-spy-font-family:
6
+ system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif,
7
+ "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
7
8
 
8
- .genome-spy {
9
9
  font-family: var(--genome-spy-font-family);
10
10
 
11
11
  position: relative;
12
12
 
13
13
  display: flex;
14
14
  flex-direction: column;
15
+ }
15
16
 
16
17
  .canvas-wrapper {
17
18
  position: relative;
@@ -21,6 +22,7 @@ overflow: hidden;
21
22
 
22
23
  canvas {
23
24
  display: block;
25
+ touch-action: none;
24
26
  transform: scale(1, 1);
25
27
  opacity: 1;
26
28
  transition:
@@ -163,6 +165,13 @@ margin-left: 0.4em;
163
165
  box-shadow: 0px 0px 3px 1px white;
164
166
  }
165
167
 
168
+ .color-legend-unmapped {
169
+ background-color: transparent;
170
+ border: 1px solid black;
171
+ box-sizing: border-box;
172
+ box-shadow: none;
173
+ }
174
+
166
175
  .attributes {
167
176
  .hovered {
168
177
  background-color: #e0e0e0;
@@ -182,23 +191,6 @@ font-size: 90%;
182
191
  }
183
192
  }
184
193
 
185
- .message-box {
186
- display: flex;
187
- align-items: center;
188
- justify-content: center;
189
- position: absolute;
190
- top: 0;
191
- height: 100%;
192
- width: 100%;
193
-
194
- > div {
195
- border: 1px solid red;
196
- padding: 10px;
197
- background: #fff0f0;
198
- }
199
- }
200
- }
201
-
202
194
  .gs-input-binding {
203
195
  display: grid;
204
196
  grid-template-columns: max-content max-content;
@@ -242,5 +234,22 @@ flex-basis: content;
242
234
  font-size: 14px;
243
235
  padding: var(--genome-spy-basic-spacing);
244
236
  }
237
+
238
+ .message-box {
239
+ display: flex;
240
+ align-items: center;
241
+ justify-content: center;
242
+ position: absolute;
243
+ top: 0;
244
+ height: 100%;
245
+ width: 100%;
246
+
247
+ > div {
248
+ border: 1px solid red;
249
+ padding: 10px;
250
+ background: #fff0f0;
251
+ }
252
+ }
253
+ }
245
254
  `;
246
255
  export default css;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=testSetup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"testSetup.d.ts","sourceRoot":"","sources":["../../src/testSetup.js"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import "./data/formats/parquet.js";
2
+ import "./data/formats/bed.js";
3
+ import "./data/formats/bedpe.js";
4
+ import "./data/formats/fasta.js";
5
+ import "./data/sources/lazy/registerBuiltInLazySources.js";
@@ -1,4 +1,6 @@
1
1
  import { html } from "lit";
2
+ import { splitAccessPath } from "vega-util";
3
+ import { getEncoderDataAccessor } from "../encoder/encoder.js";
2
4
  import formatObject from "../utils/formatObject.js";
3
5
  import { flattenDatumRows } from "./flattenDatumRows.js";
4
6
  import createTooltipContext from "./tooltipContext.js";
@@ -7,23 +9,73 @@ import createTooltipContext from "./tooltipContext.js";
7
9
  * @type {import("./tooltipHandler.js").TooltipHandler}
8
10
  */
9
11
  export default async function dataTooltipHandler(datum, mark, params, context) {
12
+ /**
13
+ * @param {string} fieldPath
14
+ * @returns {string}
15
+ */
16
+ // Tooltip rows are flattened using dot notation. Normalize encoded field
17
+ // access paths (for example bracket syntax) to the same shape.
18
+ const normalizeFieldPath = (fieldPath) =>
19
+ splitAccessPath(fieldPath).join(".");
20
+
21
+ /**
22
+ * @param {unknown} value
23
+ * @returns {boolean}
24
+ */
25
+ // Treat NaN like missing in tooltip semantics to avoid showing an
26
+ // "unmapped" marker for invalid numeric values.
27
+ const hasValue = (value) =>
28
+ value !== null &&
29
+ value !== undefined &&
30
+ !(typeof value === "number" && Number.isNaN(value));
31
+
10
32
  /**
11
33
  * @param {string} key
34
+ * @param {any} value
12
35
  * @param {object} datum
13
36
  */
14
- const legend = (key, datum) => {
37
+ const legend = (key, value, datum) => {
15
38
  for (const [channel, encoder] of Object.entries(mark.encoders)) {
16
- if (encoder?.dataAccessor?.fields.includes(key)) {
39
+ const fields = encoder
40
+ ? getEncoderDataAccessor(encoder)?.fields
41
+ : undefined;
42
+ if (
43
+ fields &&
44
+ fields.some(
45
+ (fieldPath) =>
46
+ fieldPath === key ||
47
+ normalizeFieldPath(fieldPath) === key
48
+ )
49
+ ) {
17
50
  switch (channel) {
18
51
  case "color":
19
52
  case "fill":
20
- case "stroke":
21
- return html`
22
- <span
23
- class="color-legend"
24
- style=${`background-color: ${encoder(datum)}`}
25
- ></span>
26
- `;
53
+ case "stroke": {
54
+ const encodedColor = encoder(datum);
55
+ if (
56
+ encodedColor !== null &&
57
+ encodedColor !== undefined
58
+ ) {
59
+ return html`
60
+ <span
61
+ class="color-legend"
62
+ style=${"background-color: " +
63
+ String(encodedColor)}
64
+ ></span>
65
+ `;
66
+ } else if (hasValue(value)) {
67
+ // The field has a value but the scale did not map it
68
+ // (typically outside/absent domain): show an empty,
69
+ // black-stroked swatch to signal the mismatch.
70
+ return html`
71
+ <span
72
+ class="color-legend color-legend-unmapped"
73
+ ></span>
74
+ `;
75
+ } else {
76
+ return "";
77
+ }
78
+ }
27
79
  default:
28
80
  }
29
81
  }
@@ -39,7 +91,10 @@ export default async function dataTooltipHandler(datum, mark, params, context) {
39
91
  const genomicRows = tooltipContext.genomicRows ?? [];
40
92
  const hiddenRowKeys = new Set(tooltipContext.hiddenRowKeys ?? []);
41
93
 
42
- const visibleRawRows = rawRows.filter((row) => !hiddenRowKeys.has(row.key));
94
+ const visibleRawRows = rawRows.filter(
95
+ (row) =>
96
+ !hiddenRowKeys.has(row.key) || legend(row.key, row.value, datum)
97
+ );
43
98
  const orderedRows = [...genomicRows, ...visibleRawRows];
44
99
  if (!orderedRows.length) {
45
100
  return;
@@ -47,7 +102,7 @@ export default async function dataTooltipHandler(datum, mark, params, context) {
47
102
 
48
103
  const tableContents = orderedRows.map((row) => {
49
104
  const value = formatObject(row.value);
50
- const valueLegend = legend(row.key, datum);
105
+ const valueLegend = legend(row.key, row.value, datum);
51
106
  return html`
52
107
  <tr>
53
108
  <th>${row.key}</th>
@@ -1 +1 @@
1
- {"version":3,"file":"tooltipContext.d.ts","sourceRoot":"","sources":["../../../src/tooltip/tooltipContext.js"],"names":[],"mappings":"AA2BA;;;;;;;GAOG;AACH,oDALW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QACnB,OAAO,kBAAkB,EAAE,OAAO,WAClC,OAAO,qBAAqB,EAAE,oBAAoB,GAChD,cAAc,CAgE1B;6BAhGY,OAAO,qBAAqB,EAAE,cAAc;wCAC5C,OAAO,qBAAqB,EAAE,yBAAyB;yBACvD,OAAO,qBAAqB,EAAE,UAAU"}
1
+ {"version":3,"file":"tooltipContext.d.ts","sourceRoot":"","sources":["../../../src/tooltip/tooltipContext.js"],"names":[],"mappings":"AA4BA;;;;;;;GAOG;AACH,oDALW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QACnB,OAAO,kBAAkB,EAAE,OAAO,WAClC,OAAO,qBAAqB,EAAE,oBAAoB,GAChD,cAAc,CAgE1B;6BAjGY,OAAO,qBAAqB,EAAE,cAAc;wCAC5C,OAAO,qBAAqB,EAAE,yBAAyB;yBACvD,OAAO,qBAAqB,EAAE,UAAU"}
@@ -5,6 +5,7 @@
5
5
  */
6
6
 
7
7
  import { asArray } from "../utils/arrayUtils.js";
8
+ import { getEncoderDataAccessor } from "../encoder/encoder.js";
8
9
  import { flattenDatumRows } from "./flattenDatumRows.js";
9
10
 
10
11
  /** @type {Record<"x" | "y", "x2" | "y2">} */
@@ -366,7 +367,7 @@ function readLocusCoordinate(mark, channel, datum) {
366
367
  return;
367
368
  }
368
369
 
369
- const accessor = encoder.dataAccessor;
370
+ const accessor = getEncoderDataAccessor(encoder);
370
371
  if (!accessor) {
371
372
  return;
372
373
  }
@@ -535,7 +536,7 @@ function verifyLinearizationMapping(datum, linearizedField, mapping, mark) {
535
536
  let expected;
536
537
  try {
537
538
  expected = genome.toContinuous(chrom, numericPos - mapping.offset);
538
- } catch (_error) {
539
+ } catch {
539
540
  return false;
540
541
  }
541
542
 
@@ -1,6 +1,7 @@
1
1
  import { ScaleResolutionApi } from "./scaleResolutionApi.js";
2
2
  import { TooltipHandler } from "../tooltip/tooltipHandler.js";
3
3
  import { RootSpec } from "../spec/root.js";
4
+ import { GenomeSpyConfig } from "../spec/config.js";
4
5
 
5
6
  /**
6
7
  * Embeds GenomeSpy into the DOM
@@ -41,6 +42,12 @@ export interface EmbedOptions {
41
42
  */
42
43
  powerPreference?: "default" | "high-performance" | "low-power";
43
44
 
45
+ /**
46
+ * Optional theme configuration object that is merged after the internal
47
+ * defaults and built-in theme, but before `spec.config`.
48
+ */
49
+ theme?: GenomeSpyConfig;
50
+
44
51
  /**
45
52
  * Optional hook for handling launch errors. Return true to suppress default UI.
46
53
  */
@@ -75,6 +82,12 @@ export interface EmbedResult {
75
82
  */
76
83
  getScaleResolutionByName: (name: string) => ScaleResolutionApi;
77
84
 
85
+ /**
86
+ * Waits until lazy data sources have loaded data for the current visible
87
+ * positional domain.
88
+ */
89
+ awaitVisibleLazyData: (signal?: AbortSignal) => Promise<void>;
90
+
78
91
  /**
79
92
  * Updates a named dataset
80
93
  *
@@ -83,6 +96,19 @@ export interface EmbedResult {
83
96
  */
84
97
  updateNamedData: (name: string, data?: any[]) => void;
85
98
 
99
+ /**
100
+ * Returns the bounds reached by the last rendered layout in CSS pixels.
101
+ */
102
+ getRenderedBounds: () => {
103
+ width: number | undefined;
104
+ height: number | undefined;
105
+ };
106
+
107
+ /**
108
+ * Returns the current logical canvas size in CSS pixels.
109
+ */
110
+ getLogicalCanvasSize: () => { width: number; height: number };
111
+
86
112
  /**
87
113
  * Returns a PNG data URL of the current canvas.
88
114
  *
@@ -25,7 +25,6 @@ import { ScaleLocus } from "../genome/scaleLocus.js";
25
25
  import { ScaleIndex } from "../genome/scaleIndex.js";
26
26
  import { Scalar } from "../spec/channel.js";
27
27
  import { Datum } from "../data/flowNode.js";
28
- import { ExprRefFunction } from "../paramRuntime/types.js";
29
28
 
30
29
  export interface Accessor<T = Scalar> {
31
30
  (datum: Datum): T;
@@ -86,11 +85,6 @@ export interface Accessor<T = Scalar> {
86
85
  * Format: <type>|<domainKeyBase>
87
86
  */
88
87
  domainKey?: string;
89
-
90
- /**
91
- * This accessor should be used when the predicate is true
92
- */
93
- predicate: Predicate;
94
88
  }
95
89
 
96
90
  export interface ScaleAccessor<T = Scalar> extends Accessor<T> {
@@ -99,7 +93,9 @@ export interface ScaleAccessor<T = Scalar> extends Accessor<T> {
99
93
  domainKeyBase: string;
100
94
  }
101
95
 
102
- export interface Predicate extends ExprRefFunction {
96
+ export interface Predicate {
97
+ (datum: Datum): boolean;
98
+
103
99
  /**
104
100
  * The parameter the predicate is based on
105
101
  */
@@ -113,6 +109,18 @@ export interface Predicate extends ExprRefFunction {
113
109
  empty?: boolean;
114
110
  }
115
111
 
112
+ export interface EncodingBranch {
113
+ /**
114
+ * The accessor used by this branch.
115
+ */
116
+ accessor: Accessor;
117
+
118
+ /**
119
+ * Predicate controlling whether this branch is active.
120
+ */
121
+ predicate: Predicate;
122
+ }
123
+
116
124
  /**
117
125
  * Wraps one or more accessors, uses an optional scale to encode the data.
118
126
  */
@@ -134,15 +142,9 @@ export interface Encoder {
134
142
  scale?: VegaScale;
135
143
 
136
144
  /**
137
- * An accessor, or if the ChannelDef has conditions, all the accessors.
138
- */
139
- accessors: Accessor[];
140
-
141
- /**
142
- * The encoded channel may have a maximum of one accessor accessing the
143
- * data fields. It's this one.
145
+ * Ordered branches of this encoder. The last branch is the fallback branch.
144
146
  */
145
- dataAccessor?: Accessor;
147
+ branches: EncodingBranch[];
146
148
 
147
149
  /**
148
150
  * The ChannelDef that the encoder is based on
@@ -29,12 +29,32 @@ export interface ScaleResolutionApi {
29
29
  */
30
30
  getDomain(): any[];
31
31
 
32
+ /**
33
+ * Returns true if the domain has been provided explicitly in the spec.
34
+ */
35
+ isDomainDefinedExplicitly(): boolean;
36
+
37
+ /**
38
+ * Returns true when the scale domain has moved beyond the placeholder startup state.
39
+ */
40
+ isDomainInitialized(): boolean;
41
+
32
42
  /**
33
43
  * Returns the current, possible zoomed domain converted into complex objects
34
44
  * such as genomic coordinates.
35
45
  */
36
46
  getComplexDomain(): NumericDomain | ComplexDomain;
37
47
 
48
+ getLinkedSelectionDomainInfo():
49
+ | {
50
+ param: string;
51
+ encoding: "x" | "y";
52
+ persist: boolean;
53
+ }
54
+ | undefined;
55
+
56
+ isZoomed(): boolean;
57
+
38
58
  isZoomable(): boolean;
39
59
 
40
60
  zoomTo(
@@ -18,6 +18,10 @@ export interface Hover {
18
18
 
19
19
  export type DataLoadingStatus = "loading" | "complete" | "error";
20
20
 
21
+ export interface CreateViewOptions {
22
+ layoutSizeParams?: "own" | "inherit";
23
+ }
24
+
21
25
  /**
22
26
  * ViewContext provides essential data and interfaces to View classes.
23
27
  */
@@ -37,6 +41,18 @@ export default interface ViewContext {
37
41
 
38
42
  getCurrentHover: () => Hover;
39
43
 
44
+ /**
45
+ * Internal interaction hook: suspends hover recomputation during active
46
+ * drag interactions.
47
+ */
48
+ suspendHoverTracking: () => void;
49
+
50
+ /**
51
+ * Internal interaction hook: resumes hover recomputation after an active
52
+ * drag interaction.
53
+ */
54
+ resumeHoverTracking: (event?: MouseEvent) => void;
55
+
40
56
  /**
41
57
  * Adds a keyboard event listener to the document. Cleanup is performed automatically
42
58
  * when GenomeSpy is finalized.
@@ -82,6 +98,11 @@ export default interface ViewContext {
82
98
 
83
99
  isViewSpec: (spec: any) => boolean;
84
100
 
101
+ /**
102
+ * Returns the base config scope used for root-level resolution.
103
+ */
104
+ getBaseConfig: () => GenomeSpyConfig;
105
+
85
106
  /**
86
107
  *
87
108
  * @param spec
@@ -100,6 +121,7 @@ export default interface ViewContext {
100
121
  * Validates whether the imported spec is acceptable for the importer.
101
122
  * The function should throw an Error if the view is not acceptable.
102
123
  */
103
- validator?: (spec: ViewSpec) => void
124
+ validator?: (spec: ViewSpec) => void,
125
+ options?: CreateViewOptions
104
126
  ) => Promise<View>;
105
127
  }
@@ -12,9 +12,9 @@
12
12
  export default function createFunction(expr: string, globalObject?: {}): ExpressionFunction;
13
13
  /**
14
14
  * @param {string} expr
15
- * @returns {(event: UIEvent) => boolean}
15
+ * @returns {(event: UIEvent | import("./interactionEvent.js").WheelLikeEvent) => boolean}
16
16
  */
17
- export function createEventFilterFunction(expr: string): (event: UIEvent) => boolean;
17
+ export function createEventFilterFunction(expr: string): (event: UIEvent | import("./interactionEvent.js").WheelLikeEvent) => boolean;
18
18
  export type ExpressionProps = {
19
19
  fields: string[];
20
20
  globals: string[];
@@ -1 +1 @@
1
- {"version":3,"file":"expression.d.ts","sourceRoot":"","sources":["../../../src/utils/expression.js"],"names":[],"mappings":"AAuEA;;;;;;;;;;GAUG;AACH,6CAHW,MAAM,sBACJ,kBAAkB,CAgC9B;AAQD;;;GAGG;AACH,gDAHW,MAAM,GACJ,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CA2BvC;;YA5EU,MAAM,EAAE;aACR,MAAM,EAAE;UACR,MAAM;;iCAEH,CAAC,CAAC,KAAK,CAAC,EAAE,OAAO,qBAAqB,EAAE,KAAK,KAAK,GAAG,CAAC,GAAG,eAAe"}
1
+ {"version":3,"file":"expression.d.ts","sourceRoot":"","sources":["../../../src/utils/expression.js"],"names":[],"mappings":"AA4HA;;;;;;;;;;GAUG;AACH,6CAHW,MAAM,sBACJ,kBAAkB,CAiC9B;AAQD;;;GAGG;AACH,gDAHW,MAAM,GACJ,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,uBAAuB,EAAE,cAAc,KAAK,OAAO,CA4BxF;;YA9EU,MAAM,EAAE;aACR,MAAM,EAAE;UACR,MAAM;;iCAEH,CAAC,CAAC,KAAK,CAAC,EAAE,OAAO,qBAAqB,EAAE,KAAK,KAAK,GAAG,CAAC,GAAG,eAAe"}
@@ -6,6 +6,7 @@ import {
6
6
  isObject,
7
7
  isRegExp,
8
8
  isString,
9
+ ascending,
9
10
  lerp,
10
11
  } from "vega-util";
11
12
  import { format as d3format } from "d3-format";
@@ -15,12 +16,63 @@ import linearstep from "./linearstep.js";
15
16
 
16
17
  /**
17
18
  * Some bits are adapted from https://github.com/vega/vega/blob/main/packages/vega-functions/src/codegen.js
19
+ *
20
+ * @param {unknown} value
21
+ * @returns {any}
22
+ */
23
+ function array(value) {
24
+ return isArray(value) || ArrayBuffer.isView(value) ? value : null;
25
+ }
26
+
27
+ /**
28
+ * @param {unknown} value
29
+ * @returns {any}
18
30
  */
31
+ function sequence(value) {
32
+ return array(value) || (isString(value) ? value : null);
33
+ }
34
+
19
35
  const functionContext = {
20
36
  clamp,
21
37
  format(/** @type {number} */ value, /** @type {string} */ format) {
22
38
  return d3format(format)(value);
23
39
  },
40
+ /**
41
+ * Vega's expression docs list these as basic sequence helpers, but the
42
+ * bundled `vega-expression` version does not currently include them in the
43
+ * codegen whitelist. Implement them here so specs can rely on them.
44
+ */
45
+ join(/** @type {any} */ seq, /** @type {string} */ separator) {
46
+ return array(seq).join(separator);
47
+ },
48
+
49
+ indexof(
50
+ /** @type {any} */ seq,
51
+ /** @type {any} */ value,
52
+ /** @type {number | undefined} */ start
53
+ ) {
54
+ return sequence(seq).indexOf(value, start);
55
+ },
56
+
57
+ lastindexof(
58
+ /** @type {any} */ seq,
59
+ /** @type {any} */ value,
60
+ /** @type {number | undefined} */ start
61
+ ) {
62
+ return sequence(seq).lastIndexOf(value, start);
63
+ },
64
+
65
+ reverse(/** @type {any} */ seq) {
66
+ return array(seq).slice().reverse();
67
+ },
68
+
69
+ slice(
70
+ /** @type {any} */ seq,
71
+ /** @type {number} */ start,
72
+ /** @type {number | undefined} */ end
73
+ ) {
74
+ return sequence(seq).slice(start, end);
75
+ },
24
76
  mapHasKey(/** @type {Map<any, any>} */ map, /** @type {any} */ key) {
25
77
  return map.has(key);
26
78
  },
@@ -34,7 +86,6 @@ const functionContext = {
34
86
  isRegExp,
35
87
  isString,
36
88
  isValid(/** @type {any} */ _) {
37
- // eslint-disable-next-line no-self-compare
38
89
  return _ != null && _ === _;
39
90
  },
40
91
  lerp,
@@ -46,6 +97,9 @@ const functionContext = {
46
97
  ) {
47
98
  return String(str).replace(pattern, replace);
48
99
  },
100
+ sort(/** @type {Array<any>} */ seq) {
101
+ return array(seq).slice().sort(ascending);
102
+ },
49
103
  smoothstep,
50
104
  };
51
105
 
@@ -54,7 +108,6 @@ const functionContext = {
54
108
  */
55
109
  function buildFunctions(codegen) {
56
110
  const fn = functions(codegen);
57
- // eslint-disable-next-line guard-for-in
58
111
  for (const name in functionContext) {
59
112
  fn[name] = `this.${name}`;
60
113
  }
@@ -85,7 +138,6 @@ export default function createFunction(expr, globalObject = {}) {
85
138
  const parsed = parseExpression(expr);
86
139
  const generatedCode = cg(parsed);
87
140
 
88
- // eslint-disable-next-line no-new-func
89
141
  const fn = Function(
90
142
  "datum",
91
143
  "globalObject",
@@ -108,7 +160,9 @@ export default function createFunction(expr, globalObject = {}) {
108
160
 
109
161
  return exprFunction;
110
162
  } catch (e) {
111
- throw new Error(`Invalid expression: ${expr}, ${e.message}`);
163
+ throw new Error(`Invalid expression: ${expr}, ${e.message}`, {
164
+ cause: e,
165
+ });
112
166
  }
113
167
  }
114
168
 
@@ -120,14 +174,13 @@ const eventFilterCg = codegenExpression({
120
174
 
121
175
  /**
122
176
  * @param {string} expr
123
- * @returns {(event: UIEvent) => boolean}
177
+ * @returns {(event: UIEvent | import("./interactionEvent.js").WheelLikeEvent) => boolean}
124
178
  */
125
179
  export function createEventFilterFunction(expr) {
126
180
  try {
127
181
  const parsed = parseExpression(expr);
128
182
  const generatedCode = eventFilterCg(parsed);
129
183
 
130
- // eslint-disable-next-line no-new-func
131
184
  const fn = Function(
132
185
  "event",
133
186
  "globalObject",
@@ -141,10 +194,12 @@ export function createEventFilterFunction(expr) {
141
194
  }`
142
195
  );
143
196
 
144
- return /** @type {(event: UIEvent) => boolean} */ (
197
+ return /** @type {(event: UIEvent | import("./interactionEvent.js").WheelLikeEvent) => boolean} */ (
145
198
  /** @type {any} */ (fn)
146
199
  );
147
200
  } catch (e) {
148
- throw new Error(`Invalid expression: ${expr}, ${e.message}`);
201
+ throw new Error(`Invalid expression: ${expr}, ${e.message}`, {
202
+ cause: e,
203
+ });
149
204
  }
150
205
  }
@@ -1 +1 @@
1
- {"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../../../src/utils/field.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AACH,iCAHW,MAAM,SACN,MAAM,uCAgChB"}
1
+ {"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../../../src/utils/field.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AACH,iCAHW,MAAM,SACN,MAAM,uCA+BhB"}
@@ -25,7 +25,6 @@ export function field(fieldExpr, name = fieldExpr) {
25
25
  }
26
26
  };
27
27
 
28
- // eslint-disable-next-line no-new-func
29
28
  const fn = /** @type {import("vega-util").AccessorFn} */ (
30
29
  new Function(
31
30
  "validator",
@@ -1 +1 @@
1
- {"version":3,"file":"inertia.d.ts","sourceRoot":"","sources":["../../../src/utils/inertia.js"],"names":[],"mappings":"AAwEA;;;GAGG;AACH,kCAFa,CAAC,SADH,CAAC,iCAoBX;AAzFD;;GAEG;AACH;IACI;;;OAGG;IACH,sBAHW,OAAO,eAAe,EAAE,OAAO,aAC/B,OAAO,EA0BjB;IAvBG,0CAAwB;IACxB,kBAA0B;IAG1B,oBAAsB;IAEtB,oCAAoC;IACpC,UADW,CAAS,IAAM,EAAN,MAAM,KAAE,IAAI,CACZ;IAEpB,oBAAoB;IACpB,kBAAkB;IAElB;;;;MAUC;IAGL,eAQC;IAED;;;;OAIG;IACH,mBAHW,MAAM,YACN,CAAS,IAAM,EAAN,MAAM,KAAE,IAAI,QAkB/B;CACJ"}
1
+ {"version":3,"file":"inertia.d.ts","sourceRoot":"","sources":["../../../src/utils/inertia.js"],"names":[],"mappings":"AAwEA;;;GAGG;AACH,kCAFa,CAAC,SADH,CAAC,iCAmBX;AAxFD;;GAEG;AACH;IACI;;;OAGG;IACH,sBAHW,OAAO,eAAe,EAAE,OAAO,aAC/B,OAAO,EA0BjB;IAvBG,0CAAwB;IACxB,kBAA0B;IAG1B,oBAAsB;IAEtB,oCAAoC;IACpC,UADW,CAAS,IAAM,EAAN,MAAM,KAAE,IAAI,CACZ;IAEpB,oBAAoB;IACpB,kBAAkB;IAElB;;;;MAUC;IAGL,eAQC;IAED;;;;OAIG;IACH,mBAHW,MAAM,YACN,CAAS,IAAM,EAAN,MAAM,KAAE,IAAI,QAkB/B;CACJ"}
@@ -80,7 +80,6 @@ export function makeEventTemplate(event) {
80
80
  const acceptedTypes = ["string", "number", "boolean"];
81
81
  const rejectedProps = ["wheelDelta", "wheelDeltaX", "wheelDeltaY"];
82
82
 
83
- // eslint-disable-next-line guard-for-in
84
83
  for (const key in event) {
85
84
  const k = /** @type {keyof T} */ (key);
86
85
  if (
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @param {string} url
3
+ */
4
+ export function getCuratedExampleBaseUrl(url: string): string;
5
+ /**
6
+ * Infers the effective base URL for a spec loaded from the given URL or path.
7
+ *
8
+ * Curated shared examples resolve against the examples root so they can use
9
+ * tidy `data/...` and `shared/...` paths regardless of their subdirectory.
10
+ *
11
+ * @param {string} url
12
+ */
13
+ export default function inferSpecBaseUrl(url: string): string;
14
+ //# sourceMappingURL=inferSpecBaseUrl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inferSpecBaseUrl.d.ts","sourceRoot":"","sources":["../../../src/utils/inferSpecBaseUrl.js"],"names":[],"mappings":"AAuBA;;GAEG;AACH,8CAFW,MAAM,UAahB;AAED;;;;;;;GAOG;AACH,8CAFW,MAAM,UAYhB"}