@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
@@ -20,6 +20,7 @@ import ViewParamRuntime from "../paramRuntime/viewParamRuntime.js";
20
20
  import { isExprRef } from "../paramRuntime/paramUtils.js";
21
21
  import { InternMap } from "internmap";
22
22
  import { endWithSlash } from "../utils/addBaseUrl.js";
23
+ import { mergeConfigScopes } from "../config/mergeConfig.js";
23
24
 
24
25
  // TODO: View classes have too many responsibilities. Come up with a way
25
26
  // to separate the concerns. However, most concerns are tightly tied to
@@ -50,18 +51,36 @@ const defaultOpacityFunction = (parentOpacity) => parentOpacity;
50
51
  * @typedef {object} BroadcastMessage
51
52
  * @prop {import("../genomeSpy.js").BroadcastEventType} type Broadcast type
52
53
  * @prop {any} [payload] Anything
54
+ */
55
+
56
+ /**
57
+ * Internal listener contract for view interactions.
53
58
  *
54
- * @callback InteractionEventListener
55
- * @param {import("./layout/rectangle.js").default} coords
56
- * Coordinates of the view
57
- * @param {import("../utils/interactionEvent.js").default} event
59
+ * Listeners receive a single `Interaction` object. They are attached per
60
+ * event type and may run either in the capture phase or in the bubbling
61
+ * phase, depending on how the containing view routes the interaction.
58
62
  *
63
+ * Ordinary pointer events are routed by container views, which may do hit
64
+ * testing, scrollbar dispatch, zoom policy, or other view-specific work
65
+ * before or after child propagation. In addition, `mouseenter` and
66
+ * `mouseleave` are synthesized by `InteractionDispatcher` from changes in the
67
+ * pointed view path.
68
+ *
69
+ * `stopPropagation()` prevents further routing to later views, but it does
70
+ * not provide DOM-style stop-immediate semantics for sibling listeners on the
71
+ * same view.
72
+ *
73
+ * @callback InteractionListener
74
+ * @param {import("../utils/interaction.js").default} event
75
+ */
76
+
77
+ /**
59
78
  * @typedef {object} ViewOptions
60
79
  * @prop {boolean} [blockEncodingInheritance]
61
80
  * Don't inherit encodings from parent. Default: false.
62
- * @prop {boolean} [layersChildren]
63
- * View's children are layered on top of each other and they have the same
64
- * coordinates as their parent.
81
+ * @prop {"own" | "inherit"} [layoutSizeParams]
82
+ * Whether the view should introduce local layout-driven width/height params.
83
+ * Default: "own".
65
84
  */
66
85
  /**
67
86
  * @template {import("../spec/view.js").ViewSpec} [TSpec=import("../spec/view.js").ViewSpec]
@@ -70,23 +89,28 @@ export default class View {
70
89
  /** @type {TSpec} */
71
90
  spec;
72
91
 
92
+ /** @type {import("../spec/config.js").GenomeSpyConfig[]} */
93
+ #configScopes;
94
+
73
95
  /** @type {string | undefined} */
74
96
  #defaultName;
75
97
 
76
98
  /** @type {Record<string, (function(BroadcastMessage):void)[]>} */
77
99
  #broadcastHandlers = {};
78
100
 
79
- /** @type {Record<string, InteractionEventListener[]>} */
80
- #capturingInteractionEventListeners = {};
101
+ /** @type {Record<string, InteractionListener[]>} */
102
+ #capturingInteractionListeners = {};
81
103
 
82
- /** @type {Record<string, InteractionEventListener[]>} */
83
- #nonCapturingInteractionEventListeners = {};
104
+ /** @type {Record<string, InteractionListener[]>} */
105
+ #bubblingInteractionListeners = {};
84
106
 
85
107
  /** @type {(value: number) => void} */
86
108
  #widthSetter;
87
109
 
88
110
  /** @type {(value: number) => void} */
89
111
  #heightSetter;
112
+ // TODO: Consider replacing param-backed layout size with built-in layout
113
+ // signals. That would avoid width/height shadowing rules altogether.
90
114
 
91
115
  /** @type {boolean} */
92
116
  #hasRendered = false;
@@ -135,6 +159,21 @@ export default class View {
135
159
  this.#defaultName = name;
136
160
  this.spec = spec;
137
161
 
162
+ if (dataParent && /** @type {any} */ (spec).theme !== undefined) {
163
+ throw new Error(
164
+ '"theme" is only supported at the root specification. Use "config" and "style" for subtree customization.'
165
+ );
166
+ }
167
+
168
+ const inheritedScopes = dataParent
169
+ ? dataParent.getConfigScopes()
170
+ : [context.getBaseConfig()];
171
+ const localScope = spec.config;
172
+ this.#configScopes =
173
+ /** @type {import("../spec/config.js").GenomeSpyConfig[]} */ (
174
+ [...inheritedScopes, localScope].filter((scope) => !!scope)
175
+ );
176
+
138
177
  this.resolutions = {
139
178
  /**
140
179
  * Channel-specific scale resolutions
@@ -152,6 +191,7 @@ export default class View {
152
191
 
153
192
  this.options = {
154
193
  blockEncodingInheritance: false,
194
+ layoutSizeParams: "own",
155
195
  ...options,
156
196
  };
157
197
 
@@ -179,18 +219,27 @@ export default class View {
179
219
  }
180
220
  }
181
221
 
182
- // All descendants of a layer view have the same coordinates - no need to redefine.
183
- if (!this.layoutParent?.options.layeredChildren) {
184
- // Width and height can be overriden by the view spec. Typically it
185
- // doesn't make much sense, but it's used in the App's SampleView
186
- // to set the height to sample facets' height.
187
- const allocateIfFree = (/** @type {string} */ name) =>
188
- this.paramRuntime.findRuntimeForParam(name)
189
- ? undefined
190
- : this.paramRuntime.allocateSetter(name, 0);
191
- this.#heightSetter = allocateIfFree("height");
192
- this.#widthSetter = allocateIfFree("width");
222
+ if (this.options.layoutSizeParams !== "inherit") {
223
+ // Layout-driven size params must exist before marks and child views
224
+ // bind expressions in subclass constructors.
225
+ this.#widthSetter = this.#createLayoutSizeSetter("width");
226
+ this.#heightSetter = this.#createLayoutSizeSetter("height");
227
+ }
228
+ }
229
+
230
+ /**
231
+ * @param {"width" | "height"} name
232
+ * @returns {(value: number) => void}
233
+ */
234
+ #createLayoutSizeSetter(name) {
235
+ if (
236
+ this.paramRuntime.hasLocalParam(name) ||
237
+ this.paramRuntime.hasConfiguredParamInScopeChain(name)
238
+ ) {
239
+ return undefined;
193
240
  }
241
+
242
+ return this.paramRuntime.allocateSetter(name, 0);
194
243
  }
195
244
 
196
245
  /**
@@ -216,6 +265,43 @@ export default class View {
216
265
  return this.#defaultName;
217
266
  }
218
267
 
268
+ getConfig() {
269
+ return /** @type {import("../spec/config.js").GenomeSpyConfig} */ (
270
+ mergeConfigScopes(this.#configScopes)
271
+ );
272
+ }
273
+
274
+ getCursorSpec() {
275
+ return this.spec.cursor;
276
+ }
277
+
278
+ getCursor() {
279
+ const cursor = this.getCursorSpec();
280
+ return isExprRef(cursor)
281
+ ? this.paramRuntime.evaluateAndGet(cursor.expr)
282
+ : cursor;
283
+ }
284
+
285
+ /**
286
+ * @param {() => void} listener
287
+ * @param {(disposer: () => void) => void} [registerDisposer]
288
+ */
289
+ watchCursor(listener, registerDisposer) {
290
+ const cursor = this.getCursorSpec();
291
+ if (!isExprRef(cursor)) {
292
+ return;
293
+ }
294
+
295
+ this.paramRuntime.watchExpression(cursor.expr, listener, {
296
+ scopeOwned: false,
297
+ registerDisposer,
298
+ });
299
+ }
300
+
301
+ getConfigScopes() {
302
+ return this.#configScopes.slice();
303
+ }
304
+
219
305
  /**
220
306
  * Returns the coords of the view. If view has been faceted, returns the coords
221
307
  * of an arbitrary facet. If all or specific facet coords are needed, use `facetCoords`.
@@ -318,7 +404,7 @@ export default class View {
318
404
 
319
405
  if (scale) {
320
406
  // Note: this and all ancestral views need to be refreshed when the domain is changed.
321
- let steps = 0;
407
+ let steps;
322
408
  if (isDiscrete(scale.type)) {
323
409
  steps = scale.domain().length;
324
410
  } else if (["locus", "index"].includes(scale.type)) {
@@ -478,7 +564,6 @@ export default class View {
478
564
  #getAncestors(prop) {
479
565
  /** @type {View[]} */
480
566
  const ancestors = [];
481
- // eslint-disable-next-line consistent-this
482
567
  let view = /** @type {View} */ (this);
483
568
  do {
484
569
  ancestors.push(view);
@@ -541,38 +626,40 @@ export default class View {
541
626
  }
542
627
 
543
628
  /**
544
- * Handles an interactionEvent
629
+ * Invokes this view's listeners for the current interaction phase.
630
+ *
631
+ * This method does not route the event to children or parents. Container
632
+ * subclasses implement that routing in `propagateInteraction(...)`
633
+ * and call `handleInteraction(...)` when the current phase reaches
634
+ * this view.
545
635
  *
546
- * @param {import("./layout/rectangle.js").default} coords
547
- * Coordinates of the view
548
- * @param {import("../utils/interactionEvent.js").default} event
636
+ * @param {import("../utils/interaction.js").default} event
549
637
  * @param {boolean} capturing
550
- * @protected
551
638
  */
552
- handleInteractionEvent(coords, event, capturing) {
639
+ handleInteraction(event, capturing) {
553
640
  const listenersByType = capturing
554
- ? this.#capturingInteractionEventListeners
555
- : this.#nonCapturingInteractionEventListeners;
641
+ ? this.#capturingInteractionListeners
642
+ : this.#bubblingInteractionListeners;
556
643
  for (const listener of listenersByType[event.type] || []) {
557
- listener(coords, event);
644
+ listener(event);
558
645
  }
559
646
  }
560
647
 
561
648
  /**
562
- * Add an "interaction" event listener that mimics DOM's event model inside
563
- * the view hierarchy.
649
+ * Registers an internal interaction listener.
564
650
  *
565
- * This is intended for GenomeSpy's internal use. It allows the views to handle
566
- * low level interactions such as dragging, wheeling, etc.
651
+ * Interaction listeners are internal view-hierarchy hooks, not part of
652
+ * the supported embed API. They receive the refactored `Interaction`
653
+ * object directly, without the removed legacy `coords` argument.
567
654
  *
568
655
  * @param {string} type
569
- * @param {InteractionEventListener} listener
656
+ * @param {InteractionListener} listener
570
657
  * @param {boolean} [useCapture]
571
658
  */
572
- addInteractionEventListener(type, listener, useCapture) {
659
+ addInteractionListener(type, listener, useCapture) {
573
660
  const listenersByType = useCapture
574
- ? this.#capturingInteractionEventListeners
575
- : this.#nonCapturingInteractionEventListeners;
661
+ ? this.#capturingInteractionListeners
662
+ : this.#bubblingInteractionListeners;
576
663
  let listeners = listenersByType[type];
577
664
  if (!listeners) {
578
665
  listeners = [];
@@ -583,14 +670,16 @@ export default class View {
583
670
  }
584
671
 
585
672
  /**
673
+ * Removes a previously registered interaction listener.
674
+ *
586
675
  * @param {string} type
587
- * @param {InteractionEventListener} listener
676
+ * @param {InteractionListener} listener
588
677
  * @param {boolean} [useCapture]
589
678
  */
590
- removeInteractionEventListener(type, listener, useCapture) {
679
+ removeInteractionListener(type, listener, useCapture) {
591
680
  const listenersByType = useCapture
592
- ? this.#capturingInteractionEventListeners
593
- : this.#nonCapturingInteractionEventListeners;
681
+ ? this.#capturingInteractionListeners
682
+ : this.#bubblingInteractionListeners;
594
683
  let listeners = listenersByType?.[type];
595
684
  if (listeners) {
596
685
  const index = listeners.indexOf(listener);
@@ -945,9 +1034,9 @@ export default class View {
945
1034
  * Broadcasts a message to views that include the given (x, y) point.
946
1035
  * This is mainly intended for mouse events.
947
1036
  *
948
- * @param {import("../utils/interactionEvent.js").default} event
1037
+ * @param {import("../utils/interaction.js").default} event
949
1038
  */
950
- propagateInteractionEvent(event) {
1039
+ propagateInteraction(event) {
951
1040
  // Subclasses must implement proper handling
952
1041
  }
953
1042
  }
@@ -3,6 +3,9 @@ export const VIEW_ROOT_NAME: "viewRoot";
3
3
  * @typedef {object} ViewFactoryOptions
4
4
  * @property {boolean} [allowImport] allows imports from urls
5
5
  * @property {boolean} [wrapRoot]
6
+ *
7
+ * @typedef {object} CreateViewOptions
8
+ * @property {"own" | "inherit"} [layoutSizeParams]
6
9
  */
7
10
  /**
8
11
  *
@@ -18,15 +21,16 @@ export class ViewFactory {
18
21
  * @param {SpecGuard} specGuard
19
22
  * @param {Factory} factory
20
23
  */
21
- addViewType(specGuard: (spec: import("../spec/view.js").ViewSpec) => boolean, factory: (spec: import("../spec/view.js").ViewSpec, context: import("../types/viewContext.js").default, layoutParent?: import("./containerView.js").default, dataParent?: import("./view.js").default, defaultName?: string) => View): void;
24
+ addViewType(specGuard: (spec: import("../spec/view.js").ViewSpec) => boolean, factory: (spec: import("../spec/view.js").ViewSpec, context: import("../types/viewContext.js").default, layoutParent?: import("./containerView.js").default, dataParent?: import("./view.js").default, defaultName?: string, options?: CreateViewOptions) => View): void;
22
25
  /**
23
26
  * @param {ViewSpec} spec
24
27
  * @param {ViewContext} context
25
28
  * @param {import("./containerView.js").default} [layoutParent]
26
29
  * @param {import("./view.js").default} [dataParent]
27
30
  * @param {string} [defaultName]
31
+ * @param {CreateViewOptions} [options]
28
32
  */
29
- createView(spec: import("../spec/view.js").ViewSpec, context: import("../types/viewContext.js").default, layoutParent?: import("./containerView.js").default, dataParent?: import("./view.js").default, defaultName?: string): View<import("../spec/view.js").ViewSpec>;
33
+ createView(spec: import("../spec/view.js").ViewSpec, context: import("../types/viewContext.js").default, layoutParent?: import("./containerView.js").default, dataParent?: import("./view.js").default, defaultName?: string, options?: CreateViewOptions): View<import("../spec/view.js").ViewSpec>;
30
34
  /**
31
35
  *
32
36
  * @param {ViewSpec} spec
@@ -43,8 +47,9 @@ export class ViewFactory {
43
47
  * @param {import("./view.js").default} [dataParent]
44
48
  * @param {string} [defaultName]
45
49
  * @param {(spec: ViewSpec) => void} [validator]
50
+ * @param {CreateViewOptions} [options]
46
51
  */
47
- createOrImportView(spec: import("../spec/view.js").ViewSpec | import("../spec/view.js").ImportSpec, context: import("../types/viewContext.js").default, layoutParent?: import("./containerView.js").default, dataParent?: import("./view.js").default, defaultName?: string, validator?: (spec: import("../spec/view.js").ViewSpec) => void): Promise<View<import("../spec/view.js").ViewSpec>>;
52
+ createOrImportView(spec: import("../spec/view.js").ViewSpec | import("../spec/view.js").ImportSpec, context: import("../types/viewContext.js").default, layoutParent?: import("./containerView.js").default, dataParent?: import("./view.js").default, defaultName?: string, validator?: (spec: import("../spec/view.js").ViewSpec) => void, options?: CreateViewOptions): Promise<View<import("../spec/view.js").ViewSpec>>;
48
53
  #private;
49
54
  }
50
55
  export type ViewFactoryOptions = {
@@ -54,6 +59,9 @@ export type ViewFactoryOptions = {
54
59
  allowImport?: boolean;
55
60
  wrapRoot?: boolean;
56
61
  };
62
+ export type CreateViewOptions = {
63
+ layoutSizeParams?: "own" | "inherit";
64
+ };
57
65
  import View from "./view.js";
58
66
  export { isConcatSpec, isFacetSpec, isHConcatSpec, isImportSpec, isLayerSpec, isUnitSpec, isVConcatSpec } from "./viewSpecGuards.js";
59
67
  //# sourceMappingURL=viewFactory.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"viewFactory.d.ts","sourceRoot":"","sources":["../../../src/view/viewFactory.js"],"names":[],"mappings":"AA0BA,6BAA8B,UAAU,CAAC;AAEzC;;;;GAIG;AAEH;;GAEG;AACH;IAiBI;;OAEG;IACH,sBAFW,kBAAkB,EA0D5B;IAvDG,2CAA2C;IAC3C,SADW,QAAQ,CAAC,kBAAkB,CAAC,CAKtC;IAoDL;;;OAGG;IACH,qEAxEiC,OAAO,yHAC2B,OAAO,oBAAoB,EAAE,OAAO,eAAe,OAAO,WAAW,EAAE,OAAO,gBAAgB,MAAM,KAAK,IAAI,QAyE/K;IAED;;;;;;OAMG;IACH,wHAJW,OAAO,oBAAoB,EAAE,OAAO,eACpC,OAAO,WAAW,EAAE,OAAO,gBAC3B,MAAM,4CAyBhB;IAED;;;;OAIG;IACH,sDAFa,IAAI,sCAAY,CAU5B;IAED;;;;;;;;;;OAUG;IACH,yBAPW,qCAAW,OAAO,iBAAiB,EAAE,UAAU,qEAE/C,OAAO,oBAAoB,EAAE,OAAO,eACpC,OAAO,WAAW,EAAE,OAAO,gBAC3B,MAAM,cACN,CAAC,IAAI,oCAAU,KAAK,IAAI,qDAiGlC;;CACJ;;;;;kBAvPa,OAAO;eACP,OAAO;;iBA9BJ,WAAW"}
1
+ {"version":3,"file":"viewFactory.d.ts","sourceRoot":"","sources":["../../../src/view/viewFactory.js"],"names":[],"mappings":"AA2BA,6BAA8B,UAAU,CAAC;AAEzC;;;;;;;GAOG;AAEH;;GAEG;AACH;IAiBI;;OAEG;IACH,sBAFW,kBAAkB,EAoE5B;IAjEG,2CAA2C;IAC3C,SADW,QAAQ,CAAC,kBAAkB,CAAC,CAKtC;IA8DL;;;OAGG;IACH,qEAlFiC,OAAO,yHAC2B,OAAO,oBAAoB,EAAE,OAAO,eAAe,OAAO,WAAW,EAAE,OAAO,gBAAgB,MAAM,YAAY,iBAAiB,KAAK,IAAI,QAmF5M;IAED;;;;;;;OAOG;IACH,wHALW,OAAO,oBAAoB,EAAE,OAAO,eACpC,OAAO,WAAW,EAAE,OAAO,gBAC3B,MAAM,YACN,iBAAiB,4CA0B3B;IAED;;;;OAIG;IACH,sDAFa,IAAI,sCAAY,CAU5B;IAED;;;;;;;;;;;OAWG;IACH,yBARW,qCAAW,OAAO,iBAAiB,EAAE,UAAU,qEAE/C,OAAO,oBAAoB,EAAE,OAAO,eACpC,OAAO,WAAW,EAAE,OAAO,gBAC3B,MAAM,cACN,CAAC,IAAI,oCAAU,KAAK,IAAI,YACxB,iBAAiB,qDAqG3B;;CACJ;;;;;kBA3Qa,OAAO;eACP,OAAO;;;uBAGP,KAAK,GAAG,SAAS;;iBAlCd,WAAW"}
@@ -10,6 +10,7 @@ import ContainerView from "./containerView.js";
10
10
  import ViewError from "./viewError.js";
11
11
  import { isSelectionParameter } from "../paramRuntime/paramUtils.js";
12
12
  import { asSelectionConfig } from "../selection/selection.js";
13
+ import { resolveImportedSpecConfig } from "../config/resolveConfig.js";
13
14
  import {
14
15
  markViewAsNonAddressable,
15
16
  registerImportInstance,
@@ -30,6 +31,9 @@ export const VIEW_ROOT_NAME = "viewRoot";
30
31
  * @typedef {object} ViewFactoryOptions
31
32
  * @property {boolean} [allowImport] allows imports from urls
32
33
  * @property {boolean} [wrapRoot]
34
+ *
35
+ * @typedef {object} CreateViewOptions
36
+ * @property {"own" | "inherit"} [layoutSizeParams]
33
37
  */
34
38
 
35
39
  /**
@@ -46,7 +50,7 @@ export class ViewFactory {
46
50
  * @typedef {import("../spec/view.js").ConcatSpec} ConcatSpec
47
51
  *
48
52
  * @typedef {(spec: ViewSpec) => boolean} SpecGuard
49
- * @typedef {(spec: ViewSpec, context: ViewContext, layoutParent?: import("./containerView.js").default, dataParent?: import("./view.js").default, defaultName?: string) => View} Factory
53
+ * @typedef {(spec: ViewSpec, context: ViewContext, layoutParent?: import("./containerView.js").default, dataParent?: import("./view.js").default, defaultName?: string, options?: CreateViewOptions) => View} Factory
50
54
  */
51
55
 
52
56
  /** @type {Map<SpecGuard, Factory>} */
@@ -70,19 +74,21 @@ export class ViewFactory {
70
74
  * context: ViewContext,
71
75
  * layoutParent?: import("./containerView.js").default,
72
76
  * dataParent?: import("./view.js").default,
73
- * defaultName?: string
77
+ * defaultName?: string,
78
+ * options?: CreateViewOptions
74
79
  * ) => View} */
75
80
  ViewClass
76
81
  ) =>
77
82
  /** @type {Factory} */
78
- (spec, context, layoutParent, dataParent, defaultName) =>
83
+ (spec, context, layoutParent, dataParent, defaultName, options) =>
79
84
  /** @type {View} */ (
80
85
  new ViewClass(
81
86
  spec,
82
87
  context,
83
88
  layoutParent,
84
89
  dataParent,
85
- defaultName
90
+ defaultName,
91
+ options
86
92
  )
87
93
  );
88
94
 
@@ -90,7 +96,14 @@ export class ViewFactory {
90
96
  this.addViewType(
91
97
  isMultiscaleSpec,
92
98
  /** @type {Factory} */ (
93
- (spec, context, layoutParent, dataParent, defaultName) =>
99
+ (
100
+ spec,
101
+ context,
102
+ layoutParent,
103
+ dataParent,
104
+ defaultName,
105
+ options
106
+ ) =>
94
107
  /** @type {View} */ (
95
108
  new LayerView(
96
109
  normalizeMultiscaleSpec(
@@ -101,7 +114,8 @@ export class ViewFactory {
101
114
  context,
102
115
  layoutParent,
103
116
  dataParent,
104
- defaultName
117
+ defaultName,
118
+ options
105
119
  )
106
120
  )
107
121
  )
@@ -127,8 +141,9 @@ export class ViewFactory {
127
141
  * @param {import("./containerView.js").default} [layoutParent]
128
142
  * @param {import("./view.js").default} [dataParent]
129
143
  * @param {string} [defaultName]
144
+ * @param {CreateViewOptions} [options]
130
145
  */
131
- createView(spec, context, layoutParent, dataParent, defaultName) {
146
+ createView(spec, context, layoutParent, dataParent, defaultName, options) {
132
147
  for (const [guard, factory] of this.#types) {
133
148
  if (guard(spec)) {
134
149
  return factory(
@@ -136,7 +151,8 @@ export class ViewFactory {
136
151
  context,
137
152
  layoutParent,
138
153
  dataParent,
139
- defaultName
154
+ defaultName,
155
+ options
140
156
  );
141
157
  }
142
158
  }
@@ -178,6 +194,7 @@ export class ViewFactory {
178
194
  * @param {import("./view.js").default} [dataParent]
179
195
  * @param {string} [defaultName]
180
196
  * @param {(spec: ViewSpec) => void} [validator]
197
+ * @param {CreateViewOptions} [options]
181
198
  */
182
199
  async createOrImportView(
183
200
  spec,
@@ -185,7 +202,8 @@ export class ViewFactory {
185
202
  layoutParent,
186
203
  dataParent,
187
204
  defaultName,
188
- validator
205
+ validator,
206
+ options
189
207
  ) {
190
208
  /** @type {ViewSpec} */
191
209
  let viewSpec;
@@ -244,9 +262,11 @@ export class ViewFactory {
244
262
  hasIntervalSelection(viewSpec)) &&
245
263
  defaultName === VIEW_ROOT_NAME
246
264
  ) {
265
+ const wrappedChild = { ...viewSpec };
266
+ delete (/** @type {any} */ (wrappedChild).theme);
247
267
  viewSpec = {
248
268
  name: "implicitRoot",
249
- vconcat: [viewSpec],
269
+ vconcat: [wrappedChild],
250
270
  };
251
271
  isImplicitRoot = true;
252
272
  }
@@ -256,7 +276,8 @@ export class ViewFactory {
256
276
  context,
257
277
  layoutParent,
258
278
  dataParent,
259
- defaultName
279
+ defaultName,
280
+ options
260
281
  );
261
282
 
262
283
  if (importScopeName !== undefined) {
@@ -310,6 +331,11 @@ function applyParamsToImportedSpec(importedSpec, importSpec) {
310
331
  importedSpec.visible = importSpec.visible;
311
332
  }
312
333
 
334
+ importedSpec.config = resolveImportedSpecConfig(
335
+ importSpec.config,
336
+ importedSpec.config
337
+ );
338
+
313
339
  const params = isArray(importSpec.params)
314
340
  ? importSpec.params
315
341
  : isObject(importSpec.params)
@@ -1 +1 @@
1
- {"version":3,"file":"viewUtils.d.ts","sourceRoot":"","sources":["../../../src/view/viewUtils.js"],"names":[],"mappings":"AAUA;;;;GAIG;AACH,qCAHW,OAAO,oBAAoB,EAAE,UAAU,GAAG,OAAO,iBAAiB,EAAE,YAAY,GAC9E,IAAI,IAAI,aAAa,CAIjC;AAED;;;;GAIG;AACH,oCAHW,OAAO,oBAAoB,EAAE,aAAa,GAAG,OAAO,iBAAiB,EAAE,YAAY,GACjF,IAAI,IAAI,YAAY,CAOhC;AAED;;;GAGG;AACH,+BAFW,IAAI,6EAMd;AAED;;;;GAIG;AACH,wCAFW,IAAI,8CASd;AAED;;GAEG;AACH,kDAFW,IAAI,QAiBd;AAED;;;;;;;GAOG;AACH,4CAFW,IAAI,QAUd;AAED;;;;GAIG;AACH,0DAJW,OAAO,CAAC,OAAO,kBAAkB,EAAE,OAAO,CAAC,EAAE,mBAC7C,MAAM,OAAO,GACX,OAAO,CAAC,IAAI,CAAC,CAmBzB;AAED;;;GAGG;AACH,wCAFW,IAAI;UAGO,QAAQ;aAAW,OAAO,oBAAoB,EAAE,OAAO;WAAS,OAAO,oBAAoB,EAAE,KAAK;UAAQ,OAAO,oBAAoB,EAAE,IAAI;IAqBhK;AAED;;;;;GAKG;AACH,2CALW,OAAO,iBAAiB,EAAE,UAAU,WACpC,MAAM,eACN,OAAO,yBAAyB,EAAE,OAAO,GACvC,OAAO,CAAC,OAAO,iBAAiB,EAAE,QAAQ,CAAC,CAoCvD;AAED;;GAEG;AACH,yCAFW,CAAS,IAAI,EAAJ,IAAI,EAAE,IAAM,EAAN,IAAI,EAAE,KAAE,IAAI,+BAkBrC;AAED;;;GAGG;AACH,0CAFW,IAAI,eAqBd;AAED;;GAEG;AACH,8CAFW,OAAO,WAAW,EAAE,OAAO;;;EAoBrC;iBA1P4C,WAAW;qBAFnC,eAAe"}
1
+ {"version":3,"file":"viewUtils.d.ts","sourceRoot":"","sources":["../../../src/view/viewUtils.js"],"names":[],"mappings":"AAUA;;;;GAIG;AACH,qCAHW,OAAO,oBAAoB,EAAE,UAAU,GAAG,OAAO,iBAAiB,EAAE,YAAY,GAC9E,IAAI,IAAI,aAAa,CAIjC;AAED;;;;GAIG;AACH,oCAHW,OAAO,oBAAoB,EAAE,aAAa,GAAG,OAAO,iBAAiB,EAAE,YAAY,GACjF,IAAI,IAAI,YAAY,CAOhC;AAED;;;GAGG;AACH,+BAFW,IAAI,6EAMd;AAED;;;;GAIG;AACH,wCAFW,IAAI,8CASd;AAED;;GAEG;AACH,kDAFW,IAAI,QAiBd;AAED;;;;;;;GAOG;AACH,4CAFW,IAAI,QAUd;AAED;;;;GAIG;AACH,0DAJW,OAAO,CAAC,OAAO,kBAAkB,EAAE,OAAO,CAAC,EAAE,mBAC7C,MAAM,OAAO,GACX,OAAO,CAAC,IAAI,CAAC,CAmBzB;AAED;;;GAGG;AACH,wCAFW,IAAI;UAGO,QAAQ;aAAW,OAAO,oBAAoB,EAAE,OAAO;WAAS,OAAO,oBAAoB,EAAE,KAAK;UAAQ,OAAO,oBAAoB,EAAE,IAAI;IAwDhK;AAED;;;;;GAKG;AACH,2CALW,OAAO,iBAAiB,EAAE,UAAU,WACpC,MAAM,eACN,OAAO,yBAAyB,EAAE,OAAO,GACvC,OAAO,CAAC,OAAO,iBAAiB,EAAE,QAAQ,CAAC,CAqCvD;AAED;;GAEG;AACH,yCAFW,CAAS,IAAI,EAAJ,IAAI,EAAE,IAAM,EAAN,IAAI,EAAE,KAAE,IAAI,+BAkBrC;AAED;;;GAGG;AACH,0CAFW,IAAI,eAqBd;AAED;;GAEG;AACH,8CAFW,OAAO,WAAW,EAAE,OAAO;;;EAoBrC;iBA9R4C,WAAW;qBAFnC,eAAe"}
@@ -126,15 +126,50 @@ export function findEncodedFields(view) {
126
126
  view.visit((view) => {
127
127
  if (view instanceof UnitView) {
128
128
  const encoding = view.getEncoding();
129
- for (const [channel, def] of Object.entries(encoding)) {
130
- if (!Array.isArray(def) && isFieldDef(def) && "type" in def) {
129
+
130
+ /**
131
+ * @param {import("../spec/channel.js").Channel} channel
132
+ * @param {unknown} definition
133
+ */
134
+ const collect = (channel, definition) => {
135
+ if (
136
+ !definition ||
137
+ typeof definition !== "object" ||
138
+ Array.isArray(definition)
139
+ ) {
140
+ return;
141
+ }
142
+
143
+ if (isFieldDef(definition) && "type" in definition) {
131
144
  fieldInfos.push({
132
145
  view,
133
146
  channel,
134
- field: def.field,
135
- type: def.type,
147
+ field: definition.field,
148
+ type: /** @type {import("../spec/channel.js").Type} */ (
149
+ definition.type
150
+ ),
136
151
  });
137
152
  }
153
+
154
+ if ("condition" in definition) {
155
+ const { condition } = definition;
156
+ if (Array.isArray(condition)) {
157
+ for (const subCondition of condition) {
158
+ collect(channel, subCondition);
159
+ }
160
+ } else {
161
+ collect(channel, condition);
162
+ }
163
+ }
164
+ };
165
+
166
+ for (const [channel, def] of Object.entries(encoding)) {
167
+ collect(
168
+ /** @type {import("../spec/channel.js").Channel} */ (
169
+ channel
170
+ ),
171
+ def
172
+ );
138
173
  }
139
174
  return VISIT_SKIP; // Skip sample summaries
140
175
  }
@@ -166,7 +201,8 @@ export async function loadExternalViewSpec(spec, baseUrl, viewContext) {
166
201
  );
167
202
  } catch (e) {
168
203
  throw new Error(
169
- `Could not load imported view spec: ${url}. Reason: ${e.message}`
204
+ `Could not load imported view spec: ${url}. Reason: ${e.message}`,
205
+ { cause: e }
170
206
  );
171
207
  }
172
208
 
@@ -1,13 +1,13 @@
1
1
  export function markZoomActivity(): void;
2
2
  export function isStillZooming(): boolean;
3
3
  /**
4
- * @param {import("../utils/interactionEvent.js").default} event
4
+ * @param {import("../utils/interaction.js").default} event
5
5
  * @param {import("./layout/rectangle.js").default} coords
6
- * @param {(zoomEvent: ZoomEvent) => void} handleZoom
6
+ * @param {(zoomEvent: ZoomEvent) => boolean | void} handleZoom
7
7
  * @param {import("../types/viewContext.js").Hover} [hover]
8
8
  * @param {import("../utils/animator.js").default} [animator]
9
9
  */
10
- export function interactionToZoom(event: import("../utils/interactionEvent.js").default, coords: import("./layout/rectangle.js").default, handleZoom: (zoomEvent: ZoomEvent) => void, hover?: import("../types/viewContext.js").Hover, animator?: import("../utils/animator.js").default): void;
10
+ export function interactionToZoom(event: import("../utils/interaction.js").default, coords: import("./layout/rectangle.js").default, handleZoom: (zoomEvent: ZoomEvent) => boolean | void, hover?: import("../types/viewContext.js").Hover, animator?: import("../utils/animator.js").default): void;
11
11
  export type ZoomEvent = {
12
12
  x: number;
13
13
  y: number;
@@ -15,4 +15,16 @@ export type ZoomEvent = {
15
15
  yDelta: number;
16
16
  zDelta: number;
17
17
  };
18
+ export type ZoomInteractionState = {
19
+ smoother: ReturnType<typeof makeLerpSmoother>;
20
+ touchPanEventBuffer: RingBuffer<{
21
+ point: Point;
22
+ timestamp: number;
23
+ }>;
24
+ touchPanLastPoint: Point | undefined;
25
+ touchPanPointerCount: 0 | 1 | 2;
26
+ };
27
+ import { makeLerpSmoother } from "../utils/animator.js";
28
+ import RingBuffer from "../utils/ringBuffer.js";
29
+ import Point from "./layout/point.js";
18
30
  //# sourceMappingURL=zoom.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"zoom.d.ts","sourceRoot":"","sources":["../../../src/view/zoom.js"],"names":[],"mappings":"AAkBA,yCAEC;AAED,0CAGC;AAgBD;;;;;;GAMG;AACH,yCANW,OAAO,8BAA8B,EAAE,OAAO,UAC9C,OAAO,uBAAuB,EAAE,OAAO,cACvC,CAAC,SAAS,EAAE,SAAS,KAAK,IAAI,UAC9B,OAAO,yBAAyB,EAAE,KAAK,aACvC,OAAO,sBAAsB,EAAE,OAAO,QA+IhD;;OA3LS,MAAM;OACN,MAAM;YACN,MAAM;YACN,MAAM;YACN,MAAM"}
1
+ {"version":3,"file":"zoom.d.ts","sourceRoot":"","sources":["../../../src/view/zoom.js"],"names":[],"mappings":"AAgCA,yCAEC;AAED,0CAGC;AAgBD;;;;;;GAMG;AACH,yCANW,OAAO,yBAAyB,EAAE,OAAO,UACzC,OAAO,uBAAuB,EAAE,OAAO,cACvC,CAAC,SAAS,EAAE,SAAS,KAAK,OAAO,GAAG,IAAI,UACxC,OAAO,yBAAyB,EAAE,KAAK,aACvC,OAAO,sBAAsB,EAAE,OAAO,QA4LhD;;OAtPS,MAAM;OACN,MAAM;YACN,MAAM;YACN,MAAM;YACN,MAAM;;;cAUN,UAAU,CAAC,OAAO,gBAAgB,CAAC;yBACnC,UAAU,CAAC;QAAC,KAAK,EAAE,KAAK,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAC,CAAC;uBAC7C,KAAK,GAAG,SAAS;0BACjB,CAAC,GAAG,CAAC,GAAG,CAAC;;iCAVc,sBAAsB;uBAChC,wBAAwB;kBAE7B,mBAAmB"}