@unovis/ts 1.1.1-beta.7 → 1.1.1-beta.8
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/components/area/config.d.ts +25 -0
- package/components/area/config.js +16 -0
- package/components/area/config.js.map +1 -0
- package/components/area/index.d.ts +19 -0
- package/components/area/index.js +102 -0
- package/components/area/index.js.map +1 -0
- package/components/area/style.d.ts +3 -0
- package/{src/components/area/style.ts → components/area/style.js} +10 -9
- package/components/area/style.js.map +1 -0
- package/components/area/types.d.ts +6 -0
- package/components/axis/config.d.ts +71 -0
- package/components/axis/config.js +32 -0
- package/components/axis/config.js.map +1 -0
- package/components/axis/index.d.ts +44 -0
- package/components/axis/index.js +305 -0
- package/components/axis/index.js.map +1 -0
- package/components/axis/style.d.ts +9 -0
- package/{src/components/axis/style.ts → components/axis/style.js} +22 -27
- package/components/axis/style.js.map +1 -0
- package/components/axis/types.d.ts +4 -0
- package/components/axis/types.js +8 -0
- package/components/axis/types.js.map +1 -0
- package/components/brush/config.d.ts +42 -0
- package/components/brush/config.js +24 -0
- package/components/brush/config.js.map +1 -0
- package/components/brush/index.d.ts +28 -0
- package/components/brush/index.js +199 -0
- package/components/brush/index.js.map +1 -0
- package/components/brush/style.d.ts +5 -0
- package/{src/components/brush/style.ts → components/brush/style.js} +14 -15
- package/components/brush/style.js.map +1 -0
- package/components/brush/types.d.ts +7 -0
- package/components/brush/types.js +8 -0
- package/components/brush/types.js.map +1 -0
- package/components/bullet-legend/config.d.ts +34 -0
- package/components/bullet-legend/config.js +16 -0
- package/components/bullet-legend/config.js.map +1 -0
- package/components/bullet-legend/index.d.ts +19 -0
- package/components/bullet-legend/index.js +79 -0
- package/components/bullet-legend/index.js.map +1 -0
- package/components/bullet-legend/style.d.ts +6 -0
- package/{src/components/bullet-legend/style.ts → components/bullet-legend/style.js} +16 -18
- package/components/bullet-legend/style.js.map +1 -0
- package/components/bullet-legend/types.d.ts +7 -0
- package/components/bullet-legend/types.js +2 -0
- package/components/bullet-legend/types.js.map +1 -0
- package/components/chord-diagram/config.d.ts +44 -0
- package/components/chord-diagram/config.js +25 -0
- package/components/chord-diagram/config.js.map +1 -0
- package/components/chord-diagram/index.d.ts +42 -0
- package/components/chord-diagram/index.js +305 -0
- package/components/chord-diagram/index.js.map +1 -0
- package/components/chord-diagram/modules/label.d.ts +8 -0
- package/components/chord-diagram/modules/label.js +115 -0
- package/components/chord-diagram/modules/label.js.map +1 -0
- package/components/chord-diagram/modules/link.d.ts +21 -0
- package/components/chord-diagram/modules/link.js +63 -0
- package/components/chord-diagram/modules/link.js.map +1 -0
- package/components/chord-diagram/modules/node.d.ts +17 -0
- package/components/chord-diagram/modules/node.js +52 -0
- package/components/chord-diagram/modules/node.js.map +1 -0
- package/components/chord-diagram/style.d.ts +13 -0
- package/{src/components/chord-diagram/style.ts → components/chord-diagram/style.js} +30 -39
- package/components/chord-diagram/style.js.map +1 -0
- package/components/chord-diagram/types.d.ts +58 -0
- package/components/chord-diagram/types.js +8 -0
- package/components/chord-diagram/types.js.map +1 -0
- package/components/crosshair/config.d.ts +43 -0
- package/components/crosshair/config.js +19 -0
- package/components/crosshair/config.js.map +1 -0
- package/components/crosshair/index.d.ts +35 -0
- package/components/crosshair/index.js +183 -0
- package/components/crosshair/index.js.map +1 -0
- package/components/crosshair/style.d.ts +4 -0
- package/{src/components/crosshair/style.ts → components/crosshair/style.js} +12 -12
- package/components/crosshair/style.js.map +1 -0
- package/components/crosshair/types.d.ts +13 -0
- package/components/crosshair/types.js +2 -0
- package/components/crosshair/types.js.map +1 -0
- package/components/donut/config.d.ts +59 -0
- package/components/donut/config.js +28 -0
- package/components/donut/config.js.map +1 -0
- package/components/donut/index.d.ts +21 -0
- package/components/donut/index.js +107 -0
- package/components/donut/index.js.map +1 -0
- package/components/donut/modules/arc.d.ts +10 -0
- package/components/donut/modules/arc.js +59 -0
- package/components/donut/modules/arc.js.map +1 -0
- package/components/donut/style.d.ts +7 -0
- package/{src/components/donut/style.ts → components/donut/style.js} +18 -20
- package/components/donut/style.js.map +1 -0
- package/components/donut/types.d.ts +20 -0
- package/components/flow-legend/config.d.ts +29 -0
- package/components/flow-legend/config.js +18 -0
- package/components/flow-legend/config.js.map +1 -0
- package/components/flow-legend/index.d.ts +16 -0
- package/components/flow-legend/index.js +75 -0
- package/components/flow-legend/index.js.map +1 -0
- package/components/flow-legend/style.d.ts +8 -0
- package/{src/components/flow-legend/style.ts → components/flow-legend/style.js} +21 -25
- package/components/flow-legend/style.js.map +1 -0
- package/components/flow-legend/types.d.ts +9 -0
- package/components/flow-legend/types.js +8 -0
- package/components/flow-legend/types.js.map +1 -0
- package/components/free-brush/config.d.ts +45 -0
- package/components/free-brush/config.js +24 -0
- package/components/free-brush/config.js.map +1 -0
- package/components/free-brush/index.d.ts +20 -0
- package/components/free-brush/index.js +192 -0
- package/components/free-brush/index.js.map +1 -0
- package/components/free-brush/style.d.ts +4 -0
- package/{src/components/free-brush/style.ts → components/free-brush/style.js} +12 -12
- package/components/free-brush/style.js.map +1 -0
- package/components/free-brush/types.d.ts +7 -0
- package/components/free-brush/types.js +9 -0
- package/components/free-brush/types.js.map +1 -0
- package/components/graph/config.d.ts +238 -0
- package/components/graph/config.js +84 -0
- package/components/graph/config.js.map +1 -0
- package/components/graph/index.d.ts +126 -0
- package/components/graph/index.js +656 -0
- package/components/graph/index.js.map +1 -0
- package/components/graph/modules/layout-helpers.d.ts +21 -0
- package/components/graph/modules/layout-helpers.js +69 -0
- package/components/graph/modules/layout-helpers.js.map +1 -0
- package/components/graph/modules/layout.d.ts +10 -0
- package/components/graph/modules/layout.js +399 -0
- package/components/graph/modules/layout.js.map +1 -0
- package/components/graph/modules/link/helper.d.ts +25 -0
- package/components/graph/modules/link/helper.js +74 -0
- package/components/graph/modules/link/helper.js.map +1 -0
- package/components/graph/modules/link/index.d.ts +11 -0
- package/components/graph/modules/link/index.js +212 -0
- package/components/graph/modules/link/index.js.map +1 -0
- package/components/graph/modules/link/style.d.ts +15 -0
- package/{src/components/graph/modules/link/style.ts → components/graph/modules/link/style.js} +34 -45
- package/components/graph/modules/link/style.js.map +1 -0
- package/components/graph/modules/node/helper.d.ts +21 -0
- package/components/graph/modules/node/helper.js +126 -0
- package/components/graph/modules/node/helper.js.map +1 -0
- package/components/graph/modules/node/index.d.ts +11 -0
- package/components/graph/modules/node/index.js +252 -0
- package/components/graph/modules/node/index.js.map +1 -0
- package/components/graph/modules/node/style.d.ts +24 -0
- package/{src/components/graph/modules/node/style.ts → components/graph/modules/node/style.js} +52 -72
- package/components/graph/modules/node/style.js.map +1 -0
- package/components/graph/modules/panel/helper.d.ts +18 -0
- package/components/graph/modules/panel/helper.js +111 -0
- package/components/graph/modules/panel/helper.js.map +1 -0
- package/components/graph/modules/panel/index.d.ts +7 -0
- package/components/graph/modules/panel/index.js +98 -0
- package/components/graph/modules/panel/index.js.map +1 -0
- package/components/graph/modules/panel/style.d.ts +14 -0
- package/{src/components/graph/modules/panel/style.ts → components/graph/modules/panel/style.js} +32 -42
- package/components/graph/modules/panel/style.js.map +1 -0
- package/components/graph/modules/shape.d.ts +6 -0
- package/components/graph/modules/shape.js +80 -0
- package/components/graph/modules/shape.js.map +1 -0
- package/components/graph/modules/zoom-levels.d.ts +6 -0
- package/components/graph/modules/zoom-levels.js +10 -0
- package/components/graph/modules/zoom-levels.js.map +1 -0
- package/components/graph/style.d.ts +6 -0
- package/components/graph/style.js +66 -0
- package/components/graph/style.js.map +1 -0
- package/components/graph/types.d.ts +125 -0
- package/components/graph/types.js +30 -0
- package/components/graph/types.js.map +1 -0
- package/components/grouped-bar/config.d.ts +36 -0
- package/components/grouped-bar/config.js +20 -0
- package/components/grouped-bar/config.js.map +1 -0
- package/components/grouped-bar/index.d.ts +32 -0
- package/components/grouped-bar/index.js +249 -0
- package/components/grouped-bar/index.js.map +1 -0
- package/components/grouped-bar/style.d.ts +5 -0
- package/{src/components/grouped-bar/style.ts → components/grouped-bar/style.js} +14 -15
- package/components/grouped-bar/style.js.map +1 -0
- package/components/leaflet-flow-map/config.d.ts +46 -0
- package/components/leaflet-flow-map/config.js +25 -0
- package/components/leaflet-flow-map/config.js.map +1 -0
- package/components/leaflet-flow-map/index.d.ts +52 -0
- package/components/leaflet-flow-map/index.js +220 -0
- package/components/leaflet-flow-map/index.js.map +1 -0
- package/components/leaflet-flow-map/renderer-utils.d.ts +5 -0
- package/components/leaflet-flow-map/renderer-utils.js +15 -0
- package/components/leaflet-flow-map/renderer-utils.js.map +1 -0
- package/components/leaflet-flow-map/renderer.d.ts +26 -0
- package/components/leaflet-flow-map/renderer.js +117 -0
- package/components/leaflet-flow-map/renderer.js.map +1 -0
- package/components/leaflet-flow-map/shaders.d.ts +2 -0
- package/{src/components/leaflet-flow-map/shaders.ts → components/leaflet-flow-map/shaders.js} +7 -4
- package/components/leaflet-flow-map/shaders.js.map +1 -0
- package/components/leaflet-flow-map/types.d.ts +23 -0
- package/components/leaflet-map/config.d.ts +193 -0
- package/components/leaflet-map/config.js +71 -0
- package/components/leaflet-map/config.js.map +1 -0
- package/components/leaflet-map/index.d.ts +130 -0
- package/components/leaflet-map/index.js +690 -0
- package/components/leaflet-map/index.js.map +1 -0
- package/components/leaflet-map/leaflet.css.js +5 -0
- package/components/leaflet-map/leaflet.css.js.map +1 -0
- package/components/leaflet-map/modules/clusterBackground.d.ts +5 -0
- package/components/leaflet-map/modules/clusterBackground.js +27 -0
- package/components/leaflet-map/modules/clusterBackground.js.map +1 -0
- package/components/leaflet-map/modules/donut.d.ts +3 -0
- package/components/leaflet-map/modules/donut.js +25 -0
- package/components/leaflet-map/modules/donut.js.map +1 -0
- package/components/leaflet-map/modules/map.d.ts +14 -0
- package/components/leaflet-map/modules/map.js +154 -0
- package/components/leaflet-map/modules/map.js.map +1 -0
- package/components/leaflet-map/modules/node.d.ts +9 -0
- package/components/leaflet-map/modules/node.js +162 -0
- package/components/leaflet-map/modules/node.js.map +1 -0
- package/components/leaflet-map/modules/selectionRing.d.ts +7 -0
- package/components/leaflet-map/modules/selectionRing.js +41 -0
- package/components/leaflet-map/modules/selectionRing.js.map +1 -0
- package/components/leaflet-map/modules/utils.d.ts +50 -0
- package/components/leaflet-map/modules/utils.js +210 -0
- package/components/leaflet-map/modules/utils.js.map +1 -0
- package/{src/components → components}/leaflet-map/renderer/leaflet-maplibre-gl.js +78 -76
- package/components/leaflet-map/renderer/leaflet-maplibre-gl.js.map +1 -0
- package/components/leaflet-map/renderer/map-style.d.ts +4 -0
- package/components/leaflet-map/renderer/map-style.js +15 -0
- package/components/leaflet-map/renderer/map-style.js.map +1 -0
- package/components/leaflet-map/renderer/mapboxgl/mapboxgl-dark-theme.json.js +40 -0
- package/components/leaflet-map/renderer/mapboxgl/mapboxgl-dark-theme.json.js.map +1 -0
- package/components/leaflet-map/renderer/mapboxgl/mapboxgl-light-theme.json.js +40 -0
- package/components/leaflet-map/renderer/mapboxgl/mapboxgl-light-theme.json.js.map +1 -0
- package/components/leaflet-map/renderer/mapboxgl/mapboxgl-settings.json.js +4981 -0
- package/components/leaflet-map/renderer/mapboxgl/mapboxgl-settings.json.js.map +1 -0
- package/components/leaflet-map/renderer/mapboxgl-layer.d.ts +8 -0
- package/components/leaflet-map/renderer/mapboxgl-layer.js +27 -0
- package/components/leaflet-map/renderer/mapboxgl-layer.js.map +1 -0
- package/components/leaflet-map/renderer/mapboxgl-utils.d.ts +4 -0
- package/components/leaflet-map/renderer/mapboxgl-utils.js +39 -0
- package/components/leaflet-map/renderer/mapboxgl-utils.js.map +1 -0
- package/{src/components → components}/leaflet-map/renderer/maplibre-gl.css.js +4 -2
- package/components/leaflet-map/renderer/maplibre-gl.css.js.map +1 -0
- package/components/leaflet-map/style.d.ts +52 -0
- package/components/leaflet-map/style.js +183 -0
- package/components/leaflet-map/style.js.map +1 -0
- package/components/leaflet-map/types.d.ts +75 -0
- package/components/leaflet-map/types.js +15 -0
- package/components/leaflet-map/types.js.map +1 -0
- package/components/line/config.d.ts +30 -0
- package/components/line/config.js +17 -0
- package/components/line/config.js.map +1 -0
- package/components/line/index.d.ts +27 -0
- package/components/line/index.js +152 -0
- package/components/line/index.js.map +1 -0
- package/components/line/style.d.ts +6 -0
- package/{src/components/line/style.ts → components/line/style.js} +16 -18
- package/components/line/style.js.map +1 -0
- package/components/line/types.d.ts +12 -0
- package/components/nested-donut/config.d.ts +59 -0
- package/components/nested-donut/config.js +19 -0
- package/components/nested-donut/config.js.map +1 -0
- package/components/nested-donut/index.d.ts +38 -0
- package/components/nested-donut/index.js +133 -0
- package/components/nested-donut/index.js.map +1 -0
- package/components/nested-donut/modules/arc.d.ts +17 -0
- package/components/nested-donut/modules/arc.js +50 -0
- package/components/nested-donut/modules/arc.js.map +1 -0
- package/components/nested-donut/modules/label.d.ts +7 -0
- package/components/nested-donut/modules/label.js +34 -0
- package/components/nested-donut/modules/label.js.map +1 -0
- package/components/nested-donut/style.d.ts +26 -0
- package/components/nested-donut/style.js +70 -0
- package/components/nested-donut/style.js.map +1 -0
- package/components/nested-donut/types.d.ts +24 -0
- package/components/nested-donut/types.js +11 -0
- package/components/nested-donut/types.js.map +1 -0
- package/components/sankey/config.d.ts +162 -0
- package/components/sankey/config.js +65 -0
- package/components/sankey/config.js.map +1 -0
- package/components/sankey/index.d.ts +59 -0
- package/components/sankey/index.js +306 -0
- package/components/sankey/index.js.map +1 -0
- package/components/sankey/modules/label.d.ts +23 -0
- package/components/sankey/modules/label.js +168 -0
- package/components/sankey/modules/label.js.map +1 -0
- package/components/sankey/modules/link.d.ts +14 -0
- package/components/sankey/modules/link.js +108 -0
- package/components/sankey/modules/link.js.map +1 -0
- package/components/sankey/modules/node.d.ts +10 -0
- package/components/sankey/modules/node.js +156 -0
- package/components/sankey/modules/node.js.map +1 -0
- package/components/sankey/style.d.ts +20 -0
- package/{src/components/sankey/style.ts → components/sankey/style.js} +44 -60
- package/components/sankey/style.js.map +1 -0
- package/components/sankey/types.d.ts +84 -0
- package/components/sankey/types.js +34 -0
- package/components/sankey/types.js.map +1 -0
- package/components/scatter/config.d.ts +44 -0
- package/components/scatter/config.js +23 -0
- package/components/scatter/config.js.map +1 -0
- package/components/scatter/index.d.ts +28 -0
- package/components/scatter/index.js +167 -0
- package/components/scatter/index.js.map +1 -0
- package/components/scatter/modules/point.d.ts +7 -0
- package/components/scatter/modules/point.js +86 -0
- package/components/scatter/modules/point.js.map +1 -0
- package/components/scatter/modules/utils.d.ts +11 -0
- package/components/scatter/modules/utils.js +112 -0
- package/components/scatter/modules/utils.js.map +1 -0
- package/components/scatter/style.d.ts +5 -0
- package/{src/components/scatter/style.ts → components/scatter/style.js} +14 -15
- package/components/scatter/style.js.map +1 -0
- package/components/scatter/types.d.ts +19 -0
- package/components/stacked-bar/config.d.ts +38 -0
- package/components/stacked-bar/config.js +20 -0
- package/components/stacked-bar/config.js.map +1 -0
- package/components/stacked-bar/index.d.ts +28 -0
- package/components/stacked-bar/index.js +208 -0
- package/components/stacked-bar/index.js.map +1 -0
- package/components/stacked-bar/style.d.ts +5 -0
- package/{src/components/stacked-bar/style.ts → components/stacked-bar/style.js} +14 -15
- package/components/stacked-bar/style.js.map +1 -0
- package/components/stacked-bar/types.d.ts +5 -0
- package/components/timeline/config.d.ts +43 -0
- package/components/timeline/config.js +24 -0
- package/components/timeline/config.js.map +1 -0
- package/components/timeline/index.d.ts +41 -0
- package/components/timeline/index.js +244 -0
- package/components/timeline/index.js.map +1 -0
- package/components/timeline/style.d.ts +13 -0
- package/{src/components/timeline/style.ts → components/timeline/style.js} +30 -39
- package/components/timeline/style.js.map +1 -0
- package/components/tooltip/config.d.ts +68 -0
- package/components/tooltip/config.js +20 -0
- package/components/tooltip/config.js.map +1 -0
- package/components/tooltip/index.d.ts +36 -0
- package/components/tooltip/index.js +184 -0
- package/components/tooltip/index.js.map +1 -0
- package/{src/components → components}/tooltip/style.js +14 -11
- package/components/tooltip/style.js.map +1 -0
- package/components/topojson-map/config.d.ts +99 -0
- package/components/topojson-map/config.js +42 -0
- package/components/topojson-map/config.js.map +1 -0
- package/components/topojson-map/index.d.ts +52 -0
- package/components/topojson-map/index.js +355 -0
- package/components/topojson-map/index.js.map +1 -0
- package/components/topojson-map/style.d.ts +11 -0
- package/{src/components/topojson-map/style.ts → components/topojson-map/style.js} +26 -33
- package/components/topojson-map/style.js.map +1 -0
- package/components/topojson-map/types.d.ts +78 -0
- package/components/topojson-map/types.js +80 -0
- package/components/topojson-map/types.js.map +1 -0
- package/components/topojson-map/utils.d.ts +3 -0
- package/components/topojson-map/utils.js +30 -0
- package/components/topojson-map/utils.js.map +1 -0
- package/components/vis-controls/config.d.ts +12 -0
- package/components/vis-controls/config.js +13 -0
- package/components/vis-controls/config.js.map +1 -0
- package/components/vis-controls/index.d.ts +14 -0
- package/components/vis-controls/index.js +52 -0
- package/components/vis-controls/index.js.map +1 -0
- package/components/vis-controls/style.d.ts +11 -0
- package/{src/components/vis-controls/style.ts → components/vis-controls/style.js} +27 -34
- package/components/vis-controls/style.js.map +1 -0
- package/components/vis-controls/types.d.ts +13 -0
- package/components/vis-controls/types.js +8 -0
- package/components/vis-controls/types.js.map +1 -0
- package/components/xy-labels/config.d.ts +48 -0
- package/components/xy-labels/config.js +25 -0
- package/components/xy-labels/config.js.map +1 -0
- package/components/xy-labels/index.d.ts +15 -0
- package/components/xy-labels/index.js +87 -0
- package/components/xy-labels/index.js.map +1 -0
- package/components/xy-labels/modules/label.d.ts +9 -0
- package/components/xy-labels/modules/label.js +107 -0
- package/components/xy-labels/modules/label.js.map +1 -0
- package/components/xy-labels/style.d.ts +5 -0
- package/{src/components/xy-labels/style.ts → components/xy-labels/style.js} +14 -15
- package/components/xy-labels/style.js.map +1 -0
- package/components/xy-labels/types.d.ts +23 -0
- package/components/xy-labels/types.js +9 -0
- package/components/xy-labels/types.js.map +1 -0
- package/components.d.ts +51 -0
- package/components.js +29 -0
- package/components.js.map +1 -0
- package/containers/single-container/config.d.ts +12 -0
- package/containers/single-container/config.js +12 -0
- package/containers/single-container/config.js.map +1 -0
- package/containers/single-container/index.d.ts +19 -0
- package/containers/single-container/index.js +128 -0
- package/containers/single-container/index.js.map +1 -0
- package/containers/xy-container/config.d.ts +99 -0
- package/containers/xy-container/config.js +30 -0
- package/containers/xy-container/config.js.map +1 -0
- package/containers/xy-container/index.d.ts +34 -0
- package/containers/xy-container/index.js +330 -0
- package/containers/xy-container/index.js.map +1 -0
- package/containers.d.ts +6 -0
- package/containers.js +4 -0
- package/containers.js.map +1 -0
- package/core/component/config.d.ts +58 -0
- package/core/component/config.js +14 -0
- package/core/component/config.js.map +1 -0
- package/core/component/index.d.ts +43 -0
- package/core/component/index.js +118 -0
- package/core/component/index.js.map +1 -0
- package/core/component/types.d.ts +2 -0
- package/core/component/types.js +2 -0
- package/core/component/types.js.map +1 -0
- package/core/config/index.d.ts +3 -0
- package/core/config/index.js +16 -0
- package/core/config/index.js.map +1 -0
- package/core/container/config.d.ts +48 -0
- package/core/container/config.js +29 -0
- package/core/container/config.js.map +1 -0
- package/core/container/index.d.ts +26 -0
- package/core/container/index.js +106 -0
- package/core/container/index.js.map +1 -0
- package/core/xy-component/config.d.ts +38 -0
- package/core/xy-component/config.js +20 -0
- package/core/xy-component/config.js.map +1 -0
- package/core/xy-component/index.d.ts +27 -0
- package/core/xy-component/index.js +74 -0
- package/core/xy-component/index.js.map +1 -0
- package/data-models/core.d.ts +6 -0
- package/data-models/core.js +14 -0
- package/data-models/core.js.map +1 -0
- package/data-models/graph.d.ts +24 -0
- package/data-models/graph.js +107 -0
- package/data-models/graph.js.map +1 -0
- package/data-models/map-graph.d.ts +21 -0
- package/data-models/map-graph.js +62 -0
- package/data-models/map-graph.js.map +1 -0
- package/data-models/map.d.ts +5 -0
- package/data-models/map.js +12 -0
- package/data-models/map.js.map +1 -0
- package/data-models/series.d.ts +6 -0
- package/data-models/series.js +19 -0
- package/data-models/series.js.map +1 -0
- package/index.d.ts +7 -0
- package/index.js +55 -0
- package/index.js.map +1 -0
- package/maps/china-provinces.json.js +140373 -0
- package/maps/fr-regions.json.js +14162 -0
- package/maps/germany-regions.json.js +35760 -0
- package/maps/ind-regions.json.js +290584 -0
- package/maps/uk-regions.json.js +96233 -0
- package/maps/us-counties.json.js +206318 -0
- package/maps/us-states.json.js +16345 -0
- package/maps/world-110m-alpha.json.js +251366 -0
- package/maps/world-simple.json.js +89428 -0
- package/maps/world-simplest.json.js +28175 -0
- package/maps.d.ts +60 -0
- package/maps.js +23 -0
- package/package.json +1 -1
- package/styles/colors.d.ts +7 -0
- package/styles/colors.js +24 -0
- package/styles/colors.js.map +1 -0
- package/styles/index.d.ts +7 -0
- package/styles/index.js +38 -0
- package/styles/index.js.map +1 -0
- package/styles/sizes.d.ts +2 -0
- package/{src/styles/sizes.ts → styles/sizes.js} +8 -6
- package/styles/sizes.js.map +1 -0
- package/types/accessor.d.ts +5 -0
- package/types/accessor.js +2 -0
- package/types/accessor.js.map +1 -0
- package/types/component.d.ts +13 -0
- package/types/component.js +14 -0
- package/types/component.js.map +1 -0
- package/types/curve.d.ts +40 -0
- package/types/curve.js +46 -0
- package/types/curve.js.map +1 -0
- package/types/data.d.ts +7 -0
- package/types/data.js +2 -0
- package/types/data.js.map +1 -0
- package/types/direction.d.ts +6 -0
- package/types/direction.js +10 -0
- package/types/direction.js.map +1 -0
- package/types/graph.d.ts +35 -0
- package/types/graph.js +2 -0
- package/types/graph.js.map +1 -0
- package/types/map.d.ts +4 -0
- package/types/map.js +2 -0
- package/types/map.js.map +1 -0
- package/types/misc.d.ts +8 -0
- package/types/position.d.ts +20 -0
- package/types/position.js +27 -0
- package/types/position.js.map +1 -0
- package/types/scale.d.ts +23 -0
- package/types/scale.js +27 -0
- package/types/scale.js.map +1 -0
- package/types/shape.d.ts +7 -0
- package/types/shape.js +11 -0
- package/types/shape.js.map +1 -0
- package/types/spacing.d.ts +6 -0
- package/types/spacing.js +2 -0
- package/types/spacing.js.map +1 -0
- package/types/svg.d.ts +18 -0
- package/types/svg.js +22 -0
- package/types/svg.js.map +1 -0
- package/types/symbol.d.ts +18 -0
- package/types/symbol.js +24 -0
- package/types/symbol.js.map +1 -0
- package/types/text.d.ts +47 -0
- package/types/text.js +26 -0
- package/types/text.js.map +1 -0
- package/types.d.ts +27 -0
- package/types.js +30 -0
- package/types.js.map +1 -0
- package/utils/color.d.ts +10 -0
- package/utils/color.js +32 -0
- package/utils/color.js.map +1 -0
- package/utils/d3.d.ts +3 -0
- package/utils/d3.js +16 -0
- package/utils/d3.js.map +1 -0
- package/utils/data.d.ts +45 -0
- package/utils/data.js +274 -0
- package/utils/data.js.map +1 -0
- package/utils/html.d.ts +1 -0
- package/utils/html.js +16 -0
- package/utils/html.js.map +1 -0
- package/utils/map.d.ts +2 -0
- package/utils/map.js +20 -0
- package/utils/map.js.map +1 -0
- package/utils/misc.d.ts +9 -0
- package/utils/misc.js +47 -0
- package/utils/misc.js.map +1 -0
- package/utils/path.d.ts +23 -0
- package/utils/path.js +144 -0
- package/utils/path.js.map +1 -0
- package/utils/scale.d.ts +1 -0
- package/utils/style.d.ts +6 -0
- package/utils/style.js +24 -0
- package/utils/style.js.map +1 -0
- package/utils/svg.d.ts +3 -0
- package/utils/text.d.ts +139 -0
- package/utils/text.js +443 -0
- package/utils/text.js.map +1 -0
- package/utils/type.d.ts +5 -0
- package/declaration.d.ts +0 -1
- package/index.ts +0 -1
- package/licences.txt +0 -43
- package/maps.ts +0 -1
- package/rollup.config.js +0 -71
- package/rules/ts-getter-setter.js +0 -35
- package/src/components/area/config.ts +0 -29
- package/src/components/area/index.ts +0 -133
- package/src/components/area/types.ts +0 -2
- package/src/components/axis/config.ts +0 -76
- package/src/components/axis/index.ts +0 -363
- package/src/components/axis/types.ts +0 -4
- package/src/components/brush/config.ts +0 -51
- package/src/components/brush/index.ts +0 -233
- package/src/components/brush/types.ts +0 -8
- package/src/components/bullet-legend/config.ts +0 -38
- package/src/components/bullet-legend/index.ts +0 -104
- package/src/components/bullet-legend/types.ts +0 -7
- package/src/components/chord-diagram/config.ts +0 -53
- package/src/components/chord-diagram/index.ts +0 -401
- package/src/components/chord-diagram/modules/label.ts +0 -155
- package/src/components/chord-diagram/modules/link.ts +0 -91
- package/src/components/chord-diagram/modules/node.ts +0 -80
- package/src/components/chord-diagram/types.ts +0 -68
- package/src/components/crosshair/config.ts +0 -48
- package/src/components/crosshair/index.ts +0 -220
- package/src/components/crosshair/types.ts +0 -15
- package/src/components/donut/config.ts +0 -65
- package/src/components/donut/index.ts +0 -148
- package/src/components/donut/modules/arc.ts +0 -86
- package/src/components/donut/types.ts +0 -17
- package/src/components/flow-legend/config.ts +0 -31
- package/src/components/flow-legend/index.ts +0 -103
- package/src/components/flow-legend/types.ts +0 -10
- package/src/components/free-brush/config.ts +0 -54
- package/src/components/free-brush/index.ts +0 -207
- package/src/components/free-brush/types.ts +0 -8
- package/src/components/graph/config.ts +0 -280
- package/src/components/graph/index.ts +0 -809
- package/src/components/graph/modules/layout-helpers.ts +0 -96
- package/src/components/graph/modules/layout.ts +0 -502
- package/src/components/graph/modules/link/helper.ts +0 -105
- package/src/components/graph/modules/link/index.ts +0 -302
- package/src/components/graph/modules/node/helper.ts +0 -162
- package/src/components/graph/modules/node/index.ts +0 -343
- package/src/components/graph/modules/panel/helper.ts +0 -160
- package/src/components/graph/modules/panel/index.ts +0 -137
- package/src/components/graph/modules/shape.ts +0 -108
- package/src/components/graph/modules/zoom-levels.ts +0 -6
- package/src/components/graph/style.ts +0 -72
- package/src/components/graph/types.ts +0 -152
- package/src/components/grouped-bar/config.ts +0 -40
- package/src/components/grouped-bar/index.ts +0 -325
- package/src/components/leaflet-flow-map/config.ts +0 -60
- package/src/components/leaflet-flow-map/index.ts +0 -279
- package/src/components/leaflet-flow-map/renderer-utils.ts +0 -14
- package/src/components/leaflet-flow-map/renderer.ts +0 -146
- package/src/components/leaflet-flow-map/types.ts +0 -18
- package/src/components/leaflet-map/config.ts +0 -234
- package/src/components/leaflet-map/index.ts +0 -808
- package/src/components/leaflet-map/leaflet.css +0 -625
- package/src/components/leaflet-map/modules/clusterBackground.ts +0 -34
- package/src/components/leaflet-map/modules/donut.ts +0 -37
- package/src/components/leaflet-map/modules/map.ts +0 -178
- package/src/components/leaflet-map/modules/node.ts +0 -208
- package/src/components/leaflet-map/modules/selectionRing.ts +0 -63
- package/src/components/leaflet-map/modules/utils.ts +0 -290
- package/src/components/leaflet-map/renderer/map-style.ts +0 -24
- package/src/components/leaflet-map/renderer/mapboxgl/mapboxgl-dark-theme.json +0 -35
- package/src/components/leaflet-map/renderer/mapboxgl/mapboxgl-light-theme.json +0 -35
- package/src/components/leaflet-map/renderer/mapboxgl/mapboxgl-settings.json +0 -2185
- package/src/components/leaflet-map/renderer/mapboxgl-layer.ts +0 -43
- package/src/components/leaflet-map/renderer/mapboxgl-utils.ts +0 -40
- package/src/components/leaflet-map/style.ts +0 -217
- package/src/components/leaflet-map/types.ts +0 -75
- package/src/components/line/config.ts +0 -34
- package/src/components/line/index.ts +0 -188
- package/src/components/line/types.ts +0 -3
- package/src/components/nested-donut/config.ts +0 -75
- package/src/components/nested-donut/index.ts +0 -176
- package/src/components/nested-donut/modules/arc.ts +0 -78
- package/src/components/nested-donut/modules/label.ts +0 -63
- package/src/components/nested-donut/style.ts +0 -82
- package/src/components/nested-donut/types.ts +0 -29
- package/src/components/sankey/config.ts +0 -195
- package/src/components/sankey/index.ts +0 -387
- package/src/components/sankey/modules/label.ts +0 -228
- package/src/components/sankey/modules/link.ts +0 -141
- package/src/components/sankey/modules/node.ts +0 -221
- package/src/components/sankey/types.ts +0 -95
- package/src/components/scatter/config.ts +0 -49
- package/src/components/scatter/index.ts +0 -220
- package/src/components/scatter/modules/point.ts +0 -123
- package/src/components/scatter/modules/utils.ts +0 -150
- package/src/components/scatter/types.ts +0 -21
- package/src/components/stacked-bar/config.ts +0 -42
- package/src/components/stacked-bar/index.ts +0 -267
- package/src/components/stacked-bar/types.ts +0 -5
- package/src/components/timeline/config.ts +0 -49
- package/src/components/timeline/index.ts +0 -302
- package/src/components/tooltip/config.ts +0 -69
- package/src/components/tooltip/index.ts +0 -220
- package/src/components/topojson-map/config.ts +0 -124
- package/src/components/topojson-map/index.ts +0 -436
- package/src/components/topojson-map/types.ts +0 -123
- package/src/components/topojson-map/utils.ts +0 -29
- package/src/components/vis-controls/config.ts +0 -16
- package/src/components/vis-controls/index.ts +0 -68
- package/src/components/vis-controls/types.ts +0 -14
- package/src/components/xy-labels/config.ts +0 -56
- package/src/components/xy-labels/index.ts +0 -109
- package/src/components/xy-labels/modules/label.ts +0 -140
- package/src/components/xy-labels/types.ts +0 -26
- package/src/components.ts +0 -56
- package/src/containers/single-container/config.ts +0 -15
- package/src/containers/single-container/index.ts +0 -150
- package/src/containers/xy-container/config.ts +0 -112
- package/src/containers/xy-container/index.ts +0 -407
- package/src/containers.ts +0 -6
- package/src/core/component/config.ts +0 -61
- package/src/core/component/index.ts +0 -154
- package/src/core/component/types.ts +0 -9
- package/src/core/config/index.ts +0 -12
- package/src/core/container/config.ts +0 -56
- package/src/core/container/index.ts +0 -136
- package/src/core/xy-component/config.ts +0 -46
- package/src/core/xy-component/index.ts +0 -90
- package/src/data-models/core.ts +0 -15
- package/src/data-models/graph.ts +0 -138
- package/src/data-models/map-graph.ts +0 -72
- package/src/data-models/map.ts +0 -18
- package/src/data-models/series.ts +0 -16
- package/src/index.ts +0 -7
- package/src/maps/china-provinces.json +0 -1
- package/src/maps/fr-regions.json +0 -1
- package/src/maps/germany-regions.json +0 -1
- package/src/maps/ind-regions.json +0 -1
- package/src/maps/uk-regions.json +0 -1
- package/src/maps/us-counties.json +0 -1
- package/src/maps/us-states.json +0 -1
- package/src/maps/world-110m-alpha.json +0 -1
- package/src/maps/world-simple.json +0 -1
- package/src/maps/world-simplest.json +0 -1
- package/src/maps.ts +0 -34
- package/src/styles/colors.ts +0 -28
- package/src/styles/index.ts +0 -38
- package/src/types/accessor.ts +0 -5
- package/src/types/component.ts +0 -15
- package/src/types/curve.ts +0 -62
- package/src/types/data.ts +0 -5
- package/src/types/direction.ts +0 -6
- package/src/types/graph.ts +0 -40
- package/src/types/map.ts +0 -5
- package/src/types/misc.ts +0 -10
- package/src/types/position.ts +0 -23
- package/src/types/scale.ts +0 -47
- package/src/types/shape.ts +0 -7
- package/src/types/spacing.ts +0 -6
- package/src/types/svg.ts +0 -32
- package/src/types/symbol.ts +0 -21
- package/src/types/text.ts +0 -71
- package/src/types.ts +0 -31
- package/src/utils/color.ts +0 -41
- package/src/utils/d3.ts +0 -15
- package/src/utils/data.ts +0 -328
- package/src/utils/html.ts +0 -13
- package/src/utils/map.ts +0 -29
- package/src/utils/misc.ts +0 -54
- package/src/utils/path.ts +0 -196
- package/src/utils/scale.ts +0 -1
- package/src/utils/style.ts +0 -37
- package/src/utils/svg.ts +0 -49
- package/src/utils/text.ts +0 -529
- package/src/utils/type.ts +0 -9
- package/tsconfig.json +0 -29
|
@@ -1,436 +0,0 @@
|
|
|
1
|
-
import { Selection } from 'd3-selection'
|
|
2
|
-
import { D3ZoomEvent, zoom, ZoomBehavior, zoomIdentity, ZoomTransform } from 'd3-zoom'
|
|
3
|
-
import { timeout } from 'd3-timer'
|
|
4
|
-
import { geoPath, GeoProjection } from 'd3-geo'
|
|
5
|
-
import { color } from 'd3-color'
|
|
6
|
-
import { feature } from 'topojson-client'
|
|
7
|
-
|
|
8
|
-
// Core
|
|
9
|
-
import { ComponentCore } from 'core/component'
|
|
10
|
-
import { MapGraphDataModel } from 'data-models/map-graph'
|
|
11
|
-
|
|
12
|
-
// Utils
|
|
13
|
-
import { clamp, getNumber, getString, isNumber } from 'utils/data'
|
|
14
|
-
import { smartTransition } from 'utils/d3'
|
|
15
|
-
import { getColor, hexToBrightness } from 'utils/color'
|
|
16
|
-
import { getCSSVariableValue, isStringCSSVariable } from 'utils/misc'
|
|
17
|
-
|
|
18
|
-
// Types
|
|
19
|
-
import { MapLink } from 'types/map'
|
|
20
|
-
|
|
21
|
-
// Local Types
|
|
22
|
-
import { MapData, MapFeature, MapPointLabelPosition } from './types'
|
|
23
|
-
|
|
24
|
-
// Config
|
|
25
|
-
import { TopoJSONMapConfig, TopoJSONMapConfigInterface } from './config'
|
|
26
|
-
|
|
27
|
-
// Modules
|
|
28
|
-
import { arc, getLonLat } from './utils'
|
|
29
|
-
|
|
30
|
-
// Styles
|
|
31
|
-
import * as s from './style'
|
|
32
|
-
|
|
33
|
-
export class TopoJSONMap<
|
|
34
|
-
AreaDatum,
|
|
35
|
-
PointDatum = unknown,
|
|
36
|
-
LinkDatum = unknown,
|
|
37
|
-
> extends ComponentCore<
|
|
38
|
-
MapData<AreaDatum, PointDatum, LinkDatum>,
|
|
39
|
-
TopoJSONMapConfig<AreaDatum, PointDatum, LinkDatum>,
|
|
40
|
-
TopoJSONMapConfigInterface<AreaDatum, PointDatum, LinkDatum>
|
|
41
|
-
> {
|
|
42
|
-
static selectors = s
|
|
43
|
-
config: TopoJSONMapConfig<AreaDatum, PointDatum, LinkDatum> = new TopoJSONMapConfig()
|
|
44
|
-
datamodel: MapGraphDataModel<AreaDatum, PointDatum, LinkDatum> = new MapGraphDataModel()
|
|
45
|
-
g: Selection<SVGGElement, unknown, null, undefined>
|
|
46
|
-
private _firstRender = true
|
|
47
|
-
private _isResizing = false
|
|
48
|
-
private _initialScale: number = undefined
|
|
49
|
-
private _center: [number, number]
|
|
50
|
-
private _currentZoomLevel: number = undefined
|
|
51
|
-
private _transform: ZoomTransform
|
|
52
|
-
private _path = geoPath()
|
|
53
|
-
private _projection: GeoProjection
|
|
54
|
-
private _prevWidth: number
|
|
55
|
-
private _prevHeight: number
|
|
56
|
-
private _animFrameId: number
|
|
57
|
-
|
|
58
|
-
private _featureCollection: GeoJSON.FeatureCollection
|
|
59
|
-
private _zoomBehavior: ZoomBehavior<SVGGElement, unknown> = zoom()
|
|
60
|
-
private _backgroundRect = this.g.append('rect').attr('class', s.background)
|
|
61
|
-
private _featuresGroup = this.g.append('g').attr('class', s.features)
|
|
62
|
-
private _linksGroup = this.g.append('g').attr('class', s.links)
|
|
63
|
-
private _pointsGroup = this.g.append('g').attr('class', s.points)
|
|
64
|
-
|
|
65
|
-
events = {
|
|
66
|
-
[TopoJSONMap.selectors.point]: {},
|
|
67
|
-
[TopoJSONMap.selectors.feature]: {},
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
constructor (config?: TopoJSONMapConfigInterface<AreaDatum, PointDatum, LinkDatum>, data?: MapData<AreaDatum, PointDatum, LinkDatum>) {
|
|
71
|
-
super()
|
|
72
|
-
this._zoomBehavior.on('zoom', this._onZoom.bind(this))
|
|
73
|
-
|
|
74
|
-
if (config) this.setConfig(config)
|
|
75
|
-
if (data) this.setData(data)
|
|
76
|
-
|
|
77
|
-
this.g.append('defs')
|
|
78
|
-
.append('filter')
|
|
79
|
-
.attr('id', 'heatmapFilter')
|
|
80
|
-
.html(`
|
|
81
|
-
<feGaussianBlur in="SourceGraphic" stdDeviation="${this.config.heatmapModeBlurStdDeviation}" color-interpolation-filters="sRGB" result="blur"></feGaussianBlur>
|
|
82
|
-
<feColorMatrix class="blurValues" in="blur" mode="matrix" values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 20 -4"></feColorMatrix>
|
|
83
|
-
`)
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
setData (data: MapData<AreaDatum, PointDatum, LinkDatum>): void {
|
|
87
|
-
const { config } = this
|
|
88
|
-
|
|
89
|
-
this.datamodel.pointId = config.pointId
|
|
90
|
-
this.datamodel.linkSource = config.linkSource
|
|
91
|
-
this.datamodel.linkTarget = config.linkTarget
|
|
92
|
-
this.datamodel.data = data
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
setConfig (config?: TopoJSONMapConfigInterface<AreaDatum, PointDatum, LinkDatum>): void {
|
|
96
|
-
super.setConfig(config)
|
|
97
|
-
|
|
98
|
-
const newProjection = this.config.projection
|
|
99
|
-
if (this._projection) {
|
|
100
|
-
newProjection.scale(this._projection.scale()).translate(this._projection.translate())
|
|
101
|
-
}
|
|
102
|
-
this._projection = newProjection
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
_render (customDuration?: number): void {
|
|
106
|
-
const { config } = this
|
|
107
|
-
const duration = isNumber(customDuration) ? customDuration : config.duration
|
|
108
|
-
|
|
109
|
-
this._renderBackground()
|
|
110
|
-
this._renderMap(duration)
|
|
111
|
-
this._renderGroups(duration)
|
|
112
|
-
this._renderLinks(duration)
|
|
113
|
-
this._renderPoints(duration)
|
|
114
|
-
|
|
115
|
-
// When animation is running we need to temporary disable zoom behaviour
|
|
116
|
-
if (duration && !config.disableZoom) {
|
|
117
|
-
this.g.on('.zoom', null)
|
|
118
|
-
timeout(() => {
|
|
119
|
-
this.g.call(this._zoomBehavior)
|
|
120
|
-
}, duration)
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// When zoom behaviour is active we assign the `draggable` class to show the grabbing cursor
|
|
124
|
-
this.g.classed('draggable', !config.disableZoom)
|
|
125
|
-
this._firstRender = false
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
_renderBackground (): void {
|
|
129
|
-
this._backgroundRect
|
|
130
|
-
.attr('width', '100%')
|
|
131
|
-
.attr('height', '100%')
|
|
132
|
-
.attr('transform', `translate(${-this.bleed.left}, ${-this.bleed.top})`)
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
_renderGroups (duration: number): void {
|
|
136
|
-
const transformString = this._transform.toString()
|
|
137
|
-
smartTransition(this._featuresGroup, duration)
|
|
138
|
-
.attr('transform', transformString)
|
|
139
|
-
.attr('stroke-width', 1 / this._currentZoomLevel)
|
|
140
|
-
|
|
141
|
-
smartTransition(this._linksGroup, duration)
|
|
142
|
-
.attr('transform', transformString)
|
|
143
|
-
|
|
144
|
-
smartTransition(this._pointsGroup, duration)
|
|
145
|
-
.attr('transform', transformString)
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
_renderMap (duration: number): void {
|
|
149
|
-
const { bleed, config, datamodel } = this
|
|
150
|
-
|
|
151
|
-
this.g.attr('transform', `translate(${bleed.left}, ${bleed.top})`)
|
|
152
|
-
const mapData: TopoJSON.Topology = config.topojson
|
|
153
|
-
const featureName = config.mapFeatureName
|
|
154
|
-
const featureObject = mapData?.objects?.[featureName]
|
|
155
|
-
if (!featureObject) return
|
|
156
|
-
|
|
157
|
-
this._featureCollection = feature(mapData, featureObject) as GeoJSON.FeatureCollection
|
|
158
|
-
const featureData = (this._featureCollection?.features ?? []) as MapFeature<AreaDatum>[]
|
|
159
|
-
|
|
160
|
-
if (this._firstRender) {
|
|
161
|
-
// Rendering the map for the first time.
|
|
162
|
-
this._projection.fitExtent([[0, 0], [this._width, this._height]], this._featureCollection)
|
|
163
|
-
this._initialScale = this._projection.scale()
|
|
164
|
-
this._center = this._projection.translate()
|
|
165
|
-
|
|
166
|
-
if (config.mapFitToPoints) {
|
|
167
|
-
this._fitToPoints()
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
const zoomExtent = config.zoomExtent
|
|
171
|
-
this._zoomBehavior.scaleExtent([zoomExtent[0] * this._initialScale, zoomExtent[1] * this._initialScale])
|
|
172
|
-
this.setZoom(config.zoomFactor || 1)
|
|
173
|
-
|
|
174
|
-
if (!config.disableZoom) {
|
|
175
|
-
this.g.call(this._zoomBehavior)
|
|
176
|
-
this._applyZoom()
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
this._prevWidth = this._width
|
|
180
|
-
this._prevHeight = this._height
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
if (this._prevWidth !== this._width || this._prevHeight !== this._height) {
|
|
184
|
-
this._onResize()
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
this._path.projection(this._projection)
|
|
188
|
-
|
|
189
|
-
// Merge passed area data and map feature data
|
|
190
|
-
const areaData = datamodel.areas
|
|
191
|
-
areaData.forEach(a => {
|
|
192
|
-
const feature = featureData.find(f => f.id.toString() === getString(a, config.areaId).toString())
|
|
193
|
-
if (feature) feature.data = a
|
|
194
|
-
else if (this._firstRender) console.warn(`Can't find feature by area code ${getString(a, config.areaId)}`)
|
|
195
|
-
})
|
|
196
|
-
|
|
197
|
-
const features = this._featuresGroup
|
|
198
|
-
.selectAll<SVGPathElement, unknown>(`.${s.feature}`)
|
|
199
|
-
.data(featureData)
|
|
200
|
-
|
|
201
|
-
const featuresEnter = features.enter().append('path').attr('class', s.feature)
|
|
202
|
-
smartTransition(featuresEnter.merge(features), duration)
|
|
203
|
-
.attr('d', this._path)
|
|
204
|
-
.style('fill', (d, i) => d.data ? getColor(d.data, config.areaColor, i) : null)
|
|
205
|
-
.style('cursor', d => d.data ? getString(d.data, config.areaCursor) : null)
|
|
206
|
-
features.exit().remove()
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
_renderLinks (duration: number): void {
|
|
210
|
-
const { config, datamodel } = this
|
|
211
|
-
const links = datamodel.links
|
|
212
|
-
|
|
213
|
-
const edges = this._linksGroup
|
|
214
|
-
.selectAll<SVGPathElement, MapLink<PointDatum, LinkDatum>>(`.${s.link}`)
|
|
215
|
-
.data(links, (d, i) => getString(d, config.linkId, i))
|
|
216
|
-
|
|
217
|
-
const edgesEnter = edges.enter().append('path').attr('class', s.link)
|
|
218
|
-
.style('stroke-width', 0)
|
|
219
|
-
|
|
220
|
-
smartTransition(edgesEnter.merge(edges), duration)
|
|
221
|
-
.attr('d', link => {
|
|
222
|
-
const source = this._projection(getLonLat(link.source, config.longitude, config.latitude))
|
|
223
|
-
const target = this._projection(getLonLat(link.target, config.longitude, config.latitude))
|
|
224
|
-
return arc(source, target)
|
|
225
|
-
})
|
|
226
|
-
.style('stroke-width', link => getNumber(link, config.linkWidth) / this._currentZoomLevel)
|
|
227
|
-
.style('cursor', link => getString(link, config.linkCursor))
|
|
228
|
-
.style('stroke', (link, i) => getColor(link, config.linkColor, i))
|
|
229
|
-
edges.exit().remove()
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
_renderPoints (duration: number): void {
|
|
233
|
-
const { config, datamodel } = this
|
|
234
|
-
const pointData = datamodel.points
|
|
235
|
-
|
|
236
|
-
const points = this._pointsGroup
|
|
237
|
-
.selectAll<SVGGElement, PointDatum>(`.${s.point}`)
|
|
238
|
-
.data(pointData, (d, i) => getString(d, config.pointId, i))
|
|
239
|
-
|
|
240
|
-
// Enter
|
|
241
|
-
const pointsEnter = points.enter().append('g').attr('class', s.point)
|
|
242
|
-
.attr('transform', d => {
|
|
243
|
-
const pos = this._projection(getLonLat(d, config.longitude, config.latitude))
|
|
244
|
-
return `translate(${pos[0]},${pos[1]})`
|
|
245
|
-
})
|
|
246
|
-
|
|
247
|
-
pointsEnter.append('circle').attr('class', s.pointCircle)
|
|
248
|
-
.attr('r', 0)
|
|
249
|
-
.style('fill', (d, i) => getColor(d, config.pointColor, i))
|
|
250
|
-
.style('stroke-width', d => getNumber(d, config.pointStrokeWidth))
|
|
251
|
-
|
|
252
|
-
pointsEnter.append('text').attr('class', s.pointLabel)
|
|
253
|
-
.style('opacity', 0)
|
|
254
|
-
|
|
255
|
-
// Update
|
|
256
|
-
const pointsMerged = pointsEnter.merge(points)
|
|
257
|
-
smartTransition(pointsMerged, duration)
|
|
258
|
-
.attr('transform', d => {
|
|
259
|
-
const pos = this._projection(getLonLat(d, config.longitude, config.latitude))
|
|
260
|
-
return `translate(${pos[0]},${pos[1]})`
|
|
261
|
-
})
|
|
262
|
-
.style('cursor', d => getString(d, config.pointCursor))
|
|
263
|
-
|
|
264
|
-
smartTransition(pointsMerged.select(`.${s.pointCircle}`), duration)
|
|
265
|
-
.attr('r', d => getNumber(d, config.pointRadius) / this._currentZoomLevel)
|
|
266
|
-
.style('fill', (d, i) => getColor(d, config.pointColor, i))
|
|
267
|
-
.style('stroke', (d, i) => getColor(d, config.pointColor, i))
|
|
268
|
-
.style('stroke-width', d => getNumber(d, config.pointStrokeWidth) / this._currentZoomLevel)
|
|
269
|
-
|
|
270
|
-
const pointLabelsMerged = pointsMerged.select(`.${s.pointLabel}`)
|
|
271
|
-
pointLabelsMerged
|
|
272
|
-
.text(config.pointLabel ?? '')
|
|
273
|
-
.style('font-size', d => {
|
|
274
|
-
if (config.pointLabelPosition === MapPointLabelPosition.Bottom) {
|
|
275
|
-
return `calc(var(--vis-map-point-label-font-size) / ${this._currentZoomLevel}`
|
|
276
|
-
}
|
|
277
|
-
const pointDiameter = 2 * getNumber(d, config.pointRadius)
|
|
278
|
-
const pointLabelText = getString(d, config.pointLabel) || ''
|
|
279
|
-
const textLength = pointLabelText.length
|
|
280
|
-
const fontSize = 0.5 * pointDiameter / Math.pow(textLength, 0.4)
|
|
281
|
-
return clamp(fontSize, fontSize, 16)
|
|
282
|
-
})
|
|
283
|
-
.attr('y', d => {
|
|
284
|
-
if (config.pointLabelPosition === MapPointLabelPosition.Center) return null
|
|
285
|
-
|
|
286
|
-
const pointRadius = getNumber(d, config.pointRadius) / this._currentZoomLevel
|
|
287
|
-
return pointRadius
|
|
288
|
-
})
|
|
289
|
-
.attr('dy', config.pointLabelPosition === MapPointLabelPosition.Center ? '0.32em' : '1em')
|
|
290
|
-
|
|
291
|
-
smartTransition(pointLabelsMerged, duration)
|
|
292
|
-
.style('fill', (d, i) => {
|
|
293
|
-
if (config.pointLabelPosition === MapPointLabelPosition.Bottom) return null
|
|
294
|
-
|
|
295
|
-
const pointColor = getColor(d, config.pointColor, i)
|
|
296
|
-
const hex = color(isStringCSSVariable(pointColor) ? getCSSVariableValue(pointColor, this.element) : pointColor)?.hex()
|
|
297
|
-
if (!hex) return null
|
|
298
|
-
|
|
299
|
-
const brightness = hexToBrightness(hex)
|
|
300
|
-
return brightness > config.pointLabelTextBrightnessRatio ? 'var(--vis-map-point-label-text-color-dark)' : 'var(--vis-map-point-label-text-color-light)'
|
|
301
|
-
})
|
|
302
|
-
.style('opacity', 1)
|
|
303
|
-
|
|
304
|
-
// Exit
|
|
305
|
-
points.exit().remove()
|
|
306
|
-
|
|
307
|
-
// Heatmap
|
|
308
|
-
this._pointsGroup.style('filter', (config.heatmapMode && this._currentZoomLevel < config.heatmapModeZoomLevelThreshold) ? 'url(#heatmapFilter)' : null)
|
|
309
|
-
this._pointsGroup.selectAll(`.${s.pointLabel}`).style('display', (config.heatmapMode && (this._currentZoomLevel < config.heatmapModeZoomLevelThreshold)) ? 'none' : null)
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
_fitToPoints (points?: PointDatum[], pad = 0.1): void {
|
|
313
|
-
const { config, datamodel } = this
|
|
314
|
-
const pointData = points || datamodel.points
|
|
315
|
-
if (pointData.length === 0) return
|
|
316
|
-
|
|
317
|
-
const featureCollection = {
|
|
318
|
-
type: 'FeatureCollection',
|
|
319
|
-
features: [{
|
|
320
|
-
type: 'Feature',
|
|
321
|
-
properties: {},
|
|
322
|
-
geometry: {
|
|
323
|
-
type: 'MultiPoint',
|
|
324
|
-
coordinates: pointData.map(p => {
|
|
325
|
-
return [
|
|
326
|
-
getNumber(p, d => getNumber(d, config.longitude)),
|
|
327
|
-
getNumber(p, d => getNumber(d, config.latitude)),
|
|
328
|
-
]
|
|
329
|
-
}),
|
|
330
|
-
},
|
|
331
|
-
}],
|
|
332
|
-
geometries: [],
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
this._projection.fitExtent([
|
|
336
|
-
[this._width * pad, this._height * pad],
|
|
337
|
-
[this._width * (1 - pad), this._height * (1 - pad)],
|
|
338
|
-
], featureCollection)
|
|
339
|
-
|
|
340
|
-
const maxScale = config.zoomExtent[1] * this._initialScale
|
|
341
|
-
if (this._projection.scale() > maxScale) this._projection.scale(maxScale)
|
|
342
|
-
|
|
343
|
-
this._applyZoom()
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
_applyZoom (): void {
|
|
347
|
-
const translate = this._center ?? this._projection.translate()
|
|
348
|
-
const scale = this._initialScale * this._currentZoomLevel
|
|
349
|
-
this.g.call(this._zoomBehavior.transform, zoomIdentity.translate(translate[0], translate[1]).scale(scale))
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
_onResize (): void {
|
|
353
|
-
this._isResizing = true
|
|
354
|
-
const prevTranslate = this._projection.translate()
|
|
355
|
-
|
|
356
|
-
this._projection.fitExtent([[0, 0], [this._width, this._height]], this._featureCollection)
|
|
357
|
-
this._initialScale = this._projection.scale()
|
|
358
|
-
this._center = [
|
|
359
|
-
this._projection.translate()[0] * this._center[0] / prevTranslate[0],
|
|
360
|
-
this._projection.translate()[1] * this._center[1] / prevTranslate[1],
|
|
361
|
-
]
|
|
362
|
-
this._applyZoom()
|
|
363
|
-
|
|
364
|
-
this._isResizing = false
|
|
365
|
-
this._prevWidth = this._width
|
|
366
|
-
this._prevHeight = this._height
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
_onZoom (event: D3ZoomEvent<any, any>): void {
|
|
370
|
-
if (this._firstRender) return // To prevent double render because of binding zoom behaviour
|
|
371
|
-
const isMouseEvent = event.sourceEvent !== undefined
|
|
372
|
-
const isExternalEvent = !event?.sourceEvent && !this._isResizing
|
|
373
|
-
|
|
374
|
-
window.cancelAnimationFrame(this._animFrameId)
|
|
375
|
-
this._animFrameId = window.requestAnimationFrame(this._onZoomHandler.bind(this, event.transform, isMouseEvent, isExternalEvent))
|
|
376
|
-
|
|
377
|
-
if (isMouseEvent) {
|
|
378
|
-
// Update the center coordinate so that the next call to _applyZoom()
|
|
379
|
-
// will zoom with respect to the current view
|
|
380
|
-
this._center = [event.transform.x, event.transform.y]
|
|
381
|
-
}
|
|
382
|
-
this._currentZoomLevel = (event?.transform.k / this._initialScale) || 1
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
_onZoomHandler (transform: ZoomTransform, isMouseEvent: boolean, isExternalEvent: boolean): void {
|
|
386
|
-
const scale = transform.k / this._initialScale || 1
|
|
387
|
-
const center = this._projection.translate()
|
|
388
|
-
|
|
389
|
-
this._transform = zoomIdentity
|
|
390
|
-
.translate(transform.x - center[0] * scale, transform.y - center[1] * scale)
|
|
391
|
-
.scale(scale)
|
|
392
|
-
|
|
393
|
-
const customDuration = isExternalEvent
|
|
394
|
-
? this.config.zoomDuration
|
|
395
|
-
: (isMouseEvent ? 0 : null)
|
|
396
|
-
|
|
397
|
-
// Call render functions that depend on this._transform
|
|
398
|
-
this._renderGroups(customDuration)
|
|
399
|
-
this._renderLinks(customDuration)
|
|
400
|
-
this._renderPoints(customDuration)
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
public zoomIn (increment = 0.5): void {
|
|
404
|
-
this.setZoom(this._currentZoomLevel + increment)
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
public zoomOut (increment = 0.5): void {
|
|
408
|
-
this.setZoom(this._currentZoomLevel - increment)
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
public setZoom (zoomLevel: number): void {
|
|
412
|
-
const { config } = this
|
|
413
|
-
this._currentZoomLevel = clamp(zoomLevel, config.zoomExtent[0], config.zoomExtent[1])
|
|
414
|
-
this._transform = zoomIdentity
|
|
415
|
-
.translate(this._center[0] * (1 - this._currentZoomLevel), this._center[1] * (1 - this._currentZoomLevel))
|
|
416
|
-
.scale(this._currentZoomLevel)
|
|
417
|
-
// We are using this._applyZoom() instead of directly calling this._render(config.zoomDuration) because
|
|
418
|
-
// we've to "attach" new transform to the map group element. Otherwise zoomBehavior will not know
|
|
419
|
-
// that the zoom state has changed
|
|
420
|
-
this._applyZoom()
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
public fitView (): void {
|
|
424
|
-
this._projection.fitExtent([[0, 0], [this._width, this._height]], this._featureCollection)
|
|
425
|
-
this._currentZoomLevel = (this._projection?.scale() / this._initialScale) || 1
|
|
426
|
-
this._center = this._projection.translate()
|
|
427
|
-
// We are using this._applyZoom() instead of directly calling this._render(config.zoomDuration) because
|
|
428
|
-
// we've to "attach" new transform to the map group element. Otherwise zoomBehavior will not know
|
|
429
|
-
// that the zoom state has changed
|
|
430
|
-
this._applyZoom()
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
destroy (): void {
|
|
434
|
-
window.cancelAnimationFrame(this._animFrameId)
|
|
435
|
-
}
|
|
436
|
-
}
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import { Feature, Geometry } from 'geojson'
|
|
2
|
-
import {
|
|
3
|
-
GeoProjection,
|
|
4
|
-
geoMercator,
|
|
5
|
-
geoEquirectangular,
|
|
6
|
-
geoAzimuthalEqualArea,
|
|
7
|
-
geoAzimuthalEquidistant,
|
|
8
|
-
geoGnomonic,
|
|
9
|
-
geoOrthographic,
|
|
10
|
-
geoStereographic,
|
|
11
|
-
geoEqualEarth,
|
|
12
|
-
geoAlbersUsa,
|
|
13
|
-
geoAlbers,
|
|
14
|
-
geoConicConformal,
|
|
15
|
-
geoConicEqualArea,
|
|
16
|
-
geoConicEquidistant,
|
|
17
|
-
geoTransverseMercator,
|
|
18
|
-
geoNaturalEarth1,
|
|
19
|
-
} from 'd3-geo'
|
|
20
|
-
|
|
21
|
-
import {
|
|
22
|
-
geoBromley,
|
|
23
|
-
geoNaturalEarth2,
|
|
24
|
-
geoKavrayskiy7,
|
|
25
|
-
geoHufnagel,
|
|
26
|
-
geoFoucautSinusoidal,
|
|
27
|
-
geoFahey,
|
|
28
|
-
geoEckert1,
|
|
29
|
-
geoEckert3,
|
|
30
|
-
geoBoggs,
|
|
31
|
-
geoCylindricalStereographic,
|
|
32
|
-
geoCraster,
|
|
33
|
-
geoBaker,
|
|
34
|
-
geoArmadillo,
|
|
35
|
-
geoAitoff,
|
|
36
|
-
geoRobinson,
|
|
37
|
-
} from 'd3-geo-projection'
|
|
38
|
-
|
|
39
|
-
export type MapData<AreaDatum, PointDatum = unknown, LinkDatum = unknown> = {
|
|
40
|
-
areas?: AreaDatum[];
|
|
41
|
-
points?: PointDatum[];
|
|
42
|
-
links?: LinkDatum[] ;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export enum MapPointLabelPosition {
|
|
46
|
-
Center = 'center',
|
|
47
|
-
Bottom = 'bottom',
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export type MapFeature<D> = Feature<Geometry> & { data: D }
|
|
51
|
-
|
|
52
|
-
export enum MapProjectionKind {
|
|
53
|
-
// Projections form `d3-geo`
|
|
54
|
-
Mercator = 'Mercator',
|
|
55
|
-
Equirectangular = 'Equirectangular',
|
|
56
|
-
AzimuthalEqualArea = 'AzimuthalEqualArea',
|
|
57
|
-
AzimuthalEquidistant = 'AzimuthalEquidistant',
|
|
58
|
-
Gnomonic = 'Gnomonic',
|
|
59
|
-
Orthographic = 'Orthographic',
|
|
60
|
-
Stereographic = 'Stereographic',
|
|
61
|
-
EqualEarth = 'EqualEarth',
|
|
62
|
-
AlbersUsa = 'AlbersUsa',
|
|
63
|
-
Albers = 'Albers',
|
|
64
|
-
ConicConformal = 'ConicConformal',
|
|
65
|
-
ConicEqualArea = 'ConicEqualArea',
|
|
66
|
-
ConicEquidistant = 'ConicEquidistant',
|
|
67
|
-
TransverseMercator = 'TransverseMercator',
|
|
68
|
-
NaturalEarth1 = 'NaturalEarth1',
|
|
69
|
-
|
|
70
|
-
// Projections form `d3-geo-projection`
|
|
71
|
-
Bromley = 'Bromley',
|
|
72
|
-
NaturalEarth2 = 'NaturalEarth2',
|
|
73
|
-
Kavrayskiy7 = 'Kavrayskiy7',
|
|
74
|
-
Hufnagel = 'Hufnagel',
|
|
75
|
-
FoucautSinusoidal = 'FoucautSinusoidal',
|
|
76
|
-
Eckert1 = 'Eckert1',
|
|
77
|
-
Eckert3 = 'Eckert3',
|
|
78
|
-
Boggs = 'Boggs',
|
|
79
|
-
CylindricalStereographic = 'CylindricalStereographic',
|
|
80
|
-
Craster = 'Craster',
|
|
81
|
-
Baker = 'Baker',
|
|
82
|
-
Armadillo = 'Armadillo',
|
|
83
|
-
Aitoff = 'Aitoff',
|
|
84
|
-
Fahey = 'Fahey',
|
|
85
|
-
Robinson = 'Robinson',
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export const MapProjection = {
|
|
89
|
-
// Projections form `d3-geo`
|
|
90
|
-
[MapProjectionKind.Mercator]: geoMercator,
|
|
91
|
-
[MapProjectionKind.Equirectangular]: geoEquirectangular,
|
|
92
|
-
[MapProjectionKind.AzimuthalEqualArea]: geoAzimuthalEqualArea,
|
|
93
|
-
[MapProjectionKind.AzimuthalEquidistant]: geoAzimuthalEquidistant,
|
|
94
|
-
[MapProjectionKind.Gnomonic]: geoGnomonic,
|
|
95
|
-
[MapProjectionKind.Orthographic]: geoOrthographic,
|
|
96
|
-
[MapProjectionKind.Stereographic]: geoStereographic,
|
|
97
|
-
[MapProjectionKind.EqualEarth]: geoEqualEarth,
|
|
98
|
-
[MapProjectionKind.AlbersUsa]: geoAlbersUsa,
|
|
99
|
-
[MapProjectionKind.Albers]: geoAlbers,
|
|
100
|
-
[MapProjectionKind.ConicConformal]: geoConicConformal,
|
|
101
|
-
[MapProjectionKind.ConicEqualArea]: geoConicEqualArea,
|
|
102
|
-
[MapProjectionKind.ConicEquidistant]: geoConicEquidistant,
|
|
103
|
-
[MapProjectionKind.TransverseMercator]: geoTransverseMercator,
|
|
104
|
-
[MapProjectionKind.NaturalEarth1]: geoNaturalEarth1,
|
|
105
|
-
|
|
106
|
-
// Projections form `d3-geo-projection`
|
|
107
|
-
[MapProjectionKind.Bromley]: geoBromley as () => GeoProjection,
|
|
108
|
-
[MapProjectionKind.NaturalEarth2]: geoNaturalEarth2 as () => GeoProjection,
|
|
109
|
-
[MapProjectionKind.Kavrayskiy7]: geoKavrayskiy7 as () => GeoProjection,
|
|
110
|
-
[MapProjectionKind.Hufnagel]: geoHufnagel as () => GeoProjection,
|
|
111
|
-
[MapProjectionKind.FoucautSinusoidal]: geoFoucautSinusoidal as () => GeoProjection,
|
|
112
|
-
[MapProjectionKind.Eckert1]: geoEckert1 as () => GeoProjection,
|
|
113
|
-
[MapProjectionKind.Eckert3]: geoEckert3 as () => GeoProjection,
|
|
114
|
-
[MapProjectionKind.Boggs]: geoBoggs as () => GeoProjection,
|
|
115
|
-
[MapProjectionKind.CylindricalStereographic]: geoCylindricalStereographic as () => GeoProjection,
|
|
116
|
-
[MapProjectionKind.Craster]: geoCraster as () => GeoProjection,
|
|
117
|
-
[MapProjectionKind.Baker]: geoBaker as () => GeoProjection,
|
|
118
|
-
[MapProjectionKind.Armadillo]: geoArmadillo as () => GeoProjection,
|
|
119
|
-
[MapProjectionKind.Aitoff]: geoAitoff as () => GeoProjection,
|
|
120
|
-
[MapProjectionKind.Fahey]: geoFahey as () => GeoProjection,
|
|
121
|
-
[MapProjectionKind.Robinson]: geoRobinson as () => GeoProjection,
|
|
122
|
-
}
|
|
123
|
-
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { getNumber } from 'utils/data'
|
|
2
|
-
|
|
3
|
-
// Config
|
|
4
|
-
import { NumericAccessor } from 'types/accessor'
|
|
5
|
-
|
|
6
|
-
export function getLonLat<Datum> (d: Datum, pointLongitude: NumericAccessor<Datum>, pointLatitude: NumericAccessor<Datum>): [number, number] {
|
|
7
|
-
const lat = getNumber(d, pointLatitude)
|
|
8
|
-
const lon = getNumber(d, pointLongitude)
|
|
9
|
-
return [lon, lat]
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export function arc (source?: number[], target?: number[], curvature?: number): string {
|
|
13
|
-
if (!target || !source) return 'M0,0,l0,0z'
|
|
14
|
-
const d = 3
|
|
15
|
-
const angleOffset = curvature || 0
|
|
16
|
-
const s = { x: source[0], y: source[1] }
|
|
17
|
-
const t = { x: target[0], y: target[1] }
|
|
18
|
-
const ds = { x: (t.x - s.x) / d, y: (t.y - s.y) / d }
|
|
19
|
-
const dt = { x: (s.x - t.x) / d, y: (s.y - t.y) / d }
|
|
20
|
-
let angle = 0.16667 * Math.PI * (1 + angleOffset)
|
|
21
|
-
if (s.x < t.x) angle = -angle
|
|
22
|
-
const cs = Math.cos(angle)
|
|
23
|
-
const ss = Math.sin(angle)
|
|
24
|
-
const ct = Math.cos(-angle)
|
|
25
|
-
const st = Math.sin(-angle)
|
|
26
|
-
const dds = { x: (cs * ds.x) - (ss * ds.y), y: (ss * ds.x) + (cs * ds.y) }
|
|
27
|
-
const ddt = { x: (ct * dt.x) - (st * dt.y), y: (st * dt.x) + (ct * dt.y) }
|
|
28
|
-
return `M${s.x},${s.y} C${s.x + dds.x},${s.y + dds.y} ${t.x + ddt.x},${t.y + ddt.y} ${t.x},${t.y}`
|
|
29
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Config } from 'core/config'
|
|
2
|
-
|
|
3
|
-
// Local Types
|
|
4
|
-
import { VisControlItemInterface, VisControlsOrientation } from './types'
|
|
5
|
-
|
|
6
|
-
export interface VisControlsConfigInterface {
|
|
7
|
-
/** Controls items array, VisControlItemInterface[]. Default: `[]` */
|
|
8
|
-
items?: VisControlItemInterface[];
|
|
9
|
-
/** Controls orientation. `VisControlsOrientation.Horizontal` or `VisControlsOrientation.Horizontal`. Default: `VisControlsOrientation.Horizontal` */
|
|
10
|
-
orientation?: VisControlsOrientation;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export class VisControlsConfig extends Config implements VisControlsConfigInterface {
|
|
14
|
-
items: VisControlItemInterface[] = []
|
|
15
|
-
orientation = VisControlsOrientation.Horizontal
|
|
16
|
-
}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { Selection, select } from 'd3-selection'
|
|
2
|
-
|
|
3
|
-
// Local Types
|
|
4
|
-
import { VisControlItemInterface, VisControlsOrientation } from './types'
|
|
5
|
-
|
|
6
|
-
// Config
|
|
7
|
-
import { VisControlsConfig, VisControlsConfigInterface } from './config'
|
|
8
|
-
|
|
9
|
-
// Style
|
|
10
|
-
import * as s from './style'
|
|
11
|
-
|
|
12
|
-
export class VisControls {
|
|
13
|
-
div: Selection<HTMLDivElement, unknown, null, undefined>
|
|
14
|
-
element: HTMLDivElement
|
|
15
|
-
config: VisControlsConfig
|
|
16
|
-
protected _container: HTMLElement
|
|
17
|
-
protected _items: Selection<HTMLDivElement, unknown, null, undefined>
|
|
18
|
-
|
|
19
|
-
constructor (element: HTMLElement, config?: VisControlsConfigInterface) {
|
|
20
|
-
this._container = element
|
|
21
|
-
|
|
22
|
-
this.div = select(this._container)
|
|
23
|
-
.append('div')
|
|
24
|
-
.attr('class', s.root)
|
|
25
|
-
this.element = this.div.node()
|
|
26
|
-
this._items = this.div.append('div')
|
|
27
|
-
.attr('class', s.items)
|
|
28
|
-
|
|
29
|
-
if (config) this.update(config)
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
update (config: VisControlsConfigInterface): void {
|
|
33
|
-
this.config = new VisControlsConfig().init(config)
|
|
34
|
-
this.render()
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
render (): void {
|
|
38
|
-
const { config: { items, orientation } } = this
|
|
39
|
-
this._items
|
|
40
|
-
.classed(s.horizontalItems, orientation === VisControlsOrientation.Horizontal)
|
|
41
|
-
const controlItems = this._items.selectAll<HTMLDivElement, VisControlItemInterface>(`.${s.item}`)
|
|
42
|
-
.data(items)
|
|
43
|
-
|
|
44
|
-
const controlItemsEnter = controlItems.enter()
|
|
45
|
-
.append('div')
|
|
46
|
-
.attr('class', s.item)
|
|
47
|
-
.on('click', this._onItemClick.bind(this))
|
|
48
|
-
|
|
49
|
-
controlItemsEnter.append('button')
|
|
50
|
-
.attr('class', s.itemButton)
|
|
51
|
-
|
|
52
|
-
const controlItemsMerged = controlItemsEnter.merge(controlItems)
|
|
53
|
-
controlItemsMerged
|
|
54
|
-
.classed(s.borderLeft, d => d.borderLeft)
|
|
55
|
-
.classed(s.borderTop, d => d.borderTop)
|
|
56
|
-
.classed(s.borderRight, d => d.borderRight)
|
|
57
|
-
.classed(s.borderBottom, d => d.borderBottom)
|
|
58
|
-
.classed(s.disabled, d => d.disabled)
|
|
59
|
-
controlItemsMerged.select(`.${s.itemButton}`)
|
|
60
|
-
.html(item => item.icon)
|
|
61
|
-
|
|
62
|
-
controlItems.exit().remove()
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
_onItemClick (event: MouseEvent, item: VisControlItemInterface): void {
|
|
66
|
-
item.callback?.(event)
|
|
67
|
-
}
|
|
68
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export interface VisControlItemInterface {
|
|
2
|
-
icon: string;
|
|
3
|
-
callback?: (event: MouseEvent) => any;
|
|
4
|
-
disabled?: boolean;
|
|
5
|
-
borderLeft?: boolean;
|
|
6
|
-
borderTop?: boolean;
|
|
7
|
-
borderRight?: boolean;
|
|
8
|
-
borderBottom?: boolean;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export enum VisControlsOrientation {
|
|
12
|
-
Horizontal = 'horizontal',
|
|
13
|
-
Vertical = 'vertical',
|
|
14
|
-
}
|