@unovis/ts 1.1.1-beta.6 → 1.1.1-beta.7
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/declaration.d.ts +1 -0
- package/index.ts +1 -0
- package/licences.txt +43 -0
- package/maps.ts +1 -0
- package/package.json +1 -1
- package/rollup.config.js +71 -0
- package/rules/ts-getter-setter.js +35 -0
- package/src/components/area/config.ts +29 -0
- package/src/components/area/index.ts +133 -0
- package/{components/area/style.js → src/components/area/style.ts} +9 -10
- package/src/components/area/types.ts +2 -0
- package/src/components/axis/config.ts +76 -0
- package/src/components/axis/index.ts +363 -0
- package/{components/axis/style.js → src/components/axis/style.ts} +27 -22
- package/src/components/axis/types.ts +4 -0
- package/src/components/brush/config.ts +51 -0
- package/src/components/brush/index.ts +233 -0
- package/{components/brush/style.js → src/components/brush/style.ts} +15 -14
- package/src/components/brush/types.ts +8 -0
- package/src/components/bullet-legend/config.ts +38 -0
- package/src/components/bullet-legend/index.ts +104 -0
- package/{components/bullet-legend/style.js → src/components/bullet-legend/style.ts} +18 -16
- package/src/components/bullet-legend/types.ts +7 -0
- package/src/components/chord-diagram/config.ts +53 -0
- package/src/components/chord-diagram/index.ts +401 -0
- package/src/components/chord-diagram/modules/label.ts +155 -0
- package/src/components/chord-diagram/modules/link.ts +91 -0
- package/src/components/chord-diagram/modules/node.ts +80 -0
- package/{components/chord-diagram/style.js → src/components/chord-diagram/style.ts} +39 -30
- package/src/components/chord-diagram/types.ts +68 -0
- package/src/components/crosshair/config.ts +48 -0
- package/src/components/crosshair/index.ts +220 -0
- package/{components/crosshair/style.js → src/components/crosshair/style.ts} +12 -12
- package/src/components/crosshair/types.ts +15 -0
- package/src/components/donut/config.ts +65 -0
- package/src/components/donut/index.ts +148 -0
- package/src/components/donut/modules/arc.ts +86 -0
- package/{components/donut/style.js → src/components/donut/style.ts} +20 -18
- package/src/components/donut/types.ts +17 -0
- package/src/components/flow-legend/config.ts +31 -0
- package/src/components/flow-legend/index.ts +103 -0
- package/{components/flow-legend/style.js → src/components/flow-legend/style.ts} +25 -21
- package/src/components/flow-legend/types.ts +10 -0
- package/src/components/free-brush/config.ts +54 -0
- package/src/components/free-brush/index.ts +207 -0
- package/{components/free-brush/style.js → src/components/free-brush/style.ts} +12 -12
- package/src/components/free-brush/types.ts +8 -0
- package/src/components/graph/config.ts +280 -0
- package/src/components/graph/index.ts +809 -0
- package/src/components/graph/modules/layout-helpers.ts +96 -0
- package/src/components/graph/modules/layout.ts +502 -0
- package/src/components/graph/modules/link/helper.ts +105 -0
- package/src/components/graph/modules/link/index.ts +302 -0
- package/{components/graph/modules/link/style.js → src/components/graph/modules/link/style.ts} +45 -34
- package/src/components/graph/modules/node/helper.ts +162 -0
- package/src/components/graph/modules/node/index.ts +343 -0
- package/{components/graph/modules/node/style.js → src/components/graph/modules/node/style.ts} +72 -52
- package/src/components/graph/modules/panel/helper.ts +160 -0
- package/src/components/graph/modules/panel/index.ts +137 -0
- package/{components/graph/modules/panel/style.js → src/components/graph/modules/panel/style.ts} +42 -32
- package/src/components/graph/modules/shape.ts +108 -0
- package/src/components/graph/modules/zoom-levels.ts +6 -0
- package/src/components/graph/style.ts +72 -0
- package/src/components/graph/types.ts +152 -0
- package/src/components/grouped-bar/config.ts +40 -0
- package/src/components/grouped-bar/index.ts +325 -0
- package/{components/grouped-bar/style.js → src/components/grouped-bar/style.ts} +15 -14
- package/src/components/leaflet-flow-map/config.ts +60 -0
- package/src/components/leaflet-flow-map/index.ts +279 -0
- package/src/components/leaflet-flow-map/renderer-utils.ts +14 -0
- package/src/components/leaflet-flow-map/renderer.ts +146 -0
- package/{components/leaflet-flow-map/shaders.js → src/components/leaflet-flow-map/shaders.ts} +4 -7
- package/src/components/leaflet-flow-map/types.ts +18 -0
- package/src/components/leaflet-map/config.ts +234 -0
- package/src/components/leaflet-map/index.ts +808 -0
- package/src/components/leaflet-map/leaflet.css +625 -0
- package/src/components/leaflet-map/modules/clusterBackground.ts +34 -0
- package/src/components/leaflet-map/modules/donut.ts +37 -0
- package/src/components/leaflet-map/modules/map.ts +178 -0
- package/src/components/leaflet-map/modules/node.ts +208 -0
- package/src/components/leaflet-map/modules/selectionRing.ts +63 -0
- package/src/components/leaflet-map/modules/utils.ts +290 -0
- package/{components → src/components}/leaflet-map/renderer/leaflet-maplibre-gl.js +76 -78
- package/src/components/leaflet-map/renderer/map-style.ts +24 -0
- package/src/components/leaflet-map/renderer/mapboxgl/mapboxgl-dark-theme.json +35 -0
- package/src/components/leaflet-map/renderer/mapboxgl/mapboxgl-light-theme.json +35 -0
- package/src/components/leaflet-map/renderer/mapboxgl/mapboxgl-settings.json +2185 -0
- package/src/components/leaflet-map/renderer/mapboxgl-layer.ts +43 -0
- package/src/components/leaflet-map/renderer/mapboxgl-utils.ts +40 -0
- package/{components → src/components}/leaflet-map/renderer/maplibre-gl.css.js +2 -4
- package/src/components/leaflet-map/style.ts +217 -0
- package/src/components/leaflet-map/types.ts +75 -0
- package/src/components/line/config.ts +34 -0
- package/src/components/line/index.ts +188 -0
- package/{components/line/style.js → src/components/line/style.ts} +18 -16
- package/src/components/line/types.ts +3 -0
- package/src/components/nested-donut/config.ts +75 -0
- package/src/components/nested-donut/index.ts +176 -0
- package/src/components/nested-donut/modules/arc.ts +78 -0
- package/src/components/nested-donut/modules/label.ts +63 -0
- package/src/components/nested-donut/style.ts +82 -0
- package/src/components/nested-donut/types.ts +29 -0
- package/src/components/sankey/config.ts +195 -0
- package/src/components/sankey/index.ts +387 -0
- package/src/components/sankey/modules/label.ts +228 -0
- package/src/components/sankey/modules/link.ts +141 -0
- package/src/components/sankey/modules/node.ts +221 -0
- package/{components/sankey/style.js → src/components/sankey/style.ts} +60 -44
- package/src/components/sankey/types.ts +95 -0
- package/src/components/scatter/config.ts +49 -0
- package/src/components/scatter/index.ts +220 -0
- package/src/components/scatter/modules/point.ts +123 -0
- package/src/components/scatter/modules/utils.ts +150 -0
- package/{components/scatter/style.js → src/components/scatter/style.ts} +15 -14
- package/src/components/scatter/types.ts +21 -0
- package/src/components/stacked-bar/config.ts +42 -0
- package/src/components/stacked-bar/index.ts +267 -0
- package/{components/stacked-bar/style.js → src/components/stacked-bar/style.ts} +15 -14
- package/src/components/stacked-bar/types.ts +5 -0
- package/src/components/timeline/config.ts +49 -0
- package/src/components/timeline/index.ts +302 -0
- package/{components/timeline/style.js → src/components/timeline/style.ts} +39 -30
- package/src/components/tooltip/config.ts +69 -0
- package/src/components/tooltip/index.ts +220 -0
- package/{components → src/components}/tooltip/style.js +11 -14
- package/src/components/topojson-map/config.ts +124 -0
- package/src/components/topojson-map/index.ts +436 -0
- package/{components/topojson-map/style.js → src/components/topojson-map/style.ts} +33 -26
- package/src/components/topojson-map/types.ts +123 -0
- package/src/components/topojson-map/utils.ts +29 -0
- package/src/components/vis-controls/config.ts +16 -0
- package/src/components/vis-controls/index.ts +68 -0
- package/{components/vis-controls/style.js → src/components/vis-controls/style.ts} +34 -27
- package/src/components/vis-controls/types.ts +14 -0
- package/src/components/xy-labels/config.ts +56 -0
- package/src/components/xy-labels/index.ts +109 -0
- package/src/components/xy-labels/modules/label.ts +140 -0
- package/{components/xy-labels/style.js → src/components/xy-labels/style.ts} +15 -14
- package/src/components/xy-labels/types.ts +26 -0
- package/src/components.ts +56 -0
- package/src/containers/single-container/config.ts +15 -0
- package/src/containers/single-container/index.ts +150 -0
- package/src/containers/xy-container/config.ts +112 -0
- package/src/containers/xy-container/index.ts +407 -0
- package/src/containers.ts +6 -0
- package/src/core/component/config.ts +61 -0
- package/src/core/component/index.ts +154 -0
- package/src/core/component/types.ts +9 -0
- package/src/core/config/index.ts +12 -0
- package/src/core/container/config.ts +56 -0
- package/src/core/container/index.ts +136 -0
- package/src/core/xy-component/config.ts +46 -0
- package/src/core/xy-component/index.ts +90 -0
- package/src/data-models/core.ts +15 -0
- package/src/data-models/graph.ts +138 -0
- package/src/data-models/map-graph.ts +72 -0
- package/src/data-models/map.ts +18 -0
- package/src/data-models/series.ts +16 -0
- package/src/index.ts +7 -0
- package/src/maps/china-provinces.json +1 -0
- package/src/maps/fr-regions.json +1 -0
- package/src/maps/germany-regions.json +1 -0
- package/src/maps/ind-regions.json +1 -0
- package/src/maps/uk-regions.json +1 -0
- package/src/maps/us-counties.json +1 -0
- package/src/maps/us-states.json +1 -0
- package/src/maps/world-110m-alpha.json +1 -0
- package/src/maps/world-simple.json +1 -0
- package/src/maps/world-simplest.json +1 -0
- package/src/maps.ts +34 -0
- package/src/styles/colors.ts +28 -0
- package/src/styles/index.ts +38 -0
- package/{styles/sizes.js → src/styles/sizes.ts} +6 -8
- package/src/types/accessor.ts +5 -0
- package/src/types/component.ts +15 -0
- package/src/types/curve.ts +62 -0
- package/src/types/data.ts +5 -0
- package/src/types/direction.ts +6 -0
- package/src/types/graph.ts +40 -0
- package/src/types/map.ts +5 -0
- package/src/types/misc.ts +10 -0
- package/src/types/position.ts +23 -0
- package/src/types/scale.ts +47 -0
- package/src/types/shape.ts +7 -0
- package/src/types/spacing.ts +6 -0
- package/src/types/svg.ts +32 -0
- package/src/types/symbol.ts +21 -0
- package/src/types/text.ts +71 -0
- package/src/types.ts +31 -0
- package/src/utils/color.ts +41 -0
- package/src/utils/d3.ts +15 -0
- package/src/utils/data.ts +328 -0
- package/src/utils/html.ts +13 -0
- package/src/utils/map.ts +29 -0
- package/src/utils/misc.ts +54 -0
- package/src/utils/path.ts +196 -0
- package/src/utils/scale.ts +1 -0
- package/src/utils/style.ts +37 -0
- package/src/utils/svg.ts +49 -0
- package/src/utils/text.ts +529 -0
- package/src/utils/type.ts +9 -0
- package/tsconfig.json +29 -0
- package/components/area/config.d.ts +0 -25
- package/components/area/config.js +0 -16
- package/components/area/config.js.map +0 -1
- package/components/area/index.d.ts +0 -19
- package/components/area/index.js +0 -102
- package/components/area/index.js.map +0 -1
- package/components/area/style.d.ts +0 -3
- package/components/area/style.js.map +0 -1
- package/components/area/types.d.ts +0 -6
- package/components/axis/config.d.ts +0 -71
- package/components/axis/config.js +0 -32
- package/components/axis/config.js.map +0 -1
- package/components/axis/index.d.ts +0 -44
- package/components/axis/index.js +0 -305
- package/components/axis/index.js.map +0 -1
- package/components/axis/style.d.ts +0 -9
- package/components/axis/style.js.map +0 -1
- package/components/axis/types.d.ts +0 -4
- package/components/axis/types.js +0 -8
- package/components/axis/types.js.map +0 -1
- package/components/brush/config.d.ts +0 -42
- package/components/brush/config.js +0 -24
- package/components/brush/config.js.map +0 -1
- package/components/brush/index.d.ts +0 -28
- package/components/brush/index.js +0 -199
- package/components/brush/index.js.map +0 -1
- package/components/brush/style.d.ts +0 -5
- package/components/brush/style.js.map +0 -1
- package/components/brush/types.d.ts +0 -7
- package/components/brush/types.js +0 -8
- package/components/brush/types.js.map +0 -1
- package/components/bullet-legend/config.d.ts +0 -34
- package/components/bullet-legend/config.js +0 -16
- package/components/bullet-legend/config.js.map +0 -1
- package/components/bullet-legend/index.d.ts +0 -19
- package/components/bullet-legend/index.js +0 -79
- package/components/bullet-legend/index.js.map +0 -1
- package/components/bullet-legend/style.d.ts +0 -6
- package/components/bullet-legend/style.js.map +0 -1
- package/components/bullet-legend/types.d.ts +0 -7
- package/components/bullet-legend/types.js +0 -2
- package/components/bullet-legend/types.js.map +0 -1
- package/components/chord-diagram/config.d.ts +0 -44
- package/components/chord-diagram/config.js +0 -25
- package/components/chord-diagram/config.js.map +0 -1
- package/components/chord-diagram/index.d.ts +0 -42
- package/components/chord-diagram/index.js +0 -305
- package/components/chord-diagram/index.js.map +0 -1
- package/components/chord-diagram/modules/label.d.ts +0 -8
- package/components/chord-diagram/modules/label.js +0 -115
- package/components/chord-diagram/modules/label.js.map +0 -1
- package/components/chord-diagram/modules/link.d.ts +0 -21
- package/components/chord-diagram/modules/link.js +0 -63
- package/components/chord-diagram/modules/link.js.map +0 -1
- package/components/chord-diagram/modules/node.d.ts +0 -17
- package/components/chord-diagram/modules/node.js +0 -52
- package/components/chord-diagram/modules/node.js.map +0 -1
- package/components/chord-diagram/style.d.ts +0 -13
- package/components/chord-diagram/style.js.map +0 -1
- package/components/chord-diagram/types.d.ts +0 -58
- package/components/chord-diagram/types.js +0 -8
- package/components/chord-diagram/types.js.map +0 -1
- package/components/crosshair/config.d.ts +0 -43
- package/components/crosshair/config.js +0 -19
- package/components/crosshair/config.js.map +0 -1
- package/components/crosshair/index.d.ts +0 -35
- package/components/crosshair/index.js +0 -183
- package/components/crosshair/index.js.map +0 -1
- package/components/crosshair/style.d.ts +0 -4
- package/components/crosshair/style.js.map +0 -1
- package/components/crosshair/types.d.ts +0 -13
- package/components/crosshair/types.js +0 -2
- package/components/crosshair/types.js.map +0 -1
- package/components/donut/config.d.ts +0 -59
- package/components/donut/config.js +0 -28
- package/components/donut/config.js.map +0 -1
- package/components/donut/index.d.ts +0 -21
- package/components/donut/index.js +0 -107
- package/components/donut/index.js.map +0 -1
- package/components/donut/modules/arc.d.ts +0 -10
- package/components/donut/modules/arc.js +0 -59
- package/components/donut/modules/arc.js.map +0 -1
- package/components/donut/style.d.ts +0 -7
- package/components/donut/style.js.map +0 -1
- package/components/donut/types.d.ts +0 -20
- package/components/flow-legend/config.d.ts +0 -29
- package/components/flow-legend/config.js +0 -18
- package/components/flow-legend/config.js.map +0 -1
- package/components/flow-legend/index.d.ts +0 -16
- package/components/flow-legend/index.js +0 -75
- package/components/flow-legend/index.js.map +0 -1
- package/components/flow-legend/style.d.ts +0 -8
- package/components/flow-legend/style.js.map +0 -1
- package/components/flow-legend/types.d.ts +0 -9
- package/components/flow-legend/types.js +0 -8
- package/components/flow-legend/types.js.map +0 -1
- package/components/free-brush/config.d.ts +0 -45
- package/components/free-brush/config.js +0 -24
- package/components/free-brush/config.js.map +0 -1
- package/components/free-brush/index.d.ts +0 -20
- package/components/free-brush/index.js +0 -192
- package/components/free-brush/index.js.map +0 -1
- package/components/free-brush/style.d.ts +0 -4
- package/components/free-brush/style.js.map +0 -1
- package/components/free-brush/types.d.ts +0 -7
- package/components/free-brush/types.js +0 -9
- package/components/free-brush/types.js.map +0 -1
- package/components/graph/config.d.ts +0 -238
- package/components/graph/config.js +0 -84
- package/components/graph/config.js.map +0 -1
- package/components/graph/index.d.ts +0 -126
- package/components/graph/index.js +0 -656
- package/components/graph/index.js.map +0 -1
- package/components/graph/modules/layout-helpers.d.ts +0 -21
- package/components/graph/modules/layout-helpers.js +0 -69
- package/components/graph/modules/layout-helpers.js.map +0 -1
- package/components/graph/modules/layout.d.ts +0 -10
- package/components/graph/modules/layout.js +0 -399
- package/components/graph/modules/layout.js.map +0 -1
- package/components/graph/modules/link/helper.d.ts +0 -25
- package/components/graph/modules/link/helper.js +0 -74
- package/components/graph/modules/link/helper.js.map +0 -1
- package/components/graph/modules/link/index.d.ts +0 -11
- package/components/graph/modules/link/index.js +0 -212
- package/components/graph/modules/link/index.js.map +0 -1
- package/components/graph/modules/link/style.d.ts +0 -15
- package/components/graph/modules/link/style.js.map +0 -1
- package/components/graph/modules/node/helper.d.ts +0 -21
- package/components/graph/modules/node/helper.js +0 -126
- package/components/graph/modules/node/helper.js.map +0 -1
- package/components/graph/modules/node/index.d.ts +0 -11
- package/components/graph/modules/node/index.js +0 -252
- package/components/graph/modules/node/index.js.map +0 -1
- package/components/graph/modules/node/style.d.ts +0 -24
- package/components/graph/modules/node/style.js.map +0 -1
- package/components/graph/modules/panel/helper.d.ts +0 -18
- package/components/graph/modules/panel/helper.js +0 -111
- package/components/graph/modules/panel/helper.js.map +0 -1
- package/components/graph/modules/panel/index.d.ts +0 -7
- package/components/graph/modules/panel/index.js +0 -98
- package/components/graph/modules/panel/index.js.map +0 -1
- package/components/graph/modules/panel/style.d.ts +0 -14
- package/components/graph/modules/panel/style.js.map +0 -1
- package/components/graph/modules/shape.d.ts +0 -6
- package/components/graph/modules/shape.js +0 -80
- package/components/graph/modules/shape.js.map +0 -1
- package/components/graph/modules/zoom-levels.d.ts +0 -6
- package/components/graph/modules/zoom-levels.js +0 -10
- package/components/graph/modules/zoom-levels.js.map +0 -1
- package/components/graph/style.d.ts +0 -6
- package/components/graph/style.js +0 -66
- package/components/graph/style.js.map +0 -1
- package/components/graph/types.d.ts +0 -125
- package/components/graph/types.js +0 -30
- package/components/graph/types.js.map +0 -1
- package/components/grouped-bar/config.d.ts +0 -36
- package/components/grouped-bar/config.js +0 -20
- package/components/grouped-bar/config.js.map +0 -1
- package/components/grouped-bar/index.d.ts +0 -32
- package/components/grouped-bar/index.js +0 -249
- package/components/grouped-bar/index.js.map +0 -1
- package/components/grouped-bar/style.d.ts +0 -5
- package/components/grouped-bar/style.js.map +0 -1
- package/components/leaflet-flow-map/config.d.ts +0 -46
- package/components/leaflet-flow-map/config.js +0 -25
- package/components/leaflet-flow-map/config.js.map +0 -1
- package/components/leaflet-flow-map/index.d.ts +0 -52
- package/components/leaflet-flow-map/index.js +0 -220
- package/components/leaflet-flow-map/index.js.map +0 -1
- package/components/leaflet-flow-map/renderer-utils.d.ts +0 -5
- package/components/leaflet-flow-map/renderer-utils.js +0 -15
- package/components/leaflet-flow-map/renderer-utils.js.map +0 -1
- package/components/leaflet-flow-map/renderer.d.ts +0 -26
- package/components/leaflet-flow-map/renderer.js +0 -117
- package/components/leaflet-flow-map/renderer.js.map +0 -1
- package/components/leaflet-flow-map/shaders.d.ts +0 -2
- package/components/leaflet-flow-map/shaders.js.map +0 -1
- package/components/leaflet-flow-map/types.d.ts +0 -23
- package/components/leaflet-map/config.d.ts +0 -193
- package/components/leaflet-map/config.js +0 -71
- package/components/leaflet-map/config.js.map +0 -1
- package/components/leaflet-map/index.d.ts +0 -130
- package/components/leaflet-map/index.js +0 -690
- package/components/leaflet-map/index.js.map +0 -1
- package/components/leaflet-map/leaflet.css.js +0 -5
- package/components/leaflet-map/leaflet.css.js.map +0 -1
- package/components/leaflet-map/modules/clusterBackground.d.ts +0 -5
- package/components/leaflet-map/modules/clusterBackground.js +0 -27
- package/components/leaflet-map/modules/clusterBackground.js.map +0 -1
- package/components/leaflet-map/modules/donut.d.ts +0 -3
- package/components/leaflet-map/modules/donut.js +0 -25
- package/components/leaflet-map/modules/donut.js.map +0 -1
- package/components/leaflet-map/modules/map.d.ts +0 -14
- package/components/leaflet-map/modules/map.js +0 -154
- package/components/leaflet-map/modules/map.js.map +0 -1
- package/components/leaflet-map/modules/node.d.ts +0 -9
- package/components/leaflet-map/modules/node.js +0 -162
- package/components/leaflet-map/modules/node.js.map +0 -1
- package/components/leaflet-map/modules/selectionRing.d.ts +0 -7
- package/components/leaflet-map/modules/selectionRing.js +0 -41
- package/components/leaflet-map/modules/selectionRing.js.map +0 -1
- package/components/leaflet-map/modules/utils.d.ts +0 -50
- package/components/leaflet-map/modules/utils.js +0 -210
- package/components/leaflet-map/modules/utils.js.map +0 -1
- package/components/leaflet-map/renderer/leaflet-maplibre-gl.js.map +0 -1
- package/components/leaflet-map/renderer/map-style.d.ts +0 -4
- package/components/leaflet-map/renderer/map-style.js +0 -15
- package/components/leaflet-map/renderer/map-style.js.map +0 -1
- package/components/leaflet-map/renderer/mapboxgl/mapboxgl-dark-theme.json.js +0 -40
- package/components/leaflet-map/renderer/mapboxgl/mapboxgl-dark-theme.json.js.map +0 -1
- package/components/leaflet-map/renderer/mapboxgl/mapboxgl-light-theme.json.js +0 -40
- package/components/leaflet-map/renderer/mapboxgl/mapboxgl-light-theme.json.js.map +0 -1
- package/components/leaflet-map/renderer/mapboxgl/mapboxgl-settings.json.js +0 -4981
- package/components/leaflet-map/renderer/mapboxgl/mapboxgl-settings.json.js.map +0 -1
- package/components/leaflet-map/renderer/mapboxgl-layer.d.ts +0 -8
- package/components/leaflet-map/renderer/mapboxgl-layer.js +0 -27
- package/components/leaflet-map/renderer/mapboxgl-layer.js.map +0 -1
- package/components/leaflet-map/renderer/mapboxgl-utils.d.ts +0 -4
- package/components/leaflet-map/renderer/mapboxgl-utils.js +0 -39
- package/components/leaflet-map/renderer/mapboxgl-utils.js.map +0 -1
- package/components/leaflet-map/renderer/maplibre-gl.css.js.map +0 -1
- package/components/leaflet-map/style.d.ts +0 -52
- package/components/leaflet-map/style.js +0 -183
- package/components/leaflet-map/style.js.map +0 -1
- package/components/leaflet-map/types.d.ts +0 -75
- package/components/leaflet-map/types.js +0 -15
- package/components/leaflet-map/types.js.map +0 -1
- package/components/line/config.d.ts +0 -30
- package/components/line/config.js +0 -17
- package/components/line/config.js.map +0 -1
- package/components/line/index.d.ts +0 -27
- package/components/line/index.js +0 -152
- package/components/line/index.js.map +0 -1
- package/components/line/style.d.ts +0 -6
- package/components/line/style.js.map +0 -1
- package/components/line/types.d.ts +0 -12
- package/components/nested-donut/config.d.ts +0 -59
- package/components/nested-donut/config.js +0 -19
- package/components/nested-donut/config.js.map +0 -1
- package/components/nested-donut/index.d.ts +0 -38
- package/components/nested-donut/index.js +0 -133
- package/components/nested-donut/index.js.map +0 -1
- package/components/nested-donut/modules/arc.d.ts +0 -17
- package/components/nested-donut/modules/arc.js +0 -50
- package/components/nested-donut/modules/arc.js.map +0 -1
- package/components/nested-donut/modules/label.d.ts +0 -7
- package/components/nested-donut/modules/label.js +0 -34
- package/components/nested-donut/modules/label.js.map +0 -1
- package/components/nested-donut/style.d.ts +0 -26
- package/components/nested-donut/style.js +0 -70
- package/components/nested-donut/style.js.map +0 -1
- package/components/nested-donut/types.d.ts +0 -24
- package/components/nested-donut/types.js +0 -11
- package/components/nested-donut/types.js.map +0 -1
- package/components/sankey/config.d.ts +0 -162
- package/components/sankey/config.js +0 -65
- package/components/sankey/config.js.map +0 -1
- package/components/sankey/index.d.ts +0 -59
- package/components/sankey/index.js +0 -306
- package/components/sankey/index.js.map +0 -1
- package/components/sankey/modules/label.d.ts +0 -23
- package/components/sankey/modules/label.js +0 -168
- package/components/sankey/modules/label.js.map +0 -1
- package/components/sankey/modules/link.d.ts +0 -14
- package/components/sankey/modules/link.js +0 -108
- package/components/sankey/modules/link.js.map +0 -1
- package/components/sankey/modules/node.d.ts +0 -10
- package/components/sankey/modules/node.js +0 -156
- package/components/sankey/modules/node.js.map +0 -1
- package/components/sankey/style.d.ts +0 -20
- package/components/sankey/style.js.map +0 -1
- package/components/sankey/types.d.ts +0 -84
- package/components/sankey/types.js +0 -34
- package/components/sankey/types.js.map +0 -1
- package/components/scatter/config.d.ts +0 -44
- package/components/scatter/config.js +0 -23
- package/components/scatter/config.js.map +0 -1
- package/components/scatter/index.d.ts +0 -28
- package/components/scatter/index.js +0 -167
- package/components/scatter/index.js.map +0 -1
- package/components/scatter/modules/point.d.ts +0 -7
- package/components/scatter/modules/point.js +0 -86
- package/components/scatter/modules/point.js.map +0 -1
- package/components/scatter/modules/utils.d.ts +0 -11
- package/components/scatter/modules/utils.js +0 -112
- package/components/scatter/modules/utils.js.map +0 -1
- package/components/scatter/style.d.ts +0 -5
- package/components/scatter/style.js.map +0 -1
- package/components/scatter/types.d.ts +0 -19
- package/components/stacked-bar/config.d.ts +0 -38
- package/components/stacked-bar/config.js +0 -20
- package/components/stacked-bar/config.js.map +0 -1
- package/components/stacked-bar/index.d.ts +0 -28
- package/components/stacked-bar/index.js +0 -208
- package/components/stacked-bar/index.js.map +0 -1
- package/components/stacked-bar/style.d.ts +0 -5
- package/components/stacked-bar/style.js.map +0 -1
- package/components/stacked-bar/types.d.ts +0 -5
- package/components/timeline/config.d.ts +0 -43
- package/components/timeline/config.js +0 -24
- package/components/timeline/config.js.map +0 -1
- package/components/timeline/index.d.ts +0 -41
- package/components/timeline/index.js +0 -244
- package/components/timeline/index.js.map +0 -1
- package/components/timeline/style.d.ts +0 -13
- package/components/timeline/style.js.map +0 -1
- package/components/tooltip/config.d.ts +0 -68
- package/components/tooltip/config.js +0 -20
- package/components/tooltip/config.js.map +0 -1
- package/components/tooltip/index.d.ts +0 -36
- package/components/tooltip/index.js +0 -184
- package/components/tooltip/index.js.map +0 -1
- package/components/tooltip/style.js.map +0 -1
- package/components/topojson-map/config.d.ts +0 -99
- package/components/topojson-map/config.js +0 -42
- package/components/topojson-map/config.js.map +0 -1
- package/components/topojson-map/index.d.ts +0 -52
- package/components/topojson-map/index.js +0 -355
- package/components/topojson-map/index.js.map +0 -1
- package/components/topojson-map/style.d.ts +0 -11
- package/components/topojson-map/style.js.map +0 -1
- package/components/topojson-map/types.d.ts +0 -78
- package/components/topojson-map/types.js +0 -80
- package/components/topojson-map/types.js.map +0 -1
- package/components/topojson-map/utils.d.ts +0 -3
- package/components/topojson-map/utils.js +0 -30
- package/components/topojson-map/utils.js.map +0 -1
- package/components/vis-controls/config.d.ts +0 -12
- package/components/vis-controls/config.js +0 -13
- package/components/vis-controls/config.js.map +0 -1
- package/components/vis-controls/index.d.ts +0 -14
- package/components/vis-controls/index.js +0 -52
- package/components/vis-controls/index.js.map +0 -1
- package/components/vis-controls/style.d.ts +0 -11
- package/components/vis-controls/style.js.map +0 -1
- package/components/vis-controls/types.d.ts +0 -13
- package/components/vis-controls/types.js +0 -8
- package/components/vis-controls/types.js.map +0 -1
- package/components/xy-labels/config.d.ts +0 -48
- package/components/xy-labels/config.js +0 -25
- package/components/xy-labels/config.js.map +0 -1
- package/components/xy-labels/index.d.ts +0 -15
- package/components/xy-labels/index.js +0 -87
- package/components/xy-labels/index.js.map +0 -1
- package/components/xy-labels/modules/label.d.ts +0 -9
- package/components/xy-labels/modules/label.js +0 -107
- package/components/xy-labels/modules/label.js.map +0 -1
- package/components/xy-labels/style.d.ts +0 -5
- package/components/xy-labels/style.js.map +0 -1
- package/components/xy-labels/types.d.ts +0 -23
- package/components/xy-labels/types.js +0 -9
- package/components/xy-labels/types.js.map +0 -1
- package/components.d.ts +0 -51
- package/components.js +0 -29
- package/components.js.map +0 -1
- package/containers/single-container/config.d.ts +0 -12
- package/containers/single-container/config.js +0 -12
- package/containers/single-container/config.js.map +0 -1
- package/containers/single-container/index.d.ts +0 -19
- package/containers/single-container/index.js +0 -128
- package/containers/single-container/index.js.map +0 -1
- package/containers/xy-container/config.d.ts +0 -99
- package/containers/xy-container/config.js +0 -30
- package/containers/xy-container/config.js.map +0 -1
- package/containers/xy-container/index.d.ts +0 -34
- package/containers/xy-container/index.js +0 -330
- package/containers/xy-container/index.js.map +0 -1
- package/containers.d.ts +0 -6
- package/containers.js +0 -4
- package/containers.js.map +0 -1
- package/core/component/config.d.ts +0 -58
- package/core/component/config.js +0 -14
- package/core/component/config.js.map +0 -1
- package/core/component/index.d.ts +0 -43
- package/core/component/index.js +0 -118
- package/core/component/index.js.map +0 -1
- package/core/component/types.d.ts +0 -2
- package/core/component/types.js +0 -2
- package/core/component/types.js.map +0 -1
- package/core/config/index.d.ts +0 -3
- package/core/config/index.js +0 -16
- package/core/config/index.js.map +0 -1
- package/core/container/config.d.ts +0 -48
- package/core/container/config.js +0 -29
- package/core/container/config.js.map +0 -1
- package/core/container/index.d.ts +0 -26
- package/core/container/index.js +0 -105
- package/core/container/index.js.map +0 -1
- package/core/xy-component/config.d.ts +0 -38
- package/core/xy-component/config.js +0 -20
- package/core/xy-component/config.js.map +0 -1
- package/core/xy-component/index.d.ts +0 -27
- package/core/xy-component/index.js +0 -74
- package/core/xy-component/index.js.map +0 -1
- package/data-models/core.d.ts +0 -6
- package/data-models/core.js +0 -14
- package/data-models/core.js.map +0 -1
- package/data-models/graph.d.ts +0 -24
- package/data-models/graph.js +0 -107
- package/data-models/graph.js.map +0 -1
- package/data-models/map-graph.d.ts +0 -21
- package/data-models/map-graph.js +0 -62
- package/data-models/map-graph.js.map +0 -1
- package/data-models/map.d.ts +0 -5
- package/data-models/map.js +0 -12
- package/data-models/map.js.map +0 -1
- package/data-models/series.d.ts +0 -6
- package/data-models/series.js +0 -19
- package/data-models/series.js.map +0 -1
- package/index.d.ts +0 -7
- package/index.js +0 -55
- package/index.js.map +0 -1
- package/maps/china-provinces.json.js +0 -140373
- package/maps/fr-regions.json.js +0 -14162
- package/maps/germany-regions.json.js +0 -35760
- package/maps/ind-regions.json.js +0 -290584
- package/maps/uk-regions.json.js +0 -96233
- package/maps/us-counties.json.js +0 -206318
- package/maps/us-states.json.js +0 -16345
- package/maps/world-110m-alpha.json.js +0 -251366
- package/maps/world-simple.json.js +0 -89428
- package/maps/world-simplest.json.js +0 -28175
- package/maps.d.ts +0 -60
- package/maps.js +0 -23
- package/styles/colors.d.ts +0 -7
- package/styles/colors.js +0 -24
- package/styles/colors.js.map +0 -1
- package/styles/index.d.ts +0 -7
- package/styles/index.js +0 -38
- package/styles/index.js.map +0 -1
- package/styles/sizes.d.ts +0 -2
- package/styles/sizes.js.map +0 -1
- package/types/accessor.d.ts +0 -5
- package/types/accessor.js +0 -2
- package/types/accessor.js.map +0 -1
- package/types/component.d.ts +0 -13
- package/types/component.js +0 -14
- package/types/component.js.map +0 -1
- package/types/curve.d.ts +0 -40
- package/types/curve.js +0 -46
- package/types/curve.js.map +0 -1
- package/types/data.d.ts +0 -7
- package/types/data.js +0 -2
- package/types/data.js.map +0 -1
- package/types/direction.d.ts +0 -6
- package/types/direction.js +0 -10
- package/types/direction.js.map +0 -1
- package/types/graph.d.ts +0 -35
- package/types/graph.js +0 -2
- package/types/graph.js.map +0 -1
- package/types/map.d.ts +0 -4
- package/types/map.js +0 -2
- package/types/map.js.map +0 -1
- package/types/misc.d.ts +0 -8
- package/types/position.d.ts +0 -20
- package/types/position.js +0 -27
- package/types/position.js.map +0 -1
- package/types/scale.d.ts +0 -23
- package/types/scale.js +0 -27
- package/types/scale.js.map +0 -1
- package/types/shape.d.ts +0 -7
- package/types/shape.js +0 -11
- package/types/shape.js.map +0 -1
- package/types/spacing.d.ts +0 -6
- package/types/spacing.js +0 -2
- package/types/spacing.js.map +0 -1
- package/types/svg.d.ts +0 -18
- package/types/svg.js +0 -22
- package/types/svg.js.map +0 -1
- package/types/symbol.d.ts +0 -18
- package/types/symbol.js +0 -24
- package/types/symbol.js.map +0 -1
- package/types/text.d.ts +0 -47
- package/types/text.js +0 -26
- package/types/text.js.map +0 -1
- package/types.d.ts +0 -27
- package/types.js +0 -30
- package/types.js.map +0 -1
- package/utils/color.d.ts +0 -10
- package/utils/color.js +0 -32
- package/utils/color.js.map +0 -1
- package/utils/d3.d.ts +0 -3
- package/utils/d3.js +0 -16
- package/utils/d3.js.map +0 -1
- package/utils/data.d.ts +0 -45
- package/utils/data.js +0 -274
- package/utils/data.js.map +0 -1
- package/utils/html.d.ts +0 -1
- package/utils/html.js +0 -16
- package/utils/html.js.map +0 -1
- package/utils/map.d.ts +0 -2
- package/utils/map.js +0 -20
- package/utils/map.js.map +0 -1
- package/utils/misc.d.ts +0 -9
- package/utils/misc.js +0 -47
- package/utils/misc.js.map +0 -1
- package/utils/path.d.ts +0 -23
- package/utils/path.js +0 -144
- package/utils/path.js.map +0 -1
- package/utils/scale.d.ts +0 -1
- package/utils/style.d.ts +0 -6
- package/utils/style.js +0 -24
- package/utils/style.js.map +0 -1
- package/utils/svg.d.ts +0 -3
- package/utils/text.d.ts +0 -139
- package/utils/text.js +0 -443
- package/utils/text.js.map +0 -1
- package/utils/type.d.ts +0 -5
|
@@ -0,0 +1,529 @@
|
|
|
1
|
+
import { Selection } from 'd3-selection'
|
|
2
|
+
import { sum } from 'd3-array'
|
|
3
|
+
|
|
4
|
+
// Types
|
|
5
|
+
import { TextAlign, TrimMode, UnovisText, UnovisTextFrameOptions, UnovisTextOptions, UnovisWrappedText, VerticalAlign } from 'types/text'
|
|
6
|
+
|
|
7
|
+
// Utils
|
|
8
|
+
import { flatten, isArray, merge } from 'utils/data'
|
|
9
|
+
import { getTextAnchorFromTextAlign } from 'types/svg'
|
|
10
|
+
|
|
11
|
+
// Styles
|
|
12
|
+
import { getFontWidthToHeightRatio, UNOVIS_TEXT_DEFAULT, UNOVIS_TEXT_SEPARATOR_DEFAULT } from 'styles/index'
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Converts a kebab-case string to camelCase.
|
|
16
|
+
*
|
|
17
|
+
* @param {string} str - The kebab-case string to be converted.
|
|
18
|
+
* @returns {string} The resulting camelCase string.
|
|
19
|
+
*/
|
|
20
|
+
export function kebabCaseToCamel (str: string): string {
|
|
21
|
+
return str.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase())
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Converts a given string to kebab-case.
|
|
26
|
+
* @param {string} str - The input string to be converted to kebab-case.
|
|
27
|
+
* @returns {string} - The kebab-cased string.
|
|
28
|
+
*/
|
|
29
|
+
export function kebabCase (str: string): string {
|
|
30
|
+
return str.match(/[A-Z]{2,}(?=[A-Z][a-z0-9]*|\b)|[A-Z]?[a-z0-9]*|[A-Z]|[0-9]+/g)
|
|
31
|
+
?.filter(Boolean)
|
|
32
|
+
.map(x => x.toLowerCase())
|
|
33
|
+
.join('-')
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Trims the input string from the start, leaving only the specified maximum length.
|
|
38
|
+
* @param {string} [str=''] - The input string to be trimmed.
|
|
39
|
+
* @param {number} [maxLength=15] - The maximum allowed length of the trimmed string.
|
|
40
|
+
* @returns {string} - The trimmed string.
|
|
41
|
+
*/
|
|
42
|
+
export function trimStringStart (str = '', maxLength = 15): string {
|
|
43
|
+
return str.length > maxLength ? `…${str.substr(str.length - maxLength, maxLength)}` : str
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Trims the input string from the middle, leaving only the specified maximum length.
|
|
48
|
+
* @param {string} [str=''] - The input string to be trimmed.
|
|
49
|
+
* @param {number} [maxLength=15] - The maximum allowed length of the trimmed string.
|
|
50
|
+
* @returns {string} - The trimmed string.
|
|
51
|
+
*/
|
|
52
|
+
export function trimStringMiddle (str = '', maxLength = 15): string {
|
|
53
|
+
const dist = Math.floor((maxLength - 3) / 2)
|
|
54
|
+
return str.length > maxLength ? `${str.substr(0, dist)}…${str.substr(-dist, dist)}` : str
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Trims the input string from the end, leaving only the specified maximum length.
|
|
59
|
+
* @param {string} [str=''] - The input string to be trimmed.
|
|
60
|
+
* @param {number} [maxLength=15] - The maximum allowed length of the trimmed string.
|
|
61
|
+
* @returns {string} - The trimmed string.
|
|
62
|
+
*/
|
|
63
|
+
export function trimStringEnd (str = '', maxLength = 15): string {
|
|
64
|
+
return str.length > maxLength ? `${str.substr(0, maxLength)}…` : str
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Trims the input string according to the specified trim mode.
|
|
69
|
+
* @param {string} [str=''] - The input string to be trimmed.
|
|
70
|
+
* @param {number} [length=15] - The maximum allowed length of the trimmed string.
|
|
71
|
+
* @param {TrimMode} [type=TrimMode.Middle] - The trim mode to be applied.
|
|
72
|
+
* @returns {string} - The trimmed string.
|
|
73
|
+
*/
|
|
74
|
+
export function trimString (str = '', length = 15, type = TrimMode.Middle): string {
|
|
75
|
+
let result = trimStringEnd(str, length)
|
|
76
|
+
if (type === TrimMode.Start) result = trimStringStart(str, length)
|
|
77
|
+
else if (type === TrimMode.Middle) result = trimStringMiddle(str, length)
|
|
78
|
+
return result
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Splits the input string according to the specified separators.
|
|
83
|
+
* @param {string} text - The input string to be split.
|
|
84
|
+
* @param {string[]} [separators=[' ']] - The array of separators to be used for splitting.
|
|
85
|
+
* @returns {string[]} - The array of split words.
|
|
86
|
+
*/
|
|
87
|
+
export function splitString (text: string, separators = [' ']): string[] {
|
|
88
|
+
let result = [text] as any[]
|
|
89
|
+
for (let i = 0; i < separators.length; i++) {
|
|
90
|
+
const sep = separators[i]
|
|
91
|
+
result.forEach((d, id) => {
|
|
92
|
+
const separated = d.split(sep)
|
|
93
|
+
const words = separated.map((word, j) => `${word}${j === separated.length - 1 ? '' : sep}`)
|
|
94
|
+
result[id] = words
|
|
95
|
+
})
|
|
96
|
+
result = flatten(result)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return result
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Wraps an SVG text element to fit within the specified width.
|
|
104
|
+
* @param {Selection<SVGTextElement, any, SVGElement, any>} textElement - The SVG text element to be wrapped.
|
|
105
|
+
* @param {number} width - The maximum allowed width for the text element.
|
|
106
|
+
* @param {(string | string[])} [separator=[' ', '-', '.', ',']] - The separator(s) to be used for wrapping.
|
|
107
|
+
*/
|
|
108
|
+
export function wrapSVGText (
|
|
109
|
+
textElement: Selection<SVGTextElement, any, SVGElement, any>,
|
|
110
|
+
width: number,
|
|
111
|
+
separator: string | string[] = [' ', '-', '.', ',']
|
|
112
|
+
): void {
|
|
113
|
+
const text = textElement.text()
|
|
114
|
+
if (!text) return
|
|
115
|
+
|
|
116
|
+
// Wrap
|
|
117
|
+
const separators = (isArray(separator) ? separator : [separator]) as string[]
|
|
118
|
+
const words = splitString(text, separators)
|
|
119
|
+
const x = parseFloat(textElement.attr('x')) || 0
|
|
120
|
+
|
|
121
|
+
textElement.text('')
|
|
122
|
+
let tspan = textElement.append('tspan').attr('x', x)
|
|
123
|
+
let tspanContent = `${words[0]}`
|
|
124
|
+
tspan.text(tspanContent)
|
|
125
|
+
|
|
126
|
+
words.forEach((word, i) => {
|
|
127
|
+
if (i === 0) return
|
|
128
|
+
|
|
129
|
+
const tspanText = `${tspanContent}${word}`
|
|
130
|
+
tspan.text(tspanText)
|
|
131
|
+
const tspanWidth = tspan.node().getComputedTextLength()
|
|
132
|
+
if (tspanWidth > width) {
|
|
133
|
+
tspan.text(tspanContent.trim())
|
|
134
|
+
|
|
135
|
+
tspan = textElement.append('tspan')
|
|
136
|
+
.attr('x', x)
|
|
137
|
+
.attr('dy', '1.2em')
|
|
138
|
+
.text(word)
|
|
139
|
+
|
|
140
|
+
tspanContent = word
|
|
141
|
+
} else tspanContent += word
|
|
142
|
+
})
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Trims an SVG text element based on the specified max width, trim type, and other options.
|
|
147
|
+
* @param {Selection<SVGTextElement, any, SVGElement, any>} svgTextSelection - The D3 selection of the SVG text element to be trimmed.
|
|
148
|
+
* @param {number} [maxWidth=50] - The maximum width of the text element.
|
|
149
|
+
* @param {TrimMode} [trimType=TrimMode.Middle] - The type of trim (start, middle, or end).
|
|
150
|
+
* @param {boolean} [fastMode=true] - Whether to use a fast estimation method for text length calculation.
|
|
151
|
+
* @param {number} [fontSize=0] - The font size of the text.
|
|
152
|
+
* @param {number} [fontWidthToHeightRatio=getFontWidthToHeightRatio()] - The font width to height ratio.
|
|
153
|
+
* @returns {boolean} True if the text was trimmed, false otherwise.
|
|
154
|
+
*/
|
|
155
|
+
export function trimSVGText (
|
|
156
|
+
svgTextSelection: Selection<SVGTextElement, any, SVGElement, any>,
|
|
157
|
+
maxWidth = 50,
|
|
158
|
+
trimType = TrimMode.Middle,
|
|
159
|
+
fastMode = true,
|
|
160
|
+
fontSize = +window.getComputedStyle(svgTextSelection.node())?.fontSize || 0,
|
|
161
|
+
fontWidthToHeightRatio = getFontWidthToHeightRatio()
|
|
162
|
+
): boolean {
|
|
163
|
+
const text = svgTextSelection.text()
|
|
164
|
+
const textLength = text.length
|
|
165
|
+
|
|
166
|
+
const textWidth = fastMode ? fontSize * textLength * fontWidthToHeightRatio : svgTextSelection.node().getComputedTextLength()
|
|
167
|
+
const tolerance = 1.1
|
|
168
|
+
const maxCharacters = Math.ceil(textLength * maxWidth / (tolerance * textWidth))
|
|
169
|
+
if (maxCharacters < textLength) {
|
|
170
|
+
svgTextSelection.text(trimString(text, maxCharacters, trimType))
|
|
171
|
+
return true
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
return false
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Estimates the length of a string in pixels.
|
|
179
|
+
* @param {string} str - The string to be measured.
|
|
180
|
+
* @param {number} fontSize - The font size of the string.
|
|
181
|
+
* @param {number} [fontWidthToHeightRatio=getFontWidthToHeightRatio()] - The font width to height ratio.
|
|
182
|
+
* @returns {number} The estimated length of the string in pixels.
|
|
183
|
+
*/
|
|
184
|
+
export function estimateStringPixelLength (
|
|
185
|
+
str: string,
|
|
186
|
+
fontSize: number,
|
|
187
|
+
fontWidthToHeightRatio = getFontWidthToHeightRatio()
|
|
188
|
+
): number {
|
|
189
|
+
return str.length * fontSize * fontWidthToHeightRatio || 0
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Calculates the precise length of a string in pixels.
|
|
194
|
+
* @param {string} str - The string to be measured.
|
|
195
|
+
* @param {string} [fontFamily] - The font family of the string.
|
|
196
|
+
* @param {(string | number)} [fontSize] - The font size of the string.
|
|
197
|
+
* @returns {number} The precise length of the string in pixels.
|
|
198
|
+
*/
|
|
199
|
+
export function getPreciseStringLengthPx (str: string, fontFamily?: string, fontSize?: string | number): number {
|
|
200
|
+
const svgNS = 'http://www.w3.org/2000/svg'
|
|
201
|
+
const svg = document.createElementNS(svgNS, 'svg')
|
|
202
|
+
const text = document.createElementNS(svgNS, 'text')
|
|
203
|
+
|
|
204
|
+
text.textContent = str
|
|
205
|
+
text.setAttribute('font-size', `${fontSize}`)
|
|
206
|
+
text.setAttribute('font-family', fontFamily)
|
|
207
|
+
|
|
208
|
+
svg.appendChild(text)
|
|
209
|
+
document.body.appendChild(svg)
|
|
210
|
+
const length = text.getComputedTextLength()
|
|
211
|
+
document.body.removeChild(svg)
|
|
212
|
+
|
|
213
|
+
return length
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Estimates the dimensions of an SVG text element.
|
|
218
|
+
*
|
|
219
|
+
* @export
|
|
220
|
+
* @param {Selection<SVGTextElement, any, SVGElement, any>} svgTextSelection - The D3 selection of the SVG text element.
|
|
221
|
+
* @param {number} fontSize - The font size.
|
|
222
|
+
* @param {number} [dy=0.32] - The line height scaling factor.
|
|
223
|
+
* @param {boolean} [fastMode=true] - Whether to use a fast estimation method or a more accurate one.
|
|
224
|
+
* @param {number} [fontWidthToHeightRatio] - The font width-to-height ratio.
|
|
225
|
+
* @returns {{width: number, height: number}} - The estimated dimensions of the text element.
|
|
226
|
+
*/
|
|
227
|
+
export function estimateTextSize (
|
|
228
|
+
svgTextSelection: Selection<SVGTextElement, any, SVGElement, any>,
|
|
229
|
+
fontSize: number,
|
|
230
|
+
dy = 0.32,
|
|
231
|
+
fastMode = true,
|
|
232
|
+
fontWidthToHeightRatio?: number
|
|
233
|
+
): { width: number; height: number } {
|
|
234
|
+
fontWidthToHeightRatio = fontWidthToHeightRatio || getFontWidthToHeightRatio()
|
|
235
|
+
const tspanSelection = svgTextSelection.selectAll('tspan')
|
|
236
|
+
|
|
237
|
+
const lines = tspanSelection.size() || 1
|
|
238
|
+
const height = svgTextSelection.text() ? 0.85 * fontSize * lines * (1 + dy) - dy : 0
|
|
239
|
+
|
|
240
|
+
let width = 0
|
|
241
|
+
if (tspanSelection.empty()) {
|
|
242
|
+
const textLength = svgTextSelection.text().length
|
|
243
|
+
width = fastMode ? fontSize * textLength * fontWidthToHeightRatio : svgTextSelection.node().getComputedTextLength()
|
|
244
|
+
} else {
|
|
245
|
+
for (const tspan of tspanSelection.nodes()) {
|
|
246
|
+
const tspanTextLength = (tspan as SVGTSpanElement).textContent.length
|
|
247
|
+
const w = fastMode ? fontSize * tspanTextLength * fontWidthToHeightRatio : (tspan as SVGTSpanElement).getComputedTextLength()
|
|
248
|
+
if (w > width) width = w
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
return { width, height }
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Breaks a text block into lines based on the specified width.
|
|
257
|
+
*
|
|
258
|
+
* @param {UnovisText} textBlock - The text block to break into lines.
|
|
259
|
+
* @param {number | undefined} [width=undefined] - The maximum width of a line in pixels.
|
|
260
|
+
* @param {(number | undefined)} [height=undefined] - The height limit for the wrapped text in pixels.
|
|
261
|
+
* @param {boolean} [fastMode=true] - Whether to use a fast estimation method or a more accurate one.
|
|
262
|
+
* @param {string | string[]} [separator] - The word separators.
|
|
263
|
+
* @returns {string[]} - The text split into lines.
|
|
264
|
+
*/
|
|
265
|
+
function breakTextIntoLines (
|
|
266
|
+
textBlock: UnovisText,
|
|
267
|
+
width: number | undefined = undefined,
|
|
268
|
+
fastMode = true,
|
|
269
|
+
separator: string | string[] = UNOVIS_TEXT_SEPARATOR_DEFAULT,
|
|
270
|
+
wordBreak = false
|
|
271
|
+
): string[] {
|
|
272
|
+
const text = `${textBlock.text}`
|
|
273
|
+
if (!text) return []
|
|
274
|
+
const separators = Array.isArray(separator) ? separator : [separator]
|
|
275
|
+
|
|
276
|
+
const splitByNewLine = text.split('\n')
|
|
277
|
+
return splitByNewLine.map((str) => {
|
|
278
|
+
const lines: string[] = []
|
|
279
|
+
if (!width) return [str]
|
|
280
|
+
|
|
281
|
+
const words = splitString(str, separators)
|
|
282
|
+
let line = ''
|
|
283
|
+
for (let i = 0; i < words.length; i += 1) {
|
|
284
|
+
const textLengthPx = fastMode
|
|
285
|
+
? estimateStringPixelLength(line + words[i], textBlock.fontSize, textBlock.fontWidthToHeightRatio)
|
|
286
|
+
: getPreciseStringLengthPx(line + words[i], textBlock.fontFamily, textBlock.fontSize)
|
|
287
|
+
|
|
288
|
+
if (textLengthPx < width || i === 0) {
|
|
289
|
+
line += words[i]
|
|
290
|
+
} else {
|
|
291
|
+
lines.push(line.trim())
|
|
292
|
+
line = words[i]
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// Word break functionality
|
|
296
|
+
if (wordBreak) {
|
|
297
|
+
while (line.length > 0) {
|
|
298
|
+
const subLineLengthPx = fastMode
|
|
299
|
+
? estimateStringPixelLength(line, textBlock.fontSize, textBlock.fontWidthToHeightRatio)
|
|
300
|
+
: getPreciseStringLengthPx(line, textBlock.fontFamily, textBlock.fontSize)
|
|
301
|
+
|
|
302
|
+
if (subLineLengthPx > width) {
|
|
303
|
+
let breakIndex = (line.trim()).length - 2 // Place at least 2 characters onto the next line
|
|
304
|
+
while (breakIndex > 0) {
|
|
305
|
+
const subLine = `${line.substring(0, breakIndex)}-` // Use hyphen when force breaking words
|
|
306
|
+
const subLinePx = fastMode
|
|
307
|
+
? estimateStringPixelLength(subLine, textBlock.fontSize, textBlock.fontWidthToHeightRatio)
|
|
308
|
+
: getPreciseStringLengthPx(subLine, textBlock.fontFamily, textBlock.fontSize)
|
|
309
|
+
|
|
310
|
+
if (subLinePx <= width) {
|
|
311
|
+
lines.push(subLine.trim())
|
|
312
|
+
line = line.substring(breakIndex)
|
|
313
|
+
break
|
|
314
|
+
}
|
|
315
|
+
breakIndex--
|
|
316
|
+
}
|
|
317
|
+
} else {
|
|
318
|
+
break
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
if (i === words.length - 1) lines.push(line.trim())
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
return lines
|
|
327
|
+
}).flat()
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* Wraps a text or array of texts to fit within specified width and height, if provided.
|
|
332
|
+
*
|
|
333
|
+
* @export
|
|
334
|
+
* @param {UnovisText | UnovisText[]} text - The text or array of texts to wrap.
|
|
335
|
+
* @param {number | undefined} [width=undefined] - The maximum width of a line in pixels.
|
|
336
|
+
* @param {boolean} [fastMode=true] - Whether to use a fast estimation method or a more accurate one.
|
|
337
|
+
* @param {string | string[]} [separator] - The word separators.
|
|
338
|
+
* @returns {UnovisWrappedText[]} - The wrapped texts.
|
|
339
|
+
*/
|
|
340
|
+
export function getWrappedText (
|
|
341
|
+
text: UnovisText | UnovisText[],
|
|
342
|
+
width: number | undefined = undefined,
|
|
343
|
+
height: number | undefined = undefined,
|
|
344
|
+
fastMode = true,
|
|
345
|
+
separator: string | string[] = UNOVIS_TEXT_SEPARATOR_DEFAULT,
|
|
346
|
+
wordBreak = false
|
|
347
|
+
): UnovisWrappedText[] {
|
|
348
|
+
// Merge input text with default values and convert it to an array if it's not already
|
|
349
|
+
const textArrays = Array.isArray(text) ? text.map(t => merge(UNOVIS_TEXT_DEFAULT, t)) : [merge(UNOVIS_TEXT_DEFAULT, text)]
|
|
350
|
+
|
|
351
|
+
// Break input text into lines based on width and separator
|
|
352
|
+
const textWrapped: Array<string[]> = textArrays.map(block => breakTextIntoLines(block, width, fastMode, separator, wordBreak))
|
|
353
|
+
|
|
354
|
+
const firstBlock = textArrays[0]
|
|
355
|
+
let h = -firstBlock.fontSize * (firstBlock.lineHeight - 1)
|
|
356
|
+
const blocks: UnovisWrappedText[] = []
|
|
357
|
+
|
|
358
|
+
// Process each text block and its lines based on height limit
|
|
359
|
+
textArrays.forEach((text, i) => {
|
|
360
|
+
let lines = textWrapped[i]
|
|
361
|
+
|
|
362
|
+
const prevBlock = i > 0 ? blocks[i - 1] : undefined
|
|
363
|
+
const prevBlockMarginBottomPx = prevBlock ? prevBlock.marginBottom : 0
|
|
364
|
+
const marginTopPx = text.marginTop
|
|
365
|
+
const effectiveMarginPx = Math.max(prevBlockMarginBottomPx, marginTopPx)
|
|
366
|
+
|
|
367
|
+
h += effectiveMarginPx
|
|
368
|
+
const dh = text.fontSize * text.lineHeight
|
|
369
|
+
// Iterate over lines and handle text overflow based on the height limit if provided
|
|
370
|
+
for (let k = 0; k < lines.length; k += 1) {
|
|
371
|
+
const line = lines[k]
|
|
372
|
+
h += dh
|
|
373
|
+
|
|
374
|
+
if (height && (h + dh) > height && (k !== lines.length - 1)) {
|
|
375
|
+
const textLengthPx = fastMode
|
|
376
|
+
? estimateStringPixelLength(line, text.fontSize, text.fontWidthToHeightRatio)
|
|
377
|
+
: getPreciseStringLengthPx(line, text.fontFamily, text.fontSize)
|
|
378
|
+
|
|
379
|
+
if (textLengthPx < width) {
|
|
380
|
+
lines[k] += ' …'
|
|
381
|
+
} else {
|
|
382
|
+
lines[k] = `${lines[k].substr(0, lines[k].length - 2)}…`
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
lines = lines.slice(0, k + 1)
|
|
386
|
+
break
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
// Create wrapped text block with its calculated properties
|
|
391
|
+
blocks.push({ ...text, _lines: lines, _estimatedHeight: h - (prevBlock?._estimatedHeight || 0) })
|
|
392
|
+
})
|
|
393
|
+
|
|
394
|
+
return blocks
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
/**
|
|
399
|
+
* Renders a text or array of texts to SVG tspan strings.
|
|
400
|
+
*
|
|
401
|
+
* @param {UnovisWrappedText[]} blocks - The wrapped text blocks.
|
|
402
|
+
* @param {number} [x=0] - The x-coordinate for the tspan elements.
|
|
403
|
+
* @param {number} [y] - The y-coordinate for the tspan elements.
|
|
404
|
+
* @returns {string[]} - The SVG tspan strings.
|
|
405
|
+
*/
|
|
406
|
+
function renderTextToTspanStrings (blocks: UnovisWrappedText[], x = 0, y?: number): string[] {
|
|
407
|
+
return blocks.map((b, i) => {
|
|
408
|
+
const prevBlock = i > 0 ? blocks[i - 1] : undefined
|
|
409
|
+
const prevBlockMarginBottomEm = prevBlock ? prevBlock.marginBottom / prevBlock.fontSize : 0
|
|
410
|
+
const marginTopEm = b.marginTop / b.fontSize
|
|
411
|
+
const marginEm = Math.max(prevBlockMarginBottomEm, marginTopEm)
|
|
412
|
+
const attributes = {
|
|
413
|
+
fontSize: b.fontSize,
|
|
414
|
+
fontFamily: b.fontFamily,
|
|
415
|
+
fill: b.color,
|
|
416
|
+
y: (i === 0) && y,
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
const attributesString = Object.entries(attributes)
|
|
420
|
+
.filter(([_, value]) => value)
|
|
421
|
+
.map(([key, value]) => `${kebabCase(key)}="${escape(value.toString())}"`)
|
|
422
|
+
.join(' ')
|
|
423
|
+
|
|
424
|
+
return `<tspan xmlns="http://www.w3.org/2000/svg" ${attributesString}>${b._lines.map((line, k) => {
|
|
425
|
+
let dy: number
|
|
426
|
+
if (i === 0 && k === 0) dy = 0.8 + marginEm
|
|
427
|
+
else if (k === 0) dy = marginEm + b.lineHeight
|
|
428
|
+
else dy = b.lineHeight
|
|
429
|
+
|
|
430
|
+
return `<tspan x="${x}" dy="${dy}em">${line.length ? line : ' '}</tspan>`
|
|
431
|
+
}).join('')}</tspan>`
|
|
432
|
+
})
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
/**
|
|
436
|
+
* Estimates the height of wrapped text blocks.
|
|
437
|
+
*
|
|
438
|
+
* @export
|
|
439
|
+
* @param {UnovisWrappedText[]} blocks - The wrapped text blocks.
|
|
440
|
+
* @returns {number} - The estimated height of the wrapped text blocks.
|
|
441
|
+
*/
|
|
442
|
+
export function estimateWrappedTextHeight (blocks: UnovisWrappedText[]): number {
|
|
443
|
+
return sum(blocks, b => b._estimatedHeight)
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
/**
|
|
447
|
+
* Renders a text or array of texts to an SVG text element.
|
|
448
|
+
* Calling this function will replace the contents of the specified SVG text element.
|
|
449
|
+
*
|
|
450
|
+
* @export
|
|
451
|
+
* @param {SVGTextElement} textElement - The SVG text element to render the text into.
|
|
452
|
+
* @param {UnovisText | UnovisText[]} text - The text or array of texts to render.
|
|
453
|
+
* @param {UnovisTextOptions} options - The text options.
|
|
454
|
+
*/
|
|
455
|
+
export function renderTextToSvgTextElement (
|
|
456
|
+
textElement: SVGTextElement,
|
|
457
|
+
text: UnovisText | UnovisText[],
|
|
458
|
+
options: UnovisTextOptions
|
|
459
|
+
): void {
|
|
460
|
+
const wrappedText = getWrappedText(text, options.width, undefined, options.fastMode, options.separator, options.wordBreak)
|
|
461
|
+
const textElementX = +textElement.getAttribute('x')
|
|
462
|
+
const textElementY = +textElement.getAttribute('y')
|
|
463
|
+
const x = textElementX ?? 0
|
|
464
|
+
let y = textElementY ?? 0
|
|
465
|
+
if (options.textAlign) textElement.setAttribute('text-anchor', getTextAnchorFromTextAlign(options.textAlign))
|
|
466
|
+
if (options.verticalAlign && options.verticalAlign !== VerticalAlign.Top) {
|
|
467
|
+
const height = estimateWrappedTextHeight(wrappedText)
|
|
468
|
+
const dy = options.verticalAlign === VerticalAlign.Middle ? -height / 2
|
|
469
|
+
: options.verticalAlign === VerticalAlign.Bottom ? -height : 0
|
|
470
|
+
|
|
471
|
+
y += dy
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
const parser = new DOMParser()
|
|
475
|
+
textElement.textContent = ''
|
|
476
|
+
wrappedText.forEach(block => {
|
|
477
|
+
const svgCode = renderTextToTspanStrings([block], x, y).join('')
|
|
478
|
+
const parsedSvgCode = parser.parseFromString(svgCode, 'image/svg+xml').firstChild
|
|
479
|
+
textElement.appendChild(parsedSvgCode)
|
|
480
|
+
})
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
/**
|
|
484
|
+
* Renders a text or array of texts into a frame.
|
|
485
|
+
* Calling this function will replace the contents of the specified SVG group.
|
|
486
|
+
*
|
|
487
|
+
* @export
|
|
488
|
+
* @param {SVGGElement} group - The SVG group element to render the text into.
|
|
489
|
+
* @param {UnovisText | UnovisText[]} text - The text or array of texts to render.
|
|
490
|
+
* @param {UnovisTextFrameOptions} frameOptions - The text frame options.
|
|
491
|
+
*/
|
|
492
|
+
export function renderTextIntoFrame (
|
|
493
|
+
group: SVGGElement,
|
|
494
|
+
text: UnovisText | UnovisText[],
|
|
495
|
+
frameOptions: UnovisTextFrameOptions
|
|
496
|
+
): void {
|
|
497
|
+
const wrappedText = getWrappedText(text, frameOptions.width, frameOptions.height, frameOptions.fastMode, frameOptions.separator, frameOptions.wordBreak)
|
|
498
|
+
|
|
499
|
+
const x = frameOptions.textAlign === TextAlign.Center ? frameOptions.width / 2
|
|
500
|
+
: frameOptions.textAlign === TextAlign.Right ? frameOptions.width : 0
|
|
501
|
+
|
|
502
|
+
let y = 0
|
|
503
|
+
const height = estimateWrappedTextHeight(wrappedText)
|
|
504
|
+
if (frameOptions.height && height < frameOptions.height) {
|
|
505
|
+
const height = estimateWrappedTextHeight(wrappedText)
|
|
506
|
+
const dh = frameOptions.height - height
|
|
507
|
+
y = frameOptions.verticalAlign === VerticalAlign.Middle ? dh / 2
|
|
508
|
+
: frameOptions.verticalAlign === VerticalAlign.Bottom ? dh : 0
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
const translate = (frameOptions.x || frameOptions.y)
|
|
512
|
+
? `transform="translate(${frameOptions.x ?? 0},${frameOptions.y ?? 0})"`
|
|
513
|
+
: ''
|
|
514
|
+
|
|
515
|
+
const svgCode =
|
|
516
|
+
`<text
|
|
517
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
518
|
+
text-anchor="${getTextAnchorFromTextAlign(frameOptions.textAlign)}"
|
|
519
|
+
${translate}
|
|
520
|
+
>
|
|
521
|
+
${renderTextToTspanStrings(wrappedText, x, y).join('')}
|
|
522
|
+
</text>`
|
|
523
|
+
|
|
524
|
+
const parser = new DOMParser()
|
|
525
|
+
const parsedSvgCode = parser.parseFromString(svgCode, 'image/svg+xml').firstChild
|
|
526
|
+
|
|
527
|
+
group.textContent = ''
|
|
528
|
+
group.appendChild(parsedSvgCode)
|
|
529
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type RemovePrefix<T extends string, Prefix extends string> = T extends `${Prefix}${infer Tail}` ? `${Tail}` : T
|
|
2
|
+
export type KebabToCamelCase<T extends string> =
|
|
3
|
+
T extends `${infer Head}-${infer Tail}`
|
|
4
|
+
? `${Head}${Capitalize<KebabToCamelCase<Tail>>}`
|
|
5
|
+
: T;
|
|
6
|
+
|
|
7
|
+
export type CamelCase<T> = {
|
|
8
|
+
[Property in keyof T as KebabToCamelCase<Property & string>]: T[Property];
|
|
9
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"rootDir": "./src",
|
|
5
|
+
"baseUrl": "./src",
|
|
6
|
+
"outDir": "./lib",
|
|
7
|
+
"declaration": true,
|
|
8
|
+
"paths": {
|
|
9
|
+
"types/*": ["./types/*"],
|
|
10
|
+
"utils/*": ["./utils/*"],
|
|
11
|
+
"core/*": ["./core/*"],
|
|
12
|
+
"components/*": ["./components/*"],
|
|
13
|
+
"styles/*": ["./styles/*"],
|
|
14
|
+
"data-models/*": ["./data-models/*"]
|
|
15
|
+
},
|
|
16
|
+
// To be enabled:
|
|
17
|
+
// "noImplicitAny": true,
|
|
18
|
+
// "alwaysStrict": true,
|
|
19
|
+
// "strictNullChecks": true,
|
|
20
|
+
// "strictPropertyInitialization": true,
|
|
21
|
+
"strictFunctionTypes": true,
|
|
22
|
+
"noImplicitThis": true,
|
|
23
|
+
"strictBindCallApply": true
|
|
24
|
+
},
|
|
25
|
+
"exclude": [
|
|
26
|
+
"index.ts",
|
|
27
|
+
"maps.ts"
|
|
28
|
+
]
|
|
29
|
+
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { XYComponentConfigInterface, XYComponentConfig } from "../../core/xy-component/config";
|
|
2
|
-
import { CurveType } from "../../types/curve";
|
|
3
|
-
import { NumericAccessor, StringAccessor } from "../../types/accessor";
|
|
4
|
-
export interface AreaConfigInterface<Datum> extends XYComponentConfigInterface<Datum> {
|
|
5
|
-
/** Curve type from the CurveType enum. Default: `CurveType.MonotoneX` */
|
|
6
|
-
curveType?: CurveType;
|
|
7
|
-
/** Baseline value or accessor function. Default: `undefined` */
|
|
8
|
-
baseline?: NumericAccessor<Datum>;
|
|
9
|
-
/** Opacity value or accessor function. Default: `1` */
|
|
10
|
-
opacity?: NumericAccessor<Datum>;
|
|
11
|
-
/** Optional area cursor. String or accessor function. Default: `null` */
|
|
12
|
-
cursor?: StringAccessor<Datum[]>;
|
|
13
|
-
/** If an area is smaller than 1px, extend it to have 1px height.
|
|
14
|
-
* This setting is useful when some of the area values are zeros or very small so visually they become
|
|
15
|
-
* practically invisible, but you want to show that the data behind them exists and they're not just empty segments.
|
|
16
|
-
* Default: `false` */
|
|
17
|
-
minHeight1Px?: boolean;
|
|
18
|
-
}
|
|
19
|
-
export declare class AreaConfig<Datum> extends XYComponentConfig<Datum> implements AreaConfigInterface<Datum> {
|
|
20
|
-
curveType: CurveType;
|
|
21
|
-
baseline: () => number;
|
|
22
|
-
opacity: number;
|
|
23
|
-
cursor: any;
|
|
24
|
-
minHeight1Px: boolean;
|
|
25
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { XYComponentConfig } from '../../core/xy-component/config.js';
|
|
2
|
-
import { CurveType } from '../../types/curve.js';
|
|
3
|
-
|
|
4
|
-
class AreaConfig extends XYComponentConfig {
|
|
5
|
-
constructor() {
|
|
6
|
-
super(...arguments);
|
|
7
|
-
this.curveType = CurveType.MonotoneX;
|
|
8
|
-
this.baseline = () => 0;
|
|
9
|
-
this.opacity = 1;
|
|
10
|
-
this.cursor = null;
|
|
11
|
-
this.minHeight1Px = false;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export { AreaConfig };
|
|
16
|
-
//# sourceMappingURL=config.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sources":["../../../src/components/area/config.ts"],"sourcesContent":["import { XYComponentConfigInterface, XYComponentConfig } from 'core/xy-component/config'\n\n// Types\nimport { CurveType } from 'types/curve'\nimport { NumericAccessor, StringAccessor } from 'types/accessor'\n\nexport interface AreaConfigInterface<Datum> extends XYComponentConfigInterface<Datum> {\n /** Curve type from the CurveType enum. Default: `CurveType.MonotoneX` */\n curveType?: CurveType;\n /** Baseline value or accessor function. Default: `undefined` */\n baseline?: NumericAccessor<Datum>;\n /** Opacity value or accessor function. Default: `1` */\n opacity?: NumericAccessor<Datum>;\n /** Optional area cursor. String or accessor function. Default: `null` */\n cursor?: StringAccessor<Datum[]>;\n /** If an area is smaller than 1px, extend it to have 1px height.\n * This setting is useful when some of the area values are zeros or very small so visually they become\n * practically invisible, but you want to show that the data behind them exists and they're not just empty segments.\n * Default: `false` */\n minHeight1Px?: boolean;\n}\n\nexport class AreaConfig<Datum> extends XYComponentConfig<Datum> implements AreaConfigInterface<Datum> {\n curveType = CurveType.MonotoneX\n baseline = (): number => 0\n opacity = 1\n cursor = null\n minHeight1Px = false\n}\n"],"names":[],"mappings":";;;AAsBM,MAAO,UAAkB,SAAQ,iBAAwB,CAAA;AAA/D,IAAA,WAAA,GAAA;;AACE,QAAA,IAAA,CAAA,SAAS,GAAG,SAAS,CAAC,SAAS,CAAA;AAC/B,QAAA,IAAA,CAAA,QAAQ,GAAG,MAAc,CAAC,CAAA;QAC1B,IAAO,CAAA,OAAA,GAAG,CAAC,CAAA;QACX,IAAM,CAAA,MAAA,GAAG,IAAI,CAAA;QACb,IAAY,CAAA,YAAA,GAAG,KAAK,CAAA;KACrB;AAAA;;;;"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Area as AreaInterface } from 'd3-shape';
|
|
2
|
-
import { XYComponentCore } from "../../core/xy-component";
|
|
3
|
-
import { AreaDatum } from './types';
|
|
4
|
-
import { AreaConfig, AreaConfigInterface } from './config';
|
|
5
|
-
import * as s from './style';
|
|
6
|
-
export declare class Area<Datum> extends XYComponentCore<Datum, AreaConfig<Datum>, AreaConfigInterface<Datum>> {
|
|
7
|
-
static selectors: typeof s;
|
|
8
|
-
stacked: boolean;
|
|
9
|
-
config: AreaConfig<Datum>;
|
|
10
|
-
areaGen: AreaInterface<AreaDatum>;
|
|
11
|
-
private _prevNegative;
|
|
12
|
-
events: {
|
|
13
|
-
[x: string]: {};
|
|
14
|
-
};
|
|
15
|
-
constructor(config?: AreaConfigInterface<Datum>);
|
|
16
|
-
_render(customDuration?: number): void;
|
|
17
|
-
getYDataExtent(scaleByVisibleData: boolean): number[];
|
|
18
|
-
_emptyPath(): string;
|
|
19
|
-
}
|