@genome-spy/core 0.77.0 → 0.79.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.
- package/dist/bundle/{browser-KWU9rWZT.js → browser-CETrb2cm.js} +53 -33
- package/dist/bundle/esm-BdLYkz-m.js +248 -0
- package/dist/bundle/esm-BwiDsqSb.js +1367 -0
- package/dist/bundle/esm-CDFd1cjk.js +441 -0
- package/dist/bundle/{esm-CRMf_I9V.js → esm-CTUHLDbv.js} +30 -30
- package/dist/bundle/esm-Cx-EbkOj.js +1221 -0
- package/dist/bundle/esm-DlYGqi79.js +128 -0
- package/dist/bundle/{esm-BygJiwh0.js → esm-k9p3oHkt.js} +133 -158
- package/dist/bundle/{esm-CT3ygiMq.js → esm-zAZJQO6D.js} +226 -212
- package/dist/bundle/index.es.js +14102 -10810
- package/dist/bundle/index.js +109 -95
- package/dist/bundle/{parquetRead-DG_-F5j5.js → parquetRead-Cad1SOVV.js} +473 -399
- package/dist/schema.json +23788 -11049
- package/dist/src/config/axisConfig.d.ts +2 -2
- package/dist/src/config/axisConfig.d.ts.map +1 -1
- package/dist/src/config/axisConfig.js +28 -44
- package/dist/src/config/configLayers.d.ts +45 -0
- package/dist/src/config/configLayers.d.ts.map +1 -0
- package/dist/src/config/configLayers.js +110 -0
- package/dist/src/config/defaultConfig.d.ts.map +1 -1
- package/dist/src/config/defaultConfig.js +8 -1
- package/dist/src/config/defaults/legendDefaults.d.ts +14 -0
- package/dist/src/config/defaults/legendDefaults.d.ts.map +1 -0
- package/dist/src/config/defaults/legendDefaults.js +46 -0
- package/dist/src/config/defaults/titleDefaults.d.ts.map +1 -1
- package/dist/src/config/defaults/titleDefaults.js +26 -18
- package/dist/src/config/legendConfig.d.ts +11 -0
- package/dist/src/config/legendConfig.d.ts.map +1 -0
- package/dist/src/config/legendConfig.js +63 -0
- package/dist/src/config/styleUtils.d.ts +8 -2
- package/dist/src/config/styleUtils.d.ts.map +1 -1
- package/dist/src/config/styleUtils.js +25 -1
- package/dist/src/config/themes.d.ts.map +1 -1
- package/dist/src/config/themes.js +21 -2
- package/dist/src/config/titleConfig.d.ts.map +1 -1
- package/dist/src/config/titleConfig.js +2 -18
- package/dist/src/data/collector.d.ts.map +1 -1
- package/dist/src/data/collector.js +40 -18
- package/dist/src/data/flowInit.d.ts +6 -0
- package/dist/src/data/flowInit.d.ts.map +1 -1
- package/dist/src/data/flowInit.js +1 -1
- package/dist/src/data/flowNode.d.ts +32 -0
- package/dist/src/data/flowNode.d.ts.map +1 -1
- package/dist/src/data/flowNode.js +59 -0
- package/dist/src/data/sources/lazy/bamSource.d.ts +0 -1
- package/dist/src/data/sources/lazy/bamSource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/bamSource.js +39 -30
- package/dist/src/data/sources/lazy/bigBedSource.d.ts +0 -10
- package/dist/src/data/sources/lazy/bigBedSource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/bigBedSource.js +127 -62
- package/dist/src/data/sources/lazy/bigWigSource.d.ts +2 -2
- package/dist/src/data/sources/lazy/bigWigSource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/bigWigSource.js +234 -81
- package/dist/src/data/sources/lazy/gff3Source.d.ts +7 -3
- package/dist/src/data/sources/lazy/gff3Source.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/gff3Source.js +7 -8
- package/dist/src/data/sources/lazy/indexedFastaSource.d.ts +1 -1
- package/dist/src/data/sources/lazy/indexedFastaSource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/indexedFastaSource.js +28 -19
- package/dist/src/data/sources/lazy/legendEntriesSource.d.ts +24 -0
- package/dist/src/data/sources/lazy/legendEntriesSource.d.ts.map +1 -0
- package/dist/src/data/sources/lazy/legendEntriesSource.js +217 -0
- package/dist/src/data/sources/lazy/legendGradientSource.d.ts +30 -0
- package/dist/src/data/sources/lazy/legendGradientSource.d.ts.map +1 -0
- package/dist/src/data/sources/lazy/legendGradientSource.js +388 -0
- package/dist/src/data/sources/lazy/mockLazySource.d.ts +4 -1
- package/dist/src/data/sources/lazy/mockLazySource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/mockLazySource.js +49 -4
- package/dist/src/data/sources/lazy/registerCoreLazySources.js +2 -0
- package/dist/src/data/sources/lazy/singleAxisWindowedSource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/singleAxisWindowedSource.js +3 -4
- package/dist/src/data/sources/lazy/tabixSource.d.ts +9 -4
- package/dist/src/data/sources/lazy/tabixSource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/tabixSource.js +201 -70
- package/dist/src/data/sources/lazy/tabixTsvSource.d.ts +2 -3
- package/dist/src/data/sources/lazy/tabixTsvSource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/tabixTsvSource.js +14 -12
- package/dist/src/data/sources/lazy/vcfSource.d.ts +7 -3
- package/dist/src/data/sources/lazy/vcfSource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/vcfSource.js +7 -8
- package/dist/src/data/sources/urlDescriptor.d.ts +165 -0
- package/dist/src/data/sources/urlDescriptor.d.ts.map +1 -0
- package/dist/src/data/sources/urlDescriptor.js +473 -0
- package/dist/src/data/sources/urlDescriptorController.d.ts +25 -0
- package/dist/src/data/sources/urlDescriptorController.d.ts.map +1 -0
- package/dist/src/data/sources/urlDescriptorController.js +72 -0
- package/dist/src/data/sources/urlDescriptorState.d.ts +47 -0
- package/dist/src/data/sources/urlDescriptorState.d.ts.map +1 -0
- package/dist/src/data/sources/urlDescriptorState.js +129 -0
- package/dist/src/data/sources/urlSource.d.ts.map +1 -1
- package/dist/src/data/sources/urlSource.js +101 -61
- package/dist/src/data/transforms/packLegendLabels.d.ts +21 -0
- package/dist/src/data/transforms/packLegendLabels.d.ts.map +1 -0
- package/dist/src/data/transforms/packLegendLabels.js +189 -0
- package/dist/src/data/transforms/transformFactory.d.ts.map +1 -1
- package/dist/src/data/transforms/transformFactory.js +4 -0
- package/dist/src/data/transforms/truncateText.d.ts +27 -0
- package/dist/src/data/transforms/truncateText.d.ts.map +1 -0
- package/dist/src/data/transforms/truncateText.js +94 -0
- package/dist/src/debug/dataflowDebugSnapshot.d.ts +58 -0
- package/dist/src/debug/dataflowDebugSnapshot.d.ts.map +1 -0
- package/dist/src/debug/dataflowDebugSnapshot.js +159 -0
- package/dist/src/debug/markDebugSnapshot.d.ts +54 -0
- package/dist/src/debug/markDebugSnapshot.d.ts.map +1 -0
- package/dist/src/debug/markDebugSnapshot.js +100 -0
- package/dist/src/debug/paramDebugSnapshot.d.ts +53 -0
- package/dist/src/debug/paramDebugSnapshot.d.ts.map +1 -0
- package/dist/src/debug/paramDebugSnapshot.js +86 -0
- package/dist/src/debug/resolutionDebugSnapshot.d.ts +155 -0
- package/dist/src/debug/resolutionDebugSnapshot.d.ts.map +1 -0
- package/dist/src/debug/resolutionDebugSnapshot.js +291 -0
- package/dist/src/debug/valuePreview.d.ts +9 -0
- package/dist/src/debug/valuePreview.d.ts.map +1 -0
- package/dist/src/debug/valuePreview.js +57 -0
- package/dist/src/debug/viewDebugSnapshot.d.ts +131 -0
- package/dist/src/debug/viewDebugSnapshot.d.ts.map +1 -0
- package/dist/src/debug/viewDebugSnapshot.js +390 -0
- package/dist/src/embedFactory.d.ts.map +1 -1
- package/dist/src/embedFactory.js +6 -1
- package/dist/src/encoder/encoder.d.ts +2 -2
- package/dist/src/encoder/encoder.d.ts.map +1 -1
- package/dist/src/encoder/encoder.js +5 -4
- package/dist/src/fonts/bmFontManager.d.ts +1 -1
- package/dist/src/fonts/bmFontManager.d.ts.map +1 -1
- package/dist/src/fonts/bmFontManager.js +45 -10
- package/dist/src/fonts/textMetrics.d.ts +69 -0
- package/dist/src/fonts/textMetrics.d.ts.map +1 -0
- package/dist/src/fonts/textMetrics.js +73 -0
- package/dist/src/genomeSpy/headlessBootstrap.d.ts.map +1 -1
- package/dist/src/genomeSpy/headlessBootstrap.js +8 -0
- package/dist/src/genomeSpy/interactionController.d.ts +4 -1
- package/dist/src/genomeSpy/interactionController.d.ts.map +1 -1
- package/dist/src/genomeSpy/interactionController.js +57 -13
- package/dist/src/genomeSpy/renderCoordinator.d.ts.map +1 -1
- package/dist/src/genomeSpy/renderCoordinator.js +25 -3
- package/dist/src/genomeSpy/viewDataInit.d.ts +14 -0
- package/dist/src/genomeSpy/viewDataInit.d.ts.map +1 -1
- package/dist/src/genomeSpy/viewDataInit.js +45 -8
- package/dist/src/genomeSpyBase.d.ts +6 -0
- package/dist/src/genomeSpyBase.d.ts.map +1 -1
- package/dist/src/genomeSpyBase.js +25 -4
- package/dist/src/gl/glslScaleGenerator.d.ts +17 -0
- package/dist/src/gl/glslScaleGenerator.d.ts.map +1 -1
- package/dist/src/gl/glslScaleGenerator.js +39 -2
- package/dist/src/gl/includes/common.glsl.js +1 -1
- package/dist/src/gl/vertexRangeIndex.d.ts.map +1 -1
- package/dist/src/gl/vertexRangeIndex.js +4 -2
- package/dist/src/gl/webGLHelper.d.ts +1 -1
- package/dist/src/gl/webGLHelper.d.ts.map +1 -1
- package/dist/src/gl/webGLHelper.js +13 -8
- package/dist/src/marks/__snapshots__/shaderSnapshot.test.js.snap +140 -3
- package/dist/src/marks/mark.d.ts +47 -4
- package/dist/src/marks/mark.d.ts.map +1 -1
- package/dist/src/marks/mark.js +158 -54
- package/dist/src/marks/point.d.ts.map +1 -1
- package/dist/src/marks/point.js +4 -0
- package/dist/src/marks/point.vertex.glsl.js +1 -1
- package/dist/src/marks/text.d.ts +1 -1
- package/dist/src/marks/text.d.ts.map +1 -1
- package/dist/src/marks/text.js +2 -7
- package/dist/src/marks/text.vertex.glsl.js +1 -1
- package/dist/src/paramRuntime/paramUtils.d.ts +43 -9
- package/dist/src/paramRuntime/paramUtils.d.ts.map +1 -1
- package/dist/src/paramRuntime/paramUtils.js +61 -1
- package/dist/src/paramRuntime/viewParamRuntime.d.ts +32 -0
- package/dist/src/paramRuntime/viewParamRuntime.d.ts.map +1 -1
- package/dist/src/paramRuntime/viewParamRuntime.js +63 -0
- package/dist/src/scales/axisResolution.d.ts +35 -0
- package/dist/src/scales/axisResolution.d.ts.map +1 -1
- package/dist/src/scales/axisResolution.js +115 -7
- package/dist/src/scales/domainExpressions.d.ts +21 -0
- package/dist/src/scales/domainExpressions.d.ts.map +1 -0
- package/dist/src/scales/domainExpressions.js +43 -0
- package/dist/src/scales/domainPlanner.d.ts +12 -1
- package/dist/src/scales/domainPlanner.d.ts.map +1 -1
- package/dist/src/scales/domainPlanner.js +55 -36
- package/dist/src/scales/legendResolution.d.ts +83 -0
- package/dist/src/scales/legendResolution.d.ts.map +1 -0
- package/dist/src/scales/legendResolution.js +461 -0
- package/dist/src/scales/scaleInstanceManager.d.ts +1 -0
- package/dist/src/scales/scaleInstanceManager.d.ts.map +1 -1
- package/dist/src/scales/scaleInstanceManager.js +5 -0
- package/dist/src/scales/scalePropsResolver.d.ts +6 -1
- package/dist/src/scales/scalePropsResolver.d.ts.map +1 -1
- package/dist/src/scales/scalePropsResolver.js +35 -10
- package/dist/src/scales/scaleResolution.d.ts +52 -0
- package/dist/src/scales/scaleResolution.d.ts.map +1 -1
- package/dist/src/scales/scaleResolution.js +195 -16
- package/dist/src/scales/scaleRules.d.ts +10 -0
- package/dist/src/scales/scaleRules.d.ts.map +1 -1
- package/dist/src/scales/scaleRules.js +38 -1
- package/dist/src/scales/viewLevelGuideConfig.d.ts +53 -0
- package/dist/src/scales/viewLevelGuideConfig.d.ts.map +1 -0
- package/dist/src/scales/viewLevelGuideConfig.js +224 -0
- package/dist/src/scales/viewLevelScaleConfig.d.ts +45 -0
- package/dist/src/scales/viewLevelScaleConfig.d.ts.map +1 -0
- package/dist/src/scales/viewLevelScaleConfig.js +149 -0
- package/dist/src/spec/axis.d.ts +109 -3
- package/dist/src/spec/channel.d.ts +23 -4
- package/dist/src/spec/config.d.ts +59 -4
- package/dist/src/spec/data.d.ts +177 -17
- package/dist/src/spec/legend.d.ts +246 -0
- package/dist/src/spec/mark.d.ts +16 -4
- package/dist/src/spec/scale.d.ts +19 -6
- package/dist/src/spec/title.d.ts +58 -1
- package/dist/src/spec/transform.d.ts +149 -0
- package/dist/src/spec/view.d.ts +50 -6
- package/dist/src/styles/genome-spy.css +4 -1
- package/dist/src/styles/genome-spy.css.d.ts +1 -1
- package/dist/src/styles/genome-spy.css.d.ts.map +1 -1
- package/dist/src/styles/genome-spy.css.js +4 -1
- package/dist/src/types/embedApi.d.ts +262 -6
- package/dist/src/types/rendering.d.ts +19 -3
- package/dist/src/types/viewContext.d.ts +18 -2
- package/dist/src/utils/arrayUtils.d.ts +11 -0
- package/dist/src/utils/arrayUtils.d.ts.map +1 -1
- package/dist/src/utils/arrayUtils.js +23 -0
- package/dist/src/utils/suspension.d.ts +17 -0
- package/dist/src/utils/suspension.d.ts.map +1 -0
- package/dist/src/utils/suspension.js +41 -0
- package/dist/src/utils/ui/tooltip.d.ts +4 -0
- package/dist/src/utils/ui/tooltip.d.ts.map +1 -1
- package/dist/src/utils/ui/tooltip.js +35 -10
- package/dist/src/view/axisGridView.d.ts.map +1 -1
- package/dist/src/view/axisGridView.js +1 -4
- package/dist/src/view/axisView.d.ts +18 -2
- package/dist/src/view/axisView.d.ts.map +1 -1
- package/dist/src/view/axisView.js +180 -75
- package/dist/src/view/concatView.d.ts +10 -2
- package/dist/src/view/concatView.d.ts.map +1 -1
- package/dist/src/view/concatView.js +46 -9
- package/dist/src/view/containerMutationHelper.d.ts +20 -1
- package/dist/src/view/containerMutationHelper.d.ts.map +1 -1
- package/dist/src/view/containerMutationHelper.js +203 -32
- package/dist/src/view/facetView.d.ts +1 -1
- package/dist/src/view/gridView/gridChild.d.ts +54 -4
- package/dist/src/view/gridView/gridChild.d.ts.map +1 -1
- package/dist/src/view/gridView/gridChild.js +301 -120
- package/dist/src/view/gridView/gridChildLegends.d.ts +57 -0
- package/dist/src/view/gridView/gridChildLegends.d.ts.map +1 -0
- package/dist/src/view/gridView/gridChildLegends.js +503 -0
- package/dist/src/view/gridView/gridView.d.ts +25 -0
- package/dist/src/view/gridView/gridView.d.ts.map +1 -1
- package/dist/src/view/gridView/gridView.js +454 -78
- package/dist/src/view/gridView/legendLayout.d.ts +26 -0
- package/dist/src/view/gridView/legendLayout.d.ts.map +1 -0
- package/dist/src/view/gridView/legendLayout.js +111 -0
- package/dist/src/view/gridView/scrollbar.d.ts.map +1 -1
- package/dist/src/view/gridView/scrollbar.js +1 -4
- package/dist/src/view/gridView/selectionRect.d.ts.map +1 -1
- package/dist/src/view/gridView/selectionRect.js +1 -4
- package/dist/src/view/gridView/separatorView.d.ts.map +1 -1
- package/dist/src/view/gridView/separatorView.js +1 -4
- package/dist/src/view/layerView.d.ts +9 -2
- package/dist/src/view/layerView.d.ts.map +1 -1
- package/dist/src/view/layerView.js +18 -1
- package/dist/src/view/layout/flexLayout.d.ts +20 -4
- package/dist/src/view/layout/flexLayout.d.ts.map +1 -1
- package/dist/src/view/layout/flexLayout.js +331 -31
- package/dist/src/view/layout/rectangle.d.ts +14 -0
- package/dist/src/view/layout/rectangle.d.ts.map +1 -1
- package/dist/src/view/layout/rectangle.js +40 -0
- package/dist/src/view/legend/legendEntries.d.ts +20 -0
- package/dist/src/view/legend/legendEntries.d.ts.map +1 -0
- package/dist/src/view/legend/legendEntries.js +21 -0
- package/dist/src/view/legendView.d.ts +134 -0
- package/dist/src/view/legendView.d.ts.map +1 -0
- package/dist/src/view/legendView.js +1611 -0
- package/dist/src/view/renderingContext/bufferedViewRenderingContext.d.ts.map +1 -1
- package/dist/src/view/renderingContext/bufferedViewRenderingContext.js +26 -4
- package/dist/src/view/renderingContext/clipOptions.d.ts +44 -0
- package/dist/src/view/renderingContext/clipOptions.d.ts.map +1 -0
- package/dist/src/view/renderingContext/clipOptions.js +140 -0
- package/dist/src/view/renderingContext/simpleViewRenderingContext.d.ts.map +1 -1
- package/dist/src/view/renderingContext/simpleViewRenderingContext.js +12 -1
- package/dist/src/view/resolutionPlanner.d.ts +2 -1
- package/dist/src/view/resolutionPlanner.d.ts.map +1 -1
- package/dist/src/view/resolutionPlanner.js +89 -25
- package/dist/src/view/testUtils.d.ts +4 -2
- package/dist/src/view/testUtils.d.ts.map +1 -1
- package/dist/src/view/testUtils.js +29 -7
- package/dist/src/view/titleView.d.ts +37 -0
- package/dist/src/view/titleView.d.ts.map +1 -0
- package/dist/src/view/titleView.js +584 -0
- package/dist/src/view/unitView.d.ts +3 -3
- package/dist/src/view/unitView.d.ts.map +1 -1
- package/dist/src/view/unitView.js +3 -2
- package/dist/src/view/view.d.ts +25 -24
- package/dist/src/view/view.d.ts.map +1 -1
- package/dist/src/view/view.js +121 -16
- package/dist/src/view/viewFactory.d.ts +2 -5
- package/dist/src/view/viewFactory.d.ts.map +1 -1
- package/dist/src/view/viewFactory.js +1 -2
- package/dist/src/view/viewIdentityRegistry.d.ts +37 -0
- package/dist/src/view/viewIdentityRegistry.d.ts.map +1 -0
- package/dist/src/view/viewIdentityRegistry.js +71 -0
- package/dist/src/view/viewMutationAcidTestUtils.d.ts +112 -0
- package/dist/src/view/viewMutationAcidTestUtils.d.ts.map +1 -0
- package/dist/src/view/viewMutationAcidTestUtils.js +234 -0
- package/dist/src/view/viewMutationApi.d.ts +42 -0
- package/dist/src/view/viewMutationApi.d.ts.map +1 -0
- package/dist/src/view/viewMutationApi.js +811 -0
- package/dist/src/view/viewSelectors.d.ts +10 -0
- package/dist/src/view/viewSelectors.d.ts.map +1 -1
- package/dist/src/view/viewSelectors.js +23 -1
- package/package.json +4 -4
- package/dist/bundle/esm-0dYHNV_D.js +0 -121
- package/dist/bundle/esm-C49STiCR.js +0 -1248
- package/dist/bundle/esm-CscjKVDc.js +0 -1426
- package/dist/bundle/esm-CuMSzCHy.js +0 -298
- package/dist/bundle/esm-DMXpJXM4.js +0 -369
- package/dist/src/view/title.d.ts +0 -13
- package/dist/src/view/title.d.ts.map +0 -1
- package/dist/src/view/title.js +0 -154
- /package/dist/bundle/{AbortablePromiseCache-3gHJdF3E.js → AbortablePromiseCache-BTmAcN-t.js} +0 -0
- /package/dist/bundle/{esm-CuVa5T98.js → esm-VvpZ9hsq.js} +0 -0
- /package/dist/bundle/{chunk-DmhlhrBa.js → rolldown-runtime-Dy4uBu1J.js} +0 -0
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import { createViewMutationApi } from "./viewMutationApi.js";
|
|
2
|
+
import { createHeadlessEngine } from "../genomeSpy/headlessBootstrap.js";
|
|
3
|
+
import { renderToLayout } from "./testUtils.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @typedef {{
|
|
7
|
+
* view: import("./view.js").default,
|
|
8
|
+
* api: import("../types/embedApi.js").ViewApi,
|
|
9
|
+
* context: import("../types/viewContext.js").default
|
|
10
|
+
* }} ViewMutationAcidHarness
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @param {import("../spec/root.js").RootSpec} spec
|
|
15
|
+
* @param {Parameters<typeof createHeadlessEngine>[1]} [options]
|
|
16
|
+
* @returns {Promise<ViewMutationAcidHarness>}
|
|
17
|
+
*/
|
|
18
|
+
export async function createViewMutationAcidHarness(spec, options) {
|
|
19
|
+
const { view, context } = await createHeadlessEngine(spec, options);
|
|
20
|
+
|
|
21
|
+
return {
|
|
22
|
+
view,
|
|
23
|
+
api: createViewMutationApi({ viewRoot: view }),
|
|
24
|
+
context,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Captures normalized lifecycle state that should remain stable after a
|
|
30
|
+
* round-trip mutation.
|
|
31
|
+
*
|
|
32
|
+
* @param {import("./view.js").default} viewRoot
|
|
33
|
+
*/
|
|
34
|
+
export function createMutationAcidSnapshot(viewRoot) {
|
|
35
|
+
return {
|
|
36
|
+
hierarchy: createHierarchySnapshot(viewRoot),
|
|
37
|
+
layout: renderToLayout(viewRoot),
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Captures object identities that should survive a round-trip mutation.
|
|
43
|
+
*
|
|
44
|
+
* @param {import("./view.js").default} viewRoot
|
|
45
|
+
*/
|
|
46
|
+
export function captureMutationAcidIdentities(viewRoot) {
|
|
47
|
+
const views = viewRoot.getDescendants();
|
|
48
|
+
|
|
49
|
+
return {
|
|
50
|
+
views,
|
|
51
|
+
collectors: views.map((view) => view.flowHandle?.collector),
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* @template T
|
|
57
|
+
* @returns {{
|
|
58
|
+
* promise: Promise<T>,
|
|
59
|
+
* resolve: (value: T) => void,
|
|
60
|
+
* reject: (reason?: unknown) => void
|
|
61
|
+
* }}
|
|
62
|
+
*/
|
|
63
|
+
export function createDeferred() {
|
|
64
|
+
/** @type {(value: any) => void} */
|
|
65
|
+
let resolve;
|
|
66
|
+
/** @type {(reason?: unknown) => void} */
|
|
67
|
+
let reject;
|
|
68
|
+
const promise = new Promise((resolvePromise, rejectPromise) => {
|
|
69
|
+
resolve = resolvePromise;
|
|
70
|
+
reject = rejectPromise;
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
return { promise, resolve, reject };
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* @param {() => boolean} predicate
|
|
78
|
+
* @returns {Promise<void>}
|
|
79
|
+
*/
|
|
80
|
+
export async function waitUntil(predicate) {
|
|
81
|
+
for (let i = 0; i < 50; i++) {
|
|
82
|
+
if (predicate()) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
throw new Error("Condition was not met.");
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* @param {import("./view.js").default} viewRoot
|
|
94
|
+
* @param {string} name
|
|
95
|
+
*/
|
|
96
|
+
export function getRequiredView(viewRoot, name) {
|
|
97
|
+
const view = viewRoot.getDescendants().find((view) => view.name === name);
|
|
98
|
+
if (!view) {
|
|
99
|
+
throw new Error("Expected view: " + name);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return view;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* @param {import("./view.js").default} view
|
|
107
|
+
*/
|
|
108
|
+
export function countCollectorRows(view) {
|
|
109
|
+
const collector = view.flowHandle?.collector;
|
|
110
|
+
if (!collector) {
|
|
111
|
+
throw new Error("Expected view to have a collector.");
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
let count = 0;
|
|
115
|
+
for (const datum of collector.getData()) {
|
|
116
|
+
void datum;
|
|
117
|
+
count++;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return count;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* @param {import("./view.js").default} viewRoot
|
|
125
|
+
*/
|
|
126
|
+
function createHierarchySnapshot(viewRoot) {
|
|
127
|
+
const views = viewRoot.getDescendants();
|
|
128
|
+
const viewIndexes = new Map(views.map((view, index) => [view, index]));
|
|
129
|
+
|
|
130
|
+
return views.map((view) => ({
|
|
131
|
+
name: view.name,
|
|
132
|
+
explicitName: view.explicitName,
|
|
133
|
+
defaultName: view.defaultName,
|
|
134
|
+
type: view.constructor.name,
|
|
135
|
+
dataState: view.getDataInitializationState(),
|
|
136
|
+
visibleInSpec: view.isVisibleInSpec(),
|
|
137
|
+
configuredVisible: view.isConfiguredVisible(),
|
|
138
|
+
layoutParent: getViewIndex(viewIndexes, view.layoutParent),
|
|
139
|
+
dataParent: getViewIndex(viewIndexes, view.dataParent),
|
|
140
|
+
children: getLayoutChildren(view).map((child) =>
|
|
141
|
+
getRequiredViewIndex(viewIndexes, child)
|
|
142
|
+
),
|
|
143
|
+
flowHandle: {
|
|
144
|
+
dataSource: Boolean(view.flowHandle?.dataSource),
|
|
145
|
+
collector: Boolean(view.flowHandle?.collector),
|
|
146
|
+
},
|
|
147
|
+
resolutions: createResolutionSnapshot(view, viewIndexes),
|
|
148
|
+
}));
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* @param {Map<import("./view.js").default, number>} viewIndexes
|
|
153
|
+
* @param {import("./view.js").default | null | undefined} view
|
|
154
|
+
*/
|
|
155
|
+
function getViewIndex(viewIndexes, view) {
|
|
156
|
+
return view ? getRequiredViewIndex(viewIndexes, view) : undefined;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* @param {Map<import("./view.js").default, number>} viewIndexes
|
|
161
|
+
* @param {import("./view.js").default} view
|
|
162
|
+
*/
|
|
163
|
+
function getRequiredViewIndex(viewIndexes, view) {
|
|
164
|
+
const index = viewIndexes.get(view);
|
|
165
|
+
if (index === undefined) {
|
|
166
|
+
throw new Error("Expected view to be included in the hierarchy.");
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
return index;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* @param {import("./view.js").default} view
|
|
174
|
+
* @returns {import("./view.js").default[]}
|
|
175
|
+
*/
|
|
176
|
+
function getLayoutChildren(view) {
|
|
177
|
+
const children = /** @type {{ children?: unknown }} */ (view).children;
|
|
178
|
+
return Array.isArray(children)
|
|
179
|
+
? /** @type {import("./view.js").default[]} */ (children)
|
|
180
|
+
: [];
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* @param {import("./view.js").default} view
|
|
185
|
+
* @param {Map<import("./view.js").default, number>} viewIndexes
|
|
186
|
+
*/
|
|
187
|
+
function createResolutionSnapshot(view, viewIndexes) {
|
|
188
|
+
return {
|
|
189
|
+
scale: Object.fromEntries(
|
|
190
|
+
Object.entries(view.resolutions.scale)
|
|
191
|
+
.filter((entry) => entry[1])
|
|
192
|
+
.map(([channel, resolution]) => [
|
|
193
|
+
channel,
|
|
194
|
+
resolution.getOrderedMembers().map((member) => ({
|
|
195
|
+
view: getRequiredViewIndex(viewIndexes, member.view),
|
|
196
|
+
channel: member.channel,
|
|
197
|
+
contributesToDomain: member.contributesToDomain,
|
|
198
|
+
})),
|
|
199
|
+
])
|
|
200
|
+
),
|
|
201
|
+
axis: Object.fromEntries(
|
|
202
|
+
Object.entries(view.resolutions.axis)
|
|
203
|
+
.filter((entry) => entry[1])
|
|
204
|
+
.map(([channel, resolution]) => [
|
|
205
|
+
channel,
|
|
206
|
+
{
|
|
207
|
+
visible: resolution.hasVisibleNonChromeMember(),
|
|
208
|
+
title: resolution.getTitle(),
|
|
209
|
+
},
|
|
210
|
+
])
|
|
211
|
+
),
|
|
212
|
+
legend: Object.fromEntries(
|
|
213
|
+
Object.entries(view.resolutions.legend)
|
|
214
|
+
.filter((entry) => entry[1])
|
|
215
|
+
.map(([channel, resolution]) => [
|
|
216
|
+
channel,
|
|
217
|
+
{
|
|
218
|
+
visible: resolution.hasVisibleNonChromeMember(),
|
|
219
|
+
definitions: resolution
|
|
220
|
+
.getLegendDefs()
|
|
221
|
+
.map((definition) => ({
|
|
222
|
+
view: getRequiredViewIndex(
|
|
223
|
+
viewIndexes,
|
|
224
|
+
definition.view
|
|
225
|
+
),
|
|
226
|
+
channel: definition.channel,
|
|
227
|
+
type: definition.type,
|
|
228
|
+
field: definition.field,
|
|
229
|
+
})),
|
|
230
|
+
},
|
|
231
|
+
])
|
|
232
|
+
),
|
|
233
|
+
};
|
|
234
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {{
|
|
3
|
+
* depth: number,
|
|
4
|
+
* queue: Promise<void>,
|
|
5
|
+
* failed: boolean,
|
|
6
|
+
* error: unknown | undefined,
|
|
7
|
+
* requestedLayoutReflow: boolean,
|
|
8
|
+
* restoreLayoutReflow: () => void
|
|
9
|
+
* }} TransactionState
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Creates the public view hierarchy API for a GenomeSpy instance.
|
|
13
|
+
*
|
|
14
|
+
* @param {{ viewRoot: import("./view.js").default }} genomeSpy
|
|
15
|
+
* @returns {import("../types/embedApi.js").ViewApi}
|
|
16
|
+
*/
|
|
17
|
+
export function createViewMutationApi(genomeSpy: {
|
|
18
|
+
viewRoot: import("./view.js").default;
|
|
19
|
+
}): import("../types/embedApi.js").ViewApi;
|
|
20
|
+
/**
|
|
21
|
+
* Error thrown by the public view mutation API.
|
|
22
|
+
*/
|
|
23
|
+
export class ViewMutationError extends Error {
|
|
24
|
+
/**
|
|
25
|
+
* @param {string} code
|
|
26
|
+
* @param {string} message
|
|
27
|
+
*/
|
|
28
|
+
constructor(code: string, message: string);
|
|
29
|
+
/**
|
|
30
|
+
* Stable error code for programmatic handling.
|
|
31
|
+
*/
|
|
32
|
+
code: string;
|
|
33
|
+
}
|
|
34
|
+
export type TransactionState = {
|
|
35
|
+
depth: number;
|
|
36
|
+
queue: Promise<void>;
|
|
37
|
+
failed: boolean;
|
|
38
|
+
error: unknown | undefined;
|
|
39
|
+
requestedLayoutReflow: boolean;
|
|
40
|
+
restoreLayoutReflow: () => void;
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=viewMutationApi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"viewMutationApi.d.ts","sourceRoot":"","sources":["../../../src/view/viewMutationApi.js"],"names":[],"mappings":"AAkCA;;;;;;;;;GASG;AAEH;;;;;GAKG;AACH,iDAHW;IAAE,QAAQ,EAAE,OAAO,WAAW,EAAE,OAAO,CAAA;CAAE,GACvC,OAAO,sBAAsB,EAAE,OAAO,CAguBlD;AAlwBD;;GAEG;AACH;IACI;;;OAGG;IACH,kBAHW,MAAM,WACN,MAAM,EAUhB;IAJG;;OAEG;IACH,aAAgB;CAEvB;+BAGY;IACR,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IACrB,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,OAAO,GAAG,SAAS,CAAC;IAC3B,qBAAqB,EAAE,OAAO,CAAC;IAC/B,mBAAmB,EAAE,MAAM,IAAI,CAAA;CAChC"}
|