@genome-spy/core 0.73.0 → 0.74.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle/AbortablePromiseCache-3gHJdF3E.js +96 -0
- package/dist/bundle/browser-BTgw5ieH.js +126 -0
- package/dist/bundle/chunk-DmhlhrBa.js +11 -0
- package/dist/bundle/esm-BDFRLEuD.js +1248 -0
- package/dist/bundle/esm-BygJiwh0.js +573 -0
- package/dist/bundle/esm-CGX-qz1d.js +155 -0
- package/dist/bundle/esm-CgfVIRJ-.js +121 -0
- package/dist/bundle/esm-CuMSzCHy.js +298 -0
- package/dist/bundle/esm-DMXpJXM4.js +369 -0
- package/dist/bundle/esm-DQiq2Zhd.js +1426 -0
- package/dist/bundle/esm-DtE8VqAv.js +1015 -0
- package/dist/bundle/esm-sIoQYZ21.js +461 -0
- package/dist/bundle/index.es.js +21071 -25935
- package/dist/bundle/index.js +363 -379
- package/dist/bundle/parquetRead-DG_-F5j5.js +1609 -0
- package/dist/schema.json +13098 -7095
- package/dist/src/config/axisConfig.d.ts +16 -0
- package/dist/src/config/axisConfig.d.ts.map +1 -0
- package/dist/src/config/axisConfig.js +84 -0
- package/dist/src/config/defaultConfig.d.ts +3 -0
- package/dist/src/config/defaultConfig.d.ts.map +1 -0
- package/dist/src/config/defaultConfig.js +38 -0
- package/dist/src/config/defaults/axisDefaults.d.ts +5 -0
- package/dist/src/config/defaults/axisDefaults.d.ts.map +1 -0
- package/dist/src/config/defaults/axisDefaults.js +72 -0
- package/dist/src/config/defaults/markDefaults.d.ts +15 -0
- package/dist/src/config/defaults/markDefaults.d.ts.map +1 -0
- package/dist/src/config/defaults/markDefaults.js +121 -0
- package/dist/src/config/defaults/scaleDefaults.d.ts +5 -0
- package/dist/src/config/defaults/scaleDefaults.d.ts.map +1 -0
- package/dist/src/config/defaults/scaleDefaults.js +18 -0
- package/dist/src/config/defaults/titleDefaults.d.ts +5 -0
- package/dist/src/config/defaults/titleDefaults.d.ts.map +1 -0
- package/dist/src/config/defaults/titleDefaults.js +47 -0
- package/dist/src/config/defaults/viewDefaults.d.ts +3 -0
- package/dist/src/config/defaults/viewDefaults.d.ts.map +1 -0
- package/dist/src/config/defaults/viewDefaults.js +2 -0
- package/dist/src/config/markConfig.d.ts +8 -0
- package/dist/src/config/markConfig.d.ts.map +1 -0
- package/dist/src/config/markConfig.js +27 -0
- package/dist/src/config/mergeConfig.d.ts +8 -0
- package/dist/src/config/mergeConfig.d.ts.map +1 -0
- package/dist/src/config/mergeConfig.js +81 -0
- package/dist/src/config/resolveConfig.d.ts +22 -0
- package/dist/src/config/resolveConfig.d.ts.map +1 -0
- package/dist/src/config/resolveConfig.js +32 -0
- package/dist/src/config/scaleConfig.d.ts +40 -0
- package/dist/src/config/scaleConfig.d.ts.map +1 -0
- package/dist/src/config/scaleConfig.js +220 -0
- package/dist/src/config/styleUtils.d.ts +6 -0
- package/dist/src/config/styleUtils.d.ts.map +1 -0
- package/dist/src/config/styleUtils.js +10 -0
- package/dist/src/config/themes.d.ts +15 -0
- package/dist/src/config/themes.d.ts.map +1 -0
- package/dist/src/config/themes.js +293 -0
- package/dist/src/config/titleConfig.d.ts +12 -0
- package/dist/src/config/titleConfig.d.ts.map +1 -0
- package/dist/src/config/titleConfig.js +42 -0
- package/dist/src/config/viewConfig.d.ts +7 -0
- package/dist/src/config/viewConfig.d.ts.map +1 -0
- package/dist/src/config/viewConfig.js +29 -0
- package/dist/src/data/flowNode.d.ts +22 -1
- package/dist/src/data/flowNode.d.ts.map +1 -1
- package/dist/src/data/flowNode.js +37 -1
- package/dist/src/data/formats/bed.d.ts.map +1 -1
- package/dist/src/data/formats/bed.js +6 -1
- package/dist/src/data/formats/bedpe.d.ts.map +1 -1
- package/dist/src/data/formats/bedpe.js +4 -0
- package/dist/src/data/formats/fasta.d.ts.map +1 -1
- package/dist/src/data/formats/fasta.js +4 -0
- package/dist/src/data/formats/parquet.d.ts.map +1 -1
- package/dist/src/data/formats/parquet.js +4 -0
- package/dist/src/data/sources/dataSourceFactory.d.ts +2 -13
- package/dist/src/data/sources/dataSourceFactory.d.ts.map +1 -1
- package/dist/src/data/sources/dataSourceFactory.js +5 -141
- package/dist/src/data/sources/lazy/axisGenomeSource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/axisGenomeSource.js +11 -0
- package/dist/src/data/sources/lazy/axisTickSource.d.ts +1 -1
- package/dist/src/data/sources/lazy/axisTickSource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/axisTickSource.js +19 -8
- package/dist/src/data/sources/lazy/bamSource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/bamSource.js +11 -0
- package/dist/src/data/sources/lazy/bigBedSource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/bigBedSource.js +12 -1
- package/dist/src/data/sources/lazy/bigWigSource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/bigWigSource.js +11 -0
- package/dist/src/data/sources/lazy/gff3Source.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/gff3Source.js +12 -1
- package/dist/src/data/sources/lazy/indexedFastaSource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/indexedFastaSource.js +11 -0
- package/dist/src/data/sources/lazy/lazyDataSourceRegistry.d.ts +27 -0
- package/dist/src/data/sources/lazy/lazyDataSourceRegistry.d.ts.map +1 -0
- package/dist/src/data/sources/lazy/lazyDataSourceRegistry.js +65 -0
- package/dist/src/data/sources/lazy/registerBuiltInLazySources.d.ts +2 -0
- package/dist/src/data/sources/lazy/registerBuiltInLazySources.d.ts.map +1 -0
- package/dist/src/data/sources/lazy/registerBuiltInLazySources.js +8 -0
- package/dist/src/data/sources/lazy/singleAxisLazySource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/singleAxisLazySource.js +11 -2
- package/dist/src/data/sources/lazy/vcfSource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/vcfSource.js +11 -0
- package/dist/src/data/sources/urlSource.d.ts.map +1 -1
- package/dist/src/data/sources/urlSource.js +5 -2
- package/dist/src/data/transforms/aggregate.d.ts +1 -0
- package/dist/src/data/transforms/aggregate.d.ts.map +1 -1
- package/dist/src/data/transforms/aggregate.js +30 -8
- package/dist/src/data/transforms/aggregateOps.d.ts.map +1 -1
- package/dist/src/data/transforms/aggregateOps.js +12 -1
- package/dist/src/data/transforms/coverage.js +2 -2
- package/dist/src/data/transforms/filter.js +1 -1
- package/dist/src/data/transforms/filterScoredLabels.d.ts +6 -0
- package/dist/src/data/transforms/filterScoredLabels.d.ts.map +1 -1
- package/dist/src/data/transforms/filterScoredLabels.js +9 -0
- package/dist/src/data/transforms/measureText.d.ts +1 -0
- package/dist/src/data/transforms/measureText.d.ts.map +1 -1
- package/dist/src/data/transforms/measureText.js +14 -5
- package/dist/src/data/transforms/pileup.d.ts.map +1 -1
- package/dist/src/data/transforms/pileup.js +1 -2
- package/dist/src/data/transforms/regexFold.d.ts.map +1 -1
- package/dist/src/data/transforms/regexFold.js +0 -1
- package/dist/src/embedFactory.d.ts +13 -0
- package/dist/src/embedFactory.d.ts.map +1 -0
- package/dist/src/embedFactory.js +127 -0
- package/dist/src/encoder/accessor.d.ts +3 -12
- package/dist/src/encoder/accessor.d.ts.map +1 -1
- package/dist/src/encoder/accessor.js +10 -65
- package/dist/src/encoder/encoder.d.ts +51 -8
- package/dist/src/encoder/encoder.d.ts.map +1 -1
- package/dist/src/encoder/encoder.js +179 -55
- package/dist/src/fonts/bmFontManager.js +1 -1
- package/dist/src/full.d.ts +2 -0
- package/dist/src/full.d.ts.map +1 -0
- package/dist/src/full.js +2 -0
- package/dist/src/genome/genome.d.ts +8 -0
- package/dist/src/genome/genome.d.ts.map +1 -1
- package/dist/src/genome/genome.js +16 -2
- package/dist/src/genome/genomeStore.js +1 -1
- package/dist/src/genome/rootGenomeConfig.d.ts.map +1 -1
- package/dist/src/genome/rootGenomeConfig.js +6 -2
- package/dist/src/genome/scaleLocus.d.ts.map +1 -1
- package/dist/src/genome/scaleLocus.js +26 -7
- package/dist/src/genomeSpy/cursorManager.d.ts +69 -0
- package/dist/src/genomeSpy/cursorManager.d.ts.map +1 -0
- package/dist/src/genomeSpy/cursorManager.js +131 -0
- package/dist/src/genomeSpy/headlessBootstrap.d.ts +113 -0
- package/dist/src/genomeSpy/headlessBootstrap.d.ts.map +1 -0
- package/dist/src/genomeSpy/headlessBootstrap.js +246 -0
- package/dist/src/genomeSpy/interactionController.d.ts +5 -0
- package/dist/src/genomeSpy/interactionController.d.ts.map +1 -1
- package/dist/src/genomeSpy/interactionController.js +212 -19
- package/dist/src/genomeSpy/interactionDispatcher.d.ts +50 -0
- package/dist/src/genomeSpy/interactionDispatcher.d.ts.map +1 -0
- package/dist/src/genomeSpy/interactionDispatcher.js +203 -0
- package/dist/src/genomeSpy/viewContextFactory.d.ts +4 -2
- package/dist/src/genomeSpy/viewContextFactory.d.ts.map +1 -1
- package/dist/src/genomeSpy/viewContextFactory.js +12 -4
- package/dist/src/genomeSpy/viewDataInit.d.ts.map +1 -1
- package/dist/src/genomeSpy/viewDataInit.js +7 -3
- package/dist/src/genomeSpy.d.ts +1 -124
- package/dist/src/genomeSpy.d.ts.map +1 -1
- package/dist/src/genomeSpy.js +7 -688
- package/dist/src/genomeSpyBase.d.ts +133 -0
- package/dist/src/genomeSpyBase.d.ts.map +1 -0
- package/dist/src/genomeSpyBase.js +719 -0
- package/dist/src/gl/arrayBuilder.d.ts.map +1 -1
- package/dist/src/gl/arrayBuilder.js +0 -3
- package/dist/src/gl/colorUtils.d.ts.map +1 -1
- package/dist/src/gl/colorUtils.js +3 -0
- package/dist/src/gl/dataToVertices.d.ts.map +1 -1
- package/dist/src/gl/dataToVertices.js +13 -8
- package/dist/src/gl/glslScaleGenerator.d.ts +2 -2
- package/dist/src/gl/glslScaleGenerator.d.ts.map +1 -1
- package/dist/src/gl/glslScaleGenerator.js +5 -7
- package/dist/src/index.d.ts +3 -9
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +5 -114
- package/dist/src/marks/__snapshots__/shaderSnapshot.test.js.snap +4462 -0
- package/dist/src/marks/link.d.ts.map +1 -1
- package/dist/src/marks/link.js +0 -23
- package/dist/src/marks/mark.d.ts +8 -1
- package/dist/src/marks/mark.d.ts.map +1 -1
- package/dist/src/marks/mark.js +61 -20
- package/dist/src/marks/markUtils.d.ts +18 -1
- package/dist/src/marks/markUtils.d.ts.map +1 -1
- package/dist/src/marks/markUtils.js +52 -4
- package/dist/src/marks/point.d.ts.map +1 -1
- package/dist/src/marks/point.js +6 -26
- package/dist/src/marks/rect.d.ts.map +1 -1
- package/dist/src/marks/rect.js +13 -21
- package/dist/src/marks/rule.d.ts +7 -2
- package/dist/src/marks/rule.d.ts.map +1 -1
- package/dist/src/marks/rule.js +125 -16
- package/dist/src/marks/text.d.ts.map +1 -1
- package/dist/src/marks/text.js +5 -47
- package/dist/src/minimal.d.ts +8 -0
- package/dist/src/minimal.d.ts.map +1 -0
- package/dist/src/minimal.js +21 -0
- package/dist/src/paramRuntime/viewParamRuntime.d.ts +19 -0
- package/dist/src/paramRuntime/viewParamRuntime.d.ts.map +1 -1
- package/dist/src/paramRuntime/viewParamRuntime.js +35 -0
- package/dist/src/scale/scale.d.ts.map +1 -1
- package/dist/src/scale/scale.js +13 -7
- package/dist/src/scales/axisResolution.d.ts.map +1 -1
- package/dist/src/scales/axisResolution.js +9 -5
- package/dist/src/scales/domainPlanner.d.ts +28 -8
- package/dist/src/scales/domainPlanner.d.ts.map +1 -1
- package/dist/src/scales/domainPlanner.js +207 -73
- package/dist/src/scales/indexLikeDomainUtils.d.ts +29 -0
- package/dist/src/scales/indexLikeDomainUtils.d.ts.map +1 -0
- package/dist/src/scales/indexLikeDomainUtils.js +67 -0
- package/dist/src/scales/resolutionMemberOrder.d.ts +15 -0
- package/dist/src/scales/resolutionMemberOrder.d.ts.map +1 -0
- package/dist/src/scales/resolutionMemberOrder.js +22 -0
- package/dist/src/scales/scaleInteractionController.d.ts.map +1 -1
- package/dist/src/scales/scaleInteractionController.js +43 -4
- package/dist/src/scales/scalePropsResolver.d.ts +3 -1
- package/dist/src/scales/scalePropsResolver.d.ts.map +1 -1
- package/dist/src/scales/scalePropsResolver.js +83 -6
- package/dist/src/scales/scaleResolution.d.ts +23 -0
- package/dist/src/scales/scaleResolution.d.ts.map +1 -1
- package/dist/src/scales/scaleResolution.js +220 -58
- package/dist/src/scales/scaleResolutionTestUtils.d.ts.map +1 -1
- package/dist/src/scales/scaleResolutionTestUtils.js +6 -2
- package/dist/src/scales/scaleRules.d.ts.map +1 -1
- package/dist/src/scales/scaleRules.js +16 -2
- package/dist/src/scales/selectionDomainUtils.d.ts +30 -0
- package/dist/src/scales/selectionDomainUtils.d.ts.map +1 -1
- package/dist/src/scales/selectionDomainUtils.js +116 -1
- package/dist/src/screenshotHarness.js +3 -4
- package/dist/src/spec/axis.d.ts +41 -30
- package/dist/src/spec/channel.d.ts +15 -9
- package/dist/src/spec/config.d.ts +264 -0
- package/dist/src/spec/data.d.ts +7 -0
- package/dist/src/spec/decoration.d.ts +51 -0
- package/dist/src/spec/exampleFiles.d.ts +12 -0
- package/dist/src/spec/exampleFiles.d.ts.map +1 -0
- package/dist/src/spec/exampleFiles.js +52 -0
- package/dist/src/spec/font.d.ts +1 -1
- package/dist/src/spec/mark.d.ts +97 -13
- package/dist/src/spec/parameter.d.ts +30 -10
- package/dist/src/spec/root.d.ts +14 -0
- package/dist/src/spec/scale.d.ts +18 -13
- package/dist/src/spec/title.d.ts +13 -2
- package/dist/src/spec/tooltip.d.ts +1 -1
- package/dist/src/spec/transform.d.ts +39 -4
- package/dist/src/spec/view.d.ts +67 -19
- package/dist/src/styles/genome-spy.css +55 -55
- 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 +23 -22
- package/dist/src/testSetup.d.ts +2 -0
- package/dist/src/testSetup.d.ts.map +1 -0
- package/dist/src/testSetup.js +5 -0
- package/dist/src/tooltip/dataTooltipHandler.js +8 -2
- package/dist/src/tooltip/tooltipContext.d.ts.map +1 -1
- package/dist/src/tooltip/tooltipContext.js +3 -2
- package/dist/src/types/embedApi.d.ts +7 -0
- package/dist/src/types/encoder.d.ts +17 -15
- package/dist/src/types/scaleResolutionApi.d.ts +20 -0
- package/dist/src/types/viewContext.d.ts +23 -1
- package/dist/src/utils/expression.d.ts +2 -2
- package/dist/src/utils/expression.d.ts.map +1 -1
- package/dist/src/utils/expression.js +63 -8
- package/dist/src/utils/field.d.ts.map +1 -1
- package/dist/src/utils/field.js +0 -1
- package/dist/src/utils/inertia.d.ts.map +1 -1
- package/dist/src/utils/inertia.js +0 -1
- package/dist/src/utils/inputBinding.d.ts +1 -1
- package/dist/src/utils/interaction.d.ts +109 -0
- package/dist/src/utils/interaction.d.ts.map +1 -0
- package/dist/src/utils/interaction.js +200 -0
- package/dist/src/utils/interactionEvent.d.ts +21 -42
- package/dist/src/utils/interactionEvent.d.ts.map +1 -1
- package/dist/src/utils/interactionEvent.js +43 -66
- package/dist/src/utils/kWayMerge.js +1 -1
- package/dist/src/utils/mergeObjects.d.ts.map +1 -1
- package/dist/src/utils/mergeObjects.js +0 -2
- package/dist/src/utils/radixSort.d.ts.map +1 -1
- package/dist/src/utils/radixSort.js +0 -2
- package/dist/src/utils/throttle.d.ts.map +1 -1
- package/dist/src/utils/throttle.js +0 -2
- package/dist/src/utils/ui/tooltip.d.ts +1 -0
- package/dist/src/utils/ui/tooltip.d.ts.map +1 -1
- package/dist/src/utils/ui/tooltip.js +1 -0
- package/dist/src/utils/url.js +1 -1
- package/dist/src/view/axisGridView.d.ts +1 -1
- package/dist/src/view/axisGridView.d.ts.map +1 -1
- package/dist/src/view/axisGridView.js +2 -47
- package/dist/src/view/axisView.d.ts +2 -3
- package/dist/src/view/axisView.d.ts.map +1 -1
- package/dist/src/view/axisView.js +251 -106
- package/dist/src/view/concatView.d.ts +2 -1
- package/dist/src/view/concatView.d.ts.map +1 -1
- package/dist/src/view/concatView.js +4 -2
- package/dist/src/view/containerMutationHelper.d.ts +3 -0
- package/dist/src/view/containerMutationHelper.d.ts.map +1 -1
- package/dist/src/view/containerMutationHelper.js +4 -1
- package/dist/src/view/facetView.d.ts +1 -1
- package/dist/src/view/facetView.js +3 -3
- package/dist/src/view/flowBuilder.js +2 -2
- package/dist/src/view/gridView/gridChild.d.ts +6 -0
- package/dist/src/view/gridView/gridChild.d.ts.map +1 -1
- package/dist/src/view/gridView/gridChild.js +72 -43
- package/dist/src/view/gridView/gridView.d.ts.map +1 -1
- package/dist/src/view/gridView/gridView.js +255 -101
- package/dist/src/view/gridView/keyboardZoomController.d.ts +2 -2
- package/dist/src/view/gridView/keyboardZoomController.d.ts.map +1 -1
- package/dist/src/view/gridView/keyboardZoomController.js +1 -1
- package/dist/src/view/gridView/scrollbar.d.ts.map +1 -1
- package/dist/src/view/gridView/scrollbar.js +4 -2
- package/dist/src/view/gridView/selectionRect.d.ts +4 -0
- package/dist/src/view/gridView/selectionRect.d.ts.map +1 -1
- package/dist/src/view/gridView/selectionRect.js +20 -1
- package/dist/src/view/gridView/separatorView.d.ts +1 -0
- package/dist/src/view/gridView/separatorView.d.ts.map +1 -1
- package/dist/src/view/gridView/separatorView.js +9 -0
- package/dist/src/view/interactionRouting.d.ts +20 -0
- package/dist/src/view/interactionRouting.d.ts.map +1 -0
- package/dist/src/view/interactionRouting.js +53 -0
- package/dist/src/view/layerView.d.ts.map +1 -1
- package/dist/src/view/layerView.js +12 -9
- package/dist/src/view/layout/grid.js +1 -1
- package/dist/src/view/renderingContext/bufferedViewRenderingContext.d.ts.map +1 -1
- package/dist/src/view/renderingContext/bufferedViewRenderingContext.js +0 -2
- package/dist/src/view/testUtils.d.ts +17 -3
- package/dist/src/view/testUtils.d.ts.map +1 -1
- package/dist/src/view/testUtils.js +62 -69
- package/dist/src/view/title.d.ts +8 -1
- package/dist/src/view/title.d.ts.map +1 -1
- package/dist/src/view/title.js +66 -76
- package/dist/src/view/unitView.d.ts +1 -1
- package/dist/src/view/unitView.d.ts.map +1 -1
- package/dist/src/view/unitView.js +67 -17
- package/dist/src/view/view.d.ts +76 -30
- package/dist/src/view/view.d.ts.map +1 -1
- package/dist/src/view/view.js +136 -47
- package/dist/src/view/viewFactory.d.ts +11 -3
- package/dist/src/view/viewFactory.d.ts.map +1 -1
- package/dist/src/view/viewFactory.js +37 -11
- package/dist/src/view/viewUtils.d.ts.map +1 -1
- package/dist/src/view/viewUtils.js +41 -5
- package/dist/src/view/zoom.d.ts +2 -2
- package/dist/src/view/zoom.d.ts.map +1 -1
- package/dist/src/view/zoom.js +21 -23
- package/package.json +18 -10
- package/dist/bundle/AbortablePromiseCache-Dj0vzLnp.js +0 -149
- package/dist/bundle/browser-0iNU5Wit.js +0 -138
- package/dist/bundle/index-BYsZN7b0.js +0 -1597
- package/dist/bundle/index-C3kClAEN.js +0 -1771
- package/dist/bundle/index-C7wOh6y1.js +0 -657
- package/dist/bundle/index-CRaQAuki.js +0 -326
- package/dist/bundle/index-D9v1PCj9.js +0 -507
- package/dist/bundle/index-GDOuv_D5.js +0 -266
- package/dist/bundle/index-Gt44EOIH.js +0 -628
- package/dist/bundle/inflate-GtwLkvSP.js +0 -1048
- package/dist/bundle/parquetRead-BnAGCa4_.js +0 -1663
- package/dist/bundle/unzip-Bac01w6X.js +0 -1492
- package/dist/src/config/scaleDefaults.d.ts +0 -8
- package/dist/src/config/scaleDefaults.d.ts.map +0 -1
- package/dist/src/config/scaleDefaults.js +0 -45
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
isObject,
|
|
7
7
|
isRegExp,
|
|
8
8
|
isString,
|
|
9
|
+
ascending,
|
|
9
10
|
lerp,
|
|
10
11
|
} from "vega-util";
|
|
11
12
|
import { format as d3format } from "d3-format";
|
|
@@ -15,12 +16,63 @@ import linearstep from "./linearstep.js";
|
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* Some bits are adapted from https://github.com/vega/vega/blob/main/packages/vega-functions/src/codegen.js
|
|
19
|
+
*
|
|
20
|
+
* @param {unknown} value
|
|
21
|
+
* @returns {any}
|
|
22
|
+
*/
|
|
23
|
+
function array(value) {
|
|
24
|
+
return isArray(value) || ArrayBuffer.isView(value) ? value : null;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @param {unknown} value
|
|
29
|
+
* @returns {any}
|
|
18
30
|
*/
|
|
31
|
+
function sequence(value) {
|
|
32
|
+
return array(value) || (isString(value) ? value : null);
|
|
33
|
+
}
|
|
34
|
+
|
|
19
35
|
const functionContext = {
|
|
20
36
|
clamp,
|
|
21
37
|
format(/** @type {number} */ value, /** @type {string} */ format) {
|
|
22
38
|
return d3format(format)(value);
|
|
23
39
|
},
|
|
40
|
+
/**
|
|
41
|
+
* Vega's expression docs list these as basic sequence helpers, but the
|
|
42
|
+
* bundled `vega-expression` version does not currently include them in the
|
|
43
|
+
* codegen whitelist. Implement them here so specs can rely on them.
|
|
44
|
+
*/
|
|
45
|
+
join(/** @type {any} */ seq, /** @type {string} */ separator) {
|
|
46
|
+
return array(seq).join(separator);
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
indexof(
|
|
50
|
+
/** @type {any} */ seq,
|
|
51
|
+
/** @type {any} */ value,
|
|
52
|
+
/** @type {number | undefined} */ start
|
|
53
|
+
) {
|
|
54
|
+
return sequence(seq).indexOf(value, start);
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
lastindexof(
|
|
58
|
+
/** @type {any} */ seq,
|
|
59
|
+
/** @type {any} */ value,
|
|
60
|
+
/** @type {number | undefined} */ start
|
|
61
|
+
) {
|
|
62
|
+
return sequence(seq).lastIndexOf(value, start);
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
reverse(/** @type {any} */ seq) {
|
|
66
|
+
return array(seq).slice().reverse();
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
slice(
|
|
70
|
+
/** @type {any} */ seq,
|
|
71
|
+
/** @type {number} */ start,
|
|
72
|
+
/** @type {number | undefined} */ end
|
|
73
|
+
) {
|
|
74
|
+
return sequence(seq).slice(start, end);
|
|
75
|
+
},
|
|
24
76
|
mapHasKey(/** @type {Map<any, any>} */ map, /** @type {any} */ key) {
|
|
25
77
|
return map.has(key);
|
|
26
78
|
},
|
|
@@ -34,7 +86,6 @@ const functionContext = {
|
|
|
34
86
|
isRegExp,
|
|
35
87
|
isString,
|
|
36
88
|
isValid(/** @type {any} */ _) {
|
|
37
|
-
// eslint-disable-next-line no-self-compare
|
|
38
89
|
return _ != null && _ === _;
|
|
39
90
|
},
|
|
40
91
|
lerp,
|
|
@@ -46,6 +97,9 @@ const functionContext = {
|
|
|
46
97
|
) {
|
|
47
98
|
return String(str).replace(pattern, replace);
|
|
48
99
|
},
|
|
100
|
+
sort(/** @type {Array<any>} */ seq) {
|
|
101
|
+
return array(seq).slice().sort(ascending);
|
|
102
|
+
},
|
|
49
103
|
smoothstep,
|
|
50
104
|
};
|
|
51
105
|
|
|
@@ -54,7 +108,6 @@ const functionContext = {
|
|
|
54
108
|
*/
|
|
55
109
|
function buildFunctions(codegen) {
|
|
56
110
|
const fn = functions(codegen);
|
|
57
|
-
// eslint-disable-next-line guard-for-in
|
|
58
111
|
for (const name in functionContext) {
|
|
59
112
|
fn[name] = `this.${name}`;
|
|
60
113
|
}
|
|
@@ -85,7 +138,6 @@ export default function createFunction(expr, globalObject = {}) {
|
|
|
85
138
|
const parsed = parseExpression(expr);
|
|
86
139
|
const generatedCode = cg(parsed);
|
|
87
140
|
|
|
88
|
-
// eslint-disable-next-line no-new-func
|
|
89
141
|
const fn = Function(
|
|
90
142
|
"datum",
|
|
91
143
|
"globalObject",
|
|
@@ -108,7 +160,9 @@ export default function createFunction(expr, globalObject = {}) {
|
|
|
108
160
|
|
|
109
161
|
return exprFunction;
|
|
110
162
|
} catch (e) {
|
|
111
|
-
throw new Error(`Invalid expression: ${expr}, ${e.message}
|
|
163
|
+
throw new Error(`Invalid expression: ${expr}, ${e.message}`, {
|
|
164
|
+
cause: e,
|
|
165
|
+
});
|
|
112
166
|
}
|
|
113
167
|
}
|
|
114
168
|
|
|
@@ -120,14 +174,13 @@ const eventFilterCg = codegenExpression({
|
|
|
120
174
|
|
|
121
175
|
/**
|
|
122
176
|
* @param {string} expr
|
|
123
|
-
* @returns {(event: UIEvent) => boolean}
|
|
177
|
+
* @returns {(event: UIEvent | import("./interactionEvent.js").WheelLikeEvent) => boolean}
|
|
124
178
|
*/
|
|
125
179
|
export function createEventFilterFunction(expr) {
|
|
126
180
|
try {
|
|
127
181
|
const parsed = parseExpression(expr);
|
|
128
182
|
const generatedCode = eventFilterCg(parsed);
|
|
129
183
|
|
|
130
|
-
// eslint-disable-next-line no-new-func
|
|
131
184
|
const fn = Function(
|
|
132
185
|
"event",
|
|
133
186
|
"globalObject",
|
|
@@ -141,10 +194,12 @@ export function createEventFilterFunction(expr) {
|
|
|
141
194
|
}`
|
|
142
195
|
);
|
|
143
196
|
|
|
144
|
-
return /** @type {(event: UIEvent) => boolean} */ (
|
|
197
|
+
return /** @type {(event: UIEvent | import("./interactionEvent.js").WheelLikeEvent) => boolean} */ (
|
|
145
198
|
/** @type {any} */ (fn)
|
|
146
199
|
);
|
|
147
200
|
} catch (e) {
|
|
148
|
-
throw new Error(`Invalid expression: ${expr}, ${e.message}
|
|
201
|
+
throw new Error(`Invalid expression: ${expr}, ${e.message}`, {
|
|
202
|
+
cause: e,
|
|
203
|
+
});
|
|
149
204
|
}
|
|
150
205
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../../../src/utils/field.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AACH,iCAHW,MAAM,SACN,MAAM,
|
|
1
|
+
{"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../../../src/utils/field.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AACH,iCAHW,MAAM,SACN,MAAM,uCA+BhB"}
|
package/dist/src/utils/field.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inertia.d.ts","sourceRoot":"","sources":["../../../src/utils/inertia.js"],"names":[],"mappings":"AAwEA;;;GAGG;AACH,kCAFa,CAAC,SADH,CAAC,
|
|
1
|
+
{"version":3,"file":"inertia.d.ts","sourceRoot":"","sources":["../../../src/utils/inertia.js"],"names":[],"mappings":"AAwEA;;;GAGG;AACH,kCAFa,CAAC,SADH,CAAC,iCAmBX;AAxFD;;GAEG;AACH;IACI;;;OAGG;IACH,sBAHW,OAAO,eAAe,EAAE,OAAO,aAC/B,OAAO,EA0BjB;IAvBG,0CAAwB;IACxB,kBAA0B;IAG1B,oBAAsB;IAEtB,oCAAoC;IACpC,UADW,CAAS,IAAM,EAAN,MAAM,KAAE,IAAI,CACZ;IAEpB,oBAAoB;IACpB,kBAAkB;IAElB;;;;MAUC;IAGL,eAQC;IAED;;;;OAIG;IACH,mBAHW,MAAM,YACN,CAAS,IAAM,EAAN,MAAM,KAAE,IAAI,QAkB/B;CACJ"}
|
|
@@ -80,7 +80,6 @@ export function makeEventTemplate(event) {
|
|
|
80
80
|
const acceptedTypes = ["string", "number", "boolean"];
|
|
81
81
|
const rejectedProps = ["wheelDelta", "wheelDeltaX", "wheelDeltaY"];
|
|
82
82
|
|
|
83
|
-
// eslint-disable-next-line guard-for-in
|
|
84
83
|
for (const key in event) {
|
|
85
84
|
const k = /** @type {keyof T} */ (key);
|
|
86
85
|
if (
|
|
@@ -9,5 +9,5 @@ export default function createBindingInputs(mediator: {
|
|
|
9
9
|
paramConfigs: ReadonlyMap<string, import("../spec/parameter.js").Parameter>;
|
|
10
10
|
setValue: (name: string, value: any) => void;
|
|
11
11
|
getValue: (name: string) => any;
|
|
12
|
-
}): import("lit-html").TemplateResult<
|
|
12
|
+
}): import("lit-html").TemplateResult<1 | 2 | 3>[];
|
|
13
13
|
//# sourceMappingURL=inputBinding.d.ts.map
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal event object used by GenomeSpy's canvas interaction pipeline.
|
|
3
|
+
*
|
|
4
|
+
* Interaction is deliberately smaller than DOM Event. It models the pieces
|
|
5
|
+
* that GenomeSpy needs for hierarchical pointer handling:
|
|
6
|
+
* - `point` is always in canvas coordinates
|
|
7
|
+
* - `uiEvent` is the original native or synthesized low-level event
|
|
8
|
+
* - `target` is the resolved deepest view target after propagation
|
|
9
|
+
* - `currentTarget` and `relatedTarget` are used by synthesized
|
|
10
|
+
* `mouseenter` / `mouseleave` delivery
|
|
11
|
+
*
|
|
12
|
+
* Runtime flow:
|
|
13
|
+
* 1. `InteractionController` converts native canvas events into Interaction
|
|
14
|
+
* instances and asks `InteractionDispatcher` to route them.
|
|
15
|
+
* 2. Container views route the interaction through the view hierarchy and may
|
|
16
|
+
* add policy on top, such as wheel claiming, zoom handling, or scrollbar
|
|
17
|
+
* dispatch.
|
|
18
|
+
* 3. `InteractionDispatcher` compares successive hover paths and synthesizes
|
|
19
|
+
* subtree-level `mouseenter` / `mouseleave` transitions.
|
|
20
|
+
*
|
|
21
|
+
* Differences from the DOM model:
|
|
22
|
+
* - propagation is view-driven rather than browser-driven
|
|
23
|
+
* - only the event types used by GenomeSpy are represented
|
|
24
|
+
* - there is only `stopPropagation()`, not stop-immediate semantics
|
|
25
|
+
* - mark picking is not encoded into `target`; mark hover lives separately in
|
|
26
|
+
* `InteractionController`
|
|
27
|
+
*
|
|
28
|
+
* Mouse and wheel helpers:
|
|
29
|
+
* - `mouseEvent` exposes the underlying MouseEvent for imperative handlers
|
|
30
|
+
* - `proxiedMouseEvent` exposes only primitive properties for places that
|
|
31
|
+
* must not retain live DOM objects
|
|
32
|
+
* - `wheelEvent` exposes the underlying wheel-like event, optionally with
|
|
33
|
+
* temporary delta overrides applied by `setWheelDeltas()`
|
|
34
|
+
*
|
|
35
|
+
* Special event types:
|
|
36
|
+
* - `wheelclaimprobe` asks pointed views whether they would consume wheel,
|
|
37
|
+
* without running the actual wheel side effects yet
|
|
38
|
+
* - `touchgesture` is a synthesized high-level gesture event derived from
|
|
39
|
+
* touch input
|
|
40
|
+
*/
|
|
41
|
+
export default class Interaction {
|
|
42
|
+
/**
|
|
43
|
+
* @param {import("../view/layout/point.js").default} point
|
|
44
|
+
* @param {import("./interactionEvent.js").InteractionUiEvent} uiEvent
|
|
45
|
+
* @param {string} [type]
|
|
46
|
+
*/
|
|
47
|
+
constructor(point: import("../view/layout/point.js").default, uiEvent: import("./interactionEvent.js").InteractionUiEvent, type?: string);
|
|
48
|
+
point: import("../view/layout/point.js").default;
|
|
49
|
+
stopped: boolean;
|
|
50
|
+
wheelClaimed: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* The target is known only after the interaction has been resolved
|
|
53
|
+
* against the view hierarchy.
|
|
54
|
+
*
|
|
55
|
+
* @type {import("../view/view.js").default | undefined}
|
|
56
|
+
*/
|
|
57
|
+
target: import("../view/view.js").default | undefined;
|
|
58
|
+
/**
|
|
59
|
+
* Reserved for the new interaction dispatcher.
|
|
60
|
+
*
|
|
61
|
+
* @type {import("../view/view.js").default | undefined}
|
|
62
|
+
*/
|
|
63
|
+
currentTarget: import("../view/view.js").default | undefined;
|
|
64
|
+
/**
|
|
65
|
+
* Reserved for enter/leave-style transition events.
|
|
66
|
+
*
|
|
67
|
+
* @type {import("../view/view.js").default | undefined}
|
|
68
|
+
*/
|
|
69
|
+
relatedTarget: import("../view/view.js").default | undefined;
|
|
70
|
+
set uiEvent(value: import("./interactionEvent.js").InteractionUiEvent);
|
|
71
|
+
get uiEvent(): import("./interactionEvent.js").InteractionUiEvent;
|
|
72
|
+
stopPropagation(): void;
|
|
73
|
+
/**
|
|
74
|
+
* Marks the current wheel interaction as claimed by the pointed view
|
|
75
|
+
* hierarchy.
|
|
76
|
+
*
|
|
77
|
+
* This is used both for real wheel events and for the synthetic
|
|
78
|
+
* `wheelclaimprobe` preflight. Controllers use the claimed state to decide
|
|
79
|
+
* whether the native wheel event should call `preventDefault()`.
|
|
80
|
+
*/
|
|
81
|
+
claimWheel(): void;
|
|
82
|
+
/**
|
|
83
|
+
* @param {number} deltaX
|
|
84
|
+
* @param {number} deltaY
|
|
85
|
+
*/
|
|
86
|
+
setWheelDeltas(deltaX: number, deltaY: number): void;
|
|
87
|
+
set type(value: string);
|
|
88
|
+
get type(): string;
|
|
89
|
+
/**
|
|
90
|
+
* Returns a primitive-only proxy of the underlying MouseEvent.
|
|
91
|
+
*
|
|
92
|
+
* This is intended for places such as expression evaluation, where the
|
|
93
|
+
* caller needs scalar event fields but should not receive a live DOM event
|
|
94
|
+
* object with methods, nested objects, or browser-specific prototypes.
|
|
95
|
+
*/
|
|
96
|
+
get proxiedMouseEvent(): MouseEvent;
|
|
97
|
+
get mouseEvent(): MouseEvent;
|
|
98
|
+
/**
|
|
99
|
+
* Returns a wheel-like event with any temporary delta overrides applied.
|
|
100
|
+
*
|
|
101
|
+
* The wrapped event keeps the original event identity for all properties
|
|
102
|
+
* except `deltaX` and `deltaY`, which allows intermediate handlers to
|
|
103
|
+
* consume part of the wheel interaction while keeping downstream wheel
|
|
104
|
+
* handling on the same event instance.
|
|
105
|
+
*/
|
|
106
|
+
get wheelEvent(): Pick<WheelEvent, "type" | "deltaX" | "deltaY" | "deltaMode" | "preventDefault" | "ctrlKey">;
|
|
107
|
+
#private;
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=interaction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interaction.d.ts","sourceRoot":"","sources":["../../../src/utils/interaction.js"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH;IAOI;;;;OAIG;IACH,mBAJW,OAAO,yBAAyB,EAAE,OAAO,WACzC,OAAO,uBAAuB,EAAE,kBAAkB,SAClD,MAAM,EA8BhB;IA3BG,iDAAkB;IAElB,iBAAoB;IACpB,sBAAyB;IAGzB;;;;;OAKG;IACH,QAFU,OAAO,iBAAiB,EAAE,OAAO,GAAG,SAAS,CAEhC;IAEvB;;;;OAIG;IACH,eAFU,OAAO,iBAAiB,EAAE,OAAO,GAAG,SAAS,CAEzB;IAE9B;;;;OAIG;IACH,eAFU,OAAO,iBAAiB,EAAE,OAAO,GAAG,SAAS,CAEzB;IAclC,uEAKC;IATD,kEAEC;IASD,wBAEC;IAED;;;;;;;OAOG;IACH,mBAMC;IAED;;;OAGG;IACH,uBAHW,MAAM,UACN,MAAM,QAShB;IAMD,wBAEC;IAND,mBAEC;IAMD;;;;;;OAMG;IACH,oCAQC;IAED,6BAMC;IAED;;;;;;;OAOG;IACH,8GAkBC;;CACJ"}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createPrimitiveEventProxy,
|
|
3
|
+
isWheelEvent,
|
|
4
|
+
overrideWheelEventDeltas,
|
|
5
|
+
} from "./interactionEvent.js";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Internal event object used by GenomeSpy's canvas interaction pipeline.
|
|
9
|
+
*
|
|
10
|
+
* Interaction is deliberately smaller than DOM Event. It models the pieces
|
|
11
|
+
* that GenomeSpy needs for hierarchical pointer handling:
|
|
12
|
+
* - `point` is always in canvas coordinates
|
|
13
|
+
* - `uiEvent` is the original native or synthesized low-level event
|
|
14
|
+
* - `target` is the resolved deepest view target after propagation
|
|
15
|
+
* - `currentTarget` and `relatedTarget` are used by synthesized
|
|
16
|
+
* `mouseenter` / `mouseleave` delivery
|
|
17
|
+
*
|
|
18
|
+
* Runtime flow:
|
|
19
|
+
* 1. `InteractionController` converts native canvas events into Interaction
|
|
20
|
+
* instances and asks `InteractionDispatcher` to route them.
|
|
21
|
+
* 2. Container views route the interaction through the view hierarchy and may
|
|
22
|
+
* add policy on top, such as wheel claiming, zoom handling, or scrollbar
|
|
23
|
+
* dispatch.
|
|
24
|
+
* 3. `InteractionDispatcher` compares successive hover paths and synthesizes
|
|
25
|
+
* subtree-level `mouseenter` / `mouseleave` transitions.
|
|
26
|
+
*
|
|
27
|
+
* Differences from the DOM model:
|
|
28
|
+
* - propagation is view-driven rather than browser-driven
|
|
29
|
+
* - only the event types used by GenomeSpy are represented
|
|
30
|
+
* - there is only `stopPropagation()`, not stop-immediate semantics
|
|
31
|
+
* - mark picking is not encoded into `target`; mark hover lives separately in
|
|
32
|
+
* `InteractionController`
|
|
33
|
+
*
|
|
34
|
+
* Mouse and wheel helpers:
|
|
35
|
+
* - `mouseEvent` exposes the underlying MouseEvent for imperative handlers
|
|
36
|
+
* - `proxiedMouseEvent` exposes only primitive properties for places that
|
|
37
|
+
* must not retain live DOM objects
|
|
38
|
+
* - `wheelEvent` exposes the underlying wheel-like event, optionally with
|
|
39
|
+
* temporary delta overrides applied by `setWheelDeltas()`
|
|
40
|
+
*
|
|
41
|
+
* Special event types:
|
|
42
|
+
* - `wheelclaimprobe` asks pointed views whether they would consume wheel,
|
|
43
|
+
* without running the actual wheel side effects yet
|
|
44
|
+
* - `touchgesture` is a synthesized high-level gesture event derived from
|
|
45
|
+
* touch input
|
|
46
|
+
*/
|
|
47
|
+
export default class Interaction {
|
|
48
|
+
/** @type {MouseEvent} */
|
|
49
|
+
#primitiveMouseEventProxy;
|
|
50
|
+
|
|
51
|
+
/** @type {import("./interactionEvent.js").WheelLikeEvent | undefined} */
|
|
52
|
+
#wheelEventProxy;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* @param {import("../view/layout/point.js").default} point
|
|
56
|
+
* @param {import("./interactionEvent.js").InteractionUiEvent} uiEvent
|
|
57
|
+
* @param {string} [type]
|
|
58
|
+
*/
|
|
59
|
+
constructor(point, uiEvent, type) {
|
|
60
|
+
this.point = point;
|
|
61
|
+
this.#uiEvent = uiEvent;
|
|
62
|
+
this.stopped = false;
|
|
63
|
+
this.wheelClaimed = false;
|
|
64
|
+
this.#typeOverride = type;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* The target is known only after the interaction has been resolved
|
|
68
|
+
* against the view hierarchy.
|
|
69
|
+
*
|
|
70
|
+
* @type {import("../view/view.js").default | undefined}
|
|
71
|
+
*/
|
|
72
|
+
this.target = undefined;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Reserved for the new interaction dispatcher.
|
|
76
|
+
*
|
|
77
|
+
* @type {import("../view/view.js").default | undefined}
|
|
78
|
+
*/
|
|
79
|
+
this.currentTarget = undefined;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Reserved for enter/leave-style transition events.
|
|
83
|
+
*
|
|
84
|
+
* @type {import("../view/view.js").default | undefined}
|
|
85
|
+
*/
|
|
86
|
+
this.relatedTarget = undefined;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** @type {import("./interactionEvent.js").InteractionUiEvent} */
|
|
90
|
+
#uiEvent;
|
|
91
|
+
/** @type {string | undefined} */
|
|
92
|
+
#typeOverride;
|
|
93
|
+
/** @type {{ deltaX: number, deltaY: number } | undefined} */
|
|
94
|
+
#wheelDeltaOverride;
|
|
95
|
+
|
|
96
|
+
get uiEvent() {
|
|
97
|
+
return this.#uiEvent;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
set uiEvent(value) {
|
|
101
|
+
this.#uiEvent = value;
|
|
102
|
+
this.#primitiveMouseEventProxy = undefined;
|
|
103
|
+
this.#wheelEventProxy = undefined;
|
|
104
|
+
this.#wheelDeltaOverride = undefined;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
stopPropagation() {
|
|
108
|
+
this.stopped = true;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Marks the current wheel interaction as claimed by the pointed view
|
|
113
|
+
* hierarchy.
|
|
114
|
+
*
|
|
115
|
+
* This is used both for real wheel events and for the synthetic
|
|
116
|
+
* `wheelclaimprobe` preflight. Controllers use the claimed state to decide
|
|
117
|
+
* whether the native wheel event should call `preventDefault()`.
|
|
118
|
+
*/
|
|
119
|
+
claimWheel() {
|
|
120
|
+
if (this.type !== "wheel" && this.type !== "wheelclaimprobe") {
|
|
121
|
+
throw new Error("Can claim wheel only for wheel events!");
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
this.wheelClaimed = true;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* @param {number} deltaX
|
|
129
|
+
* @param {number} deltaY
|
|
130
|
+
*/
|
|
131
|
+
setWheelDeltas(deltaX, deltaY) {
|
|
132
|
+
if (!isWheelEvent(this.uiEvent)) {
|
|
133
|
+
throw new Error("Not a WheelEvent!");
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
this.#wheelDeltaOverride = { deltaX, deltaY };
|
|
137
|
+
this.#wheelEventProxy = undefined;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
get type() {
|
|
141
|
+
return this.#typeOverride ?? this.uiEvent.type;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
set type(value) {
|
|
145
|
+
this.#typeOverride = value;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Returns a primitive-only proxy of the underlying MouseEvent.
|
|
150
|
+
*
|
|
151
|
+
* This is intended for places such as expression evaluation, where the
|
|
152
|
+
* caller needs scalar event fields but should not receive a live DOM event
|
|
153
|
+
* object with methods, nested objects, or browser-specific prototypes.
|
|
154
|
+
*/
|
|
155
|
+
get proxiedMouseEvent() {
|
|
156
|
+
if (!this.#primitiveMouseEventProxy) {
|
|
157
|
+
this.#primitiveMouseEventProxy = createPrimitiveEventProxy(
|
|
158
|
+
this.mouseEvent
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
return this.#primitiveMouseEventProxy;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
get mouseEvent() {
|
|
166
|
+
if (this.uiEvent instanceof MouseEvent) {
|
|
167
|
+
return this.uiEvent;
|
|
168
|
+
} else {
|
|
169
|
+
throw new Error("Not a MouseEvent!");
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Returns a wheel-like event with any temporary delta overrides applied.
|
|
175
|
+
*
|
|
176
|
+
* The wrapped event keeps the original event identity for all properties
|
|
177
|
+
* except `deltaX` and `deltaY`, which allows intermediate handlers to
|
|
178
|
+
* consume part of the wheel interaction while keeping downstream wheel
|
|
179
|
+
* handling on the same event instance.
|
|
180
|
+
*/
|
|
181
|
+
get wheelEvent() {
|
|
182
|
+
if (!isWheelEvent(this.uiEvent)) {
|
|
183
|
+
throw new Error("Not a WheelEvent!");
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
if (!this.#wheelDeltaOverride) {
|
|
187
|
+
return this.uiEvent;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
if (!this.#wheelEventProxy) {
|
|
191
|
+
this.#wheelEventProxy = overrideWheelEventDeltas(
|
|
192
|
+
this.uiEvent,
|
|
193
|
+
this.#wheelDeltaOverride.deltaX,
|
|
194
|
+
this.#wheelDeltaOverride.deltaY
|
|
195
|
+
);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
return this.#wheelEventProxy;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
@@ -17,13 +17,31 @@
|
|
|
17
17
|
* @prop {"wheelclaimprobe"} type
|
|
18
18
|
*/
|
|
19
19
|
/**
|
|
20
|
-
* @typedef {
|
|
20
|
+
* @typedef {Pick<
|
|
21
|
+
* WheelEvent,
|
|
22
|
+
* "type" | "deltaX" | "deltaY" | "deltaMode" | "preventDefault" | "ctrlKey"
|
|
23
|
+
* >} WheelLikeEvent
|
|
24
|
+
*/
|
|
25
|
+
/**
|
|
26
|
+
* @typedef {UIEvent | WheelLikeEvent | TouchGestureEvent | WheelClaimProbeEvent} InteractionUiEvent
|
|
21
27
|
*/
|
|
22
28
|
/**
|
|
23
29
|
* @param {unknown} eventLike
|
|
24
30
|
* @returns {eventLike is TouchGestureEvent}
|
|
25
31
|
*/
|
|
26
32
|
export function isTouchGestureEvent(eventLike: unknown): eventLike is TouchGestureEvent;
|
|
33
|
+
/**
|
|
34
|
+
* @param {unknown} eventLike
|
|
35
|
+
* @returns {eventLike is WheelLikeEvent}
|
|
36
|
+
*/
|
|
37
|
+
export function isWheelEvent(eventLike: unknown): eventLike is WheelLikeEvent;
|
|
38
|
+
/**
|
|
39
|
+
* @param {WheelLikeEvent} wheelEvent
|
|
40
|
+
* @param {number} deltaX
|
|
41
|
+
* @param {number} deltaY
|
|
42
|
+
* @returns {WheelLikeEvent}
|
|
43
|
+
*/
|
|
44
|
+
export function overrideWheelEventDeltas(wheelEvent: WheelLikeEvent, deltaX: number, deltaY: number): WheelLikeEvent;
|
|
27
45
|
/**
|
|
28
46
|
* Create a safe proxy for an event-like object that exposes only primitive
|
|
29
47
|
* (string, number, boolean, bigint, symbol, undefined) properties and null.
|
|
@@ -33,46 +51,6 @@ export function isTouchGestureEvent(eventLike: unknown): eventLike is TouchGestu
|
|
|
33
51
|
* @template T
|
|
34
52
|
*/
|
|
35
53
|
export function createPrimitiveEventProxy<T>(target: T): T;
|
|
36
|
-
/**
|
|
37
|
-
* This class wraps a MouseEvent (or similar) and allows for
|
|
38
|
-
* its propagation through the view hierarchy in a similar manner
|
|
39
|
-
* as in the DOM.
|
|
40
|
-
*/
|
|
41
|
-
export default class InteractionEvent {
|
|
42
|
-
/**
|
|
43
|
-
* @param {import("../view/layout/point.js").default} point Event coordinates
|
|
44
|
-
* inside the visualization canvas.
|
|
45
|
-
* @param {InteractionUiEvent} uiEvent The event to be wrapped
|
|
46
|
-
*/
|
|
47
|
-
constructor(point: import("../view/layout/point.js").default, uiEvent: InteractionUiEvent);
|
|
48
|
-
point: import("../view/layout/point.js").default;
|
|
49
|
-
uiEvent: InteractionUiEvent;
|
|
50
|
-
stopped: boolean;
|
|
51
|
-
wheelClaimed: boolean;
|
|
52
|
-
/**
|
|
53
|
-
* The target is known only in the bubbling phase
|
|
54
|
-
*
|
|
55
|
-
* @type {import("../view/view.js").default}
|
|
56
|
-
*/
|
|
57
|
-
target: import("../view/view.js").default;
|
|
58
|
-
stopPropagation(): void;
|
|
59
|
-
/**
|
|
60
|
-
* Marks the event as wheel-owned by the current interaction path.
|
|
61
|
-
* This is used by native wheel probes to decide preventDefault timing.
|
|
62
|
-
*/
|
|
63
|
-
claimWheel(): void;
|
|
64
|
-
/**
|
|
65
|
-
* The event type string of the underlying UI event (e.g. "click", "keydown").
|
|
66
|
-
*
|
|
67
|
-
* This getter proxies and returns the `type` property from the internal `UIEvent` instance (`this.uiEvent`).
|
|
68
|
-
*
|
|
69
|
-
* @returns {string} The UI event type.
|
|
70
|
-
*/
|
|
71
|
-
get type(): string;
|
|
72
|
-
get proxiedMouseEvent(): MouseEvent;
|
|
73
|
-
get mouseEvent(): MouseEvent;
|
|
74
|
-
#private;
|
|
75
|
-
}
|
|
76
54
|
export type TouchGestureEvent = {
|
|
77
55
|
type: "touchgesture";
|
|
78
56
|
phase: "move" | "end";
|
|
@@ -90,5 +68,6 @@ export type TouchGestureEvent = {
|
|
|
90
68
|
export type WheelClaimProbeEvent = {
|
|
91
69
|
type: "wheelclaimprobe";
|
|
92
70
|
};
|
|
93
|
-
export type
|
|
71
|
+
export type WheelLikeEvent = Pick<WheelEvent, "type" | "deltaX" | "deltaY" | "deltaMode" | "preventDefault" | "ctrlKey">;
|
|
72
|
+
export type InteractionUiEvent = UIEvent | WheelLikeEvent | TouchGestureEvent | WheelClaimProbeEvent;
|
|
94
73
|
//# sourceMappingURL=interactionEvent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactionEvent.d.ts","sourceRoot":"","sources":["../../../src/utils/interactionEvent.js"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH;;;;;;;GAOG;AAEH;;GAEG;AAEH;;;GAGG;AACH,+CAHW,OAAO,GACL,SAAS,IAAI,iBAAiB,CAoB1C;
|
|
1
|
+
{"version":3,"file":"interactionEvent.d.ts","sourceRoot":"","sources":["../../../src/utils/interactionEvent.js"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH;;;;;;;GAOG;AAEH;;;;;GAKG;AAEH;;GAEG;AAEH;;;GAGG;AACH,+CAHW,OAAO,GACL,SAAS,IAAI,iBAAiB,CAoB1C;AAED;;;GAGG;AACH,wCAHW,OAAO,GACL,SAAS,IAAI,cAAc,CAmBvC;AAED;;;;;GAKG;AACH,qDALW,cAAc,UACd,MAAM,UACN,MAAM,GACJ,cAAc,CAe1B;AAED;;;;;;;GAOG;AACH,0CAFa,CAAC,UAFH,CAAC,GACC,CAAC,CA0Eb;;UAhLS,cAAc;WACd,MAAM,GAAG,KAAK;kBACd,CAAC,GAAG,CAAC;YACL,MAAM;YACN,MAAM;YACN,MAAM;qBACN,MAAM,IAAI;;;;;;;;UASV,iBAAiB;;6BAId,IAAI,CACT,UAAU,EACjB,MAAa,GAAG,QAAQ,GAAG,QAAQ,GAAG,WAAW,GAAG,gBAAgB,GAAG,SAAS,CAC7E;iCAIS,OAAO,GAAG,cAAc,GAAG,iBAAiB,GAAG,oBAAoB"}
|