@genome-spy/core 0.67.0 → 0.69.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (290) hide show
  1. package/dist/bundle/index.es.js +15884 -13130
  2. package/dist/bundle/index.js +130 -149
  3. package/dist/schema.json +6498 -6191
  4. package/dist/src/data/collector.d.ts +20 -0
  5. package/dist/src/data/collector.d.ts.map +1 -1
  6. package/dist/src/data/collector.js +148 -0
  7. package/dist/src/data/dataFlow.d.ts +6 -0
  8. package/dist/src/data/dataFlow.d.ts.map +1 -1
  9. package/dist/src/data/dataFlow.js +20 -0
  10. package/dist/src/data/flowInit.d.ts.map +1 -1
  11. package/dist/src/data/flowInit.js +2 -3
  12. package/dist/src/data/flowNode.d.ts +33 -10
  13. package/dist/src/data/flowNode.d.ts.map +1 -1
  14. package/dist/src/data/flowNode.js +84 -13
  15. package/dist/src/data/flowTestUtils.d.ts +2 -2
  16. package/dist/src/data/flowTestUtils.d.ts.map +1 -1
  17. package/dist/src/data/flowTestUtils.js +5 -4
  18. package/dist/src/data/keyIndex.d.ts +18 -0
  19. package/dist/src/data/keyIndex.d.ts.map +1 -0
  20. package/dist/src/data/keyIndex.js +241 -0
  21. package/dist/src/data/keyIndex.test.d.ts +2 -0
  22. package/dist/src/data/keyIndex.test.d.ts.map +1 -0
  23. package/dist/src/data/sources/dataSource.d.ts.map +1 -1
  24. package/dist/src/data/sources/dataSource.js +7 -3
  25. package/dist/src/data/sources/dataSourceFactory.d.ts +14 -12
  26. package/dist/src/data/sources/dataSourceFactory.d.ts.map +1 -1
  27. package/dist/src/data/sources/dataSourceFactory.js +52 -16
  28. package/dist/src/data/sources/lazy/bigBedSource.d.ts.map +1 -1
  29. package/dist/src/data/sources/lazy/bigBedSource.js +11 -10
  30. package/dist/src/data/sources/lazy/bigWigSource.d.ts.map +1 -1
  31. package/dist/src/data/sources/lazy/bigWigSource.js +11 -10
  32. package/dist/src/data/sources/lazy/mockLazySource.d.ts +29 -0
  33. package/dist/src/data/sources/lazy/mockLazySource.d.ts.map +1 -0
  34. package/dist/src/data/sources/lazy/mockLazySource.js +44 -0
  35. package/dist/src/data/sources/lazy/singleAxisLazySource.d.ts +22 -1
  36. package/dist/src/data/sources/lazy/singleAxisLazySource.d.ts.map +1 -1
  37. package/dist/src/data/sources/lazy/singleAxisLazySource.js +34 -2
  38. package/dist/src/data/sources/lazy/singleAxisWindowedSource.d.ts.map +1 -1
  39. package/dist/src/data/sources/lazy/singleAxisWindowedSource.js +16 -1
  40. package/dist/src/data/sources/lazy/tabixSource.d.ts +0 -1
  41. package/dist/src/data/sources/lazy/tabixSource.d.ts.map +1 -1
  42. package/dist/src/data/sources/lazy/tabixSource.js +56 -16
  43. package/dist/src/data/sources/sequenceSource.d.ts.map +1 -1
  44. package/dist/src/data/sources/sequenceSource.js +5 -3
  45. package/dist/src/data/sources/urlSource.d.ts.map +1 -1
  46. package/dist/src/data/sources/urlSource.js +7 -3
  47. package/dist/src/data/transforms/filter.d.ts +4 -4
  48. package/dist/src/data/transforms/filter.d.ts.map +1 -1
  49. package/dist/src/data/transforms/filter.js +13 -7
  50. package/dist/src/data/transforms/filterScoredLabels.d.ts.map +1 -1
  51. package/dist/src/data/transforms/filterScoredLabels.js +11 -6
  52. package/dist/src/data/transforms/filterScoredLabels.test.d.ts +2 -0
  53. package/dist/src/data/transforms/filterScoredLabels.test.d.ts.map +1 -0
  54. package/dist/src/data/transforms/formula.d.ts +4 -4
  55. package/dist/src/data/transforms/formula.d.ts.map +1 -1
  56. package/dist/src/data/transforms/formula.js +12 -6
  57. package/dist/src/data/transforms/measureText.d.ts +2 -2
  58. package/dist/src/data/transforms/measureText.d.ts.map +1 -1
  59. package/dist/src/data/transforms/measureText.js +16 -12
  60. package/dist/src/data/transforms/stack.d.ts.map +1 -1
  61. package/dist/src/data/transforms/stack.js +1 -0
  62. package/dist/src/data/transforms/transform.d.ts +2 -2
  63. package/dist/src/data/transforms/transform.d.ts.map +1 -1
  64. package/dist/src/data/transforms/transform.js +3 -3
  65. package/dist/src/encoder/accessor.d.ts +51 -4
  66. package/dist/src/encoder/accessor.d.ts.map +1 -1
  67. package/dist/src/encoder/accessor.js +174 -10
  68. package/dist/src/encoder/encoder.d.ts +11 -2
  69. package/dist/src/encoder/encoder.d.ts.map +1 -1
  70. package/dist/src/encoder/encoder.js +29 -9
  71. package/dist/src/encoder/metadataChannels.d.ts +15 -0
  72. package/dist/src/encoder/metadataChannels.d.ts.map +1 -0
  73. package/dist/src/encoder/metadataChannels.js +65 -0
  74. package/dist/src/encoder/metadataChannels.test.d.ts +2 -0
  75. package/dist/src/encoder/metadataChannels.test.d.ts.map +1 -0
  76. package/dist/src/genome/genome.d.ts +8 -0
  77. package/dist/src/genome/genome.d.ts.map +1 -1
  78. package/dist/src/genome/genome.js +16 -1
  79. package/dist/src/genome/scaleLocus.d.ts.map +1 -1
  80. package/dist/src/genome/scaleLocus.js +14 -1
  81. package/dist/src/genomeSpy/containerUi.d.ts +0 -1
  82. package/dist/src/genomeSpy/containerUi.d.ts.map +1 -1
  83. package/dist/src/genomeSpy/containerUi.js +0 -14
  84. package/dist/src/genomeSpy/inputBindingManager.js +1 -1
  85. package/dist/src/genomeSpy/interactionController.d.ts.map +1 -1
  86. package/dist/src/genomeSpy/interactionController.js +7 -1
  87. package/dist/src/genomeSpy/loadingIndicatorManager.d.ts +3 -7
  88. package/dist/src/genomeSpy/loadingIndicatorManager.d.ts.map +1 -1
  89. package/dist/src/genomeSpy/loadingIndicatorManager.js +68 -20
  90. package/dist/src/genomeSpy/loadingStatusRegistry.d.ts +52 -0
  91. package/dist/src/genomeSpy/loadingStatusRegistry.d.ts.map +1 -0
  92. package/dist/src/genomeSpy/loadingStatusRegistry.js +86 -0
  93. package/dist/src/genomeSpy/viewContextFactory.d.ts.map +1 -1
  94. package/dist/src/genomeSpy/viewContextFactory.js +0 -1
  95. package/dist/src/genomeSpy/viewDataInit.d.ts.map +1 -1
  96. package/dist/src/genomeSpy/viewDataInit.js +56 -11
  97. package/dist/src/genomeSpy.d.ts +0 -2
  98. package/dist/src/genomeSpy.d.ts.map +1 -1
  99. package/dist/src/genomeSpy.js +47 -27
  100. package/dist/src/gl/glslScaleGenerator.js +1 -1
  101. package/dist/src/marks/mark.d.ts.map +1 -1
  102. package/dist/src/marks/mark.js +40 -41
  103. package/dist/src/marks/markUtils.js +1 -1
  104. package/dist/src/marks/point.d.ts.map +1 -1
  105. package/dist/src/marks/point.js +4 -6
  106. package/dist/src/paramRuntime/expressionCompiler.d.ts +7 -0
  107. package/dist/src/paramRuntime/expressionCompiler.d.ts.map +1 -0
  108. package/dist/src/paramRuntime/expressionCompiler.js +10 -0
  109. package/dist/src/paramRuntime/expressionRef.d.ts +20 -0
  110. package/dist/src/paramRuntime/expressionRef.d.ts.map +1 -0
  111. package/dist/src/paramRuntime/expressionRef.js +95 -0
  112. package/dist/src/paramRuntime/expressionRef.test.d.ts +2 -0
  113. package/dist/src/paramRuntime/expressionRef.test.d.ts.map +1 -0
  114. package/dist/src/paramRuntime/graphRuntime.d.ts +176 -0
  115. package/dist/src/paramRuntime/graphRuntime.d.ts.map +1 -0
  116. package/dist/src/paramRuntime/graphRuntime.js +628 -0
  117. package/dist/src/paramRuntime/graphRuntime.test.d.ts +2 -0
  118. package/dist/src/paramRuntime/graphRuntime.test.d.ts.map +1 -0
  119. package/dist/src/paramRuntime/index.d.ts +9 -0
  120. package/dist/src/paramRuntime/index.d.ts.map +1 -0
  121. package/dist/src/paramRuntime/index.js +8 -0
  122. package/dist/src/paramRuntime/lifecycleRegistry.d.ts +27 -0
  123. package/dist/src/paramRuntime/lifecycleRegistry.d.ts.map +1 -0
  124. package/dist/src/paramRuntime/lifecycleRegistry.js +54 -0
  125. package/dist/src/paramRuntime/paramRuntime.d.ts +165 -0
  126. package/dist/src/paramRuntime/paramRuntime.d.ts.map +1 -0
  127. package/dist/src/paramRuntime/paramRuntime.js +222 -0
  128. package/dist/src/paramRuntime/paramRuntime.test.d.ts +2 -0
  129. package/dist/src/paramRuntime/paramRuntime.test.d.ts.map +1 -0
  130. package/dist/src/paramRuntime/paramStore.d.ts +68 -0
  131. package/dist/src/paramRuntime/paramStore.d.ts.map +1 -0
  132. package/dist/src/paramRuntime/paramStore.js +148 -0
  133. package/dist/src/paramRuntime/paramStore.test.d.ts +2 -0
  134. package/dist/src/paramRuntime/paramStore.test.d.ts.map +1 -0
  135. package/dist/src/paramRuntime/paramUtils.d.ts +86 -0
  136. package/dist/src/paramRuntime/paramUtils.d.ts.map +1 -0
  137. package/dist/src/paramRuntime/paramUtils.js +272 -0
  138. package/dist/src/paramRuntime/selectionStore.d.ts +6 -0
  139. package/dist/src/paramRuntime/selectionStore.d.ts.map +1 -0
  140. package/dist/src/paramRuntime/selectionStore.js +13 -0
  141. package/dist/src/paramRuntime/types.d.ts +16 -0
  142. package/dist/src/paramRuntime/types.d.ts.map +1 -0
  143. package/dist/src/paramRuntime/types.js +25 -0
  144. package/dist/src/paramRuntime/viewParamRuntime.d.ts +164 -0
  145. package/dist/src/paramRuntime/viewParamRuntime.d.ts.map +1 -0
  146. package/dist/src/paramRuntime/viewParamRuntime.js +443 -0
  147. package/dist/src/scale/scale.d.ts +6 -1
  148. package/dist/src/scale/scale.d.ts.map +1 -1
  149. package/dist/src/scale/scale.js +83 -23
  150. package/dist/src/scales/axisResolution.d.ts.map +1 -1
  151. package/dist/src/scales/axisResolution.js +10 -0
  152. package/dist/src/scales/{scaleDomainAggregator.d.ts → domainPlanner.d.ts} +6 -3
  153. package/dist/src/scales/domainPlanner.d.ts.map +1 -0
  154. package/dist/src/scales/{scaleDomainAggregator.js → domainPlanner.js} +128 -10
  155. package/dist/src/scales/domainPlanner.test.d.ts +2 -0
  156. package/dist/src/scales/domainPlanner.test.d.ts.map +1 -0
  157. package/dist/src/scales/scaleInstanceManager.d.ts +6 -3
  158. package/dist/src/scales/scaleInstanceManager.d.ts.map +1 -1
  159. package/dist/src/scales/scaleInstanceManager.js +17 -11
  160. package/dist/src/scales/scaleInteractionController.d.ts +6 -0
  161. package/dist/src/scales/scaleInteractionController.d.ts.map +1 -1
  162. package/dist/src/scales/scaleInteractionController.js +41 -3
  163. package/dist/src/scales/scaleResolution.d.ts +20 -17
  164. package/dist/src/scales/scaleResolution.d.ts.map +1 -1
  165. package/dist/src/scales/scaleResolution.js +188 -71
  166. package/dist/src/scales/scaleResolution.test.d.ts.map +1 -1
  167. package/dist/src/selection/selection.d.ts +21 -0
  168. package/dist/src/selection/selection.d.ts.map +1 -1
  169. package/dist/src/selection/selection.js +83 -1
  170. package/dist/src/spec/channel.d.ts +52 -15
  171. package/dist/src/spec/coreSchemaRoot.d.ts +53 -0
  172. package/dist/src/spec/data.d.ts +4 -0
  173. package/dist/src/spec/parameter.d.ts +16 -11
  174. package/dist/src/spec/root.d.ts +1 -1
  175. package/dist/src/spec/testing.d.ts +12 -0
  176. package/dist/src/spec/testing.d.ts.map +1 -0
  177. package/dist/src/spec/testing.js +20 -0
  178. package/dist/src/spec/view.d.ts +157 -41
  179. package/dist/src/styles/genome-spy.css +3 -31
  180. package/dist/src/styles/genome-spy.css.d.ts +1 -1
  181. package/dist/src/styles/genome-spy.css.d.ts.map +1 -1
  182. package/dist/src/styles/genome-spy.css.js +0 -29
  183. package/dist/src/tooltip/dataTooltipHandler.d.ts +1 -1
  184. package/dist/src/tooltip/dataTooltipHandler.js +23 -32
  185. package/dist/src/tooltip/dataTooltipHandler.test.d.ts +2 -0
  186. package/dist/src/tooltip/dataTooltipHandler.test.d.ts.map +1 -0
  187. package/dist/src/tooltip/flattenDatumRows.d.ts +13 -0
  188. package/dist/src/tooltip/flattenDatumRows.d.ts.map +1 -0
  189. package/dist/src/tooltip/flattenDatumRows.js +47 -0
  190. package/dist/src/tooltip/flattenDatumRows.test.d.ts +2 -0
  191. package/dist/src/tooltip/flattenDatumRows.test.d.ts.map +1 -0
  192. package/dist/src/tooltip/refseqGeneTooltipHandler.d.ts +1 -1
  193. package/dist/src/tooltip/refseqGeneTooltipHandler.js +7 -1
  194. package/dist/src/tooltip/tooltipContext.d.ts +13 -0
  195. package/dist/src/tooltip/tooltipContext.d.ts.map +1 -0
  196. package/dist/src/tooltip/tooltipContext.js +543 -0
  197. package/dist/src/tooltip/tooltipContext.test.d.ts +2 -0
  198. package/dist/src/tooltip/tooltipContext.test.d.ts.map +1 -0
  199. package/dist/src/tooltip/tooltipHandler.d.ts +40 -1
  200. package/dist/src/tooltip/tooltipHandler.d.ts.map +1 -1
  201. package/dist/src/tooltip/tooltipHandler.ts +62 -1
  202. package/dist/src/types/encoder.d.ts +38 -3
  203. package/dist/src/types/rendering.d.ts +4 -3
  204. package/dist/src/types/viewContext.d.ts +0 -14
  205. package/dist/src/utils/inputBinding.d.ts +10 -2
  206. package/dist/src/utils/inputBinding.d.ts.map +1 -1
  207. package/dist/src/utils/inputBinding.js +12 -3
  208. package/dist/src/utils/throttle.d.ts +4 -1
  209. package/dist/src/utils/throttle.d.ts.map +1 -1
  210. package/dist/src/utils/throttle.js +54 -23
  211. package/dist/src/utils/throttle.test.d.ts +2 -0
  212. package/dist/src/utils/throttle.test.d.ts.map +1 -0
  213. package/dist/src/utils/transition.d.ts +21 -0
  214. package/dist/src/utils/transition.d.ts.map +1 -1
  215. package/dist/src/utils/transition.js +28 -0
  216. package/dist/src/utils/ui/tooltip.d.ts.map +1 -1
  217. package/dist/src/utils/ui/tooltip.js +7 -1
  218. package/dist/src/utils/ui/tooltip.test.d.ts +2 -0
  219. package/dist/src/utils/ui/tooltip.test.d.ts.map +1 -0
  220. package/dist/src/view/axisGridView.d.ts.map +1 -1
  221. package/dist/src/view/axisGridView.js +22 -5
  222. package/dist/src/view/axisView.d.ts.map +1 -1
  223. package/dist/src/view/axisView.js +20 -5
  224. package/dist/src/view/concatView.js +3 -3
  225. package/dist/src/view/containerMutationHelper.js +1 -1
  226. package/dist/src/view/containerView.d.ts +9 -5
  227. package/dist/src/view/containerView.d.ts.map +1 -1
  228. package/dist/src/view/containerView.js +34 -9
  229. package/dist/src/view/dataReadiness.d.ts +46 -0
  230. package/dist/src/view/dataReadiness.d.ts.map +1 -0
  231. package/dist/src/view/dataReadiness.js +267 -0
  232. package/dist/src/view/dataReadiness.test.d.ts +2 -0
  233. package/dist/src/view/dataReadiness.test.d.ts.map +1 -0
  234. package/dist/src/view/facetView.d.ts.map +1 -1
  235. package/dist/src/view/facetView.js +7 -5
  236. package/dist/src/view/flowBuilder.d.ts.map +1 -1
  237. package/dist/src/view/flowBuilder.js +17 -4
  238. package/dist/src/view/gridView/gridChild.d.ts.map +1 -1
  239. package/dist/src/view/gridView/gridChild.js +16 -3
  240. package/dist/src/view/gridView/gridView.d.ts.map +1 -1
  241. package/dist/src/view/gridView/gridView.js +119 -2
  242. package/dist/src/view/gridView/scrollbar.d.ts.map +1 -1
  243. package/dist/src/view/gridView/scrollbar.js +3 -0
  244. package/dist/src/view/gridView/selectionRect.d.ts +6 -10
  245. package/dist/src/view/gridView/selectionRect.d.ts.map +1 -1
  246. package/dist/src/view/gridView/selectionRect.js +22 -24
  247. package/dist/src/view/gridView/separatorView.d.ts +51 -0
  248. package/dist/src/view/gridView/separatorView.d.ts.map +1 -0
  249. package/dist/src/view/gridView/separatorView.js +275 -0
  250. package/dist/src/view/layerView.d.ts.map +1 -1
  251. package/dist/src/view/layerView.js +7 -5
  252. package/dist/src/view/layout/flexLayout.d.ts +0 -30
  253. package/dist/src/view/layout/flexLayout.d.ts.map +1 -1
  254. package/dist/src/view/layout/flexLayout.js +0 -86
  255. package/dist/src/view/multiscale.d.ts +35 -0
  256. package/dist/src/view/multiscale.d.ts.map +1 -0
  257. package/dist/src/view/multiscale.js +233 -0
  258. package/dist/src/view/multiscale.test.d.ts +2 -0
  259. package/dist/src/view/multiscale.test.d.ts.map +1 -0
  260. package/dist/src/view/testUtils.d.ts.map +1 -1
  261. package/dist/src/view/testUtils.js +6 -1
  262. package/dist/src/view/unitView.d.ts +8 -13
  263. package/dist/src/view/unitView.d.ts.map +1 -1
  264. package/dist/src/view/unitView.js +120 -45
  265. package/dist/src/view/view.d.ts +27 -18
  266. package/dist/src/view/view.d.ts.map +1 -1
  267. package/dist/src/view/view.js +298 -37
  268. package/dist/src/view/viewFactory.d.ts +0 -12
  269. package/dist/src/view/viewFactory.d.ts.map +1 -1
  270. package/dist/src/view/viewFactory.js +55 -25
  271. package/dist/src/view/viewParamRuntime.test.d.ts +2 -0
  272. package/dist/src/view/viewParamRuntime.test.d.ts.map +1 -0
  273. package/dist/src/view/viewSelectors.d.ts +148 -0
  274. package/dist/src/view/viewSelectors.d.ts.map +1 -0
  275. package/dist/src/view/viewSelectors.js +776 -0
  276. package/dist/src/view/viewSelectors.test.d.ts +2 -0
  277. package/dist/src/view/viewSelectors.test.d.ts.map +1 -0
  278. package/dist/src/view/viewUtils.d.ts +0 -8
  279. package/dist/src/view/viewUtils.d.ts.map +1 -1
  280. package/dist/src/view/viewUtils.js +1 -21
  281. package/package.json +4 -4
  282. package/dist/src/scales/scaleDomainAggregator.d.ts.map +0 -1
  283. package/dist/src/scales/scaleDomainAggregator.test.d.ts +0 -2
  284. package/dist/src/scales/scaleDomainAggregator.test.d.ts.map +0 -1
  285. package/dist/src/spec/sampleView.d.ts +0 -197
  286. package/dist/src/view/paramMediator.d.ts +0 -149
  287. package/dist/src/view/paramMediator.d.ts.map +0 -1
  288. package/dist/src/view/paramMediator.js +0 -478
  289. package/dist/src/view/paramMediator.test.d.ts +0 -2
  290. package/dist/src/view/paramMediator.test.d.ts.map +0 -1
@@ -0,0 +1,275 @@
1
+ import UnitView from "../unitView.js";
2
+ import { markViewAsNonAddressable } from "../viewSelectors.js";
3
+
4
+ /**
5
+ * @typedef {"horizontal" | "vertical"} SeparatorDirection
6
+ */
7
+
8
+ const DEFAULT_SEPARATOR_PROPS = Object.freeze({
9
+ size: 1,
10
+ color: "#ccc",
11
+ opacity: 1,
12
+ strokeDash: [4, 4],
13
+ strokeCap: "butt",
14
+ });
15
+
16
+ /**
17
+ * Draws separator rules for a single direction in a grid layout.
18
+ */
19
+ export default class SeparatorView {
20
+ /** @type {SeparatorDirection} */
21
+ #direction;
22
+
23
+ /** @type {boolean} */
24
+ #includePlotMargin;
25
+
26
+ /** @type {UnitView} */
27
+ #view;
28
+
29
+ /** @type {import("../../data/flowNode.js").Datum[]} */
30
+ #data = [];
31
+
32
+ /** @type {number[]} */
33
+ #positions = [];
34
+
35
+ /** @type {{ x: number[]; y: number[] }} */
36
+ #domains = {
37
+ x: [0, 0],
38
+ y: [0, 0],
39
+ };
40
+
41
+ /**
42
+ * @param {{
43
+ * direction: SeparatorDirection,
44
+ * props: import("../../spec/view.js").SeparatorProps,
45
+ * context: import("../../types/viewContext.js").default,
46
+ * layoutParent: import("../containerView.js").default,
47
+ * dataParent: import("../view.js").default,
48
+ * getName: (prefix: string) => string
49
+ * }} options
50
+ */
51
+ constructor({
52
+ direction,
53
+ props,
54
+ context,
55
+ layoutParent,
56
+ dataParent,
57
+ getName,
58
+ }) {
59
+ this.#direction = direction;
60
+ this.#includePlotMargin = props.includePlotMargin ?? true;
61
+ const markProps = { ...props };
62
+ delete markProps.includePlotMargin;
63
+ this.#view = this.#createView(
64
+ markProps,
65
+ context,
66
+ layoutParent,
67
+ dataParent,
68
+ getName
69
+ );
70
+ }
71
+
72
+ /**
73
+ * @returns {UnitView}
74
+ */
75
+ get view() {
76
+ return this.#view;
77
+ }
78
+
79
+ /**
80
+ * @param {import("../layout/flexLayout.js").LocSize[]} flexCoords
81
+ * @param {number} count
82
+ * @param {import("../layout/rectangle.js").default} coords
83
+ * @param {(direction: "row" | "column", index: number) => number} getViewSlot
84
+ * @param {boolean} wrappingFacet
85
+ * @param {import("../layout/padding.js").default} overhang
86
+ */
87
+ update(flexCoords, count, coords, getViewSlot, wrappingFacet, overhang) {
88
+ this.#collectPositions(flexCoords, count, getViewSlot, wrappingFacet);
89
+ this.#updateDirection(coords, overhang);
90
+ }
91
+
92
+ /**
93
+ * @param {import("../renderingContext/viewRenderingContext.js").default} context
94
+ * @param {import("../layout/rectangle.js").default} coords
95
+ * @param {import("../../types/rendering.js").RenderingOptions} options
96
+ */
97
+ render(context, coords, options) {
98
+ this.#view.render(context, coords, options);
99
+ }
100
+
101
+ /**
102
+ * @param {import("../layout/flexLayout.js").LocSize[]} flexCoords
103
+ * @param {number} count
104
+ * @param {(direction: "row" | "column", index: number) => number} getViewSlot
105
+ * @param {boolean} wrappingFacet
106
+ */
107
+ #collectPositions(flexCoords, count, getViewSlot, wrappingFacet) {
108
+ this.#positions.length = 0;
109
+
110
+ if (count < 2) {
111
+ return;
112
+ }
113
+
114
+ const axis = this.#direction === "vertical" ? "column" : "row";
115
+ const spacingOffset = wrappingFacet ? 3 : 2;
116
+
117
+ for (let index = 1; index < count; index++) {
118
+ const viewSlot = getViewSlot(axis, index);
119
+ const spacingSlot = viewSlot - spacingOffset;
120
+ const spacing = flexCoords[spacingSlot];
121
+ const location = spacing ? spacing.location : 0;
122
+ const size = spacing ? spacing.size : 0;
123
+ this.#positions.push(location + size / 2);
124
+ }
125
+ }
126
+
127
+ /**
128
+ * @param {import("../layout/rectangle.js").default} coords
129
+ * @param {import("../layout/padding.js").default} overhang
130
+ */
131
+ #updateDirection(coords, overhang) {
132
+ const xStart = this.#includePlotMargin ? 0 : overhang.left;
133
+ const xEnd = this.#includePlotMargin
134
+ ? coords.width
135
+ : coords.width - overhang.right;
136
+ const yStart = this.#includePlotMargin ? 0 : overhang.bottom;
137
+ const yEnd = this.#includePlotMargin
138
+ ? coords.height
139
+ : coords.height - overhang.top;
140
+
141
+ this.#data.length = this.#positions.length;
142
+
143
+ for (let i = 0; i < this.#positions.length; i++) {
144
+ const pos = this.#positions[i];
145
+ const entry = this.#data[i] ?? {};
146
+
147
+ if (this.#direction === "vertical") {
148
+ entry.x = pos;
149
+ entry.x2 = pos;
150
+ entry.y = yStart;
151
+ entry.y2 = yEnd;
152
+ } else {
153
+ const y = coords.height - pos;
154
+ entry.x = xStart;
155
+ entry.x2 = xEnd;
156
+ entry.y = y;
157
+ entry.y2 = y;
158
+ }
159
+
160
+ this.#data[i] = entry;
161
+ }
162
+
163
+ const dataSource =
164
+ /** @type {import("../../data/sources/inlineSource.js").default} */ (
165
+ this.#view.flowHandle?.dataSource
166
+ );
167
+
168
+ if (!dataSource) {
169
+ return;
170
+ }
171
+
172
+ dataSource.updateDynamicData(this.#data);
173
+
174
+ this.#domains.x[1] = coords.width;
175
+ this.#domains.y[1] = coords.height;
176
+
177
+ const xScale = this.#view.getScaleResolution("x")?.getScale();
178
+ if (xScale) {
179
+ xScale.domain(this.#domains.x);
180
+ }
181
+
182
+ const yScale = this.#view.getScaleResolution("y")?.getScale();
183
+ if (yScale) {
184
+ yScale.domain(this.#domains.y);
185
+ }
186
+ }
187
+
188
+ /**
189
+ * @param {Omit<import("../../spec/view.js").SeparatorProps, "includePlotMargin">} props
190
+ * @param {import("../../types/viewContext.js").default} context
191
+ * @param {import("../containerView.js").default} layoutParent
192
+ * @param {import("../view.js").default} dataParent
193
+ * @param {(prefix: string) => string} getName
194
+ * @returns {UnitView}
195
+ */
196
+ #createView(props, context, layoutParent, dataParent, getName) {
197
+ const spec = createSeparatorSpec(props);
198
+ const name =
199
+ this.#direction === "horizontal"
200
+ ? getName("separatorHorizontal")
201
+ : getName("separatorVertical");
202
+
203
+ const view = new UnitView(
204
+ spec,
205
+ context,
206
+ layoutParent,
207
+ dataParent,
208
+ name,
209
+ {
210
+ blockEncodingInheritance: true,
211
+ }
212
+ );
213
+
214
+ markViewAsNonAddressable(view, { skipSubtree: true });
215
+
216
+ return view;
217
+ }
218
+ }
219
+
220
+ /**
221
+ * @param {import("../../spec/view.js").SeparatorProps | boolean | undefined} separator
222
+ * @returns {import("../../spec/view.js").SeparatorProps | null}
223
+ */
224
+ export function resolveSeparatorProps(separator) {
225
+ if (!separator) {
226
+ return null;
227
+ }
228
+
229
+ const props =
230
+ separator === true
231
+ ? { ...DEFAULT_SEPARATOR_PROPS }
232
+ : { ...DEFAULT_SEPARATOR_PROPS, ...separator };
233
+
234
+ if (props.strokeDash === DEFAULT_SEPARATOR_PROPS.strokeDash) {
235
+ props.strokeDash = DEFAULT_SEPARATOR_PROPS.strokeDash.slice();
236
+ }
237
+
238
+ return props;
239
+ }
240
+
241
+ /**
242
+ * @param {Omit<import("../../spec/view.js").SeparatorProps, "includePlotMargin">} props
243
+ * @returns {import("../../spec/view.js").UnitSpec}
244
+ */
245
+ function createSeparatorSpec(props) {
246
+ return {
247
+ configurableVisibility: false,
248
+ domainInert: true,
249
+ data: { values: [] },
250
+ resolve: {
251
+ scale: { x: "excluded", y: "excluded" },
252
+ axis: { x: "excluded", y: "excluded" },
253
+ },
254
+ mark: {
255
+ ...props,
256
+ type: "rule",
257
+ clip: props.clip ?? false,
258
+ tooltip: null,
259
+ },
260
+ encoding: {
261
+ x: {
262
+ field: "x",
263
+ type: "quantitative",
264
+ scale: { nice: false, zero: false },
265
+ },
266
+ y: {
267
+ field: "y",
268
+ type: "quantitative",
269
+ scale: { nice: false, zero: false },
270
+ },
271
+ x2: { field: "x2" },
272
+ y2: { field: "y2" },
273
+ },
274
+ };
275
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"layerView.d.ts","sourceRoot":"","sources":["../../../src/view/layerView.js"],"names":[],"mappings":"AAKA;IAQI;;;;;;;;OAQG;IACH,kBAPW,OAAO,iBAAiB,EAAE,SAAS,WACnC,OAAO,yBAAyB,EAAE,OAAO,gBACzC,aAAa,cACb,OAAO,WAAW,EAAE,OAAO,QAC3B,MAAM,YACN,OAAO,WAAW,EAAE,WAAW,EAWzC;IAHG,0CAAgB;IAoCpB;;;;;;OAMG;IACH,wBAJW,OAAO,iBAAiB,EAAE,SAAS,GAAG,OAAO,iBAAiB,EAAE,QAAQ,GAAG,OAAO,iBAAiB,EAAE,UAAU,UAC/G,MAAM,GACJ,OAAO,CAAC,SAAS,GAAG,OAAO,eAAe,EAAE,OAAO,CAAC,CAMhE;IAED;;;;OAIG;IACH,qBAFW,MAAM,iBAIhB;IA6CD,gEAEC;;CA6CJ;0BA/KyB,oBAAoB"}
1
+ {"version":3,"file":"layerView.d.ts","sourceRoot":"","sources":["../../../src/view/layerView.js"],"names":[],"mappings":"AAMA;IAQI;;;;;;;;OAQG;IACH,kBAPW,OAAO,iBAAiB,EAAE,SAAS,WACnC,OAAO,yBAAyB,EAAE,OAAO,gBACzC,aAAa,cACb,OAAO,WAAW,EAAE,OAAO,QAC3B,MAAM,YACN,OAAO,WAAW,EAAE,WAAW,EAWzC;IAHG,0CAAgB;IAqCpB;;;;;;OAMG;IACH,wBAJW,OAAO,iBAAiB,EAAE,SAAS,GAAG,OAAO,iBAAiB,EAAE,QAAQ,GAAG,OAAO,iBAAiB,EAAE,UAAU,UAC/G,MAAM,GACJ,OAAO,CAAC,SAAS,GAAG,OAAO,eAAe,EAAE,OAAO,CAAC,CAMhE;IAED;;;;OAIG;IACH,qBAFW,MAAM,iBAIhB;IA6CD,gEAEC;;CA6CJ;0BAjLyB,oBAAoB"}
@@ -2,6 +2,7 @@ import { isLayerSpec, isUnitSpec } from "./viewFactory.js";
2
2
  import ContainerView from "./containerView.js";
3
3
  import ViewError from "./viewError.js";
4
4
  import ContainerMutationHelper from "./containerMutationHelper.js";
5
+ import { isMultiscaleSpec } from "./multiscale.js";
5
6
 
6
7
  export default class LayerView extends ContainerView {
7
8
  /**
@@ -37,20 +38,21 @@ export default class LayerView extends ContainerView {
37
38
  async initializeChildren() {
38
39
  this.#children = await Promise.all(
39
40
  this.spec.layer.map(
40
- (childSpec, i) =>
41
+ (childSpec) =>
41
42
  /** @type {(Promise<LayerView | import("./unitView.js").default>)} */ (
42
43
  this.context.createOrImportView(
43
44
  childSpec,
44
45
  this,
45
46
  this,
46
- "grid" + i,
47
+ this.getNextAutoName("layer"),
47
48
  (importedSpec) => {
48
49
  if (
49
50
  !isLayerSpec(importedSpec) &&
50
- !isUnitSpec(importedSpec)
51
+ !isUnitSpec(importedSpec) &&
52
+ !isMultiscaleSpec(importedSpec)
51
53
  ) {
52
54
  throw new ViewError(
53
- "LayerView accepts only unit or layer specs as children!",
55
+ "LayerView accepts only unit, layer, or multiscale specs as children!",
54
56
  this
55
57
  );
56
58
  // TODO: Add view to exception
@@ -123,7 +125,7 @@ export default class LayerView extends ContainerView {
123
125
  view.disposeSubtree();
124
126
  this.#children.splice(index, 1);
125
127
  },
126
- defaultName: (index) => "layer" + index,
128
+ defaultName: () => this.getNextAutoName("layer"),
127
129
  });
128
130
  }
129
131
 
@@ -70,36 +70,6 @@ export function isSizeDef(spec: any): spec is SizeDef;
70
70
  * @returns {SizeDef}
71
71
  */
72
72
  export function parseSizeDef(size: "container" | number | SizeDef | import("../../spec/view.js").Step): SizeDef;
73
- /**
74
- * Interpolates between two LocSizes
75
- *
76
- * @param {LocSize} from
77
- * @param {LocSize} to
78
- * @param {function():number} ratio
79
- * @returns {LocSize}
80
- */
81
- export function interpolateLocSizes(from: LocSize, to: LocSize, ratio: () => number): LocSize;
82
- /**
83
- * Wraps a LocSize and allows scrolling.
84
- *
85
- * @param {LocSize} locSize
86
- * @param {number | function():number} offset
87
- * @returns {LocSize}
88
- */
89
- export function translateLocSize(locSize: LocSize, offset: number | (() => number)): LocSize;
90
- /**
91
- * Wraps a LocSize and allows scaling.
92
- *
93
- * @param {LocSize} locSize
94
- * @param {number | function():number} factor
95
- * @returns {LocSize}
96
- */
97
- export function scaleLocSize(locSize: LocSize, factor: number | (() => number)): LocSize;
98
- /**
99
- * @param {LocSize} locSize
100
- * @param {number} value
101
- */
102
- export function locSizeEncloses(locSize: LocSize, value: number): boolean;
103
73
  export class FlexDimensions {
104
74
  /**
105
75
  *
@@ -1 +1 @@
1
- {"version":3,"file":"flexLayout.d.ts","sourceRoot":"","sources":["../../../../src/view/layout/flexLayout.js"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wCALW,OAAO,EAAE,iBACT,MAAM,mDACN,WAAW,GACT,OAAO,EAAE,CAqGrB;AAED;;;;;GAKG;AACH,sCAHW,QAAQ,CAAC,OAAO,CAAC,gBACjB,WAAW,UAQrB;AAED;;;GAGG;AACH,sCAHW,QAAQ,CAAC,OAAO,CAAC,GACf,OAAO,CAWnB;AAED;;;GAGG;AACH,oCAFW,OAAO,EAAE,WAInB;AAED;;;GAGG;AACH,sCAFW,OAAO,EAAE;;;EASnB;AA4ED;;;;GAIG;AACH,uCAFW,OAAO,WAIjB;AAWD;;;;GAIG;AACH,gCAHW,GAAC,GACC,IAAI,IAAI,OAAO,CAI3B;AAED;;;;GAIG;AACH,mCAHW,WAAW,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,oBAAoB,EAAE,IAAI,GAChE,OAAO,CAiBnB;AAID;;;;;;;GAOG;AACH,0CALW,OAAO,MACP,OAAO,SACP,MAAW,MAAM,GACf,OAAO,CA4BnB;AAED;;;;;;GAMG;AACH,0CAJW,OAAO,UACP,MAAM,IAAG,MAAW,MAAM,CAAA,GACxB,OAAO,CAanB;AAED;;;;;;GAMG;AACH,sCAJW,OAAO,UACP,MAAM,IAAG,MAAW,MAAM,CAAA,GACxB,OAAO,CAanB;AAED;;;GAGG;AACH,yCAHW,OAAO,SACP,MAAM,WAIhB;AA/MD;IACI;;;;OAIG;IACH,mBAHW,OAAO,UACP,OAAO,EAQjB;IAJG,gBAAgB;IAChB,wBAAkB;IAClB,gBAAgB;IAChB,yBAAoB;IAGxB;;;;OAIG;IACH,oBAFW,OAAO,cAAc,EAAE,OAAO,kBAIxC;IAED;;;;OAIG;IACH,yBAFW,OAAO,cAAc,EAAE,OAAO,kBAIxC;IAmBD;;;;OAIG;IACH,aAFa,OAAO,CAInB;;CACJ;AAED;;;;GAIG;AACH,2BAFU,OAAO,CAKd;AAEH,iDAGE;;;;;;;;SAlPQ,MAAM;;;;WACN,MAAM;;;;;;cAGN,MAAM;UACN,MAAM;;;;;;;;;;;;;;cAGN,MAAM;;;;;uBACN,MAAM;;;;aAEN,MAAM;;;;cACN,OAAO"}
1
+ {"version":3,"file":"flexLayout.d.ts","sourceRoot":"","sources":["../../../../src/view/layout/flexLayout.js"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wCALW,OAAO,EAAE,iBACT,MAAM,mDACN,WAAW,GACT,OAAO,EAAE,CAqGrB;AAED;;;;;GAKG;AACH,sCAHW,QAAQ,CAAC,OAAO,CAAC,gBACjB,WAAW,UAQrB;AAED;;;GAGG;AACH,sCAHW,QAAQ,CAAC,OAAO,CAAC,GACf,OAAO,CAWnB;AAED;;;GAGG;AACH,oCAFW,OAAO,EAAE,WAInB;AAED;;;GAGG;AACH,sCAFW,OAAO,EAAE;;;EASnB;AA4ED;;;;GAIG;AACH,uCAFW,OAAO,WAIjB;AAWD;;;;GAIG;AACH,gCAHW,GAAC,GACC,IAAI,IAAI,OAAO,CAI3B;AAED;;;;GAIG;AACH,mCAHW,WAAW,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,oBAAoB,EAAE,IAAI,GAChE,OAAO,CAiBnB;AAzHD;IACI;;;;OAIG;IACH,mBAHW,OAAO,UACP,OAAO,EAQjB;IAJG,gBAAgB;IAChB,wBAAkB;IAClB,gBAAgB;IAChB,yBAAoB;IAGxB;;;;OAIG;IACH,oBAFW,OAAO,cAAc,EAAE,OAAO,kBAIxC;IAED;;;;OAIG;IACH,yBAFW,OAAO,cAAc,EAAE,OAAO,kBAIxC;IAmBD;;;;OAIG;IACH,aAFa,OAAO,CAInB;;CACJ;AAED;;;;GAIG;AACH,2BAFU,OAAO,CAKd;AAEH,iDAGE;;;;;;;;SAlPQ,MAAM;;;;WACN,MAAM;;;;;;cAGN,MAAM;UACN,MAAM;;;;;;;;;;;;;;cAGN,MAAM;;;;;uBACN,MAAM;;;;aAEN,MAAM;;;;cACN,OAAO"}
@@ -302,89 +302,3 @@ export function parseSizeDef(size) {
302
302
 
303
303
  throw new Error(`Invalid sizeDef: ${size}`);
304
304
  }
305
-
306
- // TODO: Find a better place for the following utilities: ////////////////////////////////////
307
-
308
- /**
309
- * Interpolates between two LocSizes
310
- *
311
- * @param {LocSize} from
312
- * @param {LocSize} to
313
- * @param {function():number} ratio
314
- * @returns {LocSize}
315
- */
316
- export function interpolateLocSizes(from, to, ratio) {
317
- return {
318
- get location() {
319
- const r = ratio();
320
- switch (r) {
321
- case 0:
322
- return from.location;
323
- case 1:
324
- return to.location;
325
- default:
326
- return r * to.location + (1 - r) * from.location;
327
- }
328
- },
329
-
330
- get size() {
331
- const r = ratio();
332
- switch (r) {
333
- case 0:
334
- return from.size;
335
- case 1:
336
- return to.size;
337
- default:
338
- return r * to.size + (1 - r) * from.size;
339
- }
340
- },
341
- };
342
- }
343
-
344
- /**
345
- * Wraps a LocSize and allows scrolling.
346
- *
347
- * @param {LocSize} locSize
348
- * @param {number | function():number} offset
349
- * @returns {LocSize}
350
- */
351
- export function translateLocSize(locSize, offset) {
352
- const fn = isNumber(offset) ? () => offset : offset;
353
- return {
354
- get location() {
355
- return locSize.location + fn();
356
- },
357
-
358
- get size() {
359
- return locSize.size;
360
- },
361
- };
362
- }
363
-
364
- /**
365
- * Wraps a LocSize and allows scaling.
366
- *
367
- * @param {LocSize} locSize
368
- * @param {number | function():number} factor
369
- * @returns {LocSize}
370
- */
371
- export function scaleLocSize(locSize, factor) {
372
- const fn = isNumber(factor) ? () => factor : factor;
373
- return {
374
- get location() {
375
- return locSize.location * fn();
376
- },
377
-
378
- get size() {
379
- return locSize.size * fn();
380
- },
381
- };
382
- }
383
-
384
- /**
385
- * @param {LocSize} locSize
386
- * @param {number} value
387
- */
388
- export function locSizeEncloses(locSize, value) {
389
- return value >= locSize.location && value < locSize.location + locSize.size;
390
- }
@@ -0,0 +1,35 @@
1
+ /**
2
+ * @typedef {"unitsPerPixel"} MultiscaleMetric
3
+ * @typedef {"x" | "y" | "auto"} MultiscaleChannel
4
+ * @typedef {number | import("../spec/parameter.js").ExprRef} StopValue
5
+ *
6
+ * @typedef {{
7
+ * metric: MultiscaleMetric;
8
+ * values: StopValue[];
9
+ * channel: MultiscaleChannel;
10
+ * fade: number;
11
+ * }} ParsedStops
12
+ */
13
+ /**
14
+ * @param {object} spec
15
+ * @returns {spec is import("../spec/view.js").MultiscaleSpec}
16
+ */
17
+ export function isMultiscaleSpec(spec: object): spec is import("../spec/view.js").MultiscaleSpec;
18
+ /**
19
+ * Converts a multiscale spec into a regular layer spec by wrapping each stage
20
+ * into a generated opacity layer.
21
+ *
22
+ * @param {import("../spec/view.js").MultiscaleSpec} spec
23
+ * @returns {import("../spec/view.js").LayerSpec}
24
+ */
25
+ export function normalizeMultiscaleSpec(spec: import("../spec/view.js").MultiscaleSpec): import("../spec/view.js").LayerSpec;
26
+ export type MultiscaleMetric = "unitsPerPixel";
27
+ export type MultiscaleChannel = "x" | "y" | "auto";
28
+ export type StopValue = number | import("../spec/parameter.js").ExprRef;
29
+ export type ParsedStops = {
30
+ metric: MultiscaleMetric;
31
+ values: StopValue[];
32
+ channel: MultiscaleChannel;
33
+ fade: number;
34
+ };
35
+ //# sourceMappingURL=multiscale.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"multiscale.d.ts","sourceRoot":"","sources":["../../../src/view/multiscale.js"],"names":[],"mappings":"AAKA;;;;;;;;;;;GAWG;AAEH;;;GAGG;AACH,uCAHW,MAAM,GACJ,IAAI,IAAI,OAAO,iBAAiB,EAAE,cAAc,CAI5D;AAED;;;;;;GAMG;AACH,8CAHW,OAAO,iBAAiB,EAAE,cAAc,GACtC,OAAO,iBAAiB,EAAE,SAAS,CA6B/C;+BAtDY,eAAe;gCACf,GAAG,GAAG,GAAG,GAAG,MAAM;wBAClB,MAAM,GAAG,OAAO,sBAAsB,EAAE,OAAO;0BAE/C;IACN,MAAM,EAAE,gBAAgB,CAAC;IACzB,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,OAAO,EAAE,iBAAiB,CAAC;IAC3B,IAAI,EAAE,MAAM,CAAC;CAChB"}