@genome-spy/core 0.36.1 → 0.37.1
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/README.md +1 -0
- package/dist/{index.es.js → bundle/index.es.js} +2253 -2115
- package/dist/{index.js → bundle/index.js} +180 -44
- package/dist/src/data/collector.d.ts +36 -0
- package/dist/src/data/collector.d.ts.map +1 -0
- package/dist/src/data/collector.js +184 -0
- package/dist/src/data/collector.test.js +84 -0
- package/dist/src/data/dataFlow.d.ts +65 -0
- package/dist/src/data/dataFlow.d.ts.map +1 -0
- package/dist/src/data/dataFlow.js +142 -0
- package/dist/src/data/dataFlow.test.js +5 -0
- package/dist/src/data/facetNode.d.ts +17 -0
- package/dist/src/data/facetNode.d.ts.map +1 -0
- package/dist/src/data/facetNode.js +17 -0
- package/dist/src/data/flow.test.js +72 -0
- package/dist/src/data/flowNode.d.ts +136 -0
- package/dist/src/data/flowNode.d.ts.map +1 -0
- package/dist/src/data/flowNode.js +286 -0
- package/dist/src/data/flowNode.test.js +50 -0
- package/dist/src/data/flowOptimizer.d.ts +27 -0
- package/dist/src/data/flowOptimizer.d.ts.map +1 -0
- package/dist/src/data/flowOptimizer.js +133 -0
- package/dist/src/data/flowOptimizer.test.js +193 -0
- package/dist/src/data/flowTestUtils.d.ts +30 -0
- package/dist/src/data/flowTestUtils.d.ts.map +1 -0
- package/dist/src/data/flowTestUtils.js +63 -0
- package/dist/src/data/formats/fasta.d.ts +20 -0
- package/dist/src/data/formats/fasta.d.ts.map +1 -0
- package/dist/src/data/formats/fasta.js +32 -0
- package/dist/src/data/formats/fasta.test.js +27 -0
- package/dist/src/data/sources/dataSource.d.ts +12 -0
- package/dist/src/data/sources/dataSource.d.ts.map +1 -0
- package/dist/src/data/sources/dataSource.js +25 -0
- package/dist/src/data/sources/dataSourceFactory.d.ts +16 -0
- package/dist/src/data/sources/dataSourceFactory.d.ts.map +1 -0
- package/dist/src/data/sources/dataSourceFactory.js +127 -0
- package/dist/src/data/sources/dataUtils.d.ts +50 -0
- package/dist/src/data/sources/dataUtils.d.ts.map +1 -0
- package/dist/src/data/sources/dataUtils.js +83 -0
- package/dist/src/data/sources/dynamic/README.md +3 -0
- package/dist/src/data/sources/dynamic/axisGenomeSource.d.ts +13 -0
- package/dist/src/data/sources/dynamic/axisGenomeSource.d.ts.map +1 -0
- package/dist/src/data/sources/dynamic/axisGenomeSource.js +19 -0
- package/dist/src/data/sources/dynamic/axisTickSource.d.ts +18 -0
- package/dist/src/data/sources/dynamic/axisTickSource.d.ts.map +1 -0
- package/dist/src/data/sources/dynamic/axisTickSource.js +73 -0
- package/dist/src/data/sources/dynamic/bamSource.d.ts +46 -0
- package/dist/src/data/sources/dynamic/bamSource.d.ts.map +1 -0
- package/dist/src/data/sources/dynamic/bamSource.js +115 -0
- package/dist/src/data/sources/dynamic/bigBedSource.d.ts +51 -0
- package/dist/src/data/sources/dynamic/bigBedSource.d.ts.map +1 -0
- package/dist/src/data/sources/dynamic/bigBedSource.js +128 -0
- package/dist/src/data/sources/dynamic/bigWigSource.d.ts +58 -0
- package/dist/src/data/sources/dynamic/bigWigSource.d.ts.map +1 -0
- package/dist/src/data/sources/dynamic/bigWigSource.js +166 -0
- package/dist/src/data/sources/dynamic/gff3Source.d.ts +8 -0
- package/dist/src/data/sources/dynamic/gff3Source.d.ts.map +1 -0
- package/dist/src/data/sources/dynamic/gff3Source.js +19 -0
- package/dist/src/data/sources/dynamic/indexedFastaSource.d.ts +30 -0
- package/dist/src/data/sources/dynamic/indexedFastaSource.d.ts.map +1 -0
- package/dist/src/data/sources/dynamic/indexedFastaSource.js +86 -0
- package/dist/src/data/sources/dynamic/singleAxisLazySource.d.ts +42 -0
- package/dist/src/data/sources/dynamic/singleAxisLazySource.d.ts.map +1 -0
- package/dist/src/data/sources/dynamic/singleAxisLazySource.js +129 -0
- package/dist/src/data/sources/dynamic/tabixSource.d.ts +54 -0
- package/dist/src/data/sources/dynamic/tabixSource.d.ts.map +1 -0
- package/dist/src/data/sources/dynamic/tabixSource.js +140 -0
- package/dist/src/data/sources/dynamic/windowedMixin.d.ts +32 -0
- package/dist/src/data/sources/dynamic/windowedMixin.d.ts.map +1 -0
- package/dist/src/data/sources/dynamic/windowedMixin.js +53 -0
- package/dist/src/data/sources/inlineSource.d.ts +16 -0
- package/dist/src/data/sources/inlineSource.d.ts.map +1 -0
- package/dist/src/data/sources/inlineSource.js +68 -0
- package/dist/src/data/sources/inlineSource.test.js +56 -0
- package/dist/src/data/sources/namedSource.d.ts +25 -0
- package/dist/src/data/sources/namedSource.d.ts.map +1 -0
- package/dist/src/data/sources/namedSource.js +80 -0
- package/dist/src/data/sources/sequenceSource.d.ts +17 -0
- package/dist/src/data/sources/sequenceSource.d.ts.map +1 -0
- package/dist/src/data/sources/sequenceSource.js +47 -0
- package/dist/src/data/sources/sequenceSource.test.js +46 -0
- package/dist/src/data/sources/urlSource.d.ts +16 -0
- package/dist/src/data/sources/urlSource.d.ts.map +1 -0
- package/dist/src/data/sources/urlSource.js +74 -0
- package/dist/src/data/transforms/aggregate.d.ts +18 -0
- package/dist/src/data/transforms/aggregate.d.ts.map +1 -0
- package/dist/src/data/transforms/aggregate.js +67 -0
- package/dist/src/data/transforms/clone.d.ts +15 -0
- package/dist/src/data/transforms/clone.d.ts.map +1 -0
- package/dist/src/data/transforms/clone.js +40 -0
- package/dist/src/data/transforms/clone.test.js +11 -0
- package/dist/src/data/transforms/coverage.d.ts +30 -0
- package/dist/src/data/transforms/coverage.d.ts.map +1 -0
- package/dist/src/data/transforms/coverage.js +183 -0
- package/dist/src/data/transforms/coverage.test.js +123 -0
- package/dist/src/data/transforms/filter.d.ts +12 -0
- package/dist/src/data/transforms/filter.d.ts.map +1 -0
- package/dist/src/data/transforms/filter.js +33 -0
- package/dist/src/data/transforms/filter.test.js +18 -0
- package/dist/src/data/transforms/filterScoredLabels.d.ts +29 -0
- package/dist/src/data/transforms/filterScoredLabels.d.ts.map +1 -0
- package/dist/src/data/transforms/filterScoredLabels.js +134 -0
- package/dist/src/data/transforms/flatten.d.ts +10 -0
- package/dist/src/data/transforms/flatten.d.ts.map +1 -0
- package/dist/src/data/transforms/flatten.js +68 -0
- package/dist/src/data/transforms/flatten.test.js +93 -0
- package/dist/src/data/transforms/flattenCompressedExons.d.ts +19 -0
- package/dist/src/data/transforms/flattenCompressedExons.d.ts.map +1 -0
- package/dist/src/data/transforms/flattenCompressedExons.js +53 -0
- package/dist/src/data/transforms/flattenDelimited.d.ts +10 -0
- package/dist/src/data/transforms/flattenDelimited.d.ts.map +1 -0
- package/dist/src/data/transforms/flattenDelimited.js +66 -0
- package/dist/src/data/transforms/flattenDelimited.test.js +87 -0
- package/dist/src/data/transforms/flattenSequence.d.ts +11 -0
- package/dist/src/data/transforms/flattenSequence.d.ts.map +1 -0
- package/dist/src/data/transforms/flattenSequence.js +35 -0
- package/dist/src/data/transforms/flattenSequence.test.js +34 -0
- package/dist/src/data/transforms/formula.d.ts +13 -0
- package/dist/src/data/transforms/formula.d.ts.map +1 -0
- package/dist/src/data/transforms/formula.js +35 -0
- package/dist/src/data/transforms/formula.test.js +19 -0
- package/dist/src/data/transforms/identifier.d.ts +40 -0
- package/dist/src/data/transforms/identifier.d.ts.map +1 -0
- package/dist/src/data/transforms/identifier.js +106 -0
- package/dist/src/data/transforms/identifier.test.js +83 -0
- package/dist/src/data/transforms/linearizeGenomicCoordinate.d.ts +10 -0
- package/dist/src/data/transforms/linearizeGenomicCoordinate.d.ts.map +1 -0
- package/dist/src/data/transforms/linearizeGenomicCoordinate.js +97 -0
- package/dist/src/data/transforms/measureText.d.ts +18 -0
- package/dist/src/data/transforms/measureText.d.ts.map +1 -0
- package/dist/src/data/transforms/measureText.js +42 -0
- package/dist/src/data/transforms/pileup.d.ts +10 -0
- package/dist/src/data/transforms/pileup.d.ts.map +1 -0
- package/dist/src/data/transforms/pileup.js +126 -0
- package/dist/src/data/transforms/pileup.test.js +70 -0
- package/dist/src/data/transforms/project.d.ts +13 -0
- package/dist/src/data/transforms/project.d.ts.map +1 -0
- package/dist/src/data/transforms/project.js +38 -0
- package/dist/src/data/transforms/project.test.js +32 -0
- package/dist/src/data/transforms/regexExtract.d.ts +13 -0
- package/dist/src/data/transforms/regexExtract.d.ts.map +1 -0
- package/dist/src/data/transforms/regexExtract.js +57 -0
- package/dist/src/data/transforms/regexExtract.test.js +67 -0
- package/dist/src/data/transforms/regexFold.d.ts +14 -0
- package/dist/src/data/transforms/regexFold.d.ts.map +1 -0
- package/dist/src/data/transforms/regexFold.js +139 -0
- package/dist/src/data/transforms/regexFold.test.js +160 -0
- package/dist/src/data/transforms/sample.d.ts +42 -0
- package/dist/src/data/transforms/sample.d.ts.map +1 -0
- package/dist/src/data/transforms/sample.js +99 -0
- package/dist/src/data/transforms/sample.test.js +38 -0
- package/dist/src/data/transforms/stack.d.ts +11 -0
- package/dist/src/data/transforms/stack.d.ts.map +1 -0
- package/dist/src/data/transforms/stack.js +134 -0
- package/dist/src/data/transforms/stack.test.js +91 -0
- package/dist/src/data/transforms/transformFactory.d.ts +12 -0
- package/dist/src/data/transforms/transformFactory.d.ts.map +1 -0
- package/dist/src/data/transforms/transformFactory.js +59 -0
- package/dist/src/encoder/accessor.d.ts +15 -0
- package/dist/src/encoder/accessor.d.ts.map +1 -0
- package/dist/src/encoder/accessor.js +76 -0
- package/dist/src/encoder/accessor.test.js +47 -0
- package/dist/src/encoder/encoder.d.ts +144 -0
- package/dist/src/encoder/encoder.d.ts.map +1 -0
- package/dist/src/encoder/encoder.js +400 -0
- package/dist/src/encoder/encoder.test.js +98 -0
- package/dist/src/fonts/Lato-Regular.json +1267 -0
- package/dist/src/fonts/Lato-Regular.png +0 -0
- package/dist/src/fonts/OFL.txt +93 -0
- package/dist/src/fonts/README.md +3 -0
- package/dist/src/fonts/bmFontManager.d.ts +182 -0
- package/dist/src/fonts/bmFontManager.d.ts.map +1 -0
- package/dist/src/fonts/bmFontManager.js +359 -0
- package/dist/src/fonts/bmFontMetrics.d.ts +45 -0
- package/dist/src/fonts/bmFontMetrics.d.ts.map +1 -0
- package/dist/src/fonts/bmFontMetrics.js +108 -0
- package/dist/src/genome/genome.d.ts +172 -0
- package/dist/src/genome/genome.d.ts.map +1 -0
- package/dist/src/genome/genome.js +379 -0
- package/dist/src/genome/genome.test.js +226 -0
- package/dist/src/genome/genomeStore.d.ts +20 -0
- package/dist/src/genome/genomeStore.d.ts.map +1 -0
- package/dist/src/genome/genomeStore.js +54 -0
- package/dist/src/genome/locusFormat.d.ts +14 -0
- package/dist/src/genome/locusFormat.d.ts.map +1 -0
- package/dist/src/genome/locusFormat.js +37 -0
- package/dist/src/genome/scaleIndex.d.ts +6 -0
- package/dist/src/genome/scaleIndex.d.ts.map +1 -0
- package/dist/src/genome/scaleIndex.js +165 -0
- package/dist/src/genome/scaleIndex.test.js +78 -0
- package/dist/src/genome/scaleLocus.d.ts +3 -0
- package/dist/src/genome/scaleLocus.d.ts.map +1 -0
- package/dist/src/genome/scaleLocus.js +101 -0
- package/dist/src/genome/scaleLocus.test.js +4 -0
- package/dist/src/genomeSpy.d.ts +141 -0
- package/dist/src/genomeSpy.d.ts.map +1 -0
- package/dist/src/genomeSpy.js +788 -0
- package/dist/src/gl/arrayBuilder.d.ts +71 -0
- package/dist/src/gl/arrayBuilder.d.ts.map +1 -0
- package/dist/src/gl/arrayBuilder.js +199 -0
- package/dist/src/gl/dataToVertices.d.ts +194 -0
- package/dist/src/gl/dataToVertices.d.ts.map +1 -0
- package/dist/src/gl/dataToVertices.js +639 -0
- package/dist/src/gl/includes/common.glsl.js +2 -0
- package/dist/src/gl/includes/picking.fragment.glsl.js +2 -0
- package/dist/src/gl/includes/picking.vertex.glsl.js +2 -0
- package/dist/src/gl/includes/sampleFacet.glsl.js +2 -0
- package/dist/src/gl/includes/scales.glsl.js +2 -0
- package/dist/src/gl/link.fragment.glsl.js +2 -0
- package/dist/src/gl/link.vertex.glsl.js +2 -0
- package/dist/src/gl/point.fragment.glsl.js +2 -0
- package/dist/src/gl/point.vertex.glsl.js +2 -0
- package/dist/src/gl/rect.fragment.glsl.js +2 -0
- package/dist/src/gl/rect.vertex.glsl.js +2 -0
- package/dist/src/gl/rule.fragment.glsl.js +2 -0
- package/dist/src/gl/rule.vertex.glsl.js +2 -0
- package/dist/src/gl/text.fragment.glsl.js +2 -0
- package/dist/src/gl/text.vertex.glsl.js +2 -0
- package/dist/src/gl/webGLHelper.d.ts +118 -0
- package/dist/src/gl/webGLHelper.d.ts.map +1 -0
- package/dist/src/gl/webGLHelper.js +513 -0
- package/dist/src/img/bowtie.svg +1 -0
- package/dist/src/img/genomespy-favicon.svg +34 -0
- package/dist/src/index.d.ts +15 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.html +11 -0
- package/dist/src/index.js +129 -0
- package/dist/src/marks/link.d.ts +11 -0
- package/dist/src/marks/link.d.ts.map +1 -0
- package/dist/src/marks/link.js +175 -0
- package/dist/src/marks/mark.d.ts +226 -0
- package/dist/src/marks/mark.d.ts.map +1 -0
- package/dist/src/marks/mark.js +1004 -0
- package/dist/src/marks/markUtils.d.ts +23 -0
- package/dist/src/marks/markUtils.d.ts.map +1 -0
- package/dist/src/marks/markUtils.js +125 -0
- package/dist/src/marks/pointMark.d.ts +11 -0
- package/dist/src/marks/pointMark.d.ts.map +1 -0
- package/dist/src/marks/pointMark.js +251 -0
- package/dist/src/marks/rectMark.d.ts +18 -0
- package/dist/src/marks/rectMark.d.ts.map +1 -0
- package/dist/src/marks/rectMark.js +255 -0
- package/dist/src/marks/rule.d.ts +6 -0
- package/dist/src/marks/rule.d.ts.map +1 -0
- package/dist/src/marks/rule.js +250 -0
- package/dist/src/marks/text.d.ts +13 -0
- package/dist/src/marks/text.d.ts.map +1 -0
- package/dist/src/marks/text.js +279 -0
- package/dist/src/scale/colorUtils.d.ts +34 -0
- package/dist/src/scale/colorUtils.d.ts.map +1 -0
- package/dist/src/scale/colorUtils.js +184 -0
- package/dist/src/scale/glslScaleGenerator.d.ts +45 -0
- package/dist/src/scale/glslScaleGenerator.d.ts.map +1 -0
- package/dist/src/scale/glslScaleGenerator.js +506 -0
- package/dist/src/scale/scale.d.ts +10 -0
- package/dist/src/scale/scale.d.ts.map +1 -0
- package/dist/src/scale/scale.js +456 -0
- package/dist/src/scale/scale.test.js +324 -0
- package/dist/src/scale/ticks.d.ts +47 -0
- package/dist/src/scale/ticks.d.ts.map +1 -0
- package/dist/src/scale/ticks.js +203 -0
- package/dist/src/scale/ticks.test.js +40 -0
- package/dist/src/singlePageApp.d.ts +2 -0
- package/dist/src/singlePageApp.d.ts.map +1 -0
- package/dist/src/singlePageApp.js +13 -0
- package/dist/src/spec/axis.d.ts +402 -0
- package/dist/src/spec/channel.d.ts +440 -0
- package/dist/src/spec/data.d.ts +370 -0
- package/dist/src/spec/font.d.ts +15 -0
- package/dist/src/spec/genome.d.ts +35 -0
- package/dist/src/spec/mark.d.ts +435 -0
- package/dist/src/spec/root.d.ts +22 -0
- package/dist/src/spec/sampleView.d.ts +185 -0
- package/dist/src/spec/scale.d.ts +273 -0
- package/dist/src/spec/title.d.ts +102 -0
- package/dist/src/spec/tooltip.d.ts +9 -0
- package/dist/src/spec/transform.d.ts +504 -0
- package/dist/src/spec/view.d.ts +214 -0
- package/dist/src/styles/genome-spy.css.d.ts +3 -0
- package/dist/src/styles/genome-spy.css.d.ts.map +1 -0
- package/dist/src/styles/genome-spy.css.js +114 -0
- package/dist/src/styles/genome-spy.scss +153 -0
- package/dist/src/tooltip/dataTooltipHandler.d.ts +2 -0
- package/dist/src/tooltip/dataTooltipHandler.d.ts.map +1 -0
- package/dist/src/tooltip/dataTooltipHandler.js +64 -0
- package/dist/src/tooltip/refseqGeneTooltipHandler.d.ts +2 -0
- package/dist/src/tooltip/refseqGeneTooltipHandler.d.ts.map +1 -0
- package/dist/src/tooltip/refseqGeneTooltipHandler.js +78 -0
- package/dist/src/tooltip/tooltipHandler.d.ts +9 -0
- package/dist/src/tooltip/tooltipHandler.d.ts.map +1 -0
- package/dist/src/tooltip/tooltipHandler.ts +12 -0
- package/dist/src/types/bmFont.d.ts +58 -0
- package/dist/src/types/embedApi.d.ts +67 -0
- package/dist/src/types/encoder.d.ts +84 -0
- package/dist/src/types/flowBatch.d.ts +40 -0
- package/dist/src/types/rendering.d.ts +65 -0
- package/dist/src/types/scaleResolutionApi.d.ts +40 -0
- package/dist/src/types/viewContext.d.ts +85 -0
- package/dist/src/utils/addBaseUrl.d.ts +6 -0
- package/dist/src/utils/addBaseUrl.d.ts.map +1 -0
- package/dist/src/utils/addBaseUrl.js +19 -0
- package/dist/src/utils/addBaseUrl.test.js +22 -0
- package/dist/src/utils/animator.d.ts +41 -0
- package/dist/src/utils/animator.d.ts.map +1 -0
- package/dist/src/utils/animator.js +83 -0
- package/dist/src/utils/arrayUtils.d.ts +34 -0
- package/dist/src/utils/arrayUtils.d.ts.map +1 -0
- package/dist/src/utils/arrayUtils.js +61 -0
- package/dist/src/utils/binnedIndex.d.ts +23 -0
- package/dist/src/utils/binnedIndex.d.ts.map +1 -0
- package/dist/src/utils/binnedIndex.js +167 -0
- package/dist/src/utils/binnedIndex.test.js +155 -0
- package/dist/src/utils/clamp.d.ts +7 -0
- package/dist/src/utils/clamp.d.ts.map +1 -0
- package/dist/src/utils/clamp.js +8 -0
- package/dist/src/utils/cloner.d.ts +16 -0
- package/dist/src/utils/cloner.d.ts.map +1 -0
- package/dist/src/utils/cloner.js +34 -0
- package/dist/src/utils/cloner.test.js +24 -0
- package/dist/src/utils/coalesce.d.ts +6 -0
- package/dist/src/utils/coalesce.d.ts.map +1 -0
- package/dist/src/utils/coalesce.js +11 -0
- package/dist/src/utils/coalesce.test.js +16 -0
- package/dist/src/utils/concatIterables.d.ts +8 -0
- package/dist/src/utils/concatIterables.d.ts.map +1 -0
- package/dist/src/utils/concatIterables.js +26 -0
- package/dist/src/utils/concatIterables.test.js +8 -0
- package/dist/src/utils/debounce.d.ts +8 -0
- package/dist/src/utils/debounce.d.ts.map +1 -0
- package/dist/src/utils/debounce.js +37 -0
- package/dist/src/utils/domainArray.d.ts +61 -0
- package/dist/src/utils/domainArray.d.ts.map +1 -0
- package/dist/src/utils/domainArray.js +216 -0
- package/dist/src/utils/domainArray.test.js +130 -0
- package/dist/src/utils/eerp.d.ts +12 -0
- package/dist/src/utils/eerp.d.ts.map +1 -0
- package/dist/src/utils/eerp.js +13 -0
- package/dist/src/utils/expression.d.ts +9 -0
- package/dist/src/utils/expression.d.ts.map +1 -0
- package/dist/src/utils/expression.js +32 -0
- package/dist/src/utils/field.d.ts +17 -0
- package/dist/src/utils/field.d.ts.map +1 -0
- package/dist/src/utils/field.js +28 -0
- package/dist/src/utils/formatObject.d.ts +7 -0
- package/dist/src/utils/formatObject.d.ts.map +1 -0
- package/dist/src/utils/formatObject.js +37 -0
- package/dist/src/utils/indexer.d.ts +16 -0
- package/dist/src/utils/indexer.d.ts.map +1 -0
- package/dist/src/utils/indexer.js +43 -0
- package/dist/src/utils/indexer.test.js +47 -0
- package/dist/src/utils/inertia.d.ts +42 -0
- package/dist/src/utils/inertia.d.ts.map +1 -0
- package/dist/src/utils/inertia.js +124 -0
- package/dist/src/utils/interactionEvent.d.ts +26 -0
- package/dist/src/utils/interactionEvent.d.ts.map +1 -0
- package/dist/src/utils/interactionEvent.js +33 -0
- package/dist/src/utils/iterateNestedMaps.d.ts +11 -0
- package/dist/src/utils/iterateNestedMaps.d.ts.map +1 -0
- package/dist/src/utils/iterateNestedMaps.js +21 -0
- package/dist/src/utils/iterateNestedMaps.test.js +33 -0
- package/dist/src/utils/kWayMerge.d.ts +9 -0
- package/dist/src/utils/kWayMerge.d.ts.map +1 -0
- package/dist/src/utils/kWayMerge.js +42 -0
- package/dist/src/utils/kWayMerge.test.js +26 -0
- package/dist/src/utils/layout/flexLayout.d.ts +182 -0
- package/dist/src/utils/layout/flexLayout.d.ts.map +1 -0
- package/dist/src/utils/layout/flexLayout.js +381 -0
- package/dist/src/utils/layout/flexLayout.test.js +323 -0
- package/dist/src/utils/layout/grid.d.ts +29 -0
- package/dist/src/utils/layout/grid.d.ts.map +1 -0
- package/dist/src/utils/layout/grid.js +95 -0
- package/dist/src/utils/layout/grid.test.js +71 -0
- package/dist/src/utils/layout/padding.d.ts +83 -0
- package/dist/src/utils/layout/padding.d.ts.map +1 -0
- package/dist/src/utils/layout/padding.js +155 -0
- package/dist/src/utils/layout/point.d.ts +16 -0
- package/dist/src/utils/layout/point.d.ts.map +1 -0
- package/dist/src/utils/layout/point.js +23 -0
- package/dist/src/utils/layout/rectangle.d.ts +142 -0
- package/dist/src/utils/layout/rectangle.d.ts.map +1 -0
- package/dist/src/utils/layout/rectangle.js +296 -0
- package/dist/src/utils/layout/rectangle.test.js +172 -0
- package/dist/src/utils/mergeObjects.d.ts +15 -0
- package/dist/src/utils/mergeObjects.d.ts.map +1 -0
- package/dist/src/utils/mergeObjects.js +99 -0
- package/dist/src/utils/mergeObjects.test.js +42 -0
- package/dist/src/utils/numberExtractor.d.ts +9 -0
- package/dist/src/utils/numberExtractor.d.ts.map +1 -0
- package/dist/src/utils/numberExtractor.js +24 -0
- package/dist/src/utils/numberExtractor.test.js +6 -0
- package/dist/src/utils/point.d.ts +9 -0
- package/dist/src/utils/point.d.ts.map +1 -0
- package/dist/src/utils/point.js +14 -0
- package/dist/src/utils/propertyCacher.d.ts +30 -0
- package/dist/src/utils/propertyCacher.d.ts.map +1 -0
- package/dist/src/utils/propertyCacher.js +70 -0
- package/dist/src/utils/propertyCacher.test.js +85 -0
- package/dist/src/utils/propertyCoalescer.d.ts +15 -0
- package/dist/src/utils/propertyCoalescer.d.ts.map +1 -0
- package/dist/src/utils/propertyCoalescer.js +42 -0
- package/dist/src/utils/propertyCoalescer.test.js +22 -0
- package/dist/src/utils/reservationMap.d.ts +42 -0
- package/dist/src/utils/reservationMap.d.ts.map +1 -0
- package/dist/src/utils/reservationMap.js +103 -0
- package/dist/src/utils/reservationMap.test.js +20 -0
- package/dist/src/utils/scaleNull.d.ts +13 -0
- package/dist/src/utils/scaleNull.d.ts.map +1 -0
- package/dist/src/utils/scaleNull.js +21 -0
- package/dist/src/utils/setOperations.d.ts +31 -0
- package/dist/src/utils/setOperations.d.ts.map +1 -0
- package/dist/src/utils/setOperations.js +75 -0
- package/dist/src/utils/smoothstep.d.ts +7 -0
- package/dist/src/utils/smoothstep.d.ts.map +1 -0
- package/dist/src/utils/smoothstep.js +10 -0
- package/dist/src/utils/throttle.d.ts +8 -0
- package/dist/src/utils/throttle.d.ts.map +1 -0
- package/dist/src/utils/throttle.js +34 -0
- package/dist/src/utils/topK.d.ts +22 -0
- package/dist/src/utils/topK.d.ts.map +1 -0
- package/dist/src/utils/topK.js +76 -0
- package/dist/src/utils/topK.test.js +64 -0
- package/dist/src/utils/transition.d.ts +44 -0
- package/dist/src/utils/transition.d.ts.map +1 -0
- package/dist/src/utils/transition.js +74 -0
- package/dist/src/utils/trees.d.ts +56 -0
- package/dist/src/utils/trees.d.ts.map +1 -0
- package/dist/src/utils/trees.js +92 -0
- package/dist/src/utils/trees.test.js +130 -0
- package/dist/src/utils/ui/tooltip.d.ts +50 -0
- package/dist/src/utils/ui/tooltip.d.ts.map +1 -0
- package/dist/src/utils/ui/tooltip.js +189 -0
- package/dist/src/utils/url.d.ts +9 -0
- package/dist/src/utils/url.d.ts.map +1 -0
- package/dist/src/utils/url.js +22 -0
- package/dist/src/utils/variableTools.d.ts +14 -0
- package/dist/src/utils/variableTools.d.ts.map +1 -0
- package/dist/src/utils/variableTools.js +24 -0
- package/dist/src/utils/variableTools.test.js +13 -0
- package/dist/src/view/axisGridView.d.ts +39 -0
- package/dist/src/view/axisGridView.d.ts.map +1 -0
- package/dist/src/view/axisGridView.js +246 -0
- package/dist/src/view/axisResolution.d.ts +24 -0
- package/dist/src/view/axisResolution.d.ts.map +1 -0
- package/dist/src/view/axisResolution.js +141 -0
- package/dist/src/view/axisResolution.test.js +201 -0
- package/dist/src/view/axisView.d.ts +49 -0
- package/dist/src/view/axisView.d.ts.map +1 -0
- package/dist/src/view/axisView.js +629 -0
- package/dist/src/view/concatView.d.ts +16 -0
- package/dist/src/view/concatView.d.ts.map +1 -0
- package/dist/src/view/concatView.js +84 -0
- package/dist/src/view/containerView.d.ts +43 -0
- package/dist/src/view/containerView.d.ts.map +1 -0
- package/dist/src/view/containerView.js +137 -0
- package/dist/src/view/facetView.d.ts +71 -0
- package/dist/src/view/facetView.d.ts.map +1 -0
- package/dist/src/view/facetView.js +492 -0
- package/dist/src/view/flowBuilder.d.ts +37 -0
- package/dist/src/view/flowBuilder.d.ts.map +1 -0
- package/dist/src/view/flowBuilder.js +383 -0
- package/dist/src/view/flowBuilder.test.js +125 -0
- package/dist/src/view/gridView.d.ts +111 -0
- package/dist/src/view/gridView.d.ts.map +1 -0
- package/dist/src/view/gridView.js +1086 -0
- package/dist/src/view/implicitRootView.d.ts +9 -0
- package/dist/src/view/implicitRootView.d.ts.map +1 -0
- package/dist/src/view/implicitRootView.js +23 -0
- package/dist/src/view/importView.d.ts +17 -0
- package/dist/src/view/importView.d.ts.map +1 -0
- package/dist/src/view/importView.js +22 -0
- package/dist/src/view/layerView.d.ts +25 -0
- package/dist/src/view/layerView.d.ts.map +1 -0
- package/dist/src/view/layerView.js +77 -0
- package/dist/src/view/renderingContext/bufferedViewRenderingContext.d.ts +30 -0
- package/dist/src/view/renderingContext/bufferedViewRenderingContext.d.ts.map +1 -0
- package/dist/src/view/renderingContext/bufferedViewRenderingContext.js +175 -0
- package/dist/src/view/renderingContext/compositeViewRenderingContext.d.ts +14 -0
- package/dist/src/view/renderingContext/compositeViewRenderingContext.d.ts.map +1 -0
- package/dist/src/view/renderingContext/compositeViewRenderingContext.js +51 -0
- package/dist/src/view/renderingContext/debuggingViewRenderingContext.d.ts +51 -0
- package/dist/src/view/renderingContext/debuggingViewRenderingContext.d.ts.map +1 -0
- package/dist/src/view/renderingContext/debuggingViewRenderingContext.js +94 -0
- package/dist/src/view/renderingContext/layoutRecorderViewRenderingContext.d.ts +60 -0
- package/dist/src/view/renderingContext/layoutRecorderViewRenderingContext.d.ts.map +1 -0
- package/dist/src/view/renderingContext/layoutRecorderViewRenderingContext.js +128 -0
- package/dist/src/view/renderingContext/simpleViewRenderingContext.d.ts +19 -0
- package/dist/src/view/renderingContext/simpleViewRenderingContext.d.ts.map +1 -0
- package/dist/src/view/renderingContext/simpleViewRenderingContext.js +64 -0
- package/dist/src/view/renderingContext/svgViewRenderingContext.d.ts +22 -0
- package/dist/src/view/renderingContext/svgViewRenderingContext.d.ts.map +1 -0
- package/dist/src/view/renderingContext/svgViewRenderingContext.js +125 -0
- package/dist/src/view/renderingContext/viewRenderingContext.d.ts +33 -0
- package/dist/src/view/renderingContext/viewRenderingContext.d.ts.map +1 -0
- package/dist/src/view/renderingContext/viewRenderingContext.js +41 -0
- package/dist/src/view/scaleResolution.d.ts +170 -0
- package/dist/src/view/scaleResolution.d.ts.map +1 -0
- package/dist/src/view/scaleResolution.js +874 -0
- package/dist/src/view/scaleResolution.test.js +658 -0
- package/dist/src/view/testUtils.d.ts +30 -0
- package/dist/src/view/testUtils.d.ts.map +1 -0
- package/dist/src/view/testUtils.js +101 -0
- package/dist/src/view/title.d.ts +6 -0
- package/dist/src/view/title.d.ts.map +1 -0
- package/dist/src/view/title.js +165 -0
- package/dist/src/view/unitView.d.ts +93 -0
- package/dist/src/view/unitView.d.ts.map +1 -0
- package/dist/src/view/unitView.js +345 -0
- package/dist/src/view/view.d.ts +291 -0
- package/dist/src/view/view.d.ts.map +1 -0
- package/dist/src/view/view.js +691 -0
- package/dist/src/view/view.test.js +214 -0
- package/dist/src/view/viewFactory.d.ts +76 -0
- package/dist/src/view/viewFactory.d.ts.map +1 -0
- package/dist/src/view/viewFactory.js +178 -0
- package/dist/src/view/viewFactory.test.js +17 -0
- package/dist/src/view/viewUtils.d.ts +90 -0
- package/dist/src/view/viewUtils.d.ts.map +1 -0
- package/dist/src/view/viewUtils.js +326 -0
- package/dist/src/view/zoom.d.ts +23 -0
- package/dist/src/view/zoom.d.ts.map +1 -0
- package/dist/src/view/zoom.js +89 -0
- package/package.json +17 -12
- package/dist/style.css +0 -1
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { RemoteFile } from "generic-filehandle";
|
|
2
|
+
import { TabixIndexedFile } from "@gmod/tabix";
|
|
3
|
+
|
|
4
|
+
import SingleAxisLazySource from "./singleAxisLazySource";
|
|
5
|
+
import windowedMixin from "./windowedMixin";
|
|
6
|
+
import { debounce } from "../../../utils/debounce";
|
|
7
|
+
import addBaseUrl from "@genome-spy/core/utils/addBaseUrl";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @template T
|
|
11
|
+
*/
|
|
12
|
+
export default class TabixSource extends windowedMixin(SingleAxisLazySource) {
|
|
13
|
+
/** Keep track of the order of the requests */
|
|
14
|
+
lastRequestId = 0;
|
|
15
|
+
|
|
16
|
+
/** @type {TabixIndexedFile} */
|
|
17
|
+
tbiIndex;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @param {import("../../../spec/data").TabixData} params
|
|
21
|
+
* @param {import("../../../view/view").default} view
|
|
22
|
+
*/
|
|
23
|
+
constructor(params, view) {
|
|
24
|
+
/** @type {import("../../../spec/data").TabixData} */
|
|
25
|
+
const paramsWithDefaults = {
|
|
26
|
+
channel: "x",
|
|
27
|
+
windowSize: 3_000_000,
|
|
28
|
+
debounceDomainChange: 200,
|
|
29
|
+
...params,
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
super(view, paramsWithDefaults.channel);
|
|
33
|
+
|
|
34
|
+
this.params = paramsWithDefaults;
|
|
35
|
+
|
|
36
|
+
if (!this.params.url) {
|
|
37
|
+
throw new Error("No URL provided for TabixSource");
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const withBase = (/** @type {string} */ uri) =>
|
|
41
|
+
new RemoteFile(addBaseUrl(uri, this.view.getBaseUrl()));
|
|
42
|
+
|
|
43
|
+
this.tbiIndex = new TabixIndexedFile({
|
|
44
|
+
filehandle: withBase(this.params.url),
|
|
45
|
+
tbiFilehandle: withBase(
|
|
46
|
+
this.params.indexUrl ?? this.params.url + ".tbi"
|
|
47
|
+
),
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
if (this.params.debounceDomainChange > 0) {
|
|
51
|
+
this.onDomainChanged = debounce(
|
|
52
|
+
this.onDomainChanged.bind(this),
|
|
53
|
+
this.params.debounceDomainChange,
|
|
54
|
+
false
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Listen to the domain change event and update data when the covered windows change.
|
|
61
|
+
*
|
|
62
|
+
* @param {number[]} domain Linearized domain
|
|
63
|
+
*/
|
|
64
|
+
async onDomainChanged(domain) {
|
|
65
|
+
const windowSize = this.params.windowSize;
|
|
66
|
+
|
|
67
|
+
if (domain[1] - domain[0] > windowSize) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const quantizedInterval = this.quantizeInterval(domain, windowSize);
|
|
72
|
+
|
|
73
|
+
if (this.checkAndUpdateLastInterval(quantizedInterval)) {
|
|
74
|
+
this.doRequest(quantizedInterval);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Listen to the domain change event and update data when the covered windows change.
|
|
80
|
+
*
|
|
81
|
+
* @param {number[]} interval linearized domain
|
|
82
|
+
*/
|
|
83
|
+
async doRequest(interval) {
|
|
84
|
+
const featureResponse = await this.getFeatures(interval);
|
|
85
|
+
|
|
86
|
+
// Discard late responses
|
|
87
|
+
if (featureResponse.requestId < this.lastRequestId) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
this.publishData(featureResponse.features);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
*
|
|
96
|
+
* @param {number[]} interval
|
|
97
|
+
*/
|
|
98
|
+
async getFeatures(interval) {
|
|
99
|
+
let requestId = ++this.lastRequestId;
|
|
100
|
+
|
|
101
|
+
// TODO: Abort previous requests
|
|
102
|
+
const abortController = new AbortController();
|
|
103
|
+
|
|
104
|
+
const discreteChromosomeIntervals =
|
|
105
|
+
this.genome.continuousToDiscreteChromosomeIntervals(interval);
|
|
106
|
+
|
|
107
|
+
// TODO: Error handling
|
|
108
|
+
const featuresWithChrom = await Promise.all(
|
|
109
|
+
discreteChromosomeIntervals.map(async (d) => {
|
|
110
|
+
/** @type {string[]} */
|
|
111
|
+
const lines = [];
|
|
112
|
+
|
|
113
|
+
await this.tbiIndex.getLines(d.chrom, d.startPos, d.endPos, {
|
|
114
|
+
lineCallback: (line) => {
|
|
115
|
+
lines.push(line);
|
|
116
|
+
},
|
|
117
|
+
signal: abortController.signal,
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
// Hmm. It's silly that we have to first collect individual lines and then join them.
|
|
121
|
+
return this._parseFeatures(lines);
|
|
122
|
+
})
|
|
123
|
+
);
|
|
124
|
+
|
|
125
|
+
return {
|
|
126
|
+
requestId,
|
|
127
|
+
abort: () => abortController.abort(),
|
|
128
|
+
features: featuresWithChrom.flat(), // TODO: Use batches, not flat
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* @abstract
|
|
134
|
+
* @param {string[]} lines
|
|
135
|
+
* @returns {T[]}
|
|
136
|
+
*/
|
|
137
|
+
_parseFeatures(lines) {
|
|
138
|
+
return [];
|
|
139
|
+
}
|
|
140
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utils for handling data sources that are fetched in chunks.
|
|
3
|
+
*
|
|
4
|
+
* @template {!Constructor} T
|
|
5
|
+
* @param {T} superclass - The class to extend
|
|
6
|
+
*/
|
|
7
|
+
export default function windowedMixin<T extends Constructor>(superclass: T): {
|
|
8
|
+
new (...args: any[]): {
|
|
9
|
+
[x: string]: any;
|
|
10
|
+
/**
|
|
11
|
+
* @type {number[]}
|
|
12
|
+
*/
|
|
13
|
+
lastQuantizedInterval: number[];
|
|
14
|
+
/**
|
|
15
|
+
* Returns three consecutive windows. The idea is to immediately have some data
|
|
16
|
+
* to show to the user when they pan the view.
|
|
17
|
+
*
|
|
18
|
+
* @param {number[]} interval
|
|
19
|
+
* @param {number} windowSize
|
|
20
|
+
* @returns
|
|
21
|
+
*/
|
|
22
|
+
quantizeInterval(interval: number[], windowSize: number): number[];
|
|
23
|
+
/**
|
|
24
|
+
*
|
|
25
|
+
* @param {number[]} interval
|
|
26
|
+
* @returns
|
|
27
|
+
*/
|
|
28
|
+
checkAndUpdateLastInterval(interval: number[]): boolean;
|
|
29
|
+
};
|
|
30
|
+
} & T;
|
|
31
|
+
export type Constructor = new (...args: any[]) => any;
|
|
32
|
+
//# sourceMappingURL=windowedMixin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"windowedMixin.d.ts","sourceRoot":"","sources":["../../../../../src/data/sources/dynamic/windowedMixin.js"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH;kBAV4B,GAAG,EAAE;;QAYzB;;WAEG;+BADO,MAAM,EAAE;QAIlB;;;;;;;WAOG;mCAHQ,MAAM,EAAE,cACR,MAAM;QAgBjB;;;;WAIG;6CAFQ,MAAM,EAAE;;MAY1B;wCApD2B,GAAG,EAAE,KAAK,GAAG"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/** @typedef {new (...args: any[]) => any} Constructor */
|
|
2
|
+
|
|
3
|
+
import { shallowArrayEquals } from "../../../utils/arrayUtils";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Utils for handling data sources that are fetched in chunks.
|
|
7
|
+
*
|
|
8
|
+
* @template {!Constructor} T
|
|
9
|
+
* @param {T} superclass - The class to extend
|
|
10
|
+
*/
|
|
11
|
+
export default function windowedMixin(superclass) {
|
|
12
|
+
return class FormControl extends superclass {
|
|
13
|
+
/**
|
|
14
|
+
* @type {number[]}
|
|
15
|
+
*/
|
|
16
|
+
lastQuantizedInterval = [0, 0];
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Returns three consecutive windows. The idea is to immediately have some data
|
|
20
|
+
* to show to the user when they pan the view.
|
|
21
|
+
*
|
|
22
|
+
* @param {number[]} interval
|
|
23
|
+
* @param {number} windowSize
|
|
24
|
+
* @returns
|
|
25
|
+
*/
|
|
26
|
+
quantizeInterval(interval, windowSize) {
|
|
27
|
+
return [
|
|
28
|
+
Math.max(
|
|
29
|
+
Math.floor(interval[0] / windowSize - 1) * windowSize,
|
|
30
|
+
0
|
|
31
|
+
),
|
|
32
|
+
Math.min(
|
|
33
|
+
Math.ceil(interval[1] / windowSize + 1) * windowSize,
|
|
34
|
+
this.genome.totalSize
|
|
35
|
+
),
|
|
36
|
+
];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
*
|
|
41
|
+
* @param {number[]} interval
|
|
42
|
+
* @returns
|
|
43
|
+
*/
|
|
44
|
+
checkAndUpdateLastInterval(interval) {
|
|
45
|
+
if (shallowArrayEquals(this.lastQuantizedInterval, interval)) {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
this.lastQuantizedInterval = interval;
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {Partial<import("../../spec/data").Data>} data
|
|
3
|
+
* @returns {data is import("../../spec/data").InlineData}
|
|
4
|
+
*/
|
|
5
|
+
export function isInlineData(data: Partial<import("../../spec/data").Data>): data is import("../../spec/data").InlineData;
|
|
6
|
+
export default class InlineSource extends DataSource {
|
|
7
|
+
/**
|
|
8
|
+
* @param {import("../../spec/data").InlineData} params
|
|
9
|
+
* @param {import("../../view/view").default} view
|
|
10
|
+
*/
|
|
11
|
+
constructor(params: import("../../spec/data").InlineData, view: import("../../view/view").default);
|
|
12
|
+
params: import("../../spec/data").InlineData;
|
|
13
|
+
loadSynchronously(): void;
|
|
14
|
+
}
|
|
15
|
+
import DataSource from "./dataSource";
|
|
16
|
+
//# sourceMappingURL=inlineSource.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inlineSource.d.ts","sourceRoot":"","sources":["../../../../src/data/sources/inlineSource.js"],"names":[],"mappings":"AAIA;;;GAGG;AACH,mCAHW,QAAQ,OAAO,iBAAiB,EAAE,IAAI,CAAC,gDAKjD;AAED;IACI;;;OAGG;IACH,oBAHW,OAAO,iBAAiB,EAAE,UAAU,QACpC,OAAO,iBAAiB,EAAE,OAAO,EAY3C;IAPG,6CAAoB;IASxB,0BAiCC;CAKJ;uBAjEsB,cAAc"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { read } from "vega-loader";
|
|
2
|
+
import { getFormat, makeWrapper } from "./dataUtils";
|
|
3
|
+
import DataSource from "./dataSource";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @param {Partial<import("../../spec/data").Data>} data
|
|
7
|
+
* @returns {data is import("../../spec/data").InlineData}
|
|
8
|
+
*/
|
|
9
|
+
export function isInlineData(data) {
|
|
10
|
+
return "values" in data;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default class InlineSource extends DataSource {
|
|
14
|
+
/**
|
|
15
|
+
* @param {import("../../spec/data").InlineData} params
|
|
16
|
+
* @param {import("../../view/view").default} view
|
|
17
|
+
*/
|
|
18
|
+
constructor(params, view) {
|
|
19
|
+
super();
|
|
20
|
+
|
|
21
|
+
this.params = params;
|
|
22
|
+
|
|
23
|
+
if (typeof params.values == "string" && !params?.format?.type) {
|
|
24
|
+
throw new Error(
|
|
25
|
+
"Data format type (csv, dsv, ...) must be specified if a string is provided!"
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
loadSynchronously() {
|
|
31
|
+
const values = this.params.values;
|
|
32
|
+
|
|
33
|
+
let data = [];
|
|
34
|
+
|
|
35
|
+
/** @type {(x: any) => import("../flowNode").Datum} */
|
|
36
|
+
let wrap = (x) => x;
|
|
37
|
+
|
|
38
|
+
if (Array.isArray(values)) {
|
|
39
|
+
if (values.length > 0) {
|
|
40
|
+
data = values;
|
|
41
|
+
// TODO: Should check the whole array and abort if types are heterogeneous
|
|
42
|
+
wrap = makeWrapper(values[0]);
|
|
43
|
+
}
|
|
44
|
+
} else if (typeof values == "object") {
|
|
45
|
+
data = [values];
|
|
46
|
+
} else if (typeof values == "string") {
|
|
47
|
+
// It's a string that needs to be parsed
|
|
48
|
+
data = read(values, getFormat(this.params));
|
|
49
|
+
} else {
|
|
50
|
+
throw new Error(
|
|
51
|
+
'"values" in data configuration is not an array, object, or a string!'
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
this.reset();
|
|
56
|
+
this.beginBatch({ type: "file" });
|
|
57
|
+
|
|
58
|
+
for (const d of data) {
|
|
59
|
+
this._propagate(wrap(d));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
this.complete();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
async load() {
|
|
66
|
+
this.loadSynchronously();
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { expect, test } from "vitest";
|
|
2
|
+
import Collector from "../collector";
|
|
3
|
+
import InlineSource from "./inlineSource";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @param {InlineSource} source
|
|
7
|
+
*/
|
|
8
|
+
async function collectSource(source) {
|
|
9
|
+
const collector = new Collector();
|
|
10
|
+
source.addChild(collector);
|
|
11
|
+
|
|
12
|
+
await source.load();
|
|
13
|
+
|
|
14
|
+
return [...collector.getData()];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
test("InlineSource propagates an object", async () => {
|
|
18
|
+
expect(await collectSource(new InlineSource({ values: { x: 1 } }))).toEqual(
|
|
19
|
+
[{ x: 1 }]
|
|
20
|
+
);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
test("InlineSource propagates an array of objects", async () => {
|
|
24
|
+
expect(
|
|
25
|
+
await collectSource(new InlineSource({ values: [{ x: 1 }, { x: 2 }] }))
|
|
26
|
+
).toEqual([{ x: 1 }, { x: 2 }]);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
test("InlineSource wraps scalars to objects", async () => {
|
|
30
|
+
expect(await collectSource(new InlineSource({ values: [1, 2] }))).toEqual([
|
|
31
|
+
{ data: 1 },
|
|
32
|
+
{ data: 2 },
|
|
33
|
+
]);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
test("InlineSource parses a string", async () => {
|
|
37
|
+
expect(
|
|
38
|
+
await collectSource(
|
|
39
|
+
new InlineSource({
|
|
40
|
+
values: "a\n1\n2\n3",
|
|
41
|
+
format: {
|
|
42
|
+
type: "csv",
|
|
43
|
+
},
|
|
44
|
+
})
|
|
45
|
+
)
|
|
46
|
+
).toEqual([{ a: 1 }, { a: 2 }, { a: 3 }]);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
test("InlineSource throws on a string and a missing format specifier", () => {
|
|
50
|
+
expect(
|
|
51
|
+
() =>
|
|
52
|
+
new InlineSource({
|
|
53
|
+
values: "a\n1\n2\n3",
|
|
54
|
+
})
|
|
55
|
+
).toThrow();
|
|
56
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {Partial<import("../../spec/data").Data>} data
|
|
3
|
+
* @returns {data is import("../../spec/data").NamedData}
|
|
4
|
+
*/
|
|
5
|
+
export function isNamedData(data: Partial<import("../../spec/data").Data>): data is import("../../spec/data").NamedData;
|
|
6
|
+
export default class NamedSource extends DataSource {
|
|
7
|
+
/**
|
|
8
|
+
* @param {import("../../spec/data").NamedData} params
|
|
9
|
+
* @param {import("../../view/view").default} view
|
|
10
|
+
* @param {function(string):any[]} provider Function that retrieves a dataset using a name
|
|
11
|
+
*/
|
|
12
|
+
constructor(params: import("../../spec/data").NamedData, view: import("../../view/view").default, provider: (arg0: string) => any[]);
|
|
13
|
+
provider: (arg0: string) => any[];
|
|
14
|
+
params: import("../../spec/data").NamedData;
|
|
15
|
+
/**
|
|
16
|
+
* Update the named data. If data is omitted, a data provider is used instead.
|
|
17
|
+
*
|
|
18
|
+
* @param {import("../flowNode").Datum[]} [data]
|
|
19
|
+
*/
|
|
20
|
+
updateDynamicData(data?: import("../flowNode").Datum[]): void;
|
|
21
|
+
loadSynchronously(): void;
|
|
22
|
+
#private;
|
|
23
|
+
}
|
|
24
|
+
import DataSource from "./dataSource";
|
|
25
|
+
//# sourceMappingURL=namedSource.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"namedSource.d.ts","sourceRoot":"","sources":["../../../../src/data/sources/namedSource.js"],"names":[],"mappings":"AAGA;;;GAGG;AACH,kCAHW,QAAQ,OAAO,iBAAiB,EAAE,IAAI,CAAC,+CAKjD;AAED;IAOI;;;;OAIG;IACH,oBAJW,OAAO,iBAAiB,EAAE,SAAS,QACnC,OAAO,iBAAiB,EAAE,OAAO,mBACxB,MAAM,KAAE,GAAG,EAAE,EAOhC;IAFG,iBALgB,MAAM,KAAE,GAAG,EAAE,CAKL;IACxB,4CAAoB;IAUxB;;;;OAIG;IACH,yBAFW,OAAO,aAAa,EAAE,KAAK,EAAE,QAMvC;IAED,0BA0BC;;CAKJ;uBA/EsB,cAAc"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import DataSource from "./dataSource";
|
|
2
|
+
import { makeWrapper } from "./dataUtils";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @param {Partial<import("../../spec/data").Data>} data
|
|
6
|
+
* @returns {data is import("../../spec/data").NamedData}
|
|
7
|
+
*/
|
|
8
|
+
export function isNamedData(data) {
|
|
9
|
+
return "name" in data;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default class NamedSource extends DataSource {
|
|
13
|
+
/**
|
|
14
|
+
* Data that has been provided explicitly using the updateDynamicData method
|
|
15
|
+
* @type {any[]}
|
|
16
|
+
*/
|
|
17
|
+
#explicitData;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @param {import("../../spec/data").NamedData} params
|
|
21
|
+
* @param {import("../../view/view").default} view
|
|
22
|
+
* @param {function(string):any[]} provider Function that retrieves a dataset using a name
|
|
23
|
+
*/
|
|
24
|
+
constructor(params, view, provider) {
|
|
25
|
+
super();
|
|
26
|
+
|
|
27
|
+
this.provider = provider;
|
|
28
|
+
this.params = params;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @return {string}
|
|
33
|
+
*/
|
|
34
|
+
get identifier() {
|
|
35
|
+
return this.params.name;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Update the named data. If data is omitted, a data provider is used instead.
|
|
40
|
+
*
|
|
41
|
+
* @param {import("../flowNode").Datum[]} [data]
|
|
42
|
+
*/
|
|
43
|
+
updateDynamicData(data) {
|
|
44
|
+
// TODO: Throw is data is undefined and the provider is unable to provide any data
|
|
45
|
+
this.#explicitData = data;
|
|
46
|
+
this.loadSynchronously();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
loadSynchronously() {
|
|
50
|
+
const data =
|
|
51
|
+
this.#explicitData ?? this.provider(this.params.name) ?? [];
|
|
52
|
+
|
|
53
|
+
/** @type {(x: any) => import("../flowNode").Datum} */
|
|
54
|
+
let wrap = (x) => x;
|
|
55
|
+
|
|
56
|
+
if (Array.isArray(data)) {
|
|
57
|
+
if (data.length > 0) {
|
|
58
|
+
// TODO: Should check the whole array and abort if types are heterogeneous
|
|
59
|
+
wrap = makeWrapper(data[0]);
|
|
60
|
+
}
|
|
61
|
+
} else {
|
|
62
|
+
throw new Error(
|
|
63
|
+
`Named data "${this.params.name}" is not an array!`
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
this.reset();
|
|
68
|
+
this.beginBatch({ type: "file" });
|
|
69
|
+
|
|
70
|
+
for (const d of data) {
|
|
71
|
+
this._propagate(wrap(d));
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
this.complete();
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
async load() {
|
|
78
|
+
this.loadSynchronously();
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {Partial<import("../../spec/data").Data>} data
|
|
3
|
+
* @returns {data is import("../../spec/data").SequenceGenerator}
|
|
4
|
+
*/
|
|
5
|
+
export function isSequenceGenerator(data: Partial<import("../../spec/data").Data>): data is import("../../spec/data").SequenceGenerator;
|
|
6
|
+
export default class SequenceSource extends DataSource {
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* @param {import("../../spec/data").SequenceGenerator} params
|
|
10
|
+
* @param {import("../../view/view").default} view
|
|
11
|
+
*/
|
|
12
|
+
constructor(params: import("../../spec/data").SequenceGenerator, view: import("../../view/view").default);
|
|
13
|
+
sequence: import("../../spec/data").SequenceParams;
|
|
14
|
+
loadSynchronously(): void;
|
|
15
|
+
}
|
|
16
|
+
import DataSource from "./dataSource";
|
|
17
|
+
//# sourceMappingURL=sequenceSource.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sequenceSource.d.ts","sourceRoot":"","sources":["../../../../src/data/sources/sequenceSource.js"],"names":[],"mappings":"AAEA;;;GAGG;AACH,0CAHW,QAAQ,OAAO,iBAAiB,EAAE,IAAI,CAAC,uDAKjD;AAED;IACI;;;;OAIG;IACH,oBAHW,OAAO,iBAAiB,EAAE,iBAAiB,QAC3C,OAAO,iBAAiB,EAAE,OAAO,EAY3C;IARG,mDAA+B;IAUnC,0BAaC;CAKJ;uBA9CsB,cAAc"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import DataSource from "./dataSource";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @param {Partial<import("../../spec/data").Data>} data
|
|
5
|
+
* @returns {data is import("../../spec/data").SequenceGenerator}
|
|
6
|
+
*/
|
|
7
|
+
export function isSequenceGenerator(data) {
|
|
8
|
+
return "sequence" in data;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default class SequenceSource extends DataSource {
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @param {import("../../spec/data").SequenceGenerator} params
|
|
15
|
+
* @param {import("../../view/view").default} view
|
|
16
|
+
*/
|
|
17
|
+
constructor(params, view) {
|
|
18
|
+
super();
|
|
19
|
+
this.sequence = params.sequence;
|
|
20
|
+
|
|
21
|
+
if (!("start" in this.sequence)) {
|
|
22
|
+
throw new Error("'start' is missing from sequence parameters!");
|
|
23
|
+
}
|
|
24
|
+
if (!("stop" in this.sequence)) {
|
|
25
|
+
throw new Error("'stop' is missing from sequence parameters!");
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
loadSynchronously() {
|
|
30
|
+
const as = this.sequence.as || "data";
|
|
31
|
+
const step = this.sequence.step || 1;
|
|
32
|
+
const stop = this.sequence.stop;
|
|
33
|
+
|
|
34
|
+
this.reset();
|
|
35
|
+
this.beginBatch({ type: "file" });
|
|
36
|
+
|
|
37
|
+
for (let x = this.sequence.start; x < stop; x += step) {
|
|
38
|
+
this._propagate({ [as]: x });
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
this.complete();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
async load() {
|
|
45
|
+
this.loadSynchronously();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { expect, test } from "vitest";
|
|
2
|
+
import Collector from "../collector";
|
|
3
|
+
import SequenceSource from "./sequenceSource";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @param {SequenceSource} source
|
|
7
|
+
*/
|
|
8
|
+
async function collectSource(source) {
|
|
9
|
+
const collector = new Collector();
|
|
10
|
+
source.addChild(collector);
|
|
11
|
+
|
|
12
|
+
await source.load();
|
|
13
|
+
|
|
14
|
+
return [...collector.getData()];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
test("SequenceSource generates a sequence", async () => {
|
|
18
|
+
expect(
|
|
19
|
+
await collectSource(
|
|
20
|
+
new SequenceSource({ sequence: { start: 0, stop: 3 } })
|
|
21
|
+
)
|
|
22
|
+
).toEqual([{ data: 0 }, { data: 1 }, { data: 2 }]);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
test("SequenceSource generates a sequence with a custom step", async () => {
|
|
26
|
+
expect(
|
|
27
|
+
await collectSource(
|
|
28
|
+
new SequenceSource({ sequence: { start: 0, stop: 5, step: 2 } })
|
|
29
|
+
)
|
|
30
|
+
).toEqual([{ data: 0 }, { data: 2 }, { data: 4 }]);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
test("SequenceSource generates a sequence with a custom field name", async () => {
|
|
34
|
+
expect(
|
|
35
|
+
await collectSource(
|
|
36
|
+
new SequenceSource({ sequence: { start: 0, stop: 3, as: "x" } })
|
|
37
|
+
)
|
|
38
|
+
).toEqual([{ x: 0 }, { x: 1 }, { x: 2 }]);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
test("SequenceSource throws on missing 'start' parameter", () => {
|
|
42
|
+
expect(() => new SequenceSource({ sequence: { stop: 3 } })).toThrow();
|
|
43
|
+
});
|
|
44
|
+
test("SequenceSource throws on missing 'stop' parameter", () => {
|
|
45
|
+
expect(() => new SequenceSource({ sequence: { start: 0 } })).toThrow();
|
|
46
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {Partial<import("../../spec/data").Data>} data
|
|
3
|
+
* @returns {data is import("../../spec/data").UrlData}
|
|
4
|
+
*/
|
|
5
|
+
export function isUrlData(data: Partial<import("../../spec/data").Data>): data is import("../../spec/data").UrlData;
|
|
6
|
+
export default class UrlSource extends DataSource {
|
|
7
|
+
/**
|
|
8
|
+
* @param {import("../../spec/data").UrlData} params
|
|
9
|
+
* @param {import("../../view/view").default} view
|
|
10
|
+
*/
|
|
11
|
+
constructor(params: import("../../spec/data").UrlData, view: import("../../view/view").default);
|
|
12
|
+
params: import("../../spec/data").UrlData;
|
|
13
|
+
baseUrl: string;
|
|
14
|
+
}
|
|
15
|
+
import DataSource from "./dataSource";
|
|
16
|
+
//# sourceMappingURL=urlSource.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"urlSource.d.ts","sourceRoot":"","sources":["../../../../src/data/sources/urlSource.js"],"names":[],"mappings":"AAIA;;;GAGG;AACH,gCAHW,QAAQ,OAAO,iBAAiB,EAAE,IAAI,CAAC,6CAKjD;AAED;IACI;;;OAGG;IACH,oBAHW,OAAO,iBAAiB,EAAE,OAAO,QACjC,OAAO,iBAAiB,EAAE,OAAO,EAO3C;IAFG,0CAAoB;IACpB,gBAAiC;CAoDxC;uBAvEsB,cAAc"}
|