@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,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {object} host The object that uses caching
|
|
3
|
+
* @param {any} key string
|
|
4
|
+
* @param {function(key?):T} callable A function that produces a value to be cached
|
|
5
|
+
* @returns {T}
|
|
6
|
+
* @template T
|
|
7
|
+
*/
|
|
8
|
+
export function getCachedOrCall<T>(host: object, key: any, callable: (arg0: any | null) => T): T;
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
* @param {object} host The object that uses caching
|
|
12
|
+
* @param {string} key
|
|
13
|
+
*/
|
|
14
|
+
export function invalidate(host: object, key: string): void;
|
|
15
|
+
/**
|
|
16
|
+
*
|
|
17
|
+
* @param {object} host The object that uses caching
|
|
18
|
+
* @param {string} keyPrefix
|
|
19
|
+
*/
|
|
20
|
+
export function invalidatePrefix(host: object, keyPrefix: string): void;
|
|
21
|
+
/**
|
|
22
|
+
*
|
|
23
|
+
* @param {object} host The object that uses caching
|
|
24
|
+
*/
|
|
25
|
+
export function invalidateAll(host: object): void;
|
|
26
|
+
/**
|
|
27
|
+
* @param {any} host The object that uses caching
|
|
28
|
+
*/
|
|
29
|
+
export function initPropertyCache(host: any): void;
|
|
30
|
+
//# sourceMappingURL=propertyCacher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"propertyCacher.d.ts","sourceRoot":"","sources":["../../../src/utils/propertyCacher.js"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,yCANW,MAAM,OACN,GAAG,wCAYb;AAED;;;;GAIG;AACH,iCAHW,MAAM,OACN,MAAM,QAIhB;AAED;;;;GAIG;AACH,uCAHW,MAAM,aACN,MAAM,QAUhB;AACD;;;GAGG;AACH,oCAFW,MAAM,QAIhB;AAED;;GAEG;AACH,wCAFW,GAAG,QAKb"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
const cacheMapKey = Symbol("cacheMap");
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @param {object} host The object that uses caching
|
|
5
|
+
* @param {any} key string
|
|
6
|
+
* @param {function(key?):T} callable A function that produces a value to be cached
|
|
7
|
+
* @returns {T}
|
|
8
|
+
* @template T
|
|
9
|
+
*/
|
|
10
|
+
export function getCachedOrCall(host, key, callable) {
|
|
11
|
+
let value = getCacheMap(host).get(key);
|
|
12
|
+
if (value === undefined) {
|
|
13
|
+
value = callable(key);
|
|
14
|
+
getCacheMap(host).set(key, value);
|
|
15
|
+
}
|
|
16
|
+
return value;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
*
|
|
21
|
+
* @param {object} host The object that uses caching
|
|
22
|
+
* @param {string} key
|
|
23
|
+
*/
|
|
24
|
+
export function invalidate(host, key) {
|
|
25
|
+
getCacheMap(host).delete(key);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
*
|
|
30
|
+
* @param {object} host The object that uses caching
|
|
31
|
+
* @param {string} keyPrefix
|
|
32
|
+
*/
|
|
33
|
+
export function invalidatePrefix(host, keyPrefix) {
|
|
34
|
+
const m = getCacheMap(host);
|
|
35
|
+
for (const key of m.keys()) {
|
|
36
|
+
if (key.startsWith(keyPrefix)) {
|
|
37
|
+
m.delete(key);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
getCacheMap(host).delete(keyPrefix);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
*
|
|
44
|
+
* @param {object} host The object that uses caching
|
|
45
|
+
*/
|
|
46
|
+
export function invalidateAll(host) {
|
|
47
|
+
getCacheMap(host).clear();
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* @param {any} host The object that uses caching
|
|
52
|
+
*/
|
|
53
|
+
export function initPropertyCache(host) {
|
|
54
|
+
/** @type {Map<string, any>} */
|
|
55
|
+
host[cacheMapKey] = new Map();
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* @param {any} host The object that uses caching
|
|
60
|
+
* @returns {Map<string, any>}
|
|
61
|
+
*/
|
|
62
|
+
function getCacheMap(host) {
|
|
63
|
+
if (host[cacheMapKey]) {
|
|
64
|
+
return host[cacheMapKey];
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
initPropertyCache(host);
|
|
68
|
+
|
|
69
|
+
return host[cacheMapKey];
|
|
70
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { expect, test } from "vitest";
|
|
2
|
+
import { getCachedOrCall, invalidate, invalidateAll } from "./propertyCacher";
|
|
3
|
+
|
|
4
|
+
class TestClass {
|
|
5
|
+
constructor() {
|
|
6
|
+
/** @type {number} */
|
|
7
|
+
this._x;
|
|
8
|
+
/** @type {number} */
|
|
9
|
+
this._y;
|
|
10
|
+
|
|
11
|
+
this._xCalls = 0;
|
|
12
|
+
this._yCalls = 0;
|
|
13
|
+
|
|
14
|
+
this.resetAll();
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
get x() {
|
|
18
|
+
return getCachedOrCall(this, "x", () => {
|
|
19
|
+
this._xCalls++;
|
|
20
|
+
return this._x;
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
set x(x) {
|
|
25
|
+
this._x = x;
|
|
26
|
+
invalidate(this, "x");
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
get y() {
|
|
30
|
+
return getCachedOrCall(this, "y", () => {
|
|
31
|
+
this._yCalls++;
|
|
32
|
+
return this._y;
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
set y(y) {
|
|
37
|
+
this._y = y;
|
|
38
|
+
invalidate(this, "y");
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
resetAll() {
|
|
42
|
+
this._x = 10;
|
|
43
|
+
this._y = 20;
|
|
44
|
+
invalidateAll(this);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
test("Initial cached get returns correct values and calls callable only once", () => {
|
|
49
|
+
const instance = new TestClass();
|
|
50
|
+
|
|
51
|
+
expect(instance._xCalls).toEqual(0);
|
|
52
|
+
expect(instance.x).toEqual(10);
|
|
53
|
+
expect(instance._xCalls).toEqual(1);
|
|
54
|
+
expect(instance.x).toEqual(10);
|
|
55
|
+
expect(instance._xCalls).toEqual(1);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
test("Invalidate invalidates", () => {
|
|
59
|
+
const instance = new TestClass();
|
|
60
|
+
|
|
61
|
+
expect(instance._xCalls).toEqual(0);
|
|
62
|
+
expect(instance.x).toEqual(10);
|
|
63
|
+
expect(instance._xCalls).toEqual(1);
|
|
64
|
+
|
|
65
|
+
instance.x = 123;
|
|
66
|
+
expect(instance._xCalls).toEqual(1);
|
|
67
|
+
|
|
68
|
+
expect(instance.x).toEqual(123);
|
|
69
|
+
expect(instance._xCalls).toEqual(2);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
test("InvalidateAll invalidates everything", () => {
|
|
73
|
+
const instance = new TestClass();
|
|
74
|
+
|
|
75
|
+
instance.x = 123;
|
|
76
|
+
instance.y = 321;
|
|
77
|
+
|
|
78
|
+
expect(instance.x).toEqual(123);
|
|
79
|
+
expect(instance.y).toEqual(321);
|
|
80
|
+
|
|
81
|
+
instance.resetAll();
|
|
82
|
+
|
|
83
|
+
expect(instance.x).toEqual(10);
|
|
84
|
+
expect(instance.y).toEqual(20);
|
|
85
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Coalesces properties. Allows for creating chains of defaults without
|
|
3
|
+
* using object destructuring, which may generate piles of garbage for GC.
|
|
4
|
+
*
|
|
5
|
+
* Still WIP.
|
|
6
|
+
* TODO: Efficient computed defaults.
|
|
7
|
+
* TODO: Make sense of the types
|
|
8
|
+
*
|
|
9
|
+
* @param {...function():T} sources
|
|
10
|
+
* @returns {T}
|
|
11
|
+
*
|
|
12
|
+
* @template {Record<string | symbol, any>} [T=object]
|
|
13
|
+
*/
|
|
14
|
+
export default function coalesceProperties<T extends Record<string | symbol, any> = object>(...sources: (() => T)[]): T;
|
|
15
|
+
//# sourceMappingURL=propertyCoalescer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"propertyCoalescer.d.ts","sourceRoot":"","sources":["../../../src/utils/propertyCoalescer.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,wHA4BC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Coalesces properties. Allows for creating chains of defaults without
|
|
3
|
+
* using object destructuring, which may generate piles of garbage for GC.
|
|
4
|
+
*
|
|
5
|
+
* Still WIP.
|
|
6
|
+
* TODO: Efficient computed defaults.
|
|
7
|
+
* TODO: Make sense of the types
|
|
8
|
+
*
|
|
9
|
+
* @param {...function():T} sources
|
|
10
|
+
* @returns {T}
|
|
11
|
+
*
|
|
12
|
+
* @template {Record<string | symbol, any>} [T=object]
|
|
13
|
+
*/
|
|
14
|
+
export default function coalesceProperties(...sources) {
|
|
15
|
+
/** @type {ProxyHandler<T>} */
|
|
16
|
+
const handler = {
|
|
17
|
+
get(_target, prop, _receiver) {
|
|
18
|
+
for (const source of sources) {
|
|
19
|
+
const props = source();
|
|
20
|
+
const value = props[prop];
|
|
21
|
+
if (value !== undefined) {
|
|
22
|
+
return value;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return undefined;
|
|
26
|
+
},
|
|
27
|
+
|
|
28
|
+
// @ts-ignore
|
|
29
|
+
has(target, prop, _receiver) {
|
|
30
|
+
for (const source of sources) {
|
|
31
|
+
const props = source();
|
|
32
|
+
if (prop in props) {
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return false;
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
// @ts-ignore
|
|
41
|
+
return new Proxy({}, handler);
|
|
42
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { expect, test } from "vitest";
|
|
2
|
+
import coalesceProperties from "./propertyCoalescer";
|
|
3
|
+
|
|
4
|
+
test("CoalesceProperties works as expected", () => {
|
|
5
|
+
const defaults = { a: 10, b: 11 };
|
|
6
|
+
const props = { a: 1, c: 2 };
|
|
7
|
+
|
|
8
|
+
const coalesced = coalesceProperties(
|
|
9
|
+
() => props,
|
|
10
|
+
() => defaults
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
expect(coalesced.a).toEqual(1);
|
|
14
|
+
expect(coalesced.b).toEqual(11);
|
|
15
|
+
expect(coalesced.c).toEqual(2);
|
|
16
|
+
expect(coalesced.undef).toBeUndefined();
|
|
17
|
+
|
|
18
|
+
expect("a" in coalesced).toBeTruthy();
|
|
19
|
+
expect("b" in coalesced).toBeTruthy();
|
|
20
|
+
expect("c" in coalesced).toBeTruthy();
|
|
21
|
+
expect("undef" in coalesced).toBeFalsy();
|
|
22
|
+
});
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A simple data structure for keeping track of unreserved space in one dimension.
|
|
3
|
+
* Doesn't do any balancing, reservations must be done in random order.
|
|
4
|
+
* Uses arrays to minimize object allocation and burden on GC.
|
|
5
|
+
*
|
|
6
|
+
* Note: this data structure appears to have some similarities to "Segment Tree".
|
|
7
|
+
* TODO: Balancing ideas: https://cp-algorithms.com/data_structures/segment_tree.html
|
|
8
|
+
*/
|
|
9
|
+
export default class ReservationMap {
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
* @param {number} maxSize Max number of free slots that can be tracked
|
|
13
|
+
* @param {number} [lowerLimit]
|
|
14
|
+
* @param {number} [upperLimit]
|
|
15
|
+
*/
|
|
16
|
+
constructor(maxSize: number, lowerLimit?: number, upperLimit?: number);
|
|
17
|
+
maxSize: number;
|
|
18
|
+
lowerLimit: number;
|
|
19
|
+
upperLimit: number;
|
|
20
|
+
lowerLimits: Float64Array;
|
|
21
|
+
upperLimits: Float64Array;
|
|
22
|
+
lowerChildren: Int32Array;
|
|
23
|
+
upperChildren: Int32Array;
|
|
24
|
+
reset(): void;
|
|
25
|
+
n: number;
|
|
26
|
+
/**
|
|
27
|
+
*
|
|
28
|
+
* @param {number} lower
|
|
29
|
+
* @param {number} upper
|
|
30
|
+
* @param {number} i
|
|
31
|
+
* @returns {number} Node index or -1 if not found
|
|
32
|
+
*/
|
|
33
|
+
_findSlot(lower: number, upper: number, i?: number): number;
|
|
34
|
+
/**
|
|
35
|
+
*
|
|
36
|
+
* @param {number} lower
|
|
37
|
+
* @param {number} upper
|
|
38
|
+
* @returns {boolean} true if reservation succeeded
|
|
39
|
+
*/
|
|
40
|
+
reserve(lower: number, upper: number): boolean;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=reservationMap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reservationMap.d.ts","sourceRoot":"","sources":["../../../src/utils/reservationMap.js"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH;IACI;;;;;OAKG;IACH,qBAJW,MAAM,eACN,MAAM,eACN,MAAM,EAehB;IAZG,gBAAsB;IACtB,mBAA4B;IAC5B,mBAA4B;IAI5B,0BAA0C;IAC1C,0BAA0C;IAC1C,0BAA0C;IAC1C,0BAA0C;IAK9C,cAUC;IAHG,UAAU;IAKd;;;;;;OAMG;IACH,iBALW,MAAM,SACN,MAAM,MACN,MAAM,GACJ,MAAM,CAkBlB;IAED;;;;;OAKG;IACH,eAJW,MAAM,SACN,MAAM,GACJ,OAAO,CA8BnB;CACJ"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A simple data structure for keeping track of unreserved space in one dimension.
|
|
3
|
+
* Doesn't do any balancing, reservations must be done in random order.
|
|
4
|
+
* Uses arrays to minimize object allocation and burden on GC.
|
|
5
|
+
*
|
|
6
|
+
* Note: this data structure appears to have some similarities to "Segment Tree".
|
|
7
|
+
* TODO: Balancing ideas: https://cp-algorithms.com/data_structures/segment_tree.html
|
|
8
|
+
*/
|
|
9
|
+
export default class ReservationMap {
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
* @param {number} maxSize Max number of free slots that can be tracked
|
|
13
|
+
* @param {number} [lowerLimit]
|
|
14
|
+
* @param {number} [upperLimit]
|
|
15
|
+
*/
|
|
16
|
+
constructor(maxSize, lowerLimit = -Infinity, upperLimit = Infinity) {
|
|
17
|
+
this.maxSize = maxSize;
|
|
18
|
+
this.lowerLimit = lowerLimit;
|
|
19
|
+
this.upperLimit = upperLimit;
|
|
20
|
+
|
|
21
|
+
const count = this.maxSize * 2 + 1; // TODO: The factor could be lower
|
|
22
|
+
|
|
23
|
+
this.lowerLimits = new Float64Array(count);
|
|
24
|
+
this.upperLimits = new Float64Array(count);
|
|
25
|
+
this.lowerChildren = new Int32Array(count);
|
|
26
|
+
this.upperChildren = new Int32Array(count);
|
|
27
|
+
|
|
28
|
+
this.reset();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
reset() {
|
|
32
|
+
this.lowerLimits.fill(0);
|
|
33
|
+
this.upperLimits.fill(0);
|
|
34
|
+
this.lowerChildren.fill(0);
|
|
35
|
+
this.upperChildren.fill(0);
|
|
36
|
+
|
|
37
|
+
// Initial node
|
|
38
|
+
this.n = 1;
|
|
39
|
+
this.lowerLimits[0] = this.lowerLimit;
|
|
40
|
+
this.upperLimits[0] = this.upperLimit;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
*
|
|
45
|
+
* @param {number} lower
|
|
46
|
+
* @param {number} upper
|
|
47
|
+
* @param {number} i
|
|
48
|
+
* @returns {number} Node index or -1 if not found
|
|
49
|
+
*/
|
|
50
|
+
_findSlot(lower, upper, i = 0) {
|
|
51
|
+
if (lower >= this.lowerLimits[i] && upper <= this.upperLimits[i]) {
|
|
52
|
+
const lowerChild = this.lowerChildren[i];
|
|
53
|
+
if (!lowerChild) {
|
|
54
|
+
// Node has no children, found a free slot
|
|
55
|
+
return i;
|
|
56
|
+
} else {
|
|
57
|
+
const lowerResult = this._findSlot(lower, upper, lowerChild);
|
|
58
|
+
if (lowerResult >= 0) {
|
|
59
|
+
return lowerResult;
|
|
60
|
+
}
|
|
61
|
+
return this._findSlot(lower, upper, this.upperChildren[i]);
|
|
62
|
+
}
|
|
63
|
+
} else {
|
|
64
|
+
return -1;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
*
|
|
70
|
+
* @param {number} lower
|
|
71
|
+
* @param {number} upper
|
|
72
|
+
* @returns {boolean} true if reservation succeeded
|
|
73
|
+
*/
|
|
74
|
+
reserve(lower, upper) {
|
|
75
|
+
if (upper - lower <= 0) {
|
|
76
|
+
throw new Error("Cannot reserve an empty or negative-size slot!");
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (this.n + 1 > this.lowerLimits.length) {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const i = this._findSlot(lower, upper);
|
|
84
|
+
if (i < 0) {
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// TODO: if the requested range is connected to an edge of the free slot,
|
|
89
|
+
// adjust the found slot instead
|
|
90
|
+
|
|
91
|
+
const lowerIndex = this.n++;
|
|
92
|
+
const upperIndex = this.n++;
|
|
93
|
+
|
|
94
|
+
this.lowerLimits[lowerIndex] = this.lowerLimits[i];
|
|
95
|
+
this.upperLimits[lowerIndex] = lower;
|
|
96
|
+
this.lowerLimits[upperIndex] = upper;
|
|
97
|
+
this.upperLimits[upperIndex] = this.upperLimits[i];
|
|
98
|
+
this.lowerChildren[i] = lowerIndex;
|
|
99
|
+
this.upperChildren[i] = upperIndex;
|
|
100
|
+
|
|
101
|
+
return true;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { expect, test } from "vitest";
|
|
2
|
+
import ReservationMap from "./reservationMap";
|
|
3
|
+
|
|
4
|
+
test("ReservationMap works correctly", () => {
|
|
5
|
+
const m = new ReservationMap(20);
|
|
6
|
+
|
|
7
|
+
expect(m.reserve(0, 3)).toBeTruthy();
|
|
8
|
+
expect(m.reserve(15, 17)).toBeTruthy();
|
|
9
|
+
expect(m.reserve(5, 11)).toBeTruthy();
|
|
10
|
+
expect(m.reserve(19, 22)).toBeTruthy();
|
|
11
|
+
expect(m.reserve(23, 26)).toBeTruthy();
|
|
12
|
+
expect(m.reserve(12, 13)).toBeTruthy();
|
|
13
|
+
expect(m.reserve(13, 14)).toBeTruthy();
|
|
14
|
+
expect(m.reserve(4, 5)).toBeTruthy();
|
|
15
|
+
|
|
16
|
+
expect(m.reserve(6, 8)).toBeFalsy();
|
|
17
|
+
expect(m.reserve(10, 13)).toBeFalsy();
|
|
18
|
+
expect(m.reserve(-2, 1)).toBeFalsy();
|
|
19
|
+
expect(m.reserve(25, 28)).toBeFalsy();
|
|
20
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Like scaleIdentity but passes everything thru. Doesn't support domains or ranges or anything.
|
|
3
|
+
*/
|
|
4
|
+
export default function scaleNull(): {
|
|
5
|
+
(x: any): any;
|
|
6
|
+
/** @param {any} x */
|
|
7
|
+
invert(x: any): any;
|
|
8
|
+
copy: typeof scaleNull;
|
|
9
|
+
/** Keep vega-scale happy */
|
|
10
|
+
invertRange(): void;
|
|
11
|
+
type: string;
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=scaleNull.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scaleNull.d.ts","sourceRoot":"","sources":["../../../src/utils/scaleNull.js"],"names":[],"mappings":"AAAA;;GAEG;AACH;QACgB,GAAG;IAGf,qBAAqB;cAAT,GAAG;;IAKf,4BAA4B;;;EAQ/B"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Like scaleIdentity but passes everything thru. Doesn't support domains or ranges or anything.
|
|
3
|
+
*/
|
|
4
|
+
export default function scaleNull() {
|
|
5
|
+
/** @param {any} x */
|
|
6
|
+
const scale = (x) => x;
|
|
7
|
+
|
|
8
|
+
/** @param {any} x */
|
|
9
|
+
scale.invert = (x) => x;
|
|
10
|
+
|
|
11
|
+
scale.copy = scaleNull;
|
|
12
|
+
|
|
13
|
+
/** Keep vega-scale happy */
|
|
14
|
+
scale.invertRange = () => {
|
|
15
|
+
//
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
scale.type = "null";
|
|
19
|
+
|
|
20
|
+
return scale;
|
|
21
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {Set<T>} set
|
|
3
|
+
* @param {Set<T>} subset
|
|
4
|
+
* @template T
|
|
5
|
+
*/
|
|
6
|
+
export function isSuperset<T>(set: Set<T>, subset: Set<T>): boolean;
|
|
7
|
+
/**
|
|
8
|
+
* @param {Set<T>} setA
|
|
9
|
+
* @param {Set<T>} setB
|
|
10
|
+
* @template T
|
|
11
|
+
*/
|
|
12
|
+
export function union<T>(setA: Set<T>, setB: Set<T>): Set<T>;
|
|
13
|
+
/**
|
|
14
|
+
* @param {Set<T>} setA
|
|
15
|
+
* @param {Set<T>} setB
|
|
16
|
+
* @template T
|
|
17
|
+
*/
|
|
18
|
+
export function intersection<T>(setA: Set<T>, setB: Set<T>): Set<any>;
|
|
19
|
+
/**
|
|
20
|
+
* @param {Set<T>} setA
|
|
21
|
+
* @param {Set<T>} setB
|
|
22
|
+
* @template T
|
|
23
|
+
*/
|
|
24
|
+
export function symmetricDifference<T>(setA: Set<T>, setB: Set<T>): Set<T>;
|
|
25
|
+
/**
|
|
26
|
+
* @param {Set<T>} setA
|
|
27
|
+
* @param {Set<T>} setB
|
|
28
|
+
* @template T
|
|
29
|
+
*/
|
|
30
|
+
export function difference<T>(setA: Set<T>, setB: Set<T>): Set<T>;
|
|
31
|
+
//# sourceMappingURL=setOperations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setOperations.d.ts","sourceRoot":"","sources":["../../../src/utils/setOperations.js"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,oEAOC;AAED;;;;GAIG;AACH,6DAMC;AAED;;;;GAIG;AACH,sEAQC;AAED;;;;GAIG;AACH,2EAUC;AAED;;;;GAIG;AACH,kEAMC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Adapted from: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set#implementing_basic_set_operations
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @param {Set<T>} set
|
|
7
|
+
* @param {Set<T>} subset
|
|
8
|
+
* @template T
|
|
9
|
+
*/
|
|
10
|
+
export function isSuperset(set, subset) {
|
|
11
|
+
for (let elem of subset) {
|
|
12
|
+
if (!set.has(elem)) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @param {Set<T>} setA
|
|
21
|
+
* @param {Set<T>} setB
|
|
22
|
+
* @template T
|
|
23
|
+
*/
|
|
24
|
+
export function union(setA, setB) {
|
|
25
|
+
let _union = new Set(setA);
|
|
26
|
+
for (let elem of setB) {
|
|
27
|
+
_union.add(elem);
|
|
28
|
+
}
|
|
29
|
+
return _union;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @param {Set<T>} setA
|
|
34
|
+
* @param {Set<T>} setB
|
|
35
|
+
* @template T
|
|
36
|
+
*/
|
|
37
|
+
export function intersection(setA, setB) {
|
|
38
|
+
let _intersection = new Set();
|
|
39
|
+
for (let elem of setB) {
|
|
40
|
+
if (setA.has(elem)) {
|
|
41
|
+
_intersection.add(elem);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return _intersection;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* @param {Set<T>} setA
|
|
49
|
+
* @param {Set<T>} setB
|
|
50
|
+
* @template T
|
|
51
|
+
*/
|
|
52
|
+
export function symmetricDifference(setA, setB) {
|
|
53
|
+
let _difference = new Set(setA);
|
|
54
|
+
for (let elem of setB) {
|
|
55
|
+
if (_difference.has(elem)) {
|
|
56
|
+
_difference.delete(elem);
|
|
57
|
+
} else {
|
|
58
|
+
_difference.add(elem);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return _difference;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* @param {Set<T>} setA
|
|
66
|
+
* @param {Set<T>} setB
|
|
67
|
+
* @template T
|
|
68
|
+
*/
|
|
69
|
+
export function difference(setA, setB) {
|
|
70
|
+
let _difference = new Set(setA);
|
|
71
|
+
for (let elem of setB) {
|
|
72
|
+
_difference.delete(elem);
|
|
73
|
+
}
|
|
74
|
+
return _difference;
|
|
75
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"smoothstep.d.ts","sourceRoot":"","sources":["../../../src/utils/smoothstep.js"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,0CAJW,MAAM,SACN,MAAM,KACN,MAAM,UAMhB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* https://codeburst.io/throttling-and-debouncing-in-javascript-b01cad5c8edf
|
|
3
|
+
*
|
|
4
|
+
* @param {function} func
|
|
5
|
+
* @param {number} limit
|
|
6
|
+
*/
|
|
7
|
+
export default function throttle(func: Function, limit: number): (...args: any[]) => void;
|
|
8
|
+
//# sourceMappingURL=throttle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"throttle.d.ts","sourceRoot":"","sources":["../../../src/utils/throttle.js"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wDAFW,MAAM,4BA2BhB"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/* eslint-disable consistent-this */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* https://codeburst.io/throttling-and-debouncing-in-javascript-b01cad5c8edf
|
|
5
|
+
*
|
|
6
|
+
* @param {function} func
|
|
7
|
+
* @param {number} limit
|
|
8
|
+
*/
|
|
9
|
+
export default function throttle(func, limit) {
|
|
10
|
+
/** @type {number} */
|
|
11
|
+
let lastFunc;
|
|
12
|
+
|
|
13
|
+
/** @type {number} */
|
|
14
|
+
let lastRan;
|
|
15
|
+
|
|
16
|
+
return function () {
|
|
17
|
+
// eslint-disable-next-line no-invalid-this
|
|
18
|
+
const context = this;
|
|
19
|
+
// eslint-disable-next-line prefer-rest-params
|
|
20
|
+
const args = arguments;
|
|
21
|
+
if (!lastRan) {
|
|
22
|
+
func.apply(context, args);
|
|
23
|
+
lastRan = Date.now();
|
|
24
|
+
} else {
|
|
25
|
+
clearTimeout(lastFunc);
|
|
26
|
+
lastFunc = window.setTimeout(function () {
|
|
27
|
+
if (Date.now() - lastRan >= limit) {
|
|
28
|
+
func.apply(context, args);
|
|
29
|
+
lastRan = Date.now();
|
|
30
|
+
}
|
|
31
|
+
}, limit - (Date.now() - lastRan));
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
}
|