@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,214 @@
|
|
|
1
|
+
import { describe, expect, test } from "vitest";
|
|
2
|
+
import UnitView from "./unitView";
|
|
3
|
+
|
|
4
|
+
import { create, createAndInitialize } from "./testUtils";
|
|
5
|
+
import { toRegularArray as r } from "../utils/domainArray";
|
|
6
|
+
import ConcatView from "./concatView";
|
|
7
|
+
import PointMark from "../marks/pointMark";
|
|
8
|
+
import View from "./view";
|
|
9
|
+
import LayerView from "./layerView";
|
|
10
|
+
|
|
11
|
+
describe("Trivial creations and initializations", () => {
|
|
12
|
+
test("Fails on empty spec", () => {
|
|
13
|
+
// @ts-ignore
|
|
14
|
+
expect(() => create({}, View)).toThrow();
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
test("Parses a trivial spec", () => {
|
|
18
|
+
expect(create({ mark: "point" }, View)).toBeInstanceOf(UnitView);
|
|
19
|
+
expect(create({ layer: [] }, View)).toBeInstanceOf(LayerView);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
test("Parses a more comples spec", () => {
|
|
23
|
+
const view = create(
|
|
24
|
+
{
|
|
25
|
+
concat: [
|
|
26
|
+
{
|
|
27
|
+
layer: [{ mark: "point" }, { mark: "rect" }],
|
|
28
|
+
},
|
|
29
|
+
{ mark: "rect" },
|
|
30
|
+
],
|
|
31
|
+
},
|
|
32
|
+
ConcatView
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
expect(view).toBeInstanceOf(ConcatView);
|
|
36
|
+
expect(view.children[0]).toBeInstanceOf(LayerView);
|
|
37
|
+
expect(view.children[0].children[0]).toBeInstanceOf(UnitView);
|
|
38
|
+
expect(view.children[0].children[0].mark).toBeInstanceOf(PointMark);
|
|
39
|
+
expect(view.children[1]).toBeInstanceOf(UnitView);
|
|
40
|
+
expect(view.children[2]).toBeUndefined();
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
test("Parses and initializes a trivial spec", () => {
|
|
44
|
+
const spec = {
|
|
45
|
+
data: { values: [1] },
|
|
46
|
+
mark: "point",
|
|
47
|
+
encoding: {
|
|
48
|
+
x: { field: "data", type: "quantitative" },
|
|
49
|
+
y: { field: "data", type: "quantitative" },
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
expect(createAndInitialize(spec, View)).resolves.toBeInstanceOf(
|
|
54
|
+
UnitView
|
|
55
|
+
);
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
describe("Test domain handling", () => {
|
|
60
|
+
const dataSpec = {
|
|
61
|
+
values: [
|
|
62
|
+
{ a: 1, b: 3 },
|
|
63
|
+
{ a: 2, b: 4 },
|
|
64
|
+
{ a: 3, b: 5 },
|
|
65
|
+
],
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
test("Uses domain from the scale properties", () => {
|
|
69
|
+
const spec = {
|
|
70
|
+
data: dataSpec,
|
|
71
|
+
mark: "point",
|
|
72
|
+
encoding: {
|
|
73
|
+
x: { field: "a", type: "quantitative" },
|
|
74
|
+
y: {
|
|
75
|
+
field: "a",
|
|
76
|
+
type: "quantitative",
|
|
77
|
+
scale: { domain: [0, 1000] },
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
return createAndInitialize(spec, UnitView).then((view) =>
|
|
83
|
+
expect(r(view.getConfiguredDomain("y"))).toEqual([0, 1000])
|
|
84
|
+
);
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
test("Includes a constant in the data domain", () => {
|
|
88
|
+
const spec = {
|
|
89
|
+
data: dataSpec,
|
|
90
|
+
mark: "point",
|
|
91
|
+
encoding: {
|
|
92
|
+
x: { datum: 123, type: "quantitative" },
|
|
93
|
+
y: { field: "a", type: "quantitative" },
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
return createAndInitialize(spec, UnitView).then((view) =>
|
|
98
|
+
expect(r(view.extractDataDomain("x"))).toEqual([123, 123])
|
|
99
|
+
);
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
test("Extracts domain from the data", () => {
|
|
103
|
+
const spec = {
|
|
104
|
+
data: dataSpec,
|
|
105
|
+
mark: "point",
|
|
106
|
+
encoding: {
|
|
107
|
+
x: { field: "a", type: "quantitative" },
|
|
108
|
+
y: { field: "a", type: "quantitative" },
|
|
109
|
+
},
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
return createAndInitialize(spec, UnitView).then((view) =>
|
|
113
|
+
expect(r(view.extractDataDomain("y"))).toEqual([1, 3])
|
|
114
|
+
);
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
test("Extracts domain from the data when a secondary channel is being used", () => {
|
|
118
|
+
const spec = {
|
|
119
|
+
data: dataSpec,
|
|
120
|
+
mark: "rect",
|
|
121
|
+
encoding: {
|
|
122
|
+
x: { field: "a", type: "quantitative" },
|
|
123
|
+
y: { field: "a", type: "quantitative" },
|
|
124
|
+
y2: { field: "b", type: "quantitative" },
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
return createAndInitialize(spec, UnitView).then((view) =>
|
|
129
|
+
expect(r(view.extractDataDomain("y"))).toEqual([1, 5])
|
|
130
|
+
);
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
describe("Utility methods", () => {
|
|
135
|
+
test("BaseUrl is handled correctly", async () => {
|
|
136
|
+
createAndInitialize(
|
|
137
|
+
{
|
|
138
|
+
layer: [],
|
|
139
|
+
},
|
|
140
|
+
LayerView
|
|
141
|
+
).then((view) => expect(view.getBaseUrl()).toBeUndefined());
|
|
142
|
+
|
|
143
|
+
await createAndInitialize(
|
|
144
|
+
{
|
|
145
|
+
baseUrl: "blaa",
|
|
146
|
+
layer: [],
|
|
147
|
+
},
|
|
148
|
+
LayerView
|
|
149
|
+
).then((view) => expect(view.getBaseUrl()).toEqual("blaa"));
|
|
150
|
+
|
|
151
|
+
await createAndInitialize(
|
|
152
|
+
{
|
|
153
|
+
baseUrl: "https://site.com",
|
|
154
|
+
layer: [],
|
|
155
|
+
},
|
|
156
|
+
LayerView
|
|
157
|
+
).then((view) => expect(view.getBaseUrl()).toEqual("https://site.com"));
|
|
158
|
+
|
|
159
|
+
await createAndInitialize(
|
|
160
|
+
{
|
|
161
|
+
baseUrl: "https://site.com",
|
|
162
|
+
layer: [
|
|
163
|
+
{
|
|
164
|
+
baseUrl: "blaa",
|
|
165
|
+
layer: [],
|
|
166
|
+
},
|
|
167
|
+
],
|
|
168
|
+
},
|
|
169
|
+
LayerView
|
|
170
|
+
).then((view) =>
|
|
171
|
+
expect(view.children[0].getBaseUrl()).toEqual(
|
|
172
|
+
"https://site.com/blaa"
|
|
173
|
+
)
|
|
174
|
+
);
|
|
175
|
+
|
|
176
|
+
await createAndInitialize(
|
|
177
|
+
{
|
|
178
|
+
baseUrl: "https://site.com",
|
|
179
|
+
layer: [
|
|
180
|
+
{
|
|
181
|
+
baseUrl: "https://another-site.com",
|
|
182
|
+
layer: [],
|
|
183
|
+
},
|
|
184
|
+
],
|
|
185
|
+
},
|
|
186
|
+
LayerView
|
|
187
|
+
).then((view) =>
|
|
188
|
+
expect(view.children[0].getBaseUrl()).toEqual(
|
|
189
|
+
"https://another-site.com"
|
|
190
|
+
)
|
|
191
|
+
);
|
|
192
|
+
|
|
193
|
+
await createAndInitialize(
|
|
194
|
+
{
|
|
195
|
+
baseUrl: "https://site.com",
|
|
196
|
+
layer: [
|
|
197
|
+
{
|
|
198
|
+
layer: [
|
|
199
|
+
{
|
|
200
|
+
baseUrl: "blaa",
|
|
201
|
+
layer: [],
|
|
202
|
+
},
|
|
203
|
+
],
|
|
204
|
+
},
|
|
205
|
+
],
|
|
206
|
+
},
|
|
207
|
+
LayerView
|
|
208
|
+
).then((view) =>
|
|
209
|
+
expect(view.children[0].children[0].getBaseUrl()).toEqual(
|
|
210
|
+
"https://site.com/blaa"
|
|
211
|
+
)
|
|
212
|
+
);
|
|
213
|
+
});
|
|
214
|
+
});
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {ViewSpec} spec
|
|
4
|
+
* @returns {spec is UnitSpec}
|
|
5
|
+
*/
|
|
6
|
+
export function isUnitSpec(spec: import("../spec/view").ViewSpec): spec is import("../spec/view").UnitSpec;
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* @param {ViewSpec} spec
|
|
10
|
+
* @returns {spec is LayerSpec}
|
|
11
|
+
*/
|
|
12
|
+
export function isLayerSpec(spec: import("../spec/view").ViewSpec): spec is import("../spec/view").LayerSpec;
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @param {ViewSpec} spec
|
|
16
|
+
* @returns {spec is LayerSpec}
|
|
17
|
+
*/
|
|
18
|
+
export function isFacetSpec(spec: import("../spec/view").ViewSpec): spec is import("../spec/view").LayerSpec;
|
|
19
|
+
/**
|
|
20
|
+
*
|
|
21
|
+
* @param {ViewSpec} spec
|
|
22
|
+
* @returns {spec is import("../spec/view").AggregateSamplesSpec}
|
|
23
|
+
*/
|
|
24
|
+
export function isAggregateSamplesSpec(spec: import("../spec/view").ViewSpec): spec is import("../spec/view").AggregateSamplesSpec;
|
|
25
|
+
/**
|
|
26
|
+
*
|
|
27
|
+
* @param {object} spec
|
|
28
|
+
* @returns {spec is ImportSpec}
|
|
29
|
+
*/
|
|
30
|
+
export function isImportSpec(spec: object): spec is ImportSpec;
|
|
31
|
+
/**
|
|
32
|
+
*
|
|
33
|
+
* @param {ViewSpec} spec
|
|
34
|
+
* @returns {spec is VConcatSpec}
|
|
35
|
+
*/
|
|
36
|
+
export function isVConcatSpec(spec: import("../spec/view").ViewSpec): spec is import("../spec/view").VConcatSpec;
|
|
37
|
+
/**
|
|
38
|
+
*
|
|
39
|
+
* @param {ViewSpec} spec
|
|
40
|
+
* @returns {spec is HConcatSpec}
|
|
41
|
+
*/
|
|
42
|
+
export function isHConcatSpec(spec: import("../spec/view").ViewSpec): spec is HConcatSpec;
|
|
43
|
+
/**
|
|
44
|
+
*
|
|
45
|
+
* @param {ViewSpec} spec
|
|
46
|
+
* @returns {spec is ConcatSpec}
|
|
47
|
+
*/
|
|
48
|
+
export function isConcatSpec(spec: import("../spec/view").ViewSpec): spec is import("../spec/view").ConcatSpec;
|
|
49
|
+
export class ViewFactory {
|
|
50
|
+
/** @type {{specGuard: SpecGuard, factory: Factory}[]} */
|
|
51
|
+
types: {
|
|
52
|
+
specGuard: (spec: import("../spec/view").ViewSpec) => boolean;
|
|
53
|
+
factory: (spec: import("../spec/view").ViewSpec, context: import("../types/viewContext").default, layoutParent?: import("./containerView").default, dataParent?: import("./view").default, defaultName?: string) => View;
|
|
54
|
+
}[];
|
|
55
|
+
/**
|
|
56
|
+
* @param {SpecGuard} specGuard
|
|
57
|
+
* @param {Factory} factory
|
|
58
|
+
*/
|
|
59
|
+
addViewType(specGuard: (spec: import("../spec/view").ViewSpec) => boolean, factory: (spec: import("../spec/view").ViewSpec, context: import("../types/viewContext").default, layoutParent?: import("./containerView").default, dataParent?: import("./view").default, defaultName?: string) => View): void;
|
|
60
|
+
/**
|
|
61
|
+
* @param {ViewSpec} spec
|
|
62
|
+
* @param {ViewContext} context
|
|
63
|
+
* @param {import("./containerView").default} [layoutParent]
|
|
64
|
+
* @param {import("./view").default} [dataParent]
|
|
65
|
+
* @param {string} [defaultName]
|
|
66
|
+
*/
|
|
67
|
+
createView(spec: import("../spec/view").ViewSpec, context: import("../types/viewContext").default, layoutParent?: import("./containerView").default, dataParent?: import("./view").default, defaultName?: string): View;
|
|
68
|
+
/**
|
|
69
|
+
*
|
|
70
|
+
* @param {ViewSpec} spec
|
|
71
|
+
* @returns {spec is ViewSpec}
|
|
72
|
+
*/
|
|
73
|
+
isViewSpec(spec: import("../spec/view").ViewSpec): spec is import("../spec/view").ViewSpec;
|
|
74
|
+
}
|
|
75
|
+
import View from "./view";
|
|
76
|
+
//# sourceMappingURL=viewFactory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"viewFactory.d.ts","sourceRoot":"","sources":["../../../src/view/viewFactory.js"],"names":[],"mappings":"AAkGA;;;;GAIG;AACH,2GAEC;AAED;;;;GAIG;AACH,6GAEC;AAED;;;;GAIG;AACH,6GAOC;AAED;;;;GAIG;AACH,mIAMC;AAED;;;;GAIG;AACH,mCAHW,MAAM,sBAKhB;AAED;;;;GAIG;AACH,iHAEC;AAED;;;;GAIG;AACH,0FAEC;AAED;;;;GAIG;AACH,+GAEC;AAxKD;IAaQ,yDAAyD;IACzD;8DAL6B,OAAO;yHAC2B,OAAO,iBAAiB,EAAE,OAAO,eAAe,OAAO,QAAQ,EAAE,OAAO,gBAAgB,MAAM,KAAK,IAAI;QAIvJ;IA0BnB;;;OAGG;IACH,kEAnCiC,OAAO,mHAC2B,OAAO,iBAAiB,EAAE,OAAO,eAAe,OAAO,QAAQ,EAAE,OAAO,gBAAgB,MAAM,KAAK,IAAI,QAoCzK;IAED;;;;;;OAMG;IACH,kHAJW,OAAO,iBAAiB,EAAE,OAAO,eACjC,OAAO,QAAQ,EAAE,OAAO,gBACxB,MAAM,QAkBhB;IAED;;;;OAIG;IACH,2FAQC;CACJ;iBA/FgB,QAAQ"}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
// eslint-disable-next-line no-unused-vars
|
|
2
|
+
import View from "./view";
|
|
3
|
+
|
|
4
|
+
import UnitView from "./unitView";
|
|
5
|
+
import ImportView from "./importView";
|
|
6
|
+
import LayerView from "./layerView";
|
|
7
|
+
import ConcatView from "./concatView";
|
|
8
|
+
import { isArray, isObject, isString } from "vega-util";
|
|
9
|
+
|
|
10
|
+
export class ViewFactory {
|
|
11
|
+
/**
|
|
12
|
+
* @typedef {import("../types/viewContext").default} ViewContext
|
|
13
|
+
* @typedef {import("../spec/view").UnitSpec} UnitSpec
|
|
14
|
+
* @typedef {import("../spec/view").ViewSpec} ViewSpec
|
|
15
|
+
* @typedef {import("../spec/view").LayerSpec} LayerSpec
|
|
16
|
+
* @typedef {import("../spec/view").VConcatSpec} VConcatSpec
|
|
17
|
+
* @typedef {import("../spec/view").ConcatSpec} ConcatSpec
|
|
18
|
+
*
|
|
19
|
+
* @typedef {(spec: ViewSpec) => boolean} SpecGuard
|
|
20
|
+
* @typedef {(spec: ViewSpec, context: ViewContext, layoutParent?: import("./containerView").default, dataParent?: import("./view").default, defaultName?: string) => View} Factory
|
|
21
|
+
*/
|
|
22
|
+
constructor() {
|
|
23
|
+
/** @type {{specGuard: SpecGuard, factory: Factory}[]} */
|
|
24
|
+
this.types = [];
|
|
25
|
+
|
|
26
|
+
const makeDefaultFactory =
|
|
27
|
+
(/** @type {typeof View} */ ViewClass) =>
|
|
28
|
+
/** @type {Factory} */
|
|
29
|
+
(spec, context, layoutParent, dataParent, defaultName) =>
|
|
30
|
+
/** @type {View} */ (
|
|
31
|
+
new ViewClass(
|
|
32
|
+
spec,
|
|
33
|
+
context,
|
|
34
|
+
layoutParent,
|
|
35
|
+
dataParent,
|
|
36
|
+
spec.name ?? defaultName
|
|
37
|
+
)
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
// @ts-expect-error TODO: Fix typing
|
|
41
|
+
this.addViewType(isImportSpec, makeDefaultFactory(ImportView));
|
|
42
|
+
this.addViewType(isLayerSpec, makeDefaultFactory(LayerView));
|
|
43
|
+
this.addViewType(isUnitSpec, makeDefaultFactory(UnitView));
|
|
44
|
+
this.addViewType(isVConcatSpec, makeDefaultFactory(ConcatView));
|
|
45
|
+
this.addViewType(isHConcatSpec, makeDefaultFactory(ConcatView));
|
|
46
|
+
this.addViewType(isConcatSpec, makeDefaultFactory(ConcatView));
|
|
47
|
+
//this.addViewType(isFacetSpec, makeDefaultFactory(FacetView));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* @param {SpecGuard} specGuard
|
|
52
|
+
* @param {Factory} factory
|
|
53
|
+
*/
|
|
54
|
+
addViewType(specGuard, factory) {
|
|
55
|
+
this.types.push({ specGuard, factory });
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* @param {ViewSpec} spec
|
|
60
|
+
* @param {ViewContext} context
|
|
61
|
+
* @param {import("./containerView").default} [layoutParent]
|
|
62
|
+
* @param {import("./view").default} [dataParent]
|
|
63
|
+
* @param {string} [defaultName]
|
|
64
|
+
*/
|
|
65
|
+
createView(spec, context, layoutParent, dataParent, defaultName) {
|
|
66
|
+
const type = this.types.find((type) => type.specGuard(spec));
|
|
67
|
+
if (type) {
|
|
68
|
+
return type.factory(
|
|
69
|
+
spec,
|
|
70
|
+
context,
|
|
71
|
+
layoutParent,
|
|
72
|
+
dataParent,
|
|
73
|
+
defaultName ?? "unnamed"
|
|
74
|
+
);
|
|
75
|
+
} else {
|
|
76
|
+
throw new Error(
|
|
77
|
+
"Invalid spec, cannot figure out the view type from the properties: " +
|
|
78
|
+
JSON.stringify([...Object.keys(spec)])
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
*
|
|
85
|
+
* @param {ViewSpec} spec
|
|
86
|
+
* @returns {spec is ViewSpec}
|
|
87
|
+
*/
|
|
88
|
+
isViewSpec(spec) {
|
|
89
|
+
const matches = this.types.filter((type) => type.specGuard(spec));
|
|
90
|
+
|
|
91
|
+
if (matches.length > 1) {
|
|
92
|
+
throw new Error("Ambiguous spec. Cannot create a view!");
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return matches.length == 1;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
*
|
|
101
|
+
* @param {ViewSpec} spec
|
|
102
|
+
* @returns {spec is UnitSpec}
|
|
103
|
+
*/
|
|
104
|
+
export function isUnitSpec(spec) {
|
|
105
|
+
return "mark" in spec && (isString(spec.mark) || isObject(spec.mark));
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
*
|
|
110
|
+
* @param {ViewSpec} spec
|
|
111
|
+
* @returns {spec is LayerSpec}
|
|
112
|
+
*/
|
|
113
|
+
export function isLayerSpec(spec) {
|
|
114
|
+
return "layer" in spec && isObject(spec.layer);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
*
|
|
119
|
+
* @param {ViewSpec} spec
|
|
120
|
+
* @returns {spec is LayerSpec}
|
|
121
|
+
*/
|
|
122
|
+
export function isFacetSpec(spec) {
|
|
123
|
+
return (
|
|
124
|
+
"facet" in spec &&
|
|
125
|
+
isObject(spec.facet) &&
|
|
126
|
+
"spec" in spec &&
|
|
127
|
+
isObject(spec.spec)
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
*
|
|
133
|
+
* @param {ViewSpec} spec
|
|
134
|
+
* @returns {spec is import("../spec/view").AggregateSamplesSpec}
|
|
135
|
+
*/
|
|
136
|
+
export function isAggregateSamplesSpec(spec) {
|
|
137
|
+
return (
|
|
138
|
+
spec &&
|
|
139
|
+
(isUnitSpec(spec) || isLayerSpec(spec)) &&
|
|
140
|
+
"aggregateSamples" in spec
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
*
|
|
146
|
+
* @param {object} spec
|
|
147
|
+
* @returns {spec is ImportSpec}
|
|
148
|
+
*/
|
|
149
|
+
export function isImportSpec(spec) {
|
|
150
|
+
return "import" in spec;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
*
|
|
155
|
+
* @param {ViewSpec} spec
|
|
156
|
+
* @returns {spec is VConcatSpec}
|
|
157
|
+
*/
|
|
158
|
+
export function isVConcatSpec(spec) {
|
|
159
|
+
return "vconcat" in spec && isArray(spec.vconcat);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
*
|
|
164
|
+
* @param {ViewSpec} spec
|
|
165
|
+
* @returns {spec is HConcatSpec}
|
|
166
|
+
*/
|
|
167
|
+
export function isHConcatSpec(spec) {
|
|
168
|
+
return "hconcat" in spec && isArray(spec.hconcat);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
*
|
|
173
|
+
* @param {ViewSpec} spec
|
|
174
|
+
* @returns {spec is ConcatSpec}
|
|
175
|
+
*/
|
|
176
|
+
export function isConcatSpec(spec) {
|
|
177
|
+
return "concat" in spec && isArray(spec.concat);
|
|
178
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { expect, test } from "vitest";
|
|
2
|
+
import { ViewFactory } from "./viewFactory";
|
|
3
|
+
|
|
4
|
+
test("isViewSpec", () => {
|
|
5
|
+
const factory = new ViewFactory();
|
|
6
|
+
|
|
7
|
+
// @ts-ignore
|
|
8
|
+
expect(factory.isViewSpec({})).toBeFalsy();
|
|
9
|
+
|
|
10
|
+
expect(factory.isViewSpec({ mark: "rect" })).toBeTruthy();
|
|
11
|
+
expect(factory.isViewSpec({ layer: [] })).toBeTruthy();
|
|
12
|
+
expect(factory.isViewSpec({ hconcat: [] })).toBeTruthy();
|
|
13
|
+
expect(factory.isViewSpec({ vconcat: [] })).toBeTruthy();
|
|
14
|
+
expect(factory.isViewSpec({ concat: [] })).toBeTruthy();
|
|
15
|
+
|
|
16
|
+
expect(() => factory.isViewSpec({ mark: "rect", layer: [] })).toThrow();
|
|
17
|
+
});
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {import("../spec/channel").ChannelDef | import("../spec/view").FacetMapping} def
|
|
4
|
+
* @returns {spec is FacetFieldDef}
|
|
5
|
+
*/
|
|
6
|
+
export function isFacetFieldDef(def: import("../spec/channel").ChannelDef | import("../spec/view").FacetMapping): spec is FacetFieldDef;
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* @param {import("../spec/channel").FacetFieldDef | import("../spec/view").FacetMapping} def
|
|
10
|
+
* @returns {spec is FacetMapping}
|
|
11
|
+
*/
|
|
12
|
+
export function isFacetMapping(def: import("../spec/channel").FacetFieldDef | import("../spec/view").FacetMapping): spec is FacetMapping;
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @param {object} config
|
|
16
|
+
* @returns {config is ImportConfig}
|
|
17
|
+
*/
|
|
18
|
+
export function isImportConfig(config: object): config is ImportConfig;
|
|
19
|
+
/**
|
|
20
|
+
* Returns all marks in the order (DFS) they are rendered
|
|
21
|
+
* @param {View} root
|
|
22
|
+
*/
|
|
23
|
+
export function getMarks(root: View): import("../marks/mark").default[];
|
|
24
|
+
/**
|
|
25
|
+
* Returns the nodes of the view hierarchy in depth-first order.
|
|
26
|
+
*
|
|
27
|
+
* @param {View} root
|
|
28
|
+
*/
|
|
29
|
+
export function getFlattenedViews(root: View): View[];
|
|
30
|
+
/**
|
|
31
|
+
* @param {View} root
|
|
32
|
+
*/
|
|
33
|
+
export function resolveScalesAndAxes(root: View): void;
|
|
34
|
+
/**
|
|
35
|
+
* Gives names to zoomable scales that have been pulled to the root. This allows
|
|
36
|
+
* the zoomed domains to be bookmarked without explicitly specifying the names.
|
|
37
|
+
* This only affects the trivial but common cases, e.g., a genome-browser-like
|
|
38
|
+
* view with a shared x scale.
|
|
39
|
+
*
|
|
40
|
+
* @param {View} root
|
|
41
|
+
*/
|
|
42
|
+
export function setImplicitScaleNames(root: View): void;
|
|
43
|
+
/**
|
|
44
|
+
* @param {View} root
|
|
45
|
+
* @param {import("../data/dataFlow").default<View>} [existingFlow] Add data flow
|
|
46
|
+
* graphs to an existing DataFlow object.
|
|
47
|
+
*/
|
|
48
|
+
export function initializeData(root: View, existingFlow?: import("../data/dataFlow").default<View>): Promise<import("../data/dataFlow").default<View>>;
|
|
49
|
+
/**
|
|
50
|
+
*
|
|
51
|
+
* @param {View} view
|
|
52
|
+
*/
|
|
53
|
+
export function findEncodedFields(view: View): {
|
|
54
|
+
view: UnitView;
|
|
55
|
+
channel: import("../spec/channel").Channel;
|
|
56
|
+
field: import("../spec/channel").Field;
|
|
57
|
+
type: import("../spec/channel").Type;
|
|
58
|
+
}[];
|
|
59
|
+
/**
|
|
60
|
+
* @param {import("./view").default} viewRoot
|
|
61
|
+
*/
|
|
62
|
+
export function processImports(viewRoot: import("./view").default): Promise<void>;
|
|
63
|
+
/**
|
|
64
|
+
* @param {function(View, View[]):void} visitor
|
|
65
|
+
*/
|
|
66
|
+
export function stackifyVisitor(visitor: (arg0: View, arg1: View[]) => void): import("./view").Visitor;
|
|
67
|
+
/**
|
|
68
|
+
* Finds the descendants having the given name. The root is included in the search.
|
|
69
|
+
*
|
|
70
|
+
* @param {View} root
|
|
71
|
+
* @param {string} name View name
|
|
72
|
+
* @returns {View[]}
|
|
73
|
+
*/
|
|
74
|
+
export function findDescendantsByPath(root: View, name: string): View[];
|
|
75
|
+
/**
|
|
76
|
+
*
|
|
77
|
+
* @param {View} root
|
|
78
|
+
*/
|
|
79
|
+
export function findUniqueViewNames(root: View): Set<string>;
|
|
80
|
+
/**
|
|
81
|
+
* @param {View} viewRoot
|
|
82
|
+
*/
|
|
83
|
+
export function calculateCanvasSize(viewRoot: View): {
|
|
84
|
+
width: number;
|
|
85
|
+
height: number;
|
|
86
|
+
};
|
|
87
|
+
export function isCustomViewName(name: string): boolean;
|
|
88
|
+
import View from "./view";
|
|
89
|
+
import UnitView from "./unitView";
|
|
90
|
+
//# sourceMappingURL=viewUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"viewUtils.d.ts","sourceRoot":"","sources":["../../../src/view/viewUtils.js"],"names":[],"mappings":"AAYA;;;;GAIG;AACH,qCAHW,OAAO,iBAAiB,EAAE,UAAU,GAAG,OAAO,cAAc,EAAE,YAAY,yBAKpF;AAED;;;;GAIG;AACH,oCAHW,OAAO,iBAAiB,EAAE,aAAa,GAAG,OAAO,cAAc,EAAE,YAAY,wBAQvF;AAED;;;;GAIG;AACH,uCAHW,MAAM,0BAKhB;AAED;;;GAGG;AACH,+BAFW,IAAI,qCAMd;AAED;;;;GAIG;AACH,wCAFW,IAAI,UASd;AAED;;GAEG;AACH,2CAFW,IAAI,QA8Bd;AAED;;;;;;;GAOG;AACH,4CAFW,IAAI,QAUd;AAED;;;;GAIG;AACH,qCAJW,IAAI,iBACJ,OAAO,kBAAkB,EAAE,OAAO,CAAC,IAAI,CAAC,qDAclD;AAED;;;GAGG;AACH,wCAFW,IAAI;UAGO,QAAQ;aAAW,OAAO,iBAAiB,EAAE,OAAO;WAAS,OAAO,iBAAiB,EAAE,KAAK;UAAQ,OAAO,iBAAiB,EAAE,IAAI;IAqBvJ;AAqCD;;GAEG;AACH,yCAFW,OAAO,QAAQ,EAAE,OAAO,iBAoClC;AAED;;GAEG;AACH,gDAFoB,IAAI,QAAE,IAAI,EAAE,KAAE,IAAI,4BAkBrC;AAED;;;;;;GAMG;AACH,4CAJW,IAAI,QACJ,MAAM,GACJ,IAAI,EAAE,CAalB;AAED;;;GAGG;AACH,0CAFW,IAAI,eAqBd;AAOD;;GAEG;AACH,8CAFW,IAAI;;;EAgBd;AAnBM,uCAFI,MAAM,WAE0D;iBA5S9B,QAAQ;qBAHhC,YAAY"}
|