@genome-spy/core 0.77.0 → 0.79.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle/{browser-KWU9rWZT.js → browser-CETrb2cm.js} +53 -33
- package/dist/bundle/esm-BdLYkz-m.js +248 -0
- package/dist/bundle/esm-BwiDsqSb.js +1367 -0
- package/dist/bundle/esm-CDFd1cjk.js +441 -0
- package/dist/bundle/{esm-CRMf_I9V.js → esm-CTUHLDbv.js} +30 -30
- package/dist/bundle/esm-Cx-EbkOj.js +1221 -0
- package/dist/bundle/esm-DlYGqi79.js +128 -0
- package/dist/bundle/{esm-BygJiwh0.js → esm-k9p3oHkt.js} +133 -158
- package/dist/bundle/{esm-CT3ygiMq.js → esm-zAZJQO6D.js} +226 -212
- package/dist/bundle/index.es.js +14102 -10810
- package/dist/bundle/index.js +109 -95
- package/dist/bundle/{parquetRead-DG_-F5j5.js → parquetRead-Cad1SOVV.js} +473 -399
- package/dist/schema.json +23788 -11049
- package/dist/src/config/axisConfig.d.ts +2 -2
- package/dist/src/config/axisConfig.d.ts.map +1 -1
- package/dist/src/config/axisConfig.js +28 -44
- package/dist/src/config/configLayers.d.ts +45 -0
- package/dist/src/config/configLayers.d.ts.map +1 -0
- package/dist/src/config/configLayers.js +110 -0
- package/dist/src/config/defaultConfig.d.ts.map +1 -1
- package/dist/src/config/defaultConfig.js +8 -1
- package/dist/src/config/defaults/legendDefaults.d.ts +14 -0
- package/dist/src/config/defaults/legendDefaults.d.ts.map +1 -0
- package/dist/src/config/defaults/legendDefaults.js +46 -0
- package/dist/src/config/defaults/titleDefaults.d.ts.map +1 -1
- package/dist/src/config/defaults/titleDefaults.js +26 -18
- package/dist/src/config/legendConfig.d.ts +11 -0
- package/dist/src/config/legendConfig.d.ts.map +1 -0
- package/dist/src/config/legendConfig.js +63 -0
- package/dist/src/config/styleUtils.d.ts +8 -2
- package/dist/src/config/styleUtils.d.ts.map +1 -1
- package/dist/src/config/styleUtils.js +25 -1
- package/dist/src/config/themes.d.ts.map +1 -1
- package/dist/src/config/themes.js +21 -2
- package/dist/src/config/titleConfig.d.ts.map +1 -1
- package/dist/src/config/titleConfig.js +2 -18
- package/dist/src/data/collector.d.ts.map +1 -1
- package/dist/src/data/collector.js +40 -18
- package/dist/src/data/flowInit.d.ts +6 -0
- package/dist/src/data/flowInit.d.ts.map +1 -1
- package/dist/src/data/flowInit.js +1 -1
- package/dist/src/data/flowNode.d.ts +32 -0
- package/dist/src/data/flowNode.d.ts.map +1 -1
- package/dist/src/data/flowNode.js +59 -0
- package/dist/src/data/sources/lazy/bamSource.d.ts +0 -1
- package/dist/src/data/sources/lazy/bamSource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/bamSource.js +39 -30
- package/dist/src/data/sources/lazy/bigBedSource.d.ts +0 -10
- package/dist/src/data/sources/lazy/bigBedSource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/bigBedSource.js +127 -62
- package/dist/src/data/sources/lazy/bigWigSource.d.ts +2 -2
- package/dist/src/data/sources/lazy/bigWigSource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/bigWigSource.js +234 -81
- package/dist/src/data/sources/lazy/gff3Source.d.ts +7 -3
- package/dist/src/data/sources/lazy/gff3Source.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/gff3Source.js +7 -8
- package/dist/src/data/sources/lazy/indexedFastaSource.d.ts +1 -1
- package/dist/src/data/sources/lazy/indexedFastaSource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/indexedFastaSource.js +28 -19
- package/dist/src/data/sources/lazy/legendEntriesSource.d.ts +24 -0
- package/dist/src/data/sources/lazy/legendEntriesSource.d.ts.map +1 -0
- package/dist/src/data/sources/lazy/legendEntriesSource.js +217 -0
- package/dist/src/data/sources/lazy/legendGradientSource.d.ts +30 -0
- package/dist/src/data/sources/lazy/legendGradientSource.d.ts.map +1 -0
- package/dist/src/data/sources/lazy/legendGradientSource.js +388 -0
- package/dist/src/data/sources/lazy/mockLazySource.d.ts +4 -1
- package/dist/src/data/sources/lazy/mockLazySource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/mockLazySource.js +49 -4
- package/dist/src/data/sources/lazy/registerCoreLazySources.js +2 -0
- package/dist/src/data/sources/lazy/singleAxisWindowedSource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/singleAxisWindowedSource.js +3 -4
- package/dist/src/data/sources/lazy/tabixSource.d.ts +9 -4
- package/dist/src/data/sources/lazy/tabixSource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/tabixSource.js +201 -70
- package/dist/src/data/sources/lazy/tabixTsvSource.d.ts +2 -3
- package/dist/src/data/sources/lazy/tabixTsvSource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/tabixTsvSource.js +14 -12
- package/dist/src/data/sources/lazy/vcfSource.d.ts +7 -3
- package/dist/src/data/sources/lazy/vcfSource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/vcfSource.js +7 -8
- package/dist/src/data/sources/urlDescriptor.d.ts +165 -0
- package/dist/src/data/sources/urlDescriptor.d.ts.map +1 -0
- package/dist/src/data/sources/urlDescriptor.js +473 -0
- package/dist/src/data/sources/urlDescriptorController.d.ts +25 -0
- package/dist/src/data/sources/urlDescriptorController.d.ts.map +1 -0
- package/dist/src/data/sources/urlDescriptorController.js +72 -0
- package/dist/src/data/sources/urlDescriptorState.d.ts +47 -0
- package/dist/src/data/sources/urlDescriptorState.d.ts.map +1 -0
- package/dist/src/data/sources/urlDescriptorState.js +129 -0
- package/dist/src/data/sources/urlSource.d.ts.map +1 -1
- package/dist/src/data/sources/urlSource.js +101 -61
- package/dist/src/data/transforms/packLegendLabels.d.ts +21 -0
- package/dist/src/data/transforms/packLegendLabels.d.ts.map +1 -0
- package/dist/src/data/transforms/packLegendLabels.js +189 -0
- package/dist/src/data/transforms/transformFactory.d.ts.map +1 -1
- package/dist/src/data/transforms/transformFactory.js +4 -0
- package/dist/src/data/transforms/truncateText.d.ts +27 -0
- package/dist/src/data/transforms/truncateText.d.ts.map +1 -0
- package/dist/src/data/transforms/truncateText.js +94 -0
- package/dist/src/debug/dataflowDebugSnapshot.d.ts +58 -0
- package/dist/src/debug/dataflowDebugSnapshot.d.ts.map +1 -0
- package/dist/src/debug/dataflowDebugSnapshot.js +159 -0
- package/dist/src/debug/markDebugSnapshot.d.ts +54 -0
- package/dist/src/debug/markDebugSnapshot.d.ts.map +1 -0
- package/dist/src/debug/markDebugSnapshot.js +100 -0
- package/dist/src/debug/paramDebugSnapshot.d.ts +53 -0
- package/dist/src/debug/paramDebugSnapshot.d.ts.map +1 -0
- package/dist/src/debug/paramDebugSnapshot.js +86 -0
- package/dist/src/debug/resolutionDebugSnapshot.d.ts +155 -0
- package/dist/src/debug/resolutionDebugSnapshot.d.ts.map +1 -0
- package/dist/src/debug/resolutionDebugSnapshot.js +291 -0
- package/dist/src/debug/valuePreview.d.ts +9 -0
- package/dist/src/debug/valuePreview.d.ts.map +1 -0
- package/dist/src/debug/valuePreview.js +57 -0
- package/dist/src/debug/viewDebugSnapshot.d.ts +131 -0
- package/dist/src/debug/viewDebugSnapshot.d.ts.map +1 -0
- package/dist/src/debug/viewDebugSnapshot.js +390 -0
- package/dist/src/embedFactory.d.ts.map +1 -1
- package/dist/src/embedFactory.js +6 -1
- package/dist/src/encoder/encoder.d.ts +2 -2
- package/dist/src/encoder/encoder.d.ts.map +1 -1
- package/dist/src/encoder/encoder.js +5 -4
- package/dist/src/fonts/bmFontManager.d.ts +1 -1
- package/dist/src/fonts/bmFontManager.d.ts.map +1 -1
- package/dist/src/fonts/bmFontManager.js +45 -10
- package/dist/src/fonts/textMetrics.d.ts +69 -0
- package/dist/src/fonts/textMetrics.d.ts.map +1 -0
- package/dist/src/fonts/textMetrics.js +73 -0
- package/dist/src/genomeSpy/headlessBootstrap.d.ts.map +1 -1
- package/dist/src/genomeSpy/headlessBootstrap.js +8 -0
- package/dist/src/genomeSpy/interactionController.d.ts +4 -1
- package/dist/src/genomeSpy/interactionController.d.ts.map +1 -1
- package/dist/src/genomeSpy/interactionController.js +57 -13
- package/dist/src/genomeSpy/renderCoordinator.d.ts.map +1 -1
- package/dist/src/genomeSpy/renderCoordinator.js +25 -3
- package/dist/src/genomeSpy/viewDataInit.d.ts +14 -0
- package/dist/src/genomeSpy/viewDataInit.d.ts.map +1 -1
- package/dist/src/genomeSpy/viewDataInit.js +45 -8
- package/dist/src/genomeSpyBase.d.ts +6 -0
- package/dist/src/genomeSpyBase.d.ts.map +1 -1
- package/dist/src/genomeSpyBase.js +25 -4
- package/dist/src/gl/glslScaleGenerator.d.ts +17 -0
- package/dist/src/gl/glslScaleGenerator.d.ts.map +1 -1
- package/dist/src/gl/glslScaleGenerator.js +39 -2
- package/dist/src/gl/includes/common.glsl.js +1 -1
- package/dist/src/gl/vertexRangeIndex.d.ts.map +1 -1
- package/dist/src/gl/vertexRangeIndex.js +4 -2
- package/dist/src/gl/webGLHelper.d.ts +1 -1
- package/dist/src/gl/webGLHelper.d.ts.map +1 -1
- package/dist/src/gl/webGLHelper.js +13 -8
- package/dist/src/marks/__snapshots__/shaderSnapshot.test.js.snap +140 -3
- package/dist/src/marks/mark.d.ts +47 -4
- package/dist/src/marks/mark.d.ts.map +1 -1
- package/dist/src/marks/mark.js +158 -54
- package/dist/src/marks/point.d.ts.map +1 -1
- package/dist/src/marks/point.js +4 -0
- package/dist/src/marks/point.vertex.glsl.js +1 -1
- package/dist/src/marks/text.d.ts +1 -1
- package/dist/src/marks/text.d.ts.map +1 -1
- package/dist/src/marks/text.js +2 -7
- package/dist/src/marks/text.vertex.glsl.js +1 -1
- package/dist/src/paramRuntime/paramUtils.d.ts +43 -9
- package/dist/src/paramRuntime/paramUtils.d.ts.map +1 -1
- package/dist/src/paramRuntime/paramUtils.js +61 -1
- package/dist/src/paramRuntime/viewParamRuntime.d.ts +32 -0
- package/dist/src/paramRuntime/viewParamRuntime.d.ts.map +1 -1
- package/dist/src/paramRuntime/viewParamRuntime.js +63 -0
- package/dist/src/scales/axisResolution.d.ts +35 -0
- package/dist/src/scales/axisResolution.d.ts.map +1 -1
- package/dist/src/scales/axisResolution.js +115 -7
- package/dist/src/scales/domainExpressions.d.ts +21 -0
- package/dist/src/scales/domainExpressions.d.ts.map +1 -0
- package/dist/src/scales/domainExpressions.js +43 -0
- package/dist/src/scales/domainPlanner.d.ts +12 -1
- package/dist/src/scales/domainPlanner.d.ts.map +1 -1
- package/dist/src/scales/domainPlanner.js +55 -36
- package/dist/src/scales/legendResolution.d.ts +83 -0
- package/dist/src/scales/legendResolution.d.ts.map +1 -0
- package/dist/src/scales/legendResolution.js +461 -0
- package/dist/src/scales/scaleInstanceManager.d.ts +1 -0
- package/dist/src/scales/scaleInstanceManager.d.ts.map +1 -1
- package/dist/src/scales/scaleInstanceManager.js +5 -0
- package/dist/src/scales/scalePropsResolver.d.ts +6 -1
- package/dist/src/scales/scalePropsResolver.d.ts.map +1 -1
- package/dist/src/scales/scalePropsResolver.js +35 -10
- package/dist/src/scales/scaleResolution.d.ts +52 -0
- package/dist/src/scales/scaleResolution.d.ts.map +1 -1
- package/dist/src/scales/scaleResolution.js +195 -16
- package/dist/src/scales/scaleRules.d.ts +10 -0
- package/dist/src/scales/scaleRules.d.ts.map +1 -1
- package/dist/src/scales/scaleRules.js +38 -1
- package/dist/src/scales/viewLevelGuideConfig.d.ts +53 -0
- package/dist/src/scales/viewLevelGuideConfig.d.ts.map +1 -0
- package/dist/src/scales/viewLevelGuideConfig.js +224 -0
- package/dist/src/scales/viewLevelScaleConfig.d.ts +45 -0
- package/dist/src/scales/viewLevelScaleConfig.d.ts.map +1 -0
- package/dist/src/scales/viewLevelScaleConfig.js +149 -0
- package/dist/src/spec/axis.d.ts +109 -3
- package/dist/src/spec/channel.d.ts +23 -4
- package/dist/src/spec/config.d.ts +59 -4
- package/dist/src/spec/data.d.ts +177 -17
- package/dist/src/spec/legend.d.ts +246 -0
- package/dist/src/spec/mark.d.ts +16 -4
- package/dist/src/spec/scale.d.ts +19 -6
- package/dist/src/spec/title.d.ts +58 -1
- package/dist/src/spec/transform.d.ts +149 -0
- package/dist/src/spec/view.d.ts +50 -6
- package/dist/src/styles/genome-spy.css +4 -1
- package/dist/src/styles/genome-spy.css.d.ts +1 -1
- package/dist/src/styles/genome-spy.css.d.ts.map +1 -1
- package/dist/src/styles/genome-spy.css.js +4 -1
- package/dist/src/types/embedApi.d.ts +262 -6
- package/dist/src/types/rendering.d.ts +19 -3
- package/dist/src/types/viewContext.d.ts +18 -2
- package/dist/src/utils/arrayUtils.d.ts +11 -0
- package/dist/src/utils/arrayUtils.d.ts.map +1 -1
- package/dist/src/utils/arrayUtils.js +23 -0
- package/dist/src/utils/suspension.d.ts +17 -0
- package/dist/src/utils/suspension.d.ts.map +1 -0
- package/dist/src/utils/suspension.js +41 -0
- package/dist/src/utils/ui/tooltip.d.ts +4 -0
- package/dist/src/utils/ui/tooltip.d.ts.map +1 -1
- package/dist/src/utils/ui/tooltip.js +35 -10
- package/dist/src/view/axisGridView.d.ts.map +1 -1
- package/dist/src/view/axisGridView.js +1 -4
- package/dist/src/view/axisView.d.ts +18 -2
- package/dist/src/view/axisView.d.ts.map +1 -1
- package/dist/src/view/axisView.js +180 -75
- package/dist/src/view/concatView.d.ts +10 -2
- package/dist/src/view/concatView.d.ts.map +1 -1
- package/dist/src/view/concatView.js +46 -9
- package/dist/src/view/containerMutationHelper.d.ts +20 -1
- package/dist/src/view/containerMutationHelper.d.ts.map +1 -1
- package/dist/src/view/containerMutationHelper.js +203 -32
- package/dist/src/view/facetView.d.ts +1 -1
- package/dist/src/view/gridView/gridChild.d.ts +54 -4
- package/dist/src/view/gridView/gridChild.d.ts.map +1 -1
- package/dist/src/view/gridView/gridChild.js +301 -120
- package/dist/src/view/gridView/gridChildLegends.d.ts +57 -0
- package/dist/src/view/gridView/gridChildLegends.d.ts.map +1 -0
- package/dist/src/view/gridView/gridChildLegends.js +503 -0
- package/dist/src/view/gridView/gridView.d.ts +25 -0
- package/dist/src/view/gridView/gridView.d.ts.map +1 -1
- package/dist/src/view/gridView/gridView.js +454 -78
- package/dist/src/view/gridView/legendLayout.d.ts +26 -0
- package/dist/src/view/gridView/legendLayout.d.ts.map +1 -0
- package/dist/src/view/gridView/legendLayout.js +111 -0
- package/dist/src/view/gridView/scrollbar.d.ts.map +1 -1
- package/dist/src/view/gridView/scrollbar.js +1 -4
- package/dist/src/view/gridView/selectionRect.d.ts.map +1 -1
- package/dist/src/view/gridView/selectionRect.js +1 -4
- package/dist/src/view/gridView/separatorView.d.ts.map +1 -1
- package/dist/src/view/gridView/separatorView.js +1 -4
- package/dist/src/view/layerView.d.ts +9 -2
- package/dist/src/view/layerView.d.ts.map +1 -1
- package/dist/src/view/layerView.js +18 -1
- package/dist/src/view/layout/flexLayout.d.ts +20 -4
- package/dist/src/view/layout/flexLayout.d.ts.map +1 -1
- package/dist/src/view/layout/flexLayout.js +331 -31
- package/dist/src/view/layout/rectangle.d.ts +14 -0
- package/dist/src/view/layout/rectangle.d.ts.map +1 -1
- package/dist/src/view/layout/rectangle.js +40 -0
- package/dist/src/view/legend/legendEntries.d.ts +20 -0
- package/dist/src/view/legend/legendEntries.d.ts.map +1 -0
- package/dist/src/view/legend/legendEntries.js +21 -0
- package/dist/src/view/legendView.d.ts +134 -0
- package/dist/src/view/legendView.d.ts.map +1 -0
- package/dist/src/view/legendView.js +1611 -0
- package/dist/src/view/renderingContext/bufferedViewRenderingContext.d.ts.map +1 -1
- package/dist/src/view/renderingContext/bufferedViewRenderingContext.js +26 -4
- package/dist/src/view/renderingContext/clipOptions.d.ts +44 -0
- package/dist/src/view/renderingContext/clipOptions.d.ts.map +1 -0
- package/dist/src/view/renderingContext/clipOptions.js +140 -0
- package/dist/src/view/renderingContext/simpleViewRenderingContext.d.ts.map +1 -1
- package/dist/src/view/renderingContext/simpleViewRenderingContext.js +12 -1
- package/dist/src/view/resolutionPlanner.d.ts +2 -1
- package/dist/src/view/resolutionPlanner.d.ts.map +1 -1
- package/dist/src/view/resolutionPlanner.js +89 -25
- package/dist/src/view/testUtils.d.ts +4 -2
- package/dist/src/view/testUtils.d.ts.map +1 -1
- package/dist/src/view/testUtils.js +29 -7
- package/dist/src/view/titleView.d.ts +37 -0
- package/dist/src/view/titleView.d.ts.map +1 -0
- package/dist/src/view/titleView.js +584 -0
- package/dist/src/view/unitView.d.ts +3 -3
- package/dist/src/view/unitView.d.ts.map +1 -1
- package/dist/src/view/unitView.js +3 -2
- package/dist/src/view/view.d.ts +25 -24
- package/dist/src/view/view.d.ts.map +1 -1
- package/dist/src/view/view.js +121 -16
- package/dist/src/view/viewFactory.d.ts +2 -5
- package/dist/src/view/viewFactory.d.ts.map +1 -1
- package/dist/src/view/viewFactory.js +1 -2
- package/dist/src/view/viewIdentityRegistry.d.ts +37 -0
- package/dist/src/view/viewIdentityRegistry.d.ts.map +1 -0
- package/dist/src/view/viewIdentityRegistry.js +71 -0
- package/dist/src/view/viewMutationAcidTestUtils.d.ts +112 -0
- package/dist/src/view/viewMutationAcidTestUtils.d.ts.map +1 -0
- package/dist/src/view/viewMutationAcidTestUtils.js +234 -0
- package/dist/src/view/viewMutationApi.d.ts +42 -0
- package/dist/src/view/viewMutationApi.d.ts.map +1 -0
- package/dist/src/view/viewMutationApi.js +811 -0
- package/dist/src/view/viewSelectors.d.ts +10 -0
- package/dist/src/view/viewSelectors.d.ts.map +1 -1
- package/dist/src/view/viewSelectors.js +23 -1
- package/package.json +4 -4
- package/dist/bundle/esm-0dYHNV_D.js +0 -121
- package/dist/bundle/esm-C49STiCR.js +0 -1248
- package/dist/bundle/esm-CscjKVDc.js +0 -1426
- package/dist/bundle/esm-CuMSzCHy.js +0 -298
- package/dist/bundle/esm-DMXpJXM4.js +0 -369
- package/dist/src/view/title.d.ts +0 -13
- package/dist/src/view/title.d.ts.map +0 -1
- package/dist/src/view/title.js +0 -154
- /package/dist/bundle/{AbortablePromiseCache-3gHJdF3E.js → AbortablePromiseCache-BTmAcN-t.js} +0 -0
- /package/dist/bundle/{esm-CuVa5T98.js → esm-VvpZ9hsq.js} +0 -0
- /package/dist/bundle/{chunk-DmhlhrBa.js → rolldown-runtime-Dy4uBu1J.js} +0 -0
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
import ContainerView from "../view/containerView.js";
|
|
2
|
+
import { getViewSelector, isChromeView } from "../view/viewSelectors.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @typedef {object} ViewDebugSnapshotOptions
|
|
6
|
+
* @prop {boolean} [includeChrome=false]
|
|
7
|
+
* @prop {(object: object) => string} getDebugId
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @typedef {object} ViewDebugNode
|
|
12
|
+
* @prop {string} id
|
|
13
|
+
* @prop {string | undefined} parentId
|
|
14
|
+
* @prop {string[]} childIds
|
|
15
|
+
* @prop {string} name
|
|
16
|
+
* @prop {string | undefined} explicitName
|
|
17
|
+
* @prop {string | undefined} defaultName
|
|
18
|
+
* @prop {string} path
|
|
19
|
+
* @prop {string} className
|
|
20
|
+
* @prop {string} type
|
|
21
|
+
* @prop {string | undefined} markType
|
|
22
|
+
* @prop {boolean} chrome
|
|
23
|
+
* @prop {boolean} visible
|
|
24
|
+
* @prop {boolean} configuredVisible
|
|
25
|
+
* @prop {boolean} visibleInSpec
|
|
26
|
+
* @prop {"none" | "pending" | "ready"} dataInitializationState
|
|
27
|
+
* @prop {import("../view/viewUtilTypes.d.ts").ViewSelector | undefined} selector
|
|
28
|
+
* @prop {{ x: number, y: number, width: number, height: number } | undefined} bounds
|
|
29
|
+
* @prop {{ width: any, height: any } | undefined} size
|
|
30
|
+
* @prop {{ width: any, height: any } | undefined} viewportSize
|
|
31
|
+
* @prop {Record<string, string>} scaleResolutionIds
|
|
32
|
+
* @prop {Record<string, string>} axisResolutionIds
|
|
33
|
+
* @prop {Record<string, string>} legendResolutionIds
|
|
34
|
+
* @prop {Record<string, EncodingDebugNode>} encodings
|
|
35
|
+
* @prop {string[]} paramNames
|
|
36
|
+
* @prop {Record<string, any>} spec
|
|
37
|
+
* @prop {DebugSnapshotError[]} debugErrors
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @typedef {object} DebugSnapshotError
|
|
42
|
+
* @prop {string} field
|
|
43
|
+
* @prop {string} message
|
|
44
|
+
*/
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* @typedef {object} EncodingDebugNode
|
|
48
|
+
* @prop {string} channel
|
|
49
|
+
* @prop {string | undefined} field
|
|
50
|
+
* @prop {string | undefined} expr
|
|
51
|
+
* @prop {any} value
|
|
52
|
+
* @prop {string | undefined} type
|
|
53
|
+
* @prop {string | undefined} scaleResolutionId
|
|
54
|
+
* @prop {string | undefined} axisResolutionId
|
|
55
|
+
* @prop {string | undefined} legendResolutionId
|
|
56
|
+
* @prop {Record<string, any>} channelDef
|
|
57
|
+
*/
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* @typedef {object} ViewDebugSnapshot
|
|
61
|
+
* @prop {string | undefined} rootId
|
|
62
|
+
* @prop {ViewDebugNode[]} nodes
|
|
63
|
+
*/
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Creates a plain, read-only debug snapshot of the live view hierarchy.
|
|
67
|
+
*
|
|
68
|
+
* This module is intended for dynamic import by optional development tools.
|
|
69
|
+
* Keep the returned shape serializable and avoid exposing mutable runtime
|
|
70
|
+
* collections directly.
|
|
71
|
+
*
|
|
72
|
+
* @param {import("../view/view.js").default | undefined} root
|
|
73
|
+
* @param {ViewDebugSnapshotOptions} options
|
|
74
|
+
* @returns {ViewDebugSnapshot}
|
|
75
|
+
*/
|
|
76
|
+
export function createViewDebugSnapshot(root, options) {
|
|
77
|
+
if (!root) {
|
|
78
|
+
return {
|
|
79
|
+
rootId: undefined,
|
|
80
|
+
nodes: [],
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const includeChrome = options.includeChrome ?? false;
|
|
85
|
+
/** @type {ViewDebugNode[]} */
|
|
86
|
+
const nodes = [];
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* @param {import("../view/view.js").default} view
|
|
90
|
+
* @param {string | undefined} parentId
|
|
91
|
+
* @returns {ViewDebugNode | undefined}
|
|
92
|
+
*/
|
|
93
|
+
const visit = (view, parentId) => {
|
|
94
|
+
const chrome = isChromeView(view);
|
|
95
|
+
if (chrome && !includeChrome) {
|
|
96
|
+
return undefined;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const id = options.getDebugId(view);
|
|
100
|
+
const node = createViewDebugNode(view, id, parentId, chrome, options);
|
|
101
|
+
nodes.push(node);
|
|
102
|
+
|
|
103
|
+
if (view instanceof ContainerView) {
|
|
104
|
+
for (const child of view) {
|
|
105
|
+
const childNode = visit(child, id);
|
|
106
|
+
if (childNode) {
|
|
107
|
+
node.childIds.push(childNode.id);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return node;
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
const rootNode = visit(root, undefined);
|
|
116
|
+
|
|
117
|
+
return {
|
|
118
|
+
rootId: rootNode?.id,
|
|
119
|
+
nodes,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* @param {import("../view/view.js").default} view
|
|
125
|
+
* @param {string} id
|
|
126
|
+
* @param {string | undefined} parentId
|
|
127
|
+
* @param {boolean} chrome
|
|
128
|
+
* @param {ViewDebugSnapshotOptions} options
|
|
129
|
+
* @returns {ViewDebugNode}
|
|
130
|
+
*/
|
|
131
|
+
function createViewDebugNode(view, id, parentId, chrome, options) {
|
|
132
|
+
/** @type {DebugSnapshotError[]} */
|
|
133
|
+
const debugErrors = [];
|
|
134
|
+
return {
|
|
135
|
+
id,
|
|
136
|
+
parentId,
|
|
137
|
+
childIds: [],
|
|
138
|
+
name: view.name,
|
|
139
|
+
explicitName: view.explicitName,
|
|
140
|
+
defaultName: view.defaultName,
|
|
141
|
+
path: captureDebugValue(debugErrors, "path", view.name, () =>
|
|
142
|
+
view.getPathString()
|
|
143
|
+
),
|
|
144
|
+
className: view.constructor.name,
|
|
145
|
+
type: captureDebugValue(debugErrors, "type", "unknown", () =>
|
|
146
|
+
getViewType(view)
|
|
147
|
+
),
|
|
148
|
+
markType: captureDebugValue(debugErrors, "markType", undefined, () =>
|
|
149
|
+
getMarkType(view)
|
|
150
|
+
),
|
|
151
|
+
chrome,
|
|
152
|
+
visible: captureDebugValue(debugErrors, "visible", false, () =>
|
|
153
|
+
view.isVisible()
|
|
154
|
+
),
|
|
155
|
+
configuredVisible: captureDebugValue(
|
|
156
|
+
debugErrors,
|
|
157
|
+
"configuredVisible",
|
|
158
|
+
false,
|
|
159
|
+
() => view.isConfiguredVisible()
|
|
160
|
+
),
|
|
161
|
+
visibleInSpec: captureDebugValue(
|
|
162
|
+
debugErrors,
|
|
163
|
+
"visibleInSpec",
|
|
164
|
+
false,
|
|
165
|
+
() => view.isVisibleInSpec()
|
|
166
|
+
),
|
|
167
|
+
dataInitializationState: captureDebugValue(
|
|
168
|
+
debugErrors,
|
|
169
|
+
"dataInitializationState",
|
|
170
|
+
"none",
|
|
171
|
+
() => view.getDataInitializationState()
|
|
172
|
+
),
|
|
173
|
+
selector: captureDebugValue(debugErrors, "selector", undefined, () =>
|
|
174
|
+
getSelector(view)
|
|
175
|
+
),
|
|
176
|
+
bounds: captureDebugValue(debugErrors, "bounds", undefined, () =>
|
|
177
|
+
getBounds(view)
|
|
178
|
+
),
|
|
179
|
+
size: captureDebugValue(debugErrors, "size", undefined, () =>
|
|
180
|
+
summarizeFlexDimensions(view.getSize())
|
|
181
|
+
),
|
|
182
|
+
viewportSize: captureDebugValue(
|
|
183
|
+
debugErrors,
|
|
184
|
+
"viewportSize",
|
|
185
|
+
undefined,
|
|
186
|
+
() => summarizeFlexDimensions(view.getViewportSize())
|
|
187
|
+
),
|
|
188
|
+
scaleResolutionIds: captureDebugValue(
|
|
189
|
+
debugErrors,
|
|
190
|
+
"scaleResolutionIds",
|
|
191
|
+
{},
|
|
192
|
+
() => getResolutionIds(view.resolutions.scale, options)
|
|
193
|
+
),
|
|
194
|
+
axisResolutionIds: captureDebugValue(
|
|
195
|
+
debugErrors,
|
|
196
|
+
"axisResolutionIds",
|
|
197
|
+
{},
|
|
198
|
+
() => getResolutionIds(view.resolutions.axis, options)
|
|
199
|
+
),
|
|
200
|
+
legendResolutionIds: captureDebugValue(
|
|
201
|
+
debugErrors,
|
|
202
|
+
"legendResolutionIds",
|
|
203
|
+
{},
|
|
204
|
+
() => getResolutionIds(view.resolutions.legend, options)
|
|
205
|
+
),
|
|
206
|
+
encodings: captureDebugValue(debugErrors, "encodings", {}, () =>
|
|
207
|
+
getEncodings(view, options)
|
|
208
|
+
),
|
|
209
|
+
paramNames: captureDebugValue(debugErrors, "paramNames", [], () =>
|
|
210
|
+
Array.from(view.paramRuntime.paramConfigs.keys())
|
|
211
|
+
),
|
|
212
|
+
spec: captureDebugValue(
|
|
213
|
+
debugErrors,
|
|
214
|
+
"spec",
|
|
215
|
+
/** @type {import("../spec/view.js").ViewSpec} */ ({}),
|
|
216
|
+
() => structuredClone(view.spec)
|
|
217
|
+
),
|
|
218
|
+
debugErrors,
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* @template T
|
|
224
|
+
* @param {DebugSnapshotError[]} debugErrors
|
|
225
|
+
* @param {string} field
|
|
226
|
+
* @param {T} fallback
|
|
227
|
+
* @param {() => T} getter
|
|
228
|
+
* @returns {T}
|
|
229
|
+
*/
|
|
230
|
+
function captureDebugValue(debugErrors, field, fallback, getter) {
|
|
231
|
+
try {
|
|
232
|
+
return getter();
|
|
233
|
+
} catch (error) {
|
|
234
|
+
console.warn(`Failed to collect view debug field "${field}".`, error);
|
|
235
|
+
debugErrors.push({
|
|
236
|
+
field,
|
|
237
|
+
message: error instanceof Error ? error.message : String(error),
|
|
238
|
+
});
|
|
239
|
+
return fallback;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* @param {import("../view/view.js").default} view
|
|
245
|
+
* @returns {string}
|
|
246
|
+
*/
|
|
247
|
+
function getViewType(view) {
|
|
248
|
+
if (typeof (/** @type {any} */ (view).getMarkType) === "function") {
|
|
249
|
+
return "unit";
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
const className = view.constructor.name;
|
|
253
|
+
return className.endsWith("View")
|
|
254
|
+
? className.slice(0, -4).toLowerCase()
|
|
255
|
+
: className.toLowerCase();
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* @param {import("../view/view.js").default} view
|
|
260
|
+
* @returns {string | undefined}
|
|
261
|
+
*/
|
|
262
|
+
function getMarkType(view) {
|
|
263
|
+
const unitView = /** @type {{ getMarkType?: () => string }} */ (
|
|
264
|
+
/** @type {unknown} */ (view)
|
|
265
|
+
);
|
|
266
|
+
if (typeof unitView.getMarkType === "function") {
|
|
267
|
+
return unitView.getMarkType();
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* @param {import("../view/view.js").default} view
|
|
273
|
+
* @returns {import("../view/viewUtilTypes.d.ts").ViewSelector | undefined}
|
|
274
|
+
*/
|
|
275
|
+
function getSelector(view) {
|
|
276
|
+
if (!view.explicitName) {
|
|
277
|
+
return undefined;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
return getViewSelector(view);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* @param {import("../view/view.js").default} view
|
|
285
|
+
* @returns {{ x: number, y: number, width: number, height: number } | undefined}
|
|
286
|
+
*/
|
|
287
|
+
function getBounds(view) {
|
|
288
|
+
const coords = view.coords;
|
|
289
|
+
if (!coords) {
|
|
290
|
+
return undefined;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
return {
|
|
294
|
+
x: coords.x,
|
|
295
|
+
y: coords.y,
|
|
296
|
+
width: coords.width,
|
|
297
|
+
height: coords.height,
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* @param {import("../view/layout/flexLayout.js").FlexDimensions} dimensions
|
|
303
|
+
* @returns {{ width: any, height: any }}
|
|
304
|
+
*/
|
|
305
|
+
function summarizeFlexDimensions(dimensions) {
|
|
306
|
+
return {
|
|
307
|
+
width: dimensions.width,
|
|
308
|
+
height: dimensions.height,
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* @param {Record<string, any>} resolutions
|
|
314
|
+
* @param {ViewDebugSnapshotOptions} options
|
|
315
|
+
* @returns {Record<string, string>}
|
|
316
|
+
*/
|
|
317
|
+
function getResolutionIds(resolutions, options) {
|
|
318
|
+
/** @type {Record<string, string>} */
|
|
319
|
+
const ids = {};
|
|
320
|
+
|
|
321
|
+
for (const [channel, resolution] of Object.entries(resolutions)) {
|
|
322
|
+
if (resolution) {
|
|
323
|
+
ids[channel] = options.getDebugId(
|
|
324
|
+
/** @type {object} */ (resolution)
|
|
325
|
+
);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
return ids;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* @param {import("../view/view.js").default} view
|
|
334
|
+
* @param {ViewDebugSnapshotOptions} options
|
|
335
|
+
* @returns {Record<string, EncodingDebugNode>}
|
|
336
|
+
*/
|
|
337
|
+
function getEncodings(view, options) {
|
|
338
|
+
const encodingProvider =
|
|
339
|
+
/** @type {{ mark?: { encoding?: Record<string, any> } }} */ (
|
|
340
|
+
/** @type {unknown} */ (view)
|
|
341
|
+
);
|
|
342
|
+
const encoding = encodingProvider.mark?.encoding ?? view.getEncoding();
|
|
343
|
+
/** @type {Record<string, EncodingDebugNode>} */
|
|
344
|
+
const encodings = {};
|
|
345
|
+
|
|
346
|
+
for (const [channel, channelDef] of Object.entries(encoding)) {
|
|
347
|
+
if (!channelDef) {
|
|
348
|
+
continue;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
encodings[channel] = {
|
|
352
|
+
channel,
|
|
353
|
+
field: "field" in channelDef ? channelDef.field : undefined,
|
|
354
|
+
expr: "expr" in channelDef ? channelDef.expr : undefined,
|
|
355
|
+
value: "value" in channelDef ? channelDef.value : undefined,
|
|
356
|
+
type: "type" in channelDef ? channelDef.type : undefined,
|
|
357
|
+
scaleResolutionId: getChannelResolutionId(
|
|
358
|
+
view.resolutions.scale,
|
|
359
|
+
channel,
|
|
360
|
+
options
|
|
361
|
+
),
|
|
362
|
+
axisResolutionId: getChannelResolutionId(
|
|
363
|
+
view.resolutions.axis,
|
|
364
|
+
channel,
|
|
365
|
+
options
|
|
366
|
+
),
|
|
367
|
+
legendResolutionId: getChannelResolutionId(
|
|
368
|
+
view.resolutions.legend,
|
|
369
|
+
channel,
|
|
370
|
+
options
|
|
371
|
+
),
|
|
372
|
+
channelDef: structuredClone(channelDef),
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
return encodings;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* @param {Record<string, any>} resolutions
|
|
381
|
+
* @param {string} channel
|
|
382
|
+
* @param {ViewDebugSnapshotOptions} options
|
|
383
|
+
* @returns {string | undefined}
|
|
384
|
+
*/
|
|
385
|
+
function getChannelResolutionId(resolutions, channel, options) {
|
|
386
|
+
const resolution = resolutions[channel];
|
|
387
|
+
return resolution
|
|
388
|
+
? options.getDebugId(/** @type {object} */ (resolution))
|
|
389
|
+
: undefined;
|
|
390
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"embedFactory.d.ts","sourceRoot":"","sources":["../../src/embedFactory.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"embedFactory.d.ts","sourceRoot":"","sources":["../../src/embedFactory.js"],"names":[],"mappings":"AAMA;;;GAGG;AACH,uCAHW,KAAK,SAAS,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,gBAAgB,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,OAAO,qBAAqB,EAAE,YAAY,KAAK,OAAO,gBAAgB,EAAE,OAAO,GAC7J,CAAC,EAAE,EAAE,WAAW,GAAG,MAAM,EAAE,IAAI,EAAE,OAAO,gBAAgB,EAAE,QAAQ,GAAG,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,qBAAqB,EAAE,YAAY,KAAK,OAAO,CAAC,OAAO,qBAAqB,EAAE,WAAW,CAAC,CAyFpM;AAaD;;;;;GAKG;AACH,8BAFW,MAAM,gBAmBhB"}
|
package/dist/src/embedFactory.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { isObject, isString } from "vega-util";
|
|
2
2
|
|
|
3
|
+
import { createViewMutationApi } from "./view/viewMutationApi.js";
|
|
3
4
|
import { fetchJson } from "./utils/fetchUtils.js";
|
|
4
5
|
import inferSpecBaseUrl from "./utils/inferSpecBaseUrl.js";
|
|
5
6
|
|
|
@@ -38,7 +39,6 @@ export function createEmbed(GenomeSpy) {
|
|
|
38
39
|
const specObject = isObject(spec) ? spec : await loadSpec(spec);
|
|
39
40
|
|
|
40
41
|
specObject.baseUrl ??= "";
|
|
41
|
-
specObject.width ??= "container";
|
|
42
42
|
specObject.padding ??= 10;
|
|
43
43
|
|
|
44
44
|
if (element == document.body) {
|
|
@@ -60,6 +60,8 @@ export function createEmbed(GenomeSpy) {
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
return {
|
|
63
|
+
views: createViewMutationApi(genomeSpy),
|
|
64
|
+
|
|
63
65
|
finalize() {
|
|
64
66
|
genomeSpy.destroy();
|
|
65
67
|
while (element.firstChild) {
|
|
@@ -88,6 +90,9 @@ export function createEmbed(GenomeSpy) {
|
|
|
88
90
|
getLogicalCanvasSize:
|
|
89
91
|
genomeSpy.getLogicalCanvasSize.bind(genomeSpy),
|
|
90
92
|
exportCanvas: genomeSpy.exportCanvas.bind(genomeSpy),
|
|
93
|
+
getDebugViewRoot() {
|
|
94
|
+
return genomeSpy ? genomeSpy.viewRoot : undefined;
|
|
95
|
+
},
|
|
91
96
|
};
|
|
92
97
|
};
|
|
93
98
|
}
|
|
@@ -97,12 +97,12 @@ export function isChannelDefWithScale(channelDef: import("../spec/channel.js").C
|
|
|
97
97
|
/**
|
|
98
98
|
* @param {import("../spec/channel.js").ChannelDef} channelDef
|
|
99
99
|
*/
|
|
100
|
-
export function findChannelDefWithScale(channelDef: import("../spec/channel.js").ChannelDef): import("../spec/channel.js").
|
|
100
|
+
export function findChannelDefWithScale(channelDef: import("../spec/channel.js").ChannelDef): import("../spec/channel.js").ChannelDefWithScale;
|
|
101
101
|
/**
|
|
102
102
|
* @param {import("../view/unitView.js").default} view
|
|
103
103
|
* @param {import("../spec/channel.js").Channel} channel
|
|
104
104
|
*/
|
|
105
|
-
export function getChannelDefWithScale(view: import("../view/unitView.js").default, channel: import("../spec/channel.js").Channel): import("../spec/channel.js").
|
|
105
|
+
export function getChannelDefWithScale(view: import("../view/unitView.js").default, channel: import("../spec/channel.js").Channel): import("../spec/channel.js").ChannelDefWithScale;
|
|
106
106
|
/**
|
|
107
107
|
* @param {import("../spec/channel.js").ChannelDef} channelDef
|
|
108
108
|
* @returns {channelDef is import("../spec/channel.js").TypeMixins<import("../spec/channel.js").Type>}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encoder.d.ts","sourceRoot":"","sources":["../../../src/encoder/encoder.js"],"names":[],"mappings":"AAOA;;;;;;;;;;;GAWG;AACH,gDANW,MAAM,YACN,OAAO,oBAAoB,EAAE,QAAQ,gBACrC;IAAE,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,GAAG,CAAC;IAAC,gBAAgB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAA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AAM,CAmBhC;AA7LD;;GAEG;AACH,wCAFU,OAAO,oBAAoB,EAAE,wBAAwB,EAAE,CAEb;AAEpD;;GAEG;AACH,0CAFU,OAAO,oBAAoB,EAAE,0BAA0B,EAAE,CAEX;AAExD;;GAEG;AACH,iCAFU,OAAO,oBAAoB,EAAE,iBAAiB,EAAE,CAKxD;AAoBF;;;;GAIG;AACH,gCAFU,OAAO,CAAC,MAAM,CAAC,OAAO,oBAAoB,EAAE,OAAO,EAAE,OAAO,oBAAoB,EAAE,0BAA0B,CAAC,CAAC,CAKtH;AAEF;;;;GAIG;AACH,8BAFU,OAAO,CAAC,MAAM,CAAC,OAAO,oBAAoB,EAAE,OAAO,EAAE,OAAO,oBAAoB,EAAE,OAAO,CAAC,CAAC,CAInG"}
|
|
@@ -362,11 +362,12 @@ export function isChannelDefWithScale(channelDef) {
|
|
|
362
362
|
export function findChannelDefWithScale(channelDef) {
|
|
363
363
|
if (isValueDefWithCondition(channelDef)) {
|
|
364
364
|
const condition = channelDef.condition;
|
|
365
|
-
|
|
366
|
-
|
|
365
|
+
const conditions = Array.isArray(condition) ? condition : [condition];
|
|
366
|
+
return conditions.find((condition) => isChannelDefWithScale(condition));
|
|
367
|
+
} else {
|
|
368
|
+
if (isChannelDefWithScale(channelDef)) {
|
|
369
|
+
return channelDef;
|
|
367
370
|
}
|
|
368
|
-
} else if (isChannelDefWithScale(channelDef)) {
|
|
369
|
-
return channelDef;
|
|
370
371
|
}
|
|
371
372
|
}
|
|
372
373
|
|
|
@@ -51,7 +51,7 @@ export default class BmFontManager {
|
|
|
51
51
|
* @param {FontWeight | keyof WEIGHTS} weight
|
|
52
52
|
* @returns {FontEntry}
|
|
53
53
|
*/
|
|
54
|
-
getFont(family
|
|
54
|
+
getFont(family?: string, style?: FontStyle, weight?: FontWeight | ("bold" | "black" | "normal" | "thin" | "light" | "regular" | "medium")): FontEntry;
|
|
55
55
|
/**
|
|
56
56
|
*
|
|
57
57
|
* @param {FontEntry} fontEntry An uninitialized font entry
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bmFontManager.d.ts","sourceRoot":"","sources":["../../../src/fonts/bmFontManager.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bmFontManager.d.ts","sourceRoot":"","sources":["../../../src/fonts/bmFontManager.js"],"names":[],"mappings":"AAwBA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH;IACI;;OAEG;IACH,0BAFW,OAAO,sBAAsB,EAAE,OAAO,EAiChD;IA9BG,qDAA+B;IAE/B,uBACiF;IAEjF;;OAEG;IACH,QAFU,GAAG,CAAC,OAAO,EAAE,SAAS,CAAC,CAEc;IAE/C,8DAA8D;IAC9D,mBADW,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,uBAAuB,EAAE,CAAC,CAAC,CACxB;IAElC,kDAAkD;IAClD,eADW,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC,CAChB;IAE9B,uEAAuE;IACvE,WADW,OAAO,CAAC,IAAI,CAAC,EAAE,CACP;IAEnB;;;OAGG;IACH,mBAFU,SAAS,CAOlB;IAIL,gCAEC;IAED;;;;;;OAMG;IACH,iBALW,MAAM,UACN,SAAS,WACT,UAAU,0EAAgB,GACxB,SAAS,CAiBrB;IAED;;;;OAIG;IACH,0BAHW,SAAS,OACT,OAAO,iBA0BjB;IAED;;OAEG;IACH,eAFW,MAAM,uDAoBhB;IAED;;;OAGG;IACH,sBAFW,MAAM,sCA+BhB;IAED,4BAEC;IAED;;;;OAIG;IACH,0BAHW,MAAM,GACJ,OAAO,CAAC,YAAY,CAAC,CAqBjC;IAED;;;;OAIG;IACH,6BAHW,MAAM,GACJ,YAAY,CA0BxB;CACJ;;;;;;;;;;UAmDS,MAAM;;;;WACN,MAAM;;;;YACN,MAAM;;;;cACN,MAAM;;;;sBACN,MAAM;;;;eACN,MAAM;;;;eACN,MAAM;;;;;;;;;qBA9RH,OAAO,oBAAoB,EAAE,MAAM;;;;;;;;4BACnC,OAAO,oBAAoB,EAAE,aAAa;;;;;;;;wBAE1C,QAAQ,GAAG,QAAQ;;;;;;;;yBACnB,MAAM;;;;;;;;;YAGT,MAAM;WACN,SAAS;YACT,UAAU;;;;;;;;;;aAGV,aAAa;aACb,YAAY"}
|
|
@@ -15,6 +15,13 @@ const WEIGHTS = {
|
|
|
15
15
|
black: 900,
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
+
/** @type {FontKey} */
|
|
19
|
+
const DEFAULT_FONT_KEY = {
|
|
20
|
+
family: "Lato",
|
|
21
|
+
style: "normal",
|
|
22
|
+
weight: 400,
|
|
23
|
+
};
|
|
24
|
+
|
|
18
25
|
/**
|
|
19
26
|
* Loader for A-Frame fonts.
|
|
20
27
|
*
|
|
@@ -72,6 +79,7 @@ export default class BmFontManager {
|
|
|
72
79
|
? this._createTextureNow(latoRegularBitmap)
|
|
73
80
|
: undefined,
|
|
74
81
|
};
|
|
82
|
+
this._fonts.set(DEFAULT_FONT_KEY, this._defaultFontEntry);
|
|
75
83
|
}
|
|
76
84
|
|
|
77
85
|
async waitUntilReady() {
|
|
@@ -85,16 +93,8 @@ export default class BmFontManager {
|
|
|
85
93
|
* @param {FontWeight | keyof WEIGHTS} weight
|
|
86
94
|
* @returns {FontEntry}
|
|
87
95
|
*/
|
|
88
|
-
getFont(family, style = "normal", weight =
|
|
89
|
-
|
|
90
|
-
weight =
|
|
91
|
-
WEIGHTS[/** @type {keyof WEIGHTS} */ (weight.toLowerCase())];
|
|
92
|
-
if (!weight) {
|
|
93
|
-
throw new Error("Unknown font weight: " + weight);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
const key = { family, style, weight };
|
|
96
|
+
getFont(family = DEFAULT_FONT_KEY.family, style = "normal", weight = 400) {
|
|
97
|
+
const key = normalizeFontKey(family, style, weight);
|
|
98
98
|
let fontEntry = this._fonts.get(key);
|
|
99
99
|
if (!fontEntry) {
|
|
100
100
|
// Return and empty entry, load it asynchronously
|
|
@@ -261,6 +261,41 @@ export default class BmFontManager {
|
|
|
261
261
|
}
|
|
262
262
|
}
|
|
263
263
|
|
|
264
|
+
/**
|
|
265
|
+
* @param {string} family
|
|
266
|
+
* @param {FontStyle} style
|
|
267
|
+
* @param {FontWeight | keyof WEIGHTS} weight
|
|
268
|
+
* @returns {FontKey}
|
|
269
|
+
*/
|
|
270
|
+
function normalizeFontKey(family, style, weight) {
|
|
271
|
+
return {
|
|
272
|
+
family:
|
|
273
|
+
family.toLowerCase() == "sans-serif"
|
|
274
|
+
? DEFAULT_FONT_KEY.family
|
|
275
|
+
: family,
|
|
276
|
+
style,
|
|
277
|
+
weight: normalizeFontWeight(weight),
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* @param {FontWeight | keyof WEIGHTS} weight
|
|
283
|
+
* @returns {FontWeight}
|
|
284
|
+
*/
|
|
285
|
+
function normalizeFontWeight(weight) {
|
|
286
|
+
if (isString(weight)) {
|
|
287
|
+
const numericWeight =
|
|
288
|
+
WEIGHTS[/** @type {keyof WEIGHTS} */ (weight.toLowerCase())];
|
|
289
|
+
if (!numericWeight) {
|
|
290
|
+
throw new Error("Unknown font weight: " + weight);
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
return numericWeight;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
return weight;
|
|
297
|
+
}
|
|
298
|
+
|
|
264
299
|
/**
|
|
265
300
|
*
|
|
266
301
|
* @param {string} family
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import("./bmFontManager.js").BMFontMetrics} BMFontMetrics
|
|
3
|
+
* @typedef {import("../spec/font.js").FontStyle} FontStyle
|
|
4
|
+
* @typedef {import("../spec/font.js").FontWeight} FontWeight
|
|
5
|
+
* @typedef {{ metrics?: BMFontMetrics, texture?: WebGLTexture }} FontEntryLike
|
|
6
|
+
* @typedef {{
|
|
7
|
+
* font?: string,
|
|
8
|
+
* fontStyle?: FontStyle,
|
|
9
|
+
* fontWeight?: FontWeight,
|
|
10
|
+
* }} FontConfig
|
|
11
|
+
* @typedef {{
|
|
12
|
+
* getDefaultFont: () => FontEntryLike,
|
|
13
|
+
* getFont: (
|
|
14
|
+
* family?: string,
|
|
15
|
+
* style?: FontStyle,
|
|
16
|
+
* weight?: FontWeight
|
|
17
|
+
* ) => FontEntryLike,
|
|
18
|
+
* }} FontManagerLike
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* Requests a font entry and registers asynchronous loading for custom fonts.
|
|
22
|
+
*
|
|
23
|
+
* @param {FontManagerLike} fontManager
|
|
24
|
+
* @param {FontConfig} config
|
|
25
|
+
* @returns {FontEntryLike}
|
|
26
|
+
*/
|
|
27
|
+
export function requestFont(fontManager: FontManagerLike, config: FontConfig): FontEntryLike;
|
|
28
|
+
/**
|
|
29
|
+
* @param {BMFontMetrics} metrics
|
|
30
|
+
* @param {number} fontSize
|
|
31
|
+
*/
|
|
32
|
+
export function getTextHeight(metrics: BMFontMetrics, fontSize: number): number;
|
|
33
|
+
/**
|
|
34
|
+
* @param {BMFontMetrics} metrics
|
|
35
|
+
* @param {string} text
|
|
36
|
+
* @param {number} fontSize
|
|
37
|
+
*/
|
|
38
|
+
export function measureText(metrics: BMFontMetrics, text: string, fontSize: number): {
|
|
39
|
+
width: number;
|
|
40
|
+
height: number;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Returns the projected text extent along a layout direction after rotation.
|
|
44
|
+
*
|
|
45
|
+
* @param {{ width: number, height: number }} size
|
|
46
|
+
* @param {number} angle
|
|
47
|
+
* @param {"horizontal" | "vertical"} direction
|
|
48
|
+
*/
|
|
49
|
+
export function getProjectedTextExtent(size: {
|
|
50
|
+
width: number;
|
|
51
|
+
height: number;
|
|
52
|
+
}, angle: number, direction: "horizontal" | "vertical"): number;
|
|
53
|
+
export type BMFontMetrics = import("./bmFontManager.js").BMFontMetrics;
|
|
54
|
+
export type FontStyle = import("../spec/font.js").FontStyle;
|
|
55
|
+
export type FontWeight = import("../spec/font.js").FontWeight;
|
|
56
|
+
export type FontEntryLike = {
|
|
57
|
+
metrics?: BMFontMetrics;
|
|
58
|
+
texture?: WebGLTexture;
|
|
59
|
+
};
|
|
60
|
+
export type FontConfig = {
|
|
61
|
+
font?: string;
|
|
62
|
+
fontStyle?: FontStyle;
|
|
63
|
+
fontWeight?: FontWeight;
|
|
64
|
+
};
|
|
65
|
+
export type FontManagerLike = {
|
|
66
|
+
getDefaultFont: () => FontEntryLike;
|
|
67
|
+
getFont: (family?: string, style?: FontStyle, weight?: FontWeight) => FontEntryLike;
|
|
68
|
+
};
|
|
69
|
+
//# sourceMappingURL=textMetrics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"textMetrics.d.ts","sourceRoot":"","sources":["../../../src/fonts/textMetrics.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH;;;;;;GAMG;AACH,yCAJW,eAAe,UACf,UAAU,GACR,aAAa,CAQzB;AAED;;;GAGG;AACH,uCAHW,aAAa,YACb,MAAM,UAMhB;AAED;;;;GAIG;AACH,qCAJW,aAAa,QACb,MAAM,YACN,MAAM;;;EAOhB;AAED;;;;;;GAMG;AACH,6CAJW;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,SACjC,MAAM,aACN,YAAY,GAAG,UAAU,UAUnC;4BAvEY,OAAO,oBAAoB,EAAE,aAAa;wBAC1C,OAAO,iBAAiB,EAAE,SAAS;yBACnC,OAAO,iBAAiB,EAAE,UAAU;4BACpC;IAAE,OAAO,CAAC,EAAE,aAAa,CAAC;IAAC,OAAO,CAAC,EAAE,YAAY,CAAA;CAAE;yBACnD;IACN,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,UAAU,CAAC,EAAE,UAAU,CAAC;CAC3B;8BACS;IACN,cAAc,EAAE,MAAM,aAAa,CAAC;IACpC,OAAO,EAAE,CACL,MAAM,CAAC,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,SAAS,EACjB,MAAM,CAAC,EAAE,UAAU,KAClB,aAAa,CAAC;CACtB"}
|