@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
@@ -5,6 +5,7 @@ import {
5
5
  createMessageBox,
6
6
  } from "./genomeSpy/containerUi.js";
7
7
  import LoadingIndicatorManager from "./genomeSpy/loadingIndicatorManager.js";
8
+ import LoadingStatusRegistry from "./genomeSpy/loadingStatusRegistry.js";
8
9
  import { createViewHighlighter } from "./genomeSpy/viewHighlight.js";
9
10
  import KeyboardListenerManager from "./genomeSpy/keyboardListenerManager.js";
10
11
  import EventListenerRegistry from "./genomeSpy/eventListenerRegistry.js";
@@ -35,6 +36,7 @@ import {
35
36
  configureViewOpacity,
36
37
  } from "./genomeSpy/viewHierarchyConfig.js";
37
38
  import { exportCanvas } from "./genomeSpy/canvasExport.js";
39
+ import { validateSelectorConstraints } from "./view/viewSelectors.js";
38
40
 
39
41
  /**
40
42
  * Events that are broadcasted to all views.
@@ -50,6 +52,8 @@ export default class GenomeSpy {
50
52
  #renderCoordinator;
51
53
  /** @type {LoadingIndicatorManager} */
52
54
  #loadingIndicatorManager;
55
+ /** @type {LoadingStatusRegistry} */
56
+ #loadingStatusRegistry;
53
57
  /** @type {InputBindingManager} */
54
58
  #inputBindingManager;
55
59
  /** @type {InteractionController} */
@@ -192,7 +196,7 @@ export default class GenomeSpy {
192
196
  }
193
197
 
194
198
  #setupDpr() {
195
- const dprSetter = this.viewRoot.paramMediator.allocateSetter(
199
+ const dprSetter = this.viewRoot.paramRuntime.allocateSetter(
196
200
  "devicePixelRatio",
197
201
  this.dpr
198
202
  );
@@ -237,12 +241,8 @@ export default class GenomeSpy {
237
241
  }
238
242
 
239
243
  #prepareContainer() {
240
- const {
241
- canvasWrapper,
242
- loadingMessageElement,
243
- loadingIndicatorsElement,
244
- tooltip,
245
- } = createContainerUi(this.container);
244
+ const { canvasWrapper, loadingIndicatorsElement, tooltip } =
245
+ createContainerUi(this.container);
246
246
 
247
247
  this.#glHelper = new WebGLHelper(
248
248
  canvasWrapper,
@@ -253,16 +253,11 @@ export default class GenomeSpy {
253
253
  { powerPreference: this.options.powerPreference ?? "default" }
254
254
  );
255
255
 
256
- // The initial loading message that is shown until the first frame is rendered
257
- this.loadingMessageElement = loadingMessageElement;
258
- // A container for loading indicators (for lazy data sources.)
259
- // These could alternatively be included in the view hierarchy,
260
- // but it's easier this way – particularly if we want to show
261
- // some fancy animated spinners.
262
- this.loadingIndicatorsElement = loadingIndicatorsElement;
263
256
  this.tooltip = tooltip;
257
+ this.#loadingStatusRegistry = new LoadingStatusRegistry();
264
258
  this.#loadingIndicatorManager = new LoadingIndicatorManager(
265
- loadingIndicatorsElement
259
+ loadingIndicatorsElement,
260
+ this.#loadingStatusRegistry
266
261
  );
267
262
  }
268
263
 
@@ -285,6 +280,8 @@ export default class GenomeSpy {
285
280
 
286
281
  this.#inputBindingManager.remove();
287
282
 
283
+ this.#loadingIndicatorManager.destroy();
284
+
288
285
  while (this.container.firstChild) {
289
286
  this.container.firstChild.remove();
290
287
  }
@@ -311,8 +308,11 @@ export default class GenomeSpy {
311
308
  }
312
309
 
313
310
  #createViewContext() {
311
+ const dataFlow = new DataFlow();
312
+ dataFlow.loadingStatusRegistry = this.#loadingStatusRegistry;
313
+
314
314
  return createViewContext({
315
- dataFlow: new DataFlow(),
315
+ dataFlow,
316
316
  glHelper: this.#glHelper,
317
317
  animator: this.animator,
318
318
  genomeStore: this.genomeStore,
@@ -321,12 +321,6 @@ export default class GenomeSpy {
321
321
  getNamedDataFromProvider: this.getNamedDataFromProvider.bind(this),
322
322
  getCurrentHover: () =>
323
323
  this.#interactionController.getCurrentHover(),
324
- setDataLoadingStatus: (view, status, detail) =>
325
- this.#loadingIndicatorManager.setDataLoadingStatus(
326
- view,
327
- status,
328
- detail
329
- ),
330
324
  addKeyboardListener: (type, listener) => {
331
325
  // TODO: Listeners should be called only when the mouse pointer is inside the
332
326
  // container or the app covers the full document.
@@ -378,6 +372,8 @@ export default class GenomeSpy {
378
372
  VIEW_ROOT_NAME
379
373
  );
380
374
 
375
+ this.#loadingStatusRegistry.set(this.viewRoot, "loading");
376
+
381
377
  this.#canvasWrapper.style.flexGrow =
382
378
  this.viewRoot.getSize().height.grow > 0 ? "1" : "0";
383
379
 
@@ -385,6 +381,7 @@ export default class GenomeSpy {
385
381
 
386
382
  configureViewHierarchy(this.viewRoot);
387
383
  configureViewOpacity(this.viewRoot);
384
+ this.#logSelectorConstraintWarnings();
388
385
 
389
386
  // We should now have a complete view hierarchy. Let's update the canvas size
390
387
  // and ensure that the loading message is visible.
@@ -405,6 +402,17 @@ export default class GenomeSpy {
405
402
  this.#setupDpr();
406
403
  }
407
404
 
405
+ #logSelectorConstraintWarnings() {
406
+ const issues = validateSelectorConstraints(this.viewRoot);
407
+ if (!issues.length) {
408
+ return;
409
+ }
410
+
411
+ for (const issue of issues) {
412
+ console.warn("Selector constraints warning:", issue.message);
413
+ }
414
+ }
415
+
408
416
  /**
409
417
  * @param {import("./types/viewContext.js").default} context
410
418
  */
@@ -435,6 +443,7 @@ export default class GenomeSpy {
435
443
  * @returns {Promise<boolean>} true if the launch was successful
436
444
  */
437
445
  async launch() {
446
+ let launched = false;
438
447
  try {
439
448
  this.#prepareContainer();
440
449
 
@@ -445,6 +454,7 @@ export default class GenomeSpy {
445
454
  this.computeLayout();
446
455
  this.animator.requestRender();
447
456
 
457
+ launched = true;
448
458
  return true;
449
459
  } catch (reason) {
450
460
  const message = `${
@@ -456,13 +466,20 @@ export default class GenomeSpy {
456
466
  createMessageBox(this.container, message);
457
467
  }
458
468
 
469
+ if (this.viewRoot) {
470
+ this.#loadingStatusRegistry.set(
471
+ this.viewRoot,
472
+ "error",
473
+ message
474
+ );
475
+ }
476
+
459
477
  return false;
460
478
  } finally {
461
479
  this.#canvasWrapper.classList.remove("loading");
462
- // Transition listener doesn't appear to work on observablehq
463
- window.setTimeout(() => {
464
- this.loadingMessageElement.style.display = "none";
465
- }, 2000);
480
+ if (launched && this.viewRoot) {
481
+ this.#loadingStatusRegistry.set(this.viewRoot, "complete");
482
+ }
466
483
  }
467
484
  }
468
485
 
@@ -552,7 +569,10 @@ export default class GenomeSpy {
552
569
  /** @type {UnitView[]} */
553
570
  const views = [];
554
571
  this.viewRoot.visit((view) => {
555
- if (view instanceof UnitView && view.getDataAccessor("search")) {
572
+ if (
573
+ view instanceof UnitView &&
574
+ view.getSearchAccessors().length > 0
575
+ ) {
556
576
  views.push(view);
557
577
  }
558
578
  });
@@ -15,7 +15,7 @@ import {
15
15
  } from "../encoder/encoder.js";
16
16
  import { asArray, peek } from "../utils/arrayUtils.js";
17
17
  import { InternMap } from "internmap";
18
- import { isExprRef } from "../view/paramMediator.js";
18
+ import { isExprRef } from "../paramRuntime/paramUtils.js";
19
19
  import scaleNull from "../utils/scaleNull.js";
20
20
  import { cssColorToArray } from "./colorUtils.js";
21
21
 
@@ -1 +1 @@
1
- {"version":3,"file":"mark.d.ts","sourceRoot":"","sources":["../../../src/marks/mark.js"],"names":[],"mappings":"AA0DA,mCAAoC,sBAAsB,CAAC;AAC3D,mCAAoC,sBAAsB,CAAC;AAE3D,uCAAwC,oBAAoB,CAAC;AAE7D;;;;;;;;;;;;;GAaG;AAEH;;GAEG;AACH,0BAF0B,CAAC,SAAd,mCAAW;IAuBpB;;OAEG;IACH,sBAFW,OAAO,qBAAqB,EAAE,OAAO,EA4G/C;IAzGG,gDAAwB;IAExB,8EAA8E;IAC9E,UADW,OAAO,CAAC,MAAM,uCAAU,OAAO,qBAAqB,EAAE,OAAO,CAAC,CAAC,CACjD;IAIzB;;;OAGG;IACH,sBAHU,OAAO,SAAS,EAAE,UAAU,GAAG;QAAE,iBAAiB,CAAC,EAAE,MAAM,CAAA;KAAE,CAG5C;IAE3B;;;;;;;OAOG;IACH,2BAHU,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAGG;IAEhC;;;OAGG;IACH,uBAHU,OAAO,SAAS,EAAE,WAAW,CAGX;IAE5B;;;OAGG;IACH,2BAHU,OAAO,SAAS,EAAE,eAAe,CAGX;IAEhC;;;OAGG;IACH,2BAHU,OAAO,SAAS,EAAE,gBAAgB,CAGZ;IAEhC;;;;;OAKG;IACH,2BAHU,OAAO,SAAS,EAAE,gBAAgB,CAGZ;IAEhC;;;;;OAKG;IACH,uCAA+B;IAE/B;;;;;OAKG;IACH,4BAA6B;IAE7B,kFAAkF;IAClF,UADW,QAAQ,CAAC,GAAG,CAAC,CACM;IAG9B,qBAqBE;IAEF;;;;;;OAMG;IACH,qBAHU,CAAC,CAQV;IAGL;;;OAGG;IACH,0CAHW,OAAO,CAAC,CAAC,CAAC,QAQpB;IAED,sBAE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AK,GAAG,QA6BzC;IAED;;OAEG;IACH,2BA+BC;IAED,gBAEC;IAED;;;OAGG;IACH,6BAFW,GAAG,QAyCb;IAED,yBAAyB;IACzB,uDAEC;IAED,yBAAyB;IACzB,iCAEC;IAED,gCAEC;IAED,+BAEC;IAED,yCAEC;IAED;;OAEG;IACH,gCAgBC;IAED;;OAEG;IACH,4CAOC;IAED;;;;;;;;OAQG;IAEH,uBAJW,OAAO,uBAAuB,EAAE,sBAAsB,GACpD,CAAC,MAAM,IAAI,CAAC,EAAE,CA4E1B;IAED;;;;;;OAMG;IACH,qCAJW,oBAAoB,GAClB,OAAO,CAiCnB;IAED;;;;;;;OAOG;IACH,gBAJW,oBAAoB,GAClB,MAAW,IAAI,CAM3B;IAED;;;;OAIG;IACH,2BAJW,YAAY,WACZ,OAAO,WAAW,EAAE,oBAAoB,GACtC,MAAW,IAAI,CAmE3B;IAED;;;;;;;;OAQG;IACH,wBANW;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAC,OAC/B,MAAM,UACN,OAAO,6BAA6B,EAAE,OAAO,aAC7C,OAAO,6BAA6B,EAAE,OAAO,GAC3C,OAAO,CA+GnB;IAED;;;;;;;;;OASG;IACH,qBAJW,MAAM,KACN,OAAO,oBAAoB,EAAE,MAAM,GACjC,GAAG,CAIf;;CACJ;+BAh8CY,OAAO,uBAAuB,EAAE,gBAAgB;;;;;;wBAEnD,OAAO;;mCAEJ,gBAAgB,GAAG,qBAAqB;oCAG1C,MAAM,SACN,MAAM;0BAEJ,YAAY,GAAG,UAAU,GAAG,WAAW;AAw7CpD;;;GAGG;AACH,uBAFa,CAAC;IAGV,cAEC;IAkBD;;;OAGG;IACH,2BAFW,GAAG,CAAC,CAAC,EAAE,OAAO,yBAAyB,EAAE,UAAU,CAAC,QAiB9D;CACJ;0BAngDyB,WAAW"}
@@ -48,7 +48,10 @@ import coalesceProperties from "../utils/propertyCoalescer.js";
48
48
  import { isScalar } from "../utils/variableTools.js";
49
49
  import { InternMap } from "internmap";
50
50
  import ViewError from "../view/viewError.js";
51
- import { isExprRef, validateParameterName } from "../view/paramMediator.js";
51
+ import {
52
+ isExprRef,
53
+ validateParameterName,
54
+ } from "../paramRuntime/paramUtils.js";
52
55
  import { UNIQUE_ID_KEY } from "../data/transforms/identifier.js";
53
56
  import {
54
57
  isIntervalSelection,
@@ -95,11 +98,6 @@ export default class Mark {
95
98
  */
96
99
  #callAfterShaderCompilation = [];
97
100
 
98
- /**
99
- * @type {{expr: import("../view/paramMediator.js").ExprRefFunction, listener: () => void}[]}
100
- */
101
- #exprListeners = [];
102
-
103
101
  /**
104
102
  * @param {import("../view/unitView.js").default} unitView
105
103
  */
@@ -304,13 +302,13 @@ export default class Mark {
304
302
  for (const key of props) {
305
303
  const prop = this.properties[key];
306
304
  if (prop && isExprRef(prop)) {
307
- const fn = this.unitView.paramMediator.createExpression(
308
- prop.expr
305
+ const fn = this.unitView.paramRuntime.watchExpression(
306
+ prop.expr,
307
+ () => {
308
+ this.updateGraphicsData();
309
+ this.unitView.context.animator.requestRender();
310
+ }
309
311
  );
310
- fn.addListener(() => {
311
- this.updateGraphicsData();
312
- this.unitView.context.animator.requestRender();
313
- });
314
312
  // @ts-ignore
315
313
  if (!channels.includes(key)) {
316
314
  Object.defineProperty(exprProps, key, {
@@ -487,8 +485,8 @@ export default class Mark {
487
485
 
488
486
  for (const predicate of paramPredicates) {
489
487
  const param = predicate.param;
490
- const paramMediator = this.unitView.paramMediator;
491
- const selection = paramMediator.findValue(param);
488
+ const paramRuntime = this.unitView.paramRuntime;
489
+ const selection = paramRuntime.findValue(param);
492
490
 
493
491
  // The selection is supposed to have an empty value at this point
494
492
  // so that we can figure out the type of the selection.
@@ -546,7 +544,7 @@ export default class Mark {
546
544
 
547
545
  this.selectionTextureOps.push(() => {
548
546
  // Texture is set in the prepareRender method
549
- const selection = paramMediator.getValue(param);
547
+ const selection = paramRuntime.getValue(param);
550
548
  const texture = selectionTextures.get(selection);
551
549
  if (!texture) {
552
550
  throw new Error(
@@ -569,11 +567,10 @@ export default class Mark {
569
567
  // Create the initial texture
570
568
  glHelper.createSelectionTexture(selection);
571
569
 
572
- const fn = paramMediator.createExpression(param);
573
- fn.addListener(() => {
570
+ paramRuntime.watchExpression(param, () => {
574
571
  const selection =
575
572
  /** @type {import("../types/selectionTypes.js").MultiPointSelection} */ (
576
- fn(null)
573
+ paramRuntime.getValue(param)
577
574
  );
578
575
  glHelper.createSelectionTexture(selection);
579
576
  this.getContext().animator.requestRender();
@@ -940,6 +937,17 @@ export default class Mark {
940
937
  * initiated. The idea is to allow for parallel background compilation.
941
938
  */
942
939
  finalizeGraphicsInitialization() {
940
+ // Allow duplicate finalization calls when multiple init paths overlap.
941
+ if (this.programInfo) {
942
+ return;
943
+ }
944
+
945
+ if (!this.programStatus) {
946
+ throw new Error(
947
+ "No program status found! " + this.unitView.getPathString()
948
+ );
949
+ }
950
+
943
951
  const error = this.programStatus.getProgramErrors();
944
952
  if (error) {
945
953
  if (error.detail) {
@@ -1033,15 +1041,14 @@ export default class Mark {
1033
1041
  };
1034
1042
 
1035
1043
  if (isExprRef(propValue)) {
1036
- const fn = this.unitView.paramMediator.createExpression(
1037
- propValue.expr
1038
- );
1039
-
1044
+ /** @type {import("../paramRuntime/types.js").ExprRefFunction} */
1045
+ let fn;
1040
1046
  const set = () => setter(adjuster(fn(null)));
1047
+ fn = this.unitView.paramRuntime.watchExpression(
1048
+ propValue.expr,
1049
+ set
1050
+ );
1041
1051
 
1042
- // Register a listener ...
1043
- fn.addListener(set);
1044
- this.#exprListeners.push({ expr: fn, listener: set });
1045
1052
  // ... and set the initial value
1046
1053
  set();
1047
1054
  } else {
@@ -1086,10 +1093,6 @@ export default class Mark {
1086
1093
  }
1087
1094
 
1088
1095
  dispose() {
1089
- for (const { expr, listener } of this.#exprListeners) {
1090
- expr.removeListener(listener);
1091
- }
1092
- this.#exprListeners.length = 0;
1093
1096
  this.deleteGraphicsData();
1094
1097
  }
1095
1098
 
@@ -1166,7 +1169,7 @@ export default class Mark {
1166
1169
  isPickingParticipant() {
1167
1170
  if (
1168
1171
  this.properties.tooltip === null &&
1169
- !this.unitView.paramMediator.hasPointSelections()
1172
+ !this.unitView.paramRuntime.hasPointSelections()
1170
1173
  ) {
1171
1174
  // Disabled
1172
1175
  return false;
@@ -1290,21 +1293,17 @@ export default class Mark {
1290
1293
  const locationSetter = this.programInfo.uniformSetters.uSampleFacet;
1291
1294
 
1292
1295
  if (opts && locationSetter) {
1293
- const pos = opts.locSize ? opts.locSize.location : 0.0;
1294
- const height = opts.locSize ? opts.locSize.size : 1.0;
1296
+ const scale = opts.pixelToUnit;
1297
+ const pos = opts.locSize.location * scale;
1298
+ const height = opts.locSize.size * scale;
1295
1299
 
1296
1300
  if (pos > 1.0 || pos + height < 0.0) {
1297
1301
  // Not visible
1298
1302
  return false;
1299
1303
  }
1300
1304
 
1301
- const targetPos = opts.targetLocSize
1302
- ? opts.targetLocSize.location
1303
- : pos;
1304
- const targetHeight = opts.targetLocSize
1305
- ? opts.targetLocSize.size
1306
- : height;
1307
-
1305
+ // No target locSize in the current API. Keep a consistent shader path
1306
+ // by repeating the current position/height.
1308
1307
  // Use WebGL directly, because twgl uses gl.uniform4fv, which has an
1309
1308
  // inferior performance. Based on profiling, this optimization gives
1310
1309
  // a significant performance boost.
@@ -1313,8 +1312,8 @@ export default class Mark {
1313
1312
  locationSetter.location, // TODO: Make a twgl pull request to fix typing
1314
1313
  pos,
1315
1314
  height,
1316
- targetPos,
1317
- targetHeight
1315
+ pos,
1316
+ height
1318
1317
  );
1319
1318
  }
1320
1319
 
@@ -38,7 +38,7 @@ export function fixPositional(encoding, channel) {
38
38
  if (!secondary) {
39
39
  if (primary.type == "quantitative") {
40
40
  // Bar plot, anchor the other end to zero
41
- secondary = { datum: 0, contributesToScaleDomain: false };
41
+ secondary = { datum: 0, domainInert: true };
42
42
  } else {
43
43
  secondary = { ...primary };
44
44
 
@@ -1 +1 @@
1
- {"version":3,"file":"point.d.ts","sourceRoot":"","sources":["../../../src/marks/point.js"],"names":[],"mappings":"AAmBA;;GAEG;AACH;IAGI;;OAEG;IACH,sBAFW,OAAO,qBAAqB,EAAE,OAAO,EAmD/C;IA0EO,iDAMC;IAkET,+BAkBC;;CAgDJ;iBAtRgB,WAAW"}
1
+ {"version":3,"file":"point.d.ts","sourceRoot":"","sources":["../../../src/marks/point.js"],"names":[],"mappings":"AAmBA;;GAEG;AACH;IAGI;;OAEG;IACH,sBAFW,OAAO,qBAAqB,EAAE,OAAO,EAiD/C;IA0EO,iDAMC;IAkET,+BAkBC;;CAgDJ;iBApRgB,WAAW"}
@@ -10,7 +10,7 @@ import FRAGMENT_SHADER from "./point.fragment.glsl.js";
10
10
  import COMMON_SHADER from "./point.common.glsl.js";
11
11
 
12
12
  import Mark from "./mark.js";
13
- import { isExprRef } from "../view/paramMediator.js";
13
+ import { isExprRef } from "../paramRuntime/paramUtils.js";
14
14
  import { sampleIterable } from "../data/transforms/sample.js";
15
15
  import { fixFill, fixStroke } from "./markUtils.js";
16
16
 
@@ -58,11 +58,9 @@ export default class PointMark extends Mark {
58
58
  const szf = this.properties.semanticZoomFraction;
59
59
  if (szf != null) {
60
60
  if (isExprRef(szf)) {
61
- const fn = this.unitView.paramMediator.createExpression(
62
- szf.expr
63
- );
64
- fn.addListener(() =>
65
- this.getContext().animator.requestRender()
61
+ const fn = this.unitView.paramRuntime.watchExpression(
62
+ szf.expr,
63
+ () => this.getContext().animator.requestRender()
66
64
  );
67
65
  this.#semanticZoomFraction = fn;
68
66
  } else {
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @param {string} expr
3
+ * @param {Record<string, any>} [globalObject]
4
+ * @returns {import("../utils/expression.js").ExpressionFunction}
5
+ */
6
+ export function compileExpression(expr: string, globalObject?: Record<string, any>): import("../utils/expression.js").ExpressionFunction;
7
+ //# sourceMappingURL=expressionCompiler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expressionCompiler.d.ts","sourceRoot":"","sources":["../../../src/paramRuntime/expressionCompiler.js"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wCAJW,MAAM,iBACN,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACjB,OAAO,wBAAwB,EAAE,kBAAkB,CAI/D"}
@@ -0,0 +1,10 @@
1
+ import createFunction from "../utils/expression.js";
2
+
3
+ /**
4
+ * @param {string} expr
5
+ * @param {Record<string, any>} [globalObject]
6
+ * @returns {import("../utils/expression.js").ExpressionFunction}
7
+ */
8
+ export function compileExpression(expr, globalObject = {}) {
9
+ return createFunction(expr, globalObject);
10
+ }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @typedef {{
3
+ * expression: import("./types.js").ExprRefFunction,
4
+ * dependencies: import("./types.js").ParamRef<any>[]
5
+ * }} BoundExpression
6
+ */
7
+ /**
8
+ * Binds expression globals to parameter refs in a specific scope and equips the
9
+ * resulting expression function with listener lifecycle helpers.
10
+ *
11
+ * @param {string} expr
12
+ * @param {(name: string) => import("./types.js").ParamRef<any> | undefined} resolve
13
+ * @returns {BoundExpression}
14
+ */
15
+ export function bindExpression(expr: string, resolve: (name: string) => import("./types.js").ParamRef<any> | undefined): BoundExpression;
16
+ export type BoundExpression = {
17
+ expression: import("./types.js").ExprRefFunction;
18
+ dependencies: import("./types.js").ParamRef<any>[];
19
+ };
20
+ //# sourceMappingURL=expressionRef.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expressionRef.d.ts","sourceRoot":"","sources":["../../../src/paramRuntime/expressionRef.js"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH;;;;;;;GAOG;AACH,qCAJW,MAAM,WACN,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,YAAY,EAAE,QAAQ,CAAC,GAAG,CAAC,GAAG,SAAS,GAC9D,eAAe,CA+E3B;8BA3FY;IACR,UAAU,EAAE,OAAO,YAAY,EAAE,eAAe,CAAC;IACjD,YAAY,EAAE,OAAO,YAAY,EAAE,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAA;CACnD"}
@@ -0,0 +1,95 @@
1
+ import { compileExpression } from "./expressionCompiler.js";
2
+
3
+ /**
4
+ * @typedef {{
5
+ * expression: import("./types.js").ExprRefFunction,
6
+ * dependencies: import("./types.js").ParamRef<any>[]
7
+ * }} BoundExpression
8
+ */
9
+
10
+ /**
11
+ * Binds expression globals to parameter refs in a specific scope and equips the
12
+ * resulting expression function with listener lifecycle helpers.
13
+ *
14
+ * @param {string} expr
15
+ * @param {(name: string) => import("./types.js").ParamRef<any> | undefined} resolve
16
+ * @returns {BoundExpression}
17
+ */
18
+ export function bindExpression(expr, resolve) {
19
+ const globalObject = {};
20
+
21
+ /** @type {import("./types.js").ExprRefFunction} */
22
+ const expression = /** @type {any} */ (
23
+ compileExpression(expr, globalObject)
24
+ );
25
+
26
+ /** @type {Map<string, import("./types.js").ParamRef<any>>} */
27
+ const refsForParams = new Map();
28
+
29
+ for (const globalName of expression.globals) {
30
+ if (refsForParams.has(globalName)) {
31
+ continue;
32
+ }
33
+
34
+ const ref = resolve(globalName);
35
+ if (!ref) {
36
+ throw new Error(
37
+ 'Unknown variable "' + globalName + '" in expression: ' + expr
38
+ );
39
+ }
40
+
41
+ refsForParams.set(globalName, ref);
42
+
43
+ Object.defineProperty(globalObject, globalName, {
44
+ enumerable: true,
45
+ get() {
46
+ return ref.get();
47
+ },
48
+ });
49
+ }
50
+
51
+ /** @type {Set<() => void>} */
52
+ const activeSubscriptions = new Set();
53
+
54
+ expression.subscribe = (listener) => {
55
+ /** @type {(() => void)[]} */
56
+ const disposers = [];
57
+ for (const ref of refsForParams.values()) {
58
+ disposers.push(ref.subscribe(listener));
59
+ }
60
+
61
+ let active = true;
62
+ const unsubscribe = () => {
63
+ if (!active) {
64
+ return;
65
+ }
66
+ active = false;
67
+ activeSubscriptions.delete(unsubscribe);
68
+ disposers.forEach((dispose) => dispose());
69
+ };
70
+ activeSubscriptions.add(unsubscribe);
71
+
72
+ return unsubscribe;
73
+ };
74
+
75
+ expression.invalidate = () => {
76
+ for (const unsubscribe of activeSubscriptions) {
77
+ unsubscribe();
78
+ }
79
+ activeSubscriptions.clear();
80
+ };
81
+
82
+ // Include dependency identities to avoid collisions between structurally
83
+ // identical expressions in different scopes.
84
+ expression.identifier = () =>
85
+ expression.code +
86
+ "|" +
87
+ Array.from(refsForParams.values())
88
+ .map((ref) => ref.id)
89
+ .join(",");
90
+
91
+ return {
92
+ expression,
93
+ dependencies: Array.from(refsForParams.values()),
94
+ };
95
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=expressionRef.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expressionRef.test.d.ts","sourceRoot":"","sources":["../../../src/paramRuntime/expressionRef.test.js"],"names":[],"mappings":""}