@genome-spy/core 0.37.4 → 0.38.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 (356) hide show
  1. package/dist/bundle/__vite-browser-external-ENoMJThg.js +8 -0
  2. package/dist/bundle/_commonjsHelpers-QtkX90xp.js +30 -0
  3. package/dist/bundle/index-1QVesMzU.js +1074 -0
  4. package/dist/bundle/index-Cbz74kpR.js +638 -0
  5. package/dist/bundle/index-LD6yPc3X.js +515 -0
  6. package/dist/bundle/index-Pv3tKJ1W.js +2190 -0
  7. package/dist/bundle/index-UyrC0vvF.js +72 -0
  8. package/dist/bundle/index-Y-LdHNIz.js +501 -0
  9. package/dist/bundle/index-gn8bhQ8w.js +4050 -0
  10. package/dist/bundle/index-lmJu1tfP.js +1372 -0
  11. package/dist/bundle/index-z4Cs62EO.js +279 -0
  12. package/dist/bundle/index.es.js +6448 -20571
  13. package/dist/bundle/index.js +93 -112
  14. package/dist/bundle/long-Veu0zKh9.js +2382 -0
  15. package/dist/bundle/remoteFile-Ur-gRKsH.js +96 -0
  16. package/dist/schema.json +492 -108
  17. package/dist/src/data/collector.d.ts +11 -11
  18. package/dist/src/data/collector.d.ts.map +1 -1
  19. package/dist/src/data/collector.js +8 -8
  20. package/dist/src/data/dataFlow.d.ts +18 -18
  21. package/dist/src/data/dataFlow.d.ts.map +1 -1
  22. package/dist/src/data/dataFlow.js +7 -7
  23. package/dist/src/data/flowNode.d.ts +9 -9
  24. package/dist/src/data/flowNode.d.ts.map +1 -1
  25. package/dist/src/data/flowNode.js +5 -5
  26. package/dist/src/data/flowOptimizer.d.ts +11 -11
  27. package/dist/src/data/flowOptimizer.d.ts.map +1 -1
  28. package/dist/src/data/flowOptimizer.js +7 -7
  29. package/dist/src/data/flowTestUtils.d.ts +2 -2
  30. package/dist/src/data/flowTestUtils.d.ts.map +1 -1
  31. package/dist/src/data/flowTestUtils.js +1 -1
  32. package/dist/src/data/sources/dataSource.js +1 -1
  33. package/dist/src/data/sources/dataSourceFactory.d.ts +3 -3
  34. package/dist/src/data/sources/dataSourceFactory.d.ts.map +1 -1
  35. package/dist/src/data/sources/dataSourceFactory.js +20 -20
  36. package/dist/src/data/sources/dataUtils.d.ts +20 -20
  37. package/dist/src/data/sources/dataUtils.d.ts.map +1 -1
  38. package/dist/src/data/sources/dataUtils.js +11 -11
  39. package/dist/src/data/sources/dynamic/axisGenomeSource.d.ts +3 -3
  40. package/dist/src/data/sources/dynamic/axisGenomeSource.d.ts.map +1 -1
  41. package/dist/src/data/sources/dynamic/axisGenomeSource.js +2 -2
  42. package/dist/src/data/sources/dynamic/axisTickSource.d.ts +6 -6
  43. package/dist/src/data/sources/dynamic/axisTickSource.d.ts.map +1 -1
  44. package/dist/src/data/sources/dynamic/axisTickSource.js +4 -4
  45. package/dist/src/data/sources/dynamic/bamSource.d.ts +7 -13
  46. package/dist/src/data/sources/dynamic/bamSource.d.ts.map +1 -1
  47. package/dist/src/data/sources/dynamic/bamSource.js +35 -27
  48. package/dist/src/data/sources/dynamic/bigBedSource.d.ts +9 -9
  49. package/dist/src/data/sources/dynamic/bigBedSource.d.ts.map +1 -1
  50. package/dist/src/data/sources/dynamic/bigBedSource.js +31 -18
  51. package/dist/src/data/sources/dynamic/bigWigSource.d.ts +7 -7
  52. package/dist/src/data/sources/dynamic/bigWigSource.d.ts.map +1 -1
  53. package/dist/src/data/sources/dynamic/bigWigSource.js +33 -26
  54. package/dist/src/data/sources/dynamic/gff3Source.d.ts +9 -0
  55. package/dist/src/data/sources/dynamic/gff3Source.d.ts.map +1 -1
  56. package/dist/src/data/sources/dynamic/gff3Source.js +17 -2
  57. package/dist/src/data/sources/dynamic/indexedFastaSource.d.ts +6 -9
  58. package/dist/src/data/sources/dynamic/indexedFastaSource.d.ts.map +1 -1
  59. package/dist/src/data/sources/dynamic/indexedFastaSource.js +28 -18
  60. package/dist/src/data/sources/dynamic/singleAxisLazySource.d.ts +10 -10
  61. package/dist/src/data/sources/dynamic/singleAxisLazySource.d.ts.map +1 -1
  62. package/dist/src/data/sources/dynamic/singleAxisLazySource.js +6 -6
  63. package/dist/src/data/sources/dynamic/tabixSource.d.ts +11 -8
  64. package/dist/src/data/sources/dynamic/tabixSource.d.ts.map +1 -1
  65. package/dist/src/data/sources/dynamic/tabixSource.js +31 -17
  66. package/dist/src/data/sources/inlineSource.d.ts +7 -7
  67. package/dist/src/data/sources/inlineSource.d.ts.map +1 -1
  68. package/dist/src/data/sources/inlineSource.js +5 -5
  69. package/dist/src/data/sources/namedSource.d.ts +9 -9
  70. package/dist/src/data/sources/namedSource.d.ts.map +1 -1
  71. package/dist/src/data/sources/namedSource.js +6 -6
  72. package/dist/src/data/sources/sequenceSource.d.ts +7 -7
  73. package/dist/src/data/sources/sequenceSource.d.ts.map +1 -1
  74. package/dist/src/data/sources/sequenceSource.js +4 -4
  75. package/dist/src/data/sources/urlSource.d.ts +7 -7
  76. package/dist/src/data/sources/urlSource.d.ts.map +1 -1
  77. package/dist/src/data/sources/urlSource.js +4 -4
  78. package/dist/src/data/transforms/aggregate.d.ts +3 -3
  79. package/dist/src/data/transforms/aggregate.d.ts.map +1 -1
  80. package/dist/src/data/transforms/aggregate.js +2 -2
  81. package/dist/src/data/transforms/clone.d.ts +2 -2
  82. package/dist/src/data/transforms/clone.d.ts.map +1 -1
  83. package/dist/src/data/transforms/clone.js +1 -1
  84. package/dist/src/data/transforms/coverage.d.ts +3 -3
  85. package/dist/src/data/transforms/coverage.d.ts.map +1 -1
  86. package/dist/src/data/transforms/coverage.js +1 -1
  87. package/dist/src/data/transforms/coverage.test.js +1 -1
  88. package/dist/src/data/transforms/filter.d.ts +3 -3
  89. package/dist/src/data/transforms/filter.d.ts.map +1 -1
  90. package/dist/src/data/transforms/filter.js +2 -2
  91. package/dist/src/data/transforms/filter.test.js +1 -1
  92. package/dist/src/data/transforms/filterScoredLabels.d.ts +4 -4
  93. package/dist/src/data/transforms/filterScoredLabels.d.ts.map +1 -1
  94. package/dist/src/data/transforms/filterScoredLabels.js +3 -3
  95. package/dist/src/data/transforms/flatten.d.ts +2 -2
  96. package/dist/src/data/transforms/flatten.d.ts.map +1 -1
  97. package/dist/src/data/transforms/flatten.js +3 -3
  98. package/dist/src/data/transforms/flatten.test.js +6 -6
  99. package/dist/src/data/transforms/flattenCompressedExons.d.ts +2 -2
  100. package/dist/src/data/transforms/flattenCompressedExons.d.ts.map +1 -1
  101. package/dist/src/data/transforms/flattenCompressedExons.js +1 -1
  102. package/dist/src/data/transforms/flattenDelimited.d.ts +2 -2
  103. package/dist/src/data/transforms/flattenDelimited.d.ts.map +1 -1
  104. package/dist/src/data/transforms/flattenDelimited.js +2 -2
  105. package/dist/src/data/transforms/flattenDelimited.test.js +5 -5
  106. package/dist/src/data/transforms/flattenSequence.d.ts +2 -2
  107. package/dist/src/data/transforms/flattenSequence.d.ts.map +1 -1
  108. package/dist/src/data/transforms/flattenSequence.js +1 -1
  109. package/dist/src/data/transforms/flattenSequence.test.js +1 -1
  110. package/dist/src/data/transforms/formula.d.ts +3 -3
  111. package/dist/src/data/transforms/formula.d.ts.map +1 -1
  112. package/dist/src/data/transforms/formula.js +2 -2
  113. package/dist/src/data/transforms/identifier.d.ts +3 -3
  114. package/dist/src/data/transforms/identifier.d.ts.map +1 -1
  115. package/dist/src/data/transforms/identifier.js +2 -2
  116. package/dist/src/data/transforms/linearizeGenomicCoordinate.d.ts +3 -3
  117. package/dist/src/data/transforms/linearizeGenomicCoordinate.d.ts.map +1 -1
  118. package/dist/src/data/transforms/linearizeGenomicCoordinate.js +2 -2
  119. package/dist/src/data/transforms/measureText.d.ts +2 -2
  120. package/dist/src/data/transforms/measureText.d.ts.map +1 -1
  121. package/dist/src/data/transforms/measureText.js +1 -1
  122. package/dist/src/data/transforms/pileup.d.ts +3 -3
  123. package/dist/src/data/transforms/pileup.d.ts.map +1 -1
  124. package/dist/src/data/transforms/pileup.js +1 -1
  125. package/dist/src/data/transforms/pileup.test.js +1 -1
  126. package/dist/src/data/transforms/project.d.ts +2 -2
  127. package/dist/src/data/transforms/project.d.ts.map +1 -1
  128. package/dist/src/data/transforms/project.js +1 -1
  129. package/dist/src/data/transforms/project.test.js +1 -1
  130. package/dist/src/data/transforms/regexExtract.d.ts +2 -2
  131. package/dist/src/data/transforms/regexExtract.d.ts.map +1 -1
  132. package/dist/src/data/transforms/regexExtract.js +1 -1
  133. package/dist/src/data/transforms/regexExtract.test.js +3 -3
  134. package/dist/src/data/transforms/regexFold.d.ts +2 -2
  135. package/dist/src/data/transforms/regexFold.d.ts.map +1 -1
  136. package/dist/src/data/transforms/regexFold.js +2 -2
  137. package/dist/src/data/transforms/regexFold.test.js +3 -3
  138. package/dist/src/data/transforms/sample.d.ts +2 -2
  139. package/dist/src/data/transforms/sample.d.ts.map +1 -1
  140. package/dist/src/data/transforms/sample.js +2 -2
  141. package/dist/src/data/transforms/stack.d.ts +3 -3
  142. package/dist/src/data/transforms/stack.d.ts.map +1 -1
  143. package/dist/src/data/transforms/stack.js +2 -2
  144. package/dist/src/data/transforms/stack.test.js +2 -2
  145. package/dist/src/data/transforms/transformFactory.d.ts +5 -5
  146. package/dist/src/data/transforms/transformFactory.d.ts.map +1 -1
  147. package/dist/src/data/transforms/transformFactory.js +3 -3
  148. package/dist/src/encoder/accessor.d.ts +6 -6
  149. package/dist/src/encoder/accessor.d.ts.map +1 -1
  150. package/dist/src/encoder/accessor.js +4 -4
  151. package/dist/src/encoder/encoder.d.ts +59 -59
  152. package/dist/src/encoder/encoder.d.ts.map +1 -1
  153. package/dist/src/encoder/encoder.js +40 -40
  154. package/dist/src/encoder/encoder.test.js +4 -4
  155. package/dist/src/fonts/bmFontManager.d.ts +7 -7
  156. package/dist/src/fonts/bmFontManager.d.ts.map +1 -1
  157. package/dist/src/fonts/bmFontManager.js +3 -3
  158. package/dist/src/fonts/bmFontMetrics.d.ts +6 -6
  159. package/dist/src/fonts/bmFontMetrics.d.ts.map +1 -1
  160. package/dist/src/fonts/bmFontMetrics.js +4 -4
  161. package/dist/src/genome/genome.d.ts +7 -7
  162. package/dist/src/genome/genome.d.ts.map +1 -1
  163. package/dist/src/genome/genome.js +2 -2
  164. package/dist/src/genome/genomeStore.d.ts +2 -2
  165. package/dist/src/genome/genomeStore.d.ts.map +1 -1
  166. package/dist/src/genome/genomeStore.js +1 -1
  167. package/dist/src/genome/locusFormat.d.ts +7 -7
  168. package/dist/src/genome/locusFormat.d.ts.map +1 -1
  169. package/dist/src/genome/locusFormat.js +4 -4
  170. package/dist/src/genome/scaleIndex.d.ts +1 -1
  171. package/dist/src/genome/scaleIndex.d.ts.map +1 -1
  172. package/dist/src/genome/scaleIndex.js +1 -1
  173. package/dist/src/genome/scaleLocus.d.ts +2 -2
  174. package/dist/src/genome/scaleLocus.d.ts.map +1 -1
  175. package/dist/src/genome/scaleLocus.js +3 -3
  176. package/dist/src/genomeSpy.d.ts +12 -12
  177. package/dist/src/genomeSpy.d.ts.map +1 -1
  178. package/dist/src/genomeSpy.js +51 -34
  179. package/dist/src/gl/arrayBuilder.d.ts.map +1 -1
  180. package/dist/src/gl/dataToVertices.d.ts +18 -18
  181. package/dist/src/gl/dataToVertices.d.ts.map +1 -1
  182. package/dist/src/gl/dataToVertices.js +10 -10
  183. package/dist/src/gl/webGLHelper.d.ts +4 -4
  184. package/dist/src/gl/webGLHelper.d.ts.map +1 -1
  185. package/dist/src/gl/webGLHelper.js +2 -2
  186. package/dist/src/index.d.ts.map +1 -1
  187. package/dist/src/index.js +1 -1
  188. package/dist/src/marks/link.js +5 -5
  189. package/dist/src/marks/mark.d.ts +35 -32
  190. package/dist/src/marks/mark.d.ts.map +1 -1
  191. package/dist/src/marks/mark.js +26 -23
  192. package/dist/src/marks/markUtils.d.ts +10 -10
  193. package/dist/src/marks/markUtils.d.ts.map +1 -1
  194. package/dist/src/marks/markUtils.js +5 -5
  195. package/dist/src/marks/pointMark.d.ts +1 -1
  196. package/dist/src/marks/pointMark.d.ts.map +1 -1
  197. package/dist/src/marks/pointMark.js +7 -7
  198. package/dist/src/marks/rectMark.d.ts +2 -2
  199. package/dist/src/marks/rectMark.d.ts.map +1 -1
  200. package/dist/src/marks/rectMark.js +7 -7
  201. package/dist/src/marks/rule.js +6 -6
  202. package/dist/src/marks/text.d.ts +1 -1
  203. package/dist/src/marks/text.d.ts.map +1 -1
  204. package/dist/src/marks/text.js +6 -6
  205. package/dist/src/scale/colorUtils.d.ts +4 -4
  206. package/dist/src/scale/colorUtils.d.ts.map +1 -1
  207. package/dist/src/scale/colorUtils.js +2 -2
  208. package/dist/src/scale/glslScaleGenerator.d.ts +3 -3
  209. package/dist/src/scale/glslScaleGenerator.d.ts.map +1 -1
  210. package/dist/src/scale/glslScaleGenerator.js +2 -2
  211. package/dist/src/scale/scale.d.ts +3 -3
  212. package/dist/src/scale/scale.d.ts.map +1 -1
  213. package/dist/src/scale/scale.js +2 -2
  214. package/dist/src/scale/ticks.d.ts +4 -4
  215. package/dist/src/scale/ticks.js +4 -4
  216. package/dist/src/spec/axis.d.ts +1 -1
  217. package/dist/src/spec/channel.d.ts +2 -2
  218. package/dist/src/spec/data.d.ts +2 -2
  219. package/dist/src/spec/mark.d.ts +3 -3
  220. package/dist/src/spec/root.d.ts +2 -2
  221. package/dist/src/spec/sampleView.d.ts +5 -5
  222. package/dist/src/spec/scale.d.ts +1 -1
  223. package/dist/src/spec/title.d.ts +1 -1
  224. package/dist/src/spec/view.d.ts +36 -9
  225. package/dist/src/tooltip/dataTooltipHandler.js +1 -1
  226. package/dist/src/tooltip/refseqGeneTooltipHandler.d.ts.map +1 -1
  227. package/dist/src/tooltip/refseqGeneTooltipHandler.js +1 -1
  228. package/dist/src/tooltip/tooltipHandler.d.ts +1 -1
  229. package/dist/src/tooltip/tooltipHandler.d.ts.map +1 -1
  230. package/dist/src/tooltip/tooltipHandler.ts +1 -1
  231. package/dist/src/types/embedApi.d.ts +3 -3
  232. package/dist/src/types/encoder.d.ts +4 -4
  233. package/dist/src/types/flowBatch.d.ts +1 -1
  234. package/dist/src/types/rendering.d.ts +3 -3
  235. package/dist/src/types/scaleResolutionApi.d.ts +2 -2
  236. package/dist/src/types/viewContext.d.ts +41 -12
  237. package/dist/src/utils/animator.d.ts +2 -2
  238. package/dist/src/utils/animator.d.ts.map +1 -1
  239. package/dist/src/utils/animator.js +1 -1
  240. package/dist/src/utils/inertia.d.ts +3 -3
  241. package/dist/src/utils/inertia.d.ts.map +1 -1
  242. package/dist/src/utils/inertia.js +1 -1
  243. package/dist/src/utils/interactionEvent.d.ts +5 -5
  244. package/dist/src/utils/interactionEvent.d.ts.map +1 -1
  245. package/dist/src/utils/interactionEvent.js +2 -2
  246. package/dist/src/utils/trees.js +1 -1
  247. package/dist/src/view/axisGridView.d.ts +17 -16
  248. package/dist/src/view/axisGridView.d.ts.map +1 -1
  249. package/dist/src/view/axisGridView.js +24 -20
  250. package/dist/src/view/axisResolution.d.ts +10 -10
  251. package/dist/src/view/axisResolution.d.ts.map +1 -1
  252. package/dist/src/view/axisResolution.js +6 -6
  253. package/dist/src/view/axisResolution.test.js +1 -1
  254. package/dist/src/view/axisView.d.ts +18 -17
  255. package/dist/src/view/axisView.d.ts.map +1 -1
  256. package/dist/src/view/axisView.js +39 -35
  257. package/dist/src/view/concatView.d.ts +5 -5
  258. package/dist/src/view/concatView.d.ts.map +1 -1
  259. package/dist/src/view/concatView.js +23 -23
  260. package/dist/src/view/containerView.d.ts +10 -8
  261. package/dist/src/view/containerView.d.ts.map +1 -1
  262. package/dist/src/view/containerView.js +18 -13
  263. package/dist/src/view/facetView.d.ts +12 -12
  264. package/dist/src/view/facetView.d.ts.map +1 -1
  265. package/dist/src/view/facetView.js +19 -19
  266. package/dist/src/view/flowBuilder.d.ts +4 -4
  267. package/dist/src/view/flowBuilder.d.ts.map +1 -1
  268. package/dist/src/view/flowBuilder.js +13 -13
  269. package/dist/src/view/flowBuilder.test.js +7 -7
  270. package/dist/src/view/gridView.d.ts +63 -35
  271. package/dist/src/view/gridView.d.ts.map +1 -1
  272. package/dist/src/view/gridView.js +400 -113
  273. package/dist/src/view/layerView.d.ts +12 -14
  274. package/dist/src/view/layerView.d.ts.map +1 -1
  275. package/dist/src/view/layerView.js +55 -26
  276. package/dist/src/{utils → view}/layout/flexLayout.d.ts +6 -6
  277. package/dist/src/view/layout/flexLayout.d.ts.map +1 -0
  278. package/dist/src/{utils → view}/layout/flexLayout.js +4 -4
  279. package/dist/src/view/layout/grid.d.ts.map +1 -0
  280. package/dist/src/{utils → view}/layout/padding.d.ts +4 -4
  281. package/dist/src/view/layout/padding.d.ts.map +1 -0
  282. package/dist/src/{utils → view}/layout/padding.js +2 -2
  283. package/dist/src/view/layout/point.d.ts.map +1 -0
  284. package/dist/src/{utils → view}/layout/rectangle.d.ts +8 -2
  285. package/dist/src/view/layout/rectangle.d.ts.map +1 -0
  286. package/dist/src/{utils → view}/layout/rectangle.js +22 -2
  287. package/dist/src/{utils → view}/layout/rectangle.test.js +8 -0
  288. package/dist/src/view/renderingContext/bufferedViewRenderingContext.d.ts +10 -10
  289. package/dist/src/view/renderingContext/bufferedViewRenderingContext.d.ts.map +1 -1
  290. package/dist/src/view/renderingContext/bufferedViewRenderingContext.js +10 -10
  291. package/dist/src/view/renderingContext/compositeViewRenderingContext.d.ts +2 -2
  292. package/dist/src/view/renderingContext/compositeViewRenderingContext.d.ts.map +1 -1
  293. package/dist/src/view/renderingContext/compositeViewRenderingContext.js +4 -4
  294. package/dist/src/view/renderingContext/debuggingViewRenderingContext.d.ts +4 -4
  295. package/dist/src/view/renderingContext/debuggingViewRenderingContext.d.ts.map +1 -1
  296. package/dist/src/view/renderingContext/debuggingViewRenderingContext.js +3 -3
  297. package/dist/src/view/renderingContext/layoutRecorderViewRenderingContext.d.ts +8 -8
  298. package/dist/src/view/renderingContext/layoutRecorderViewRenderingContext.d.ts.map +1 -1
  299. package/dist/src/view/renderingContext/layoutRecorderViewRenderingContext.js +4 -4
  300. package/dist/src/view/renderingContext/simpleViewRenderingContext.d.ts +6 -6
  301. package/dist/src/view/renderingContext/simpleViewRenderingContext.d.ts.map +1 -1
  302. package/dist/src/view/renderingContext/simpleViewRenderingContext.js +7 -7
  303. package/dist/src/view/renderingContext/svgViewRenderingContext.d.ts +4 -4
  304. package/dist/src/view/renderingContext/svgViewRenderingContext.d.ts.map +1 -1
  305. package/dist/src/view/renderingContext/svgViewRenderingContext.js +6 -6
  306. package/dist/src/view/renderingContext/viewRenderingContext.d.ts +10 -10
  307. package/dist/src/view/renderingContext/viewRenderingContext.d.ts.map +1 -1
  308. package/dist/src/view/renderingContext/viewRenderingContext.js +5 -5
  309. package/dist/src/view/scaleResolution.d.ts +21 -17
  310. package/dist/src/view/scaleResolution.d.ts.map +1 -1
  311. package/dist/src/view/scaleResolution.js +29 -24
  312. package/dist/src/view/scaleResolution.test.js +57 -72
  313. package/dist/src/view/testUtils.d.ts +6 -15
  314. package/dist/src/view/testUtils.d.ts.map +1 -1
  315. package/dist/src/view/testUtils.js +40 -44
  316. package/dist/src/view/title.d.ts +3 -3
  317. package/dist/src/view/title.d.ts.map +1 -1
  318. package/dist/src/view/title.js +12 -12
  319. package/dist/src/view/unitView.d.ts +31 -30
  320. package/dist/src/view/unitView.d.ts.map +1 -1
  321. package/dist/src/view/unitView.js +30 -22
  322. package/dist/src/view/view.d.ts +86 -57
  323. package/dist/src/view/view.d.ts.map +1 -1
  324. package/dist/src/view/view.js +148 -103
  325. package/dist/src/view/view.test.js +9 -8
  326. package/dist/src/view/viewError.d.ts +9 -0
  327. package/dist/src/view/viewError.d.ts.map +1 -0
  328. package/dist/src/view/viewError.js +11 -0
  329. package/dist/src/view/viewFactory.d.ts +53 -20
  330. package/dist/src/view/viewFactory.d.ts.map +1 -1
  331. package/dist/src/view/viewFactory.js +148 -33
  332. package/dist/src/view/viewFactory.test.js +8 -0
  333. package/dist/src/view/viewUtils.d.ts +14 -12
  334. package/dist/src/view/viewUtils.d.ts.map +1 -1
  335. package/dist/src/view/viewUtils.js +10 -63
  336. package/dist/src/view/zoom.d.ts +4 -4
  337. package/dist/src/view/zoom.d.ts.map +1 -1
  338. package/dist/src/view/zoom.js +3 -3
  339. package/package.json +7 -5
  340. package/dist/src/utils/layout/flexLayout.d.ts.map +0 -1
  341. package/dist/src/utils/layout/grid.d.ts.map +0 -1
  342. package/dist/src/utils/layout/padding.d.ts.map +0 -1
  343. package/dist/src/utils/layout/point.d.ts.map +0 -1
  344. package/dist/src/utils/layout/rectangle.d.ts.map +0 -1
  345. package/dist/src/view/implicitRootView.d.ts +0 -9
  346. package/dist/src/view/implicitRootView.d.ts.map +0 -1
  347. package/dist/src/view/implicitRootView.js +0 -23
  348. package/dist/src/view/importView.d.ts +0 -17
  349. package/dist/src/view/importView.d.ts.map +0 -1
  350. package/dist/src/view/importView.js +0 -22
  351. /package/dist/src/{utils → view}/layout/flexLayout.test.js +0 -0
  352. /package/dist/src/{utils → view}/layout/grid.d.ts +0 -0
  353. /package/dist/src/{utils → view}/layout/grid.js +0 -0
  354. /package/dist/src/{utils → view}/layout/grid.test.js +0 -0
  355. /package/dist/src/{utils → view}/layout/point.d.ts +0 -0
  356. /package/dist/src/{utils → view}/layout/point.js +0 -0
@@ -2,8 +2,8 @@ import {
2
2
  parseSizeDef,
3
3
  FlexDimensions,
4
4
  ZERO_FLEXDIMENSIONS,
5
- } from "../utils/layout/flexLayout.js";
6
- import Padding from "../utils/layout/padding.js";
5
+ } from "./layout/flexLayout.js";
6
+ import Padding from "./layout/padding.js";
7
7
  import {
8
8
  getCachedOrCall,
9
9
  initPropertyCache,
@@ -15,6 +15,7 @@ import { isFieldDef, getPrimaryChannel } from "../encoder/encoder.js";
15
15
  import { appendToBaseUrl } from "../utils/url.js";
16
16
  import { isDiscrete, bandSpace } from "vega-scale";
17
17
  import { peek } from "../utils/arrayUtils.js";
18
+ import ViewError from "./viewError.js";
18
19
 
19
20
  // TODO: View classes have too many responsibilities. Come up with a way
20
21
  // to separate the concerns. However, most concerns are tightly tied to
@@ -43,13 +44,19 @@ const defaultOpacityFunction = (parentOpacity) => parentOpacity;
43
44
  * } Visitor
44
45
  *
45
46
  * @typedef {object} BroadcastMessage
46
- * @prop {import("../genomeSpy").BroadcastEventType} type Broadcast type
47
+ * @prop {import("../genomeSpy.js").BroadcastEventType} type Broadcast type
47
48
  * @prop {any} [payload] Anything
48
49
  *
49
50
  * @callback InteractionEventListener
50
- * @param {import("../utils/layout/rectangle").default} coords
51
+ * @param {import("./layout/rectangle.js").default} coords
51
52
  * Coordinates of the view
52
- * @param {import("../utils/interactionEvent").default} event
53
+ * @param {import("../utils/interactionEvent.js").default} event
54
+ *
55
+ * @typedef {object} ViewOptions
56
+ * @prop {boolean} [blockEncodingInheritance]
57
+ * Don't inherit encodings from parent. Default: false.
58
+ * @prop {boolean} [contributesToScaleDomain]
59
+ * Whether ScaleResolution should include this view or its children in the domain. Default: true
53
60
  */
54
61
  export default class View {
55
62
  /** @type {Record<string, (function(BroadcastMessage):void)[]>} */
@@ -68,13 +75,15 @@ export default class View {
68
75
 
69
76
  /**
70
77
  *
71
- * @param {import("../spec/view").ViewSpec} spec
72
- * @param {import("../types/viewContext").default} context
73
- * @param {import("./containerView").default} layoutParent Parent that handles rendering of this view
74
- * @param {import("./view").default} dataParent Parent that provides data, encodings, and is used in scale resolution
78
+ * @param {import("../spec/view.js").ViewSpec} spec
79
+ * @param {import("../types/viewContext.js").default} context
80
+ * @param {import("./containerView.js").default} layoutParent Parent that handles rendering of this view
81
+ * @param {import("./view.js").default} dataParent Parent that provides data, encodings, and is used in scale resolution
75
82
  * @param {string} name
83
+ * @param {ViewOptions} [options]
84
+ *
76
85
  */
77
- constructor(spec, context, layoutParent, dataParent, name) {
86
+ constructor(spec, context, layoutParent, dataParent, name, options = {}) {
78
87
  if (!spec) {
79
88
  throw new Error("View spec must be defined!");
80
89
  }
@@ -88,33 +97,27 @@ export default class View {
88
97
  this.resolutions = {
89
98
  /**
90
99
  * Channel-specific scale resolutions
91
- * @type {Partial<Record<import("../spec/channel").ChannelWithScale, import("./scaleResolution").default>>}
100
+ * @type {Partial<Record<import("../spec/channel.js").ChannelWithScale, import("./scaleResolution.js").default>>}
92
101
  */
93
102
  scale: {},
94
103
  /**
95
104
  * Channel-specific axis resolutions
96
- * @type {Partial<Record<import("../spec/channel").PrimaryPositionalChannel, import("./axisResolution").default>>}
105
+ * @type {Partial<Record<import("../spec/channel.js").PrimaryPositionalChannel, import("./axisResolution.js").default>>}
97
106
  */
98
107
  axis: {},
99
108
  };
100
109
 
101
110
  initPropertyCache(this);
102
111
 
103
- /**
104
- * Don't inherit encodings from parent.
105
- * TODO: Make configurable through spec. Allow more fine-grained control.
106
- */
107
- this.blockEncodingInheritance = false;
108
-
109
- /**
110
- * Whether ScaleResolution should include this view or its children in the domain.
111
- * This is mainly used to block axis views from contributing to the domain.
112
- */
113
- this.contributesToScaleDomain = true;
112
+ this.options = {
113
+ blockEncodingInheritance: false,
114
+ contributesToScaleDomain: true,
115
+ ...options,
116
+ };
114
117
 
115
118
  /**
116
119
  * Whether GridView or equivalent should draw axis and grid lines for this view.
117
- * @type {Record<import("../spec/channel").PrimaryPositionalChannel, boolean>}
120
+ * @type {Record<import("../spec/channel.js").PrimaryPositionalChannel, boolean>}
118
121
  */
119
122
  this.needsAxes = { x: false, y: false };
120
123
  }
@@ -134,6 +137,18 @@ export default class View {
134
137
  return Padding.zero();
135
138
  }
136
139
 
140
+ /**
141
+ * Returns true if the view has explicit viewport size specified and should be
142
+ * scrollable.
143
+ *
144
+ * @returns {boolean}
145
+ */
146
+ isScrollable() {
147
+ return (
148
+ this.spec.viewportWidth != null || this.spec.viewportHeight != null
149
+ );
150
+ }
151
+
137
152
  /**
138
153
  * Returns the configured size, if present. Otherwise a computed or default
139
154
  * height is returned.
@@ -143,70 +158,99 @@ export default class View {
143
158
  getSize() {
144
159
  return this._cache("size/size", () =>
145
160
  this.isConfiguredVisible()
146
- ? this.#getSizeFromSpec()
161
+ ? new FlexDimensions(
162
+ this.#getDimensionSize("width"),
163
+ this.#getDimensionSize("height")
164
+ )
147
165
  : ZERO_FLEXDIMENSIONS
148
166
  );
149
167
  }
150
168
 
151
169
  /**
152
- * @return {FlexDimensions}
170
+ * @returns {FlexDimensions}
153
171
  */
154
- #getSizeFromSpec() {
155
- /**
156
- * @param {"width" | "height"} dimension
157
- * @return {import("../utils/layout/flexLayout").SizeDef}
158
- */
159
- const handleSize = (dimension) => {
160
- let value = this.spec[dimension];
161
-
162
- if (isStepSize(value)) {
163
- const stepSize = value.step;
164
-
165
- const scale = this.getScaleResolution(
166
- dimension == "width" ? "x" : "y"
167
- )?.getScale();
168
-
169
- if (scale) {
170
- // Note: this and all ancestral views need to be refreshed when the domain is changed.
171
- let steps = 0;
172
- if (isDiscrete(scale.type)) {
173
- steps = scale.domain().length;
174
- } else if (["locus", "index"].includes(scale.type)) {
175
- const domain = scale.domain();
176
- steps = peek(domain) - domain[0];
177
- } else {
178
- throw new Error(
179
- `Cannot use step-based size with "${scale.type}" scale!`
180
- );
181
- }
182
-
183
- // TODO: Type guards maybe?
184
- const _scale =
185
- /** @type {import("d3-scale").ScaleBand<any> | import("../genome/scaleLocus").ScaleLocus | import("../genome/scaleIndex").ScaleIndex} */ (
186
- scale
187
- );
188
-
189
- steps = bandSpace(
190
- steps,
191
- _scale.paddingInner(),
192
- _scale.paddingOuter()
193
- );
172
+ getViewportSize() {
173
+ if (!this.isScrollable()) {
174
+ return this.getSize();
175
+ }
176
+
177
+ if (!this.isConfiguredVisible()) {
178
+ return ZERO_FLEXDIMENSIONS;
179
+ }
180
+
181
+ const size = this.getSize();
194
182
 
195
- return { px: steps * stepSize, grow: 0 };
183
+ // TODO: Caching
184
+ return new FlexDimensions(
185
+ this.#getDimensionSize("viewportWidth") ?? size.width,
186
+ this.#getDimensionSize("viewportHeight") ?? size.height
187
+ );
188
+ }
189
+
190
+ /**
191
+ * @param {"width" | "height" | "viewportWidth" | "viewportHeight"} dimension
192
+ * @return {import("./layout/flexLayout.js").SizeDef}
193
+ */
194
+ #getDimensionSize(dimension) {
195
+ let value = this.spec[dimension];
196
+
197
+ const viewport =
198
+ dimension == "viewportWidth" || dimension == "viewportHeight";
199
+
200
+ if (isStepSize(value)) {
201
+ if (viewport) {
202
+ throw new ViewError(
203
+ `Cannot use step-based size with "${dimension}"!`,
204
+ this
205
+ );
206
+ }
207
+
208
+ const stepSize = value.step;
209
+
210
+ const scale = this.getScaleResolution(
211
+ dimension == "width" ? "x" : "y"
212
+ )?.getScale();
213
+
214
+ if (scale) {
215
+ // Note: this and all ancestral views need to be refreshed when the domain is changed.
216
+ let steps = 0;
217
+ if (isDiscrete(scale.type)) {
218
+ steps = scale.domain().length;
219
+ } else if (["locus", "index"].includes(scale.type)) {
220
+ const domain = scale.domain();
221
+ steps = peek(domain) - domain[0];
196
222
  } else {
197
- throw new Error(
198
- "Cannot use 'step' size with missing scale!"
223
+ throw new ViewError(
224
+ `Cannot use step-based size with "${scale.type}" scale!`,
225
+ this
199
226
  );
200
227
  }
228
+
229
+ // TODO: Type guards maybe?
230
+ const _scale =
231
+ /** @type {import("d3-scale").ScaleBand<any> | import("../genome/scaleLocus.js").ScaleLocus | import("../genome/scaleIndex.js").ScaleIndex} */ (
232
+ scale
233
+ );
234
+
235
+ steps = bandSpace(
236
+ steps,
237
+ _scale.paddingInner(),
238
+ _scale.paddingOuter()
239
+ );
240
+
241
+ return { px: steps * stepSize, grow: 0 };
201
242
  } else {
202
- return (value && parseSizeDef(value)) ?? { px: 0, grow: 1 };
243
+ throw new ViewError(
244
+ "Cannot use 'step' size with missing scale!",
245
+ this
246
+ );
203
247
  }
204
- };
205
-
206
- return this._cache(
207
- "size/sizeFromSpec",
208
- () => new FlexDimensions(handleSize("width"), handleSize("height"))
209
- );
248
+ } else {
249
+ return (
250
+ (value && parseSizeDef(value)) ??
251
+ (viewport ? undefined : { px: 0, grow: 1 })
252
+ );
253
+ }
210
254
  }
211
255
 
212
256
  isConfiguredVisible() {
@@ -312,9 +356,9 @@ export default class View {
312
356
  /**
313
357
  * Handles an interactionEvent
314
358
  *
315
- * @param {import("../utils/layout/rectangle").default} coords
359
+ * @param {import("./layout/rectangle.js").default} coords
316
360
  * Coordinates of the view
317
- * @param {import("../utils/interactionEvent").default} event
361
+ * @param {import("../utils/interactionEvent.js").default} event
318
362
  * @param {boolean} capturing
319
363
  */
320
364
  handleInteractionEvent(coords, event, capturing) {
@@ -391,7 +435,7 @@ export default class View {
391
435
  /**
392
436
  * Called after all scales in the view hierarchy have been resolved.
393
437
  */
394
- onScalesResolved() {
438
+ configureViewOpacity() {
395
439
  // Only set the opacity function once. The idea is to allow custom functions
396
440
  // and prevent accidental overwrites.
397
441
  if (
@@ -414,7 +458,7 @@ export default class View {
414
458
  * Recursively traverses the view hierarchy, computes the view coordinates,
415
459
  * and coordinates the mark rendering.
416
460
  *
417
- * @type {import("../types/rendering").RenderMethod}
461
+ * @type {import("../types/rendering.js").RenderMethod}
418
462
  */
419
463
  render(context, coords, options = {}) {
420
464
  // override
@@ -425,16 +469,16 @@ export default class View {
425
469
  * encodings. However, this does not contain any defaults or inferred/adjusted/fixed
426
470
  * encodings. Those are available in Mark's encoding property.
427
471
  *
428
- * @return {import("../spec/channel").Encoding}
472
+ * @return {import("../spec/channel.js").Encoding}
429
473
  */
430
474
  getEncoding() {
431
475
  const pe =
432
- this.dataParent && !this.blockEncodingInheritance
476
+ this.dataParent && !this.options.blockEncodingInheritance
433
477
  ? this.dataParent.getEncoding()
434
478
  : {};
435
479
  const te = this.spec.encoding || {};
436
480
 
437
- /** @type {import("../spec/channel").Encoding} */
481
+ /** @type {import("../spec/channel.js").Encoding} */
438
482
  const combined = {
439
483
  ...pe,
440
484
  ...te,
@@ -497,11 +541,11 @@ export default class View {
497
541
  }
498
542
 
499
543
  /**
500
- * @param {import("../spec/channel").ChannelWithScale} channel
544
+ * @param {import("../spec/channel.js").ChannelWithScale} channel
501
545
  */
502
546
  getScaleResolution(channel) {
503
547
  const primaryChannel =
504
- /** @type {import("../spec/channel").ChannelWithScale} */ (
548
+ /** @type {import("../spec/channel.js").ChannelWithScale} */ (
505
549
  getPrimaryChannel(channel)
506
550
  );
507
551
 
@@ -511,11 +555,11 @@ export default class View {
511
555
  }
512
556
 
513
557
  /**
514
- * @param {import("../spec/channel").PositionalChannel} channel
558
+ * @param {import("../spec/channel.js").PositionalChannel} channel
515
559
  */
516
560
  getAxisResolution(channel) {
517
561
  const primaryChannel =
518
- /** @type {import("../spec/channel").PrimaryPositionalChannel} */ (
562
+ /** @type {import("../spec/channel.js").PrimaryPositionalChannel} */ (
519
563
  getPrimaryChannel(channel)
520
564
  );
521
565
 
@@ -525,18 +569,18 @@ export default class View {
525
569
  }
526
570
 
527
571
  /**
528
- * @param {import("../spec/channel").Channel | "default"} channel
529
- * @param {import("../spec/view").ResolutionTarget} resolutionType
530
- * @returns {import("../spec/view").ResolutionBehavior}
572
+ * @param {import("../spec/channel.js").Channel | "default"} channel
573
+ * @param {import("../spec/view.js").ResolutionTarget} resolutionType
574
+ * @returns {import("../spec/view.js").ResolutionBehavior}
531
575
  */
532
576
  getConfiguredResolution(channel, resolutionType) {
533
577
  return this.spec.resolve?.[resolutionType]?.[channel];
534
578
  }
535
579
 
536
580
  /**
537
- * @param {import("../spec/channel").Channel} channel
538
- * @param {import("../spec/view").ResolutionTarget} resolutionType
539
- * @returns {import("../spec/view").ResolutionBehavior}
581
+ * @param {import("../spec/channel.js").Channel} channel
582
+ * @param {import("../spec/view.js").ResolutionTarget} resolutionType
583
+ * @returns {import("../spec/view.js").ResolutionBehavior}
540
584
  */
541
585
  getConfiguredOrDefaultResolution(channel, resolutionType) {
542
586
  return (
@@ -547,9 +591,9 @@ export default class View {
547
591
  }
548
592
 
549
593
  /**
550
- * @param {import("../spec/channel").Channel} channel
551
- * @param {import("../spec/view").ResolutionTarget} resolutionType
552
- * @returns {import("../spec/view").ResolutionBehavior}
594
+ * @param {import("../spec/channel.js").Channel} channel
595
+ * @param {import("../spec/view.js").ResolutionTarget} resolutionType
596
+ * @returns {import("../spec/view.js").ResolutionBehavior}
553
597
  */
554
598
  getDefaultResolution(channel, resolutionType) {
555
599
  return "independent";
@@ -620,7 +664,7 @@ export default class View {
620
664
  * Broadcasts a message to views that include the given (x, y) point.
621
665
  * This is mainly intended for mouse events.
622
666
  *
623
- * @param {import("../utils/interactionEvent").default} event
667
+ * @param {import("../utils/interactionEvent.js").default} event
624
668
  */
625
669
  propagateInteractionEvent(event) {
626
670
  // Subclasses must implement proper handling
@@ -630,7 +674,7 @@ export default class View {
630
674
  /**
631
675
  *
632
676
  * @param {any} opacity
633
- * @returns {opacity is import("../spec/view").DynamicOpacity}
677
+ * @returns {opacity is import("../spec/view.js").DynamicOpacity}
634
678
  */
635
679
  function isDynamicOpacity(opacity) {
636
680
  return "unitsPerPixel" in opacity;
@@ -648,7 +692,7 @@ function createViewOpacityFunction(view) {
648
692
  if (isNumber(opacityDef)) {
649
693
  return (parentOpacity) => parentOpacity * opacityDef;
650
694
  } else if (isDynamicOpacity(opacityDef)) {
651
- /** @type {(channel: import("../spec/channel").ChannelWithScale) => any} */
695
+ /** @type {(channel: import("../spec/channel.js").ChannelWithScale) => any} */
652
696
  const getScale = (channel) => {
653
697
  const scale = view.getScaleResolution(channel)?.getScale();
654
698
  // Only works on linear scales
@@ -659,11 +703,12 @@ function createViewOpacityFunction(view) {
659
703
 
660
704
  const scale = opacityDef.channel
661
705
  ? getScale(opacityDef.channel)
662
- : getScale("x") || getScale("y");
706
+ : getScale("x") ?? getScale("y");
663
707
 
664
708
  if (!scale) {
665
- throw new Error(
666
- "Cannot find a resolved quantitative scale for dynamic opacity!"
709
+ throw new ViewError(
710
+ "Cannot find a resolved quantitative scale for dynamic opacity!",
711
+ view
667
712
  );
668
713
  }
669
714
 
@@ -686,6 +731,6 @@ function createViewOpacityFunction(view) {
686
731
  /**
687
732
  *
688
733
  * @param {any} size
689
- * @return {size is import("../spec/view").Step}
734
+ * @return {size is import("../spec/view.js").Step}
690
735
  */
691
736
  export const isStepSize = (size) => !!size?.step;
@@ -9,18 +9,19 @@ import View from "./view.js";
9
9
  import LayerView from "./layerView.js";
10
10
 
11
11
  describe("Trivial creations and initializations", () => {
12
- test("Fails on empty spec", () => {
13
- // @ts-ignore
14
- expect(() => create({}, View)).toThrow();
12
+ test("Fails on empty spec", async () => {
13
+ expect(create({}, View)).rejects.toThrow();
15
14
  });
16
15
 
17
16
  test("Parses a trivial spec", () => {
18
- expect(create({ mark: "point" }, View)).toBeInstanceOf(UnitView);
19
- expect(create({ layer: [] }, View)).toBeInstanceOf(LayerView);
17
+ expect(create({ mark: "point" }, View)).resolves.toBeInstanceOf(
18
+ UnitView
19
+ );
20
+ expect(create({ layer: [] }, View)).resolves.toBeInstanceOf(LayerView);
20
21
  });
21
22
 
22
- test("Parses a more comples spec", () => {
23
- const view = create(
23
+ test("Parses a more comples spec", async () => {
24
+ const view = await create(
24
25
  {
25
26
  concat: [
26
27
  {
@@ -40,7 +41,7 @@ describe("Trivial creations and initializations", () => {
40
41
  expect(view.children[2]).toBeUndefined();
41
42
  });
42
43
 
43
- test("Parses and initializes a trivial spec", () => {
44
+ test("Parses and initializes a trivial spec", async () => {
44
45
  const spec = {
45
46
  data: { values: [1] },
46
47
  mark: "point",
@@ -0,0 +1,9 @@
1
+ export default class ViewError extends Error {
2
+ /**
3
+ * @param {string} message
4
+ * @param {import("./view.js").default} view
5
+ */
6
+ constructor(message: string, view: import("./view.js").default);
7
+ view: import("./view.js").default;
8
+ }
9
+ //# sourceMappingURL=viewError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"viewError.d.ts","sourceRoot":"","sources":["../../../src/view/viewError.js"],"names":[],"mappings":"AAAA;IACI;;;OAGG;IACH,qBAHW,MAAM,QACN,OAAO,WAAW,EAAE,OAAO,EAMrC;IADG,kCAAgB;CAEvB"}
@@ -0,0 +1,11 @@
1
+ export default class ViewError extends Error {
2
+ /**
3
+ * @param {string} message
4
+ * @param {import("./view.js").default} view
5
+ */
6
+ constructor(message, view) {
7
+ super(message);
8
+ this.name = "ViewError";
9
+ this.view = view;
10
+ }
11
+ }
@@ -3,74 +3,107 @@
3
3
  * @param {ViewSpec} spec
4
4
  * @returns {spec is UnitSpec}
5
5
  */
6
- export function isUnitSpec(spec: import("../spec/view").ViewSpec): spec is import("../spec/view").UnitSpec;
6
+ export function isUnitSpec(spec: import("../spec/view.js").ViewSpec): spec is import("../spec/view.js").UnitSpec;
7
7
  /**
8
8
  *
9
9
  * @param {ViewSpec} spec
10
10
  * @returns {spec is LayerSpec}
11
11
  */
12
- export function isLayerSpec(spec: import("../spec/view").ViewSpec): spec is import("../spec/view").LayerSpec;
12
+ export function isLayerSpec(spec: import("../spec/view.js").ViewSpec): spec is import("../spec/view.js").LayerSpec;
13
13
  /**
14
14
  *
15
15
  * @param {ViewSpec} spec
16
16
  * @returns {spec is LayerSpec}
17
17
  */
18
- export function isFacetSpec(spec: import("../spec/view").ViewSpec): spec is import("../spec/view").LayerSpec;
18
+ export function isFacetSpec(spec: import("../spec/view.js").ViewSpec): spec is import("../spec/view.js").LayerSpec;
19
19
  /**
20
20
  *
21
21
  * @param {ViewSpec} spec
22
- * @returns {spec is import("../spec/view").AggregateSamplesSpec}
22
+ * @returns {spec is import("../spec/view.js").AggregateSamplesSpec}
23
23
  */
24
- export function isAggregateSamplesSpec(spec: import("../spec/view").ViewSpec): spec is import("../spec/view").AggregateSamplesSpec;
24
+ export function isAggregateSamplesSpec(spec: import("../spec/view.js").ViewSpec): spec is import("../spec/view.js").AggregateSamplesSpec;
25
25
  /**
26
26
  *
27
27
  * @param {object} spec
28
- * @returns {spec is ImportSpec}
28
+ * @returns {spec is import("../spec/view.js").ImportSpec}
29
29
  */
30
- export function isImportSpec(spec: object): spec is ImportSpec;
30
+ export function isImportSpec(spec: object): spec is import("../spec/view.js").ImportSpec;
31
31
  /**
32
32
  *
33
33
  * @param {ViewSpec} spec
34
34
  * @returns {spec is VConcatSpec}
35
35
  */
36
- export function isVConcatSpec(spec: import("../spec/view").ViewSpec): spec is import("../spec/view").VConcatSpec;
36
+ export function isVConcatSpec(spec: import("../spec/view.js").ViewSpec): spec is import("../spec/view.js").VConcatSpec;
37
37
  /**
38
38
  *
39
39
  * @param {ViewSpec} spec
40
40
  * @returns {spec is HConcatSpec}
41
41
  */
42
- export function isHConcatSpec(spec: import("../spec/view").ViewSpec): spec is HConcatSpec;
42
+ export function isHConcatSpec(spec: import("../spec/view.js").ViewSpec): spec is HConcatSpec;
43
43
  /**
44
44
  *
45
45
  * @param {ViewSpec} spec
46
46
  * @returns {spec is ConcatSpec}
47
47
  */
48
- export function isConcatSpec(spec: import("../spec/view").ViewSpec): spec is import("../spec/view").ConcatSpec;
48
+ export function isConcatSpec(spec: import("../spec/view.js").ViewSpec): spec is import("../spec/view.js").ConcatSpec;
49
+ /**
50
+ *
51
+ * @param {ViewSpec} spec
52
+ * @returns {spec is SampleSpec}
53
+ */
54
+ export function isSampleSpec(spec: import("../spec/view.js").ViewSpec): spec is import("../spec/sampleView.js").SampleSpec;
55
+ export const VIEW_ROOT_NAME: "viewRoot";
56
+ /**
57
+ * @typedef {object} ViewFactoryOptions
58
+ * @property {boolean} [allowImport]
59
+ * @property {boolean} [wrapRoot]
60
+ */
61
+ /**
62
+ *
63
+ */
49
64
  export class ViewFactory {
50
- /** @type {{specGuard: SpecGuard, factory: Factory}[]} */
51
- types: {
52
- specGuard: (spec: import("../spec/view").ViewSpec) => boolean;
53
- factory: (spec: import("../spec/view").ViewSpec, context: import("../types/viewContext").default, layoutParent?: import("./containerView").default, dataParent?: import("./view").default, defaultName?: string) => View;
54
- }[];
65
+ /**
66
+ * @param {ViewFactoryOptions} [options]
67
+ */
68
+ constructor(options?: ViewFactoryOptions);
69
+ /** @type {Required<ViewFactoryOptions>} */
70
+ options: Required<ViewFactoryOptions>;
55
71
  /**
56
72
  * @param {SpecGuard} specGuard
57
73
  * @param {Factory} factory
58
74
  */
59
- addViewType(specGuard: (spec: import("../spec/view").ViewSpec) => boolean, factory: (spec: import("../spec/view").ViewSpec, context: import("../types/viewContext").default, layoutParent?: import("./containerView").default, dataParent?: import("./view").default, defaultName?: string) => View): void;
75
+ 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;
60
76
  /**
61
77
  * @param {ViewSpec} spec
62
78
  * @param {ViewContext} context
63
- * @param {import("./containerView").default} [layoutParent]
64
- * @param {import("./view").default} [dataParent]
79
+ * @param {import("./containerView.js").default} [layoutParent]
80
+ * @param {import("./view.js").default} [dataParent]
65
81
  * @param {string} [defaultName]
66
82
  */
67
- createView(spec: import("../spec/view").ViewSpec, context: import("../types/viewContext").default, layoutParent?: import("./containerView").default, dataParent?: import("./view").default, defaultName?: string): View;
83
+ 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;
68
84
  /**
69
85
  *
70
86
  * @param {ViewSpec} spec
71
87
  * @returns {spec is ViewSpec}
72
88
  */
73
- isViewSpec(spec: import("../spec/view").ViewSpec): spec is import("../spec/view").ViewSpec;
89
+ isViewSpec(spec: import("../spec/view.js").ViewSpec): spec is import("../spec/view.js").ViewSpec;
90
+ /**
91
+ * Creates a view from a spec, or imports it from an external source.
92
+ * Also initializes child views.
93
+ *
94
+ * @param {ViewSpec | import("../spec/view.js").ImportSpec} spec
95
+ * @param {ViewContext} context
96
+ * @param {import("./containerView.js").default} [layoutParent]
97
+ * @param {import("./view.js").default} [dataParent]
98
+ * @param {string} [defaultName]
99
+ * @param {(spec: ViewSpec) => void} [validator]
100
+ */
101
+ 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>;
102
+ #private;
74
103
  }
104
+ export type ViewFactoryOptions = {
105
+ allowImport?: boolean;
106
+ wrapRoot?: boolean;
107
+ };
75
108
  import View from "./view.js";
76
109
  //# sourceMappingURL=viewFactory.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"viewFactory.d.ts","sourceRoot":"","sources":["../../../src/view/viewFactory.js"],"names":[],"mappings":"AAkGA;;;;GAIG;AACH,2GAEC;AAED;;;;GAIG;AACH,6GAEC;AAED;;;;GAIG;AACH,6GAOC;AAED;;;;GAIG;AACH,mIAMC;AAED;;;;GAIG;AACH,mCAHW,MAAM,sBAKhB;AAED;;;;GAIG;AACH,iHAEC;AAED;;;;GAIG;AACH,0FAEC;AAED;;;;GAIG;AACH,+GAEC;AAxKD;IAaQ,yDAAyD;IACzD;8DAL6B,OAAO;yHAC2B,OAAO,iBAAiB,EAAE,OAAO,eAAe,OAAO,QAAQ,EAAE,OAAO,gBAAgB,MAAM,KAAK,IAAI;QAIvJ;IA0BnB;;;OAGG;IACH,kEAnCiC,OAAO,mHAC2B,OAAO,iBAAiB,EAAE,OAAO,eAAe,OAAO,QAAQ,EAAE,OAAO,gBAAgB,MAAM,KAAK,IAAI,QAoCzK;IAED;;;;;;OAMG;IACH,kHAJW,OAAO,iBAAiB,EAAE,OAAO,eACjC,OAAO,QAAQ,EAAE,OAAO,gBACxB,MAAM,QAkBhB;IAED;;;;OAIG;IACH,2FAQC;CACJ;iBA/FgB,WAAW"}
1
+ {"version":3,"file":"viewFactory.d.ts","sourceRoot":"","sources":["../../../src/view/viewFactory.js"],"names":[],"mappings":"AAuMA;;;;GAIG;AACH,iHAEC;AAED;;;;GAIG;AACH,mHAEC;AAED;;;;GAIG;AACH,mHAOC;AAED;;;;GAIG;AACH,yIAMC;AAED;;;;GAIG;AACH,mCAHW,MAAM,gDAKhB;AAED;;;;GAIG;AACH,uHAEC;AAED;;;;GAIG;AACH,6FAEC;AAED;;;;GAIG;AACH,qHAEC;AAED;;;;GAIG;AACH,2HAOC;AAzRD,wCAAyC;AAEzC;;;;GAIG;AAEH;;GAEG;AACH;IAiBI;;OAEG;IACH,sBAFW,kBAAkB,EAoC5B;IAjCG,2CAA2C;IAC3C,SADW,SAAS,kBAAkB,CAAC,CAKtC;IA8BL;;;OAGG;IACH,qEAlDiC,OAAO,yHAC2B,OAAO,oBAAoB,EAAE,OAAO,eAAe,OAAO,WAAW,EAAE,OAAO,gBAAgB,MAAM,KAAK,IAAI,QAmD/K;IAED;;;;;;OAMG;IACH,wHAJW,OAAO,oBAAoB,EAAE,OAAO,eACpC,OAAO,WAAW,EAAE,OAAO,gBAC3B,MAAM,QAmBhB;IAED;;;;OAIG;IACH,iGAQC;IAED;;;;;;;;;;OAUG;IACH,uKALW,OAAO,oBAAoB,EAAE,OAAO,eACpC,OAAO,WAAW,EAAE,OAAO,gBAC3B,MAAM,4DACc,IAAI,iBA4DlC;;CACJ;;kBAtLa,OAAO;eACP,OAAO;;iBAfJ,WAAW"}