@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,343 +0,0 @@
|
|
|
1
|
-
import { select, Selection } from 'd3-selection'
|
|
2
|
-
import { Transition } from 'd3-transition'
|
|
3
|
-
import { arc } from 'd3-shape'
|
|
4
|
-
|
|
5
|
-
// Types
|
|
6
|
-
import { GraphInputLink, GraphInputNode } from 'types/graph'
|
|
7
|
-
|
|
8
|
-
// Utils
|
|
9
|
-
import { trimString } from 'utils/text'
|
|
10
|
-
import { polygon } from 'utils/path'
|
|
11
|
-
import { smartTransition } from 'utils/d3'
|
|
12
|
-
import { getBoolean, getNumber, getString, getValue, throttle } from 'utils/data'
|
|
13
|
-
|
|
14
|
-
// Local Types
|
|
15
|
-
import { GraphNode, GraphCircleLabel, GraphNodeAnimationState, GraphNodeAnimatedElement, GraphNodeShape } from '../../types'
|
|
16
|
-
|
|
17
|
-
// Config
|
|
18
|
-
import { GraphConfig } from '../../config'
|
|
19
|
-
|
|
20
|
-
// Helpers
|
|
21
|
-
import {
|
|
22
|
-
arcTween,
|
|
23
|
-
polyTween,
|
|
24
|
-
setLabelRect,
|
|
25
|
-
getX,
|
|
26
|
-
getY,
|
|
27
|
-
getSideLabelTextColor,
|
|
28
|
-
getNodeColor,
|
|
29
|
-
getNodeIconColor,
|
|
30
|
-
getNodeSize,
|
|
31
|
-
LABEL_RECT_VERTICAL_PADDING,
|
|
32
|
-
} from './helper'
|
|
33
|
-
import { appendShape, updateShape, isCustomXml } from '../shape'
|
|
34
|
-
import { ZoomLevel } from '../zoom-levels'
|
|
35
|
-
|
|
36
|
-
// Styles
|
|
37
|
-
import * as generalSelectors from '../../style'
|
|
38
|
-
import * as nodeSelectors from './style'
|
|
39
|
-
|
|
40
|
-
const SIDE_LABEL_DEFAULT_RADIUS = 10
|
|
41
|
-
|
|
42
|
-
export function createNodes<N extends GraphInputNode, L extends GraphInputLink> (
|
|
43
|
-
selection: Selection<SVGGElement, GraphNode<N, L>, SVGGElement, unknown>,
|
|
44
|
-
config: GraphConfig<N, L>
|
|
45
|
-
): void {
|
|
46
|
-
const { nodeShape } = config
|
|
47
|
-
|
|
48
|
-
selection.each((d, i, elements) => {
|
|
49
|
-
const element = elements[i]
|
|
50
|
-
const group = select<SVGGElement, GraphNode<N, L>>(element)
|
|
51
|
-
group
|
|
52
|
-
.attr('transform', (d: GraphNode<N, L>, i) => {
|
|
53
|
-
const configuredPosition = getValue<GraphNode<N, L>, [number, number] | undefined>(d, config.nodeEnterPosition, i)
|
|
54
|
-
const scale = getNumber(d, config.nodeEnterScale, i) ?? 0
|
|
55
|
-
const x = configuredPosition?.[0] ?? getX(d)
|
|
56
|
-
const y = configuredPosition?.[1] ?? getY(d)
|
|
57
|
-
return `translate(${x}, ${y}) scale(${scale})`
|
|
58
|
-
})
|
|
59
|
-
.attr('opacity', 0)
|
|
60
|
-
|
|
61
|
-
const shape = getString(d, nodeShape, d._index)
|
|
62
|
-
/** Todo: The 'nodeShape' storing logic below it a temporary fix, needs a cleaner implementation */
|
|
63
|
-
// eslint-disable-next-line dot-notation
|
|
64
|
-
element['nodeShape'] = shape
|
|
65
|
-
appendShape(group, shape, nodeSelectors.node, nodeSelectors.customNode, d._index)
|
|
66
|
-
appendShape(group, shape, nodeSelectors.nodeSelection, nodeSelectors.customNode, d._index)
|
|
67
|
-
group.append('path').attr('class', nodeSelectors.nodeGauge)
|
|
68
|
-
group.append('text').attr('class', nodeSelectors.nodeIcon)
|
|
69
|
-
|
|
70
|
-
const label = group.append('g').attr('class', nodeSelectors.label)
|
|
71
|
-
label.append('rect').attr('class', nodeSelectors.labelBackground)
|
|
72
|
-
|
|
73
|
-
const labelText = label.append('text')
|
|
74
|
-
.attr('class', nodeSelectors.labelText)
|
|
75
|
-
.attr('dy', '0.32em')
|
|
76
|
-
labelText.append('tspan').attr('class', nodeSelectors.labelTextContent)
|
|
77
|
-
labelText.append('tspan')
|
|
78
|
-
.attr('class', nodeSelectors.subLabelTextContent)
|
|
79
|
-
.attr('dy', '1.1em')
|
|
80
|
-
.attr('x', '0')
|
|
81
|
-
|
|
82
|
-
group.append('g')
|
|
83
|
-
.attr('class', nodeSelectors.sideLabelsGroup)
|
|
84
|
-
|
|
85
|
-
group.append('text')
|
|
86
|
-
.attr('class', nodeSelectors.nodeBottomIcon)
|
|
87
|
-
})
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export function updateSelectedNodes<N extends GraphInputNode, L extends GraphInputLink> (
|
|
91
|
-
selection: Selection<SVGGElement, GraphNode<N, L>, SVGGElement, unknown>,
|
|
92
|
-
config: GraphConfig<N, L>
|
|
93
|
-
): void {
|
|
94
|
-
const { nodeDisabled } = config
|
|
95
|
-
|
|
96
|
-
selection.each((d, i, elements) => {
|
|
97
|
-
const group: Selection<SVGGElement, GraphNode<N, L>, SVGGElement, unknown> = select(elements[i])
|
|
98
|
-
const isGreyout = getBoolean(d, nodeDisabled, d._index) || d._state.greyout
|
|
99
|
-
|
|
100
|
-
group.classed(nodeSelectors.greyoutNode, isGreyout)
|
|
101
|
-
.classed(nodeSelectors.draggable, !config.disableDrag)
|
|
102
|
-
|
|
103
|
-
const nodeSelectionOutline = group.selectAll<SVGGElement, GraphNode<N, L>>(`.${nodeSelectors.nodeSelection}`)
|
|
104
|
-
nodeSelectionOutline.classed(nodeSelectors.nodeSelectionActive, d._state.selected)
|
|
105
|
-
|
|
106
|
-
group.selectAll<SVGTextElement, GraphCircleLabel>(`.${nodeSelectors.sideLabel}`)
|
|
107
|
-
.style('fill', (l) => isGreyout ? null : getSideLabelTextColor(l, selection.node()))
|
|
108
|
-
|
|
109
|
-
group.selectAll<SVGRectElement, GraphCircleLabel>(`.${nodeSelectors.sideLabelBackground}`)
|
|
110
|
-
.style('fill', (l) => isGreyout ? null : l.color)
|
|
111
|
-
})
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
export function updateNodes<N extends GraphInputNode, L extends GraphInputLink> (
|
|
115
|
-
selection: Selection<SVGGElement, GraphNode<N, L>, SVGGElement, unknown>,
|
|
116
|
-
config: GraphConfig<N, L>,
|
|
117
|
-
duration: number,
|
|
118
|
-
scale = 1
|
|
119
|
-
): Selection<SVGGElement, GraphNode<N, L>, SVGGElement, unknown> | Transition<SVGGElement, GraphNode<N, L>, SVGGElement, unknown> {
|
|
120
|
-
const {
|
|
121
|
-
nodeGaugeAnimDuration, nodeStrokeWidth, nodeShape, nodeSize, nodeGaugeValue, nodeGaugeFill,
|
|
122
|
-
nodeIcon, nodeIconSize, nodeLabel, nodeLabelTrim, nodeLabelTrimMode, nodeLabelTrimLength,
|
|
123
|
-
nodeSubLabel, nodeSubLabelTrim, nodeSubLabelTrimMode, nodeSubLabelTrimLength,
|
|
124
|
-
nodeSideLabels, nodeStroke, nodeFill, nodeBottomIcon,
|
|
125
|
-
} = config
|
|
126
|
-
|
|
127
|
-
// Re-create nodes to update shapes if they were changes
|
|
128
|
-
selection.each((d, i, elements) => {
|
|
129
|
-
const element = elements[i]
|
|
130
|
-
const group = select<SVGGElement, GraphNode<N, L>>(element)
|
|
131
|
-
const shape = getString(d, nodeShape, d._index)
|
|
132
|
-
|
|
133
|
-
// eslint-disable-next-line dot-notation
|
|
134
|
-
if (element['nodeShape'] !== shape) {
|
|
135
|
-
group.select(`.${nodeSelectors.node}`).remove()
|
|
136
|
-
appendShape(group, nodeShape, nodeSelectors.node, nodeSelectors.customNode, d._index, `.${nodeSelectors.nodeSelection}`)
|
|
137
|
-
group.select(`.${nodeSelectors.nodeSelection}`).remove()
|
|
138
|
-
appendShape(group, shape, nodeSelectors.nodeSelection, null, d._index, `.${nodeSelectors.nodeGauge}`)
|
|
139
|
-
// eslint-disable-next-line dot-notation
|
|
140
|
-
element['nodeShape'] = shape
|
|
141
|
-
}
|
|
142
|
-
})
|
|
143
|
-
|
|
144
|
-
// Update nodes themselves
|
|
145
|
-
selection.each((d, i, elements) => {
|
|
146
|
-
const groupElement = elements[i]
|
|
147
|
-
const group: Selection<SVGGElement, GraphNode<N, L>, SVGGElement, unknown> = select(groupElement)
|
|
148
|
-
const node: Selection<SVGGElement, GraphNode<N, L>, SVGGElement, unknown> = group.select(`.${nodeSelectors.node}`)
|
|
149
|
-
const nodeArc = group.select<GraphNodeAnimatedElement<SVGElement>>(`.${nodeSelectors.nodeGauge}`)
|
|
150
|
-
const icon = group.select<SVGTextElement>(`.${nodeSelectors.nodeIcon}`)
|
|
151
|
-
const sideLabelsGroup = group.select<SVGGElement>(`.${nodeSelectors.sideLabelsGroup}`)
|
|
152
|
-
const label = group.select<SVGGElement>(`.${nodeSelectors.label}`)
|
|
153
|
-
const labelTextContent = label.select<SVGTextElement>(`.${nodeSelectors.labelTextContent}`)
|
|
154
|
-
const sublabelTextContent = label.select<SVGTextElement>(`.${nodeSelectors.subLabelTextContent}`)
|
|
155
|
-
const bottomIcon = group.select<SVGTextElement>(`.${nodeSelectors.nodeBottomIcon}`)
|
|
156
|
-
const nodeSelectionOutline = group.select<SVGGElement>(`.${nodeSelectors.nodeSelection}`)
|
|
157
|
-
const nodeSizeValue = getNodeSize(d, nodeSize, d._index)
|
|
158
|
-
const arcGenerator = arc<GraphNodeAnimationState>()
|
|
159
|
-
.innerRadius(state => getNodeSize(state, nodeSize, state.nodeIndex) / 2 - (getNumber(state, nodeStrokeWidth, state.nodeIndex) / 2))
|
|
160
|
-
.outerRadius(state => getNodeSize(state, nodeSize, state.nodeIndex) / 2 + (getNumber(state, nodeStrokeWidth, state.nodeIndex) / 2))
|
|
161
|
-
.startAngle(0 * (Math.PI / 180))
|
|
162
|
-
// eslint-disable-next-line dot-notation
|
|
163
|
-
.endAngle(a => a['endAngle'])
|
|
164
|
-
|
|
165
|
-
group
|
|
166
|
-
.classed(generalSelectors.zoomOutLevel2, scale < ZoomLevel.Level2)
|
|
167
|
-
.classed(nodeSelectors.nodeIsDragged, (d: GraphNode<N, L>) => d._state.isDragged)
|
|
168
|
-
|
|
169
|
-
// Update Group
|
|
170
|
-
group
|
|
171
|
-
.classed(nodeSelectors.nodePolygon, () => {
|
|
172
|
-
const shape = getString(d, nodeShape, d._index)
|
|
173
|
-
return shape === GraphNodeShape.Triangle || shape === GraphNodeShape.Hexagon || shape === GraphNodeShape.Square
|
|
174
|
-
})
|
|
175
|
-
|
|
176
|
-
// Update Node
|
|
177
|
-
node
|
|
178
|
-
.call(updateShape, nodeShape, nodeSize, d._index)
|
|
179
|
-
.attr('stroke-width', getNumber(d, nodeStrokeWidth, d._index) ?? 0)
|
|
180
|
-
.style('fill', getNodeColor(d, nodeFill, d._index))
|
|
181
|
-
.style('stroke', getString(d, nodeStroke, d._index) ?? null)
|
|
182
|
-
|
|
183
|
-
const nodeBBox = (node.node() as SVGGraphicsElement).getBBox()
|
|
184
|
-
|
|
185
|
-
nodeArc
|
|
186
|
-
.attr('stroke-width', getNumber(d, nodeStrokeWidth, d._index))
|
|
187
|
-
.style('display', !getNumber(d, nodeGaugeValue, d._index) ? 'none' : null)
|
|
188
|
-
.style('fill', getNodeColor(d, nodeGaugeFill, d._index))
|
|
189
|
-
.style('stroke', getNodeColor(d, nodeGaugeFill, d._index))
|
|
190
|
-
.style('stroke-opacity', d => getString(d, nodeShape, d._index) === GraphNodeShape.Circle ? 0 : null)
|
|
191
|
-
|
|
192
|
-
nodeArc
|
|
193
|
-
.transition()
|
|
194
|
-
.duration(nodeGaugeAnimDuration)
|
|
195
|
-
.attrTween('d', (
|
|
196
|
-
d,
|
|
197
|
-
j,
|
|
198
|
-
arr
|
|
199
|
-
) => {
|
|
200
|
-
switch (getString(d, nodeShape, d._index)) {
|
|
201
|
-
case GraphNodeShape.Circle: return arcTween(d, config, arcGenerator, arr[j])
|
|
202
|
-
case GraphNodeShape.Hexagon: return polyTween(d, config, polygon, arr[j])
|
|
203
|
-
case GraphNodeShape.Square: return polyTween(d, config, polygon, arr[j])
|
|
204
|
-
case GraphNodeShape.Triangle: return polyTween(d, config, polygon, arr[j])
|
|
205
|
-
default: return null
|
|
206
|
-
}
|
|
207
|
-
})
|
|
208
|
-
|
|
209
|
-
// Set Node Selection
|
|
210
|
-
updateShape(nodeSelectionOutline, nodeShape, nodeSize, d._index)
|
|
211
|
-
|
|
212
|
-
// Update Node Icon
|
|
213
|
-
icon
|
|
214
|
-
.style('font-size', `${getNumber(d, nodeIconSize, d._index) ?? 2.5 * Math.sqrt(nodeSizeValue)}px`)
|
|
215
|
-
.attr('dy', '0.1em')
|
|
216
|
-
.style('fill', getNodeIconColor(d, nodeFill, d._index, selection.node()))
|
|
217
|
-
.html(getString(d, nodeIcon, d._index))
|
|
218
|
-
|
|
219
|
-
// Side Labels
|
|
220
|
-
const sideLabelsData = getValue<GraphNode<N, L>, GraphCircleLabel[]>(d, nodeSideLabels, d._index) || []
|
|
221
|
-
const sideLabels = sideLabelsGroup.selectAll<SVGGElement, GraphCircleLabel>('g').data(sideLabelsData)
|
|
222
|
-
const sideLabelsEnter = sideLabels.enter().append('g')
|
|
223
|
-
.attr('class', nodeSelectors.sideLabelGroup)
|
|
224
|
-
sideLabelsEnter.append('circle')
|
|
225
|
-
.attr('class', nodeSelectors.sideLabelBackground)
|
|
226
|
-
.attr('r', l => l.radius ?? SIDE_LABEL_DEFAULT_RADIUS)
|
|
227
|
-
sideLabelsEnter.append('text')
|
|
228
|
-
.attr('class', nodeSelectors.sideLabel)
|
|
229
|
-
|
|
230
|
-
const sideLabelsUpdate = sideLabels.merge(sideLabelsEnter)
|
|
231
|
-
.style('cursor', l => l.cursor ?? null)
|
|
232
|
-
|
|
233
|
-
// Side label text
|
|
234
|
-
sideLabelsUpdate.select(`.${nodeSelectors.sideLabel}`).html(d => d.text)
|
|
235
|
-
.attr('dy', '0.1em')
|
|
236
|
-
.style('fill', l => l.textColor ?? getSideLabelTextColor(l, selection.node()))
|
|
237
|
-
.style('font-size', l => l.fontSize ?? `${(2 + (l.radius ?? SIDE_LABEL_DEFAULT_RADIUS)) / Math.pow(l.text.toString().length, 0.3)}px`)
|
|
238
|
-
// Side label circle background
|
|
239
|
-
sideLabelsUpdate.select(`.${nodeSelectors.sideLabelBackground}`)
|
|
240
|
-
.style('fill', l => l.color)
|
|
241
|
-
|
|
242
|
-
sideLabelsUpdate.attr('transform', (l, j) => {
|
|
243
|
-
if (sideLabelsData.length === 1) return `translate(${nodeSizeValue / 2.5}, ${-nodeSizeValue / 2.5})`
|
|
244
|
-
const r = 1.05 * nodeSizeValue / 2
|
|
245
|
-
const angle = j * 1.15 * 2 * Math.atan2(l.radius ?? SIDE_LABEL_DEFAULT_RADIUS, r) - Math.PI / 3
|
|
246
|
-
return `translate(${r * Math.cos(angle)}, ${r * Math.sin(angle)})`
|
|
247
|
-
})
|
|
248
|
-
|
|
249
|
-
sideLabels.exit().remove()
|
|
250
|
-
|
|
251
|
-
// Set label and sub-label text
|
|
252
|
-
const labelText = getString(d, nodeLabel, d._index)
|
|
253
|
-
const sublabelText = getString(d, nodeSubLabel, d._index)
|
|
254
|
-
const labelTextTrimmed = getBoolean(d, nodeLabelTrim, d._index)
|
|
255
|
-
? trimString(labelText, getNumber(d, nodeLabelTrimLength, d._index), getValue(d, nodeLabelTrimMode, d._index))
|
|
256
|
-
: labelText
|
|
257
|
-
const sublabelTextTrimmed = getBoolean(d, nodeSubLabelTrim, d._index)
|
|
258
|
-
? trimString(sublabelText, getNumber(d, nodeSubLabelTrimLength, d._index), getValue(d, nodeSubLabelTrimMode, d._index))
|
|
259
|
-
: sublabelText
|
|
260
|
-
|
|
261
|
-
labelTextContent.text(labelTextTrimmed)
|
|
262
|
-
sublabelTextContent.text(sublabelTextTrimmed)
|
|
263
|
-
group
|
|
264
|
-
.on('mouseenter', () => {
|
|
265
|
-
labelTextContent.text(labelText)
|
|
266
|
-
sublabelTextContent.text(sublabelText)
|
|
267
|
-
setLabelRect(label, labelText, nodeSelectors.labelText)
|
|
268
|
-
group.raise()
|
|
269
|
-
})
|
|
270
|
-
.on('mouseleave', () => {
|
|
271
|
-
labelTextContent.text(labelTextTrimmed)
|
|
272
|
-
sublabelTextContent.text(sublabelTextTrimmed)
|
|
273
|
-
setLabelRect(label, labelTextTrimmed, nodeSelectors.labelText)
|
|
274
|
-
})
|
|
275
|
-
|
|
276
|
-
// Position label
|
|
277
|
-
const labelFontSize = parseFloat(window.getComputedStyle(groupElement).getPropertyValue('--vis-graph-node-label-font-size')) || 12
|
|
278
|
-
const labelMargin = LABEL_RECT_VERTICAL_PADDING + 1.25 * labelFontSize ** 1.03
|
|
279
|
-
const nodeHeight = isCustomXml((getString(d, nodeShape, d._index)) as GraphNodeShape) ? nodeBBox.height : nodeSizeValue
|
|
280
|
-
label.attr('transform', `translate(0, ${nodeHeight / 2 + labelMargin})`)
|
|
281
|
-
if (scale >= ZoomLevel.Level3) setLabelRect(label, getString(d, nodeLabel, d._index), nodeSelectors.labelText)
|
|
282
|
-
|
|
283
|
-
// Bottom Icon
|
|
284
|
-
bottomIcon.html(getString(d, nodeBottomIcon, d._index))
|
|
285
|
-
.attr('transform', `translate(0, ${nodeHeight / 2})`)
|
|
286
|
-
})
|
|
287
|
-
|
|
288
|
-
updateSelectedNodes(selection, config)
|
|
289
|
-
|
|
290
|
-
return smartTransition(selection, duration)
|
|
291
|
-
.attr('transform', d => `translate(${getX(d)}, ${getY(d)}) scale(1)`)
|
|
292
|
-
.attr('opacity', 1)
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
export function removeNodes<N extends GraphInputNode, L extends GraphInputLink> (
|
|
296
|
-
selection: Selection<SVGGElement, GraphNode<N, L>, SVGGElement, unknown>,
|
|
297
|
-
config: GraphConfig<N, L>,
|
|
298
|
-
duration: number
|
|
299
|
-
): void {
|
|
300
|
-
smartTransition(selection, duration / 2)
|
|
301
|
-
.attr('opacity', 0)
|
|
302
|
-
.attr('transform', (d, i) => {
|
|
303
|
-
const configuredPosition = getValue<GraphNode<N, L>, [number, number] | undefined>(d, config.nodeExitPosition, i)
|
|
304
|
-
const scale = getNumber(d, config.nodeExitScale, i) ?? 0
|
|
305
|
-
const x = configuredPosition?.[0] ?? getX(d)
|
|
306
|
-
const y = configuredPosition?.[1] ?? getY(d)
|
|
307
|
-
return `translate(${x}, ${y}) scale(${scale})`
|
|
308
|
-
})
|
|
309
|
-
.remove()
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
function setLabelBackgroundRect<N extends GraphInputNode, L extends GraphInputLink> (
|
|
313
|
-
selection: Selection<SVGGElement, GraphNode<N, L>, SVGGElement, unknown>,
|
|
314
|
-
config: GraphConfig<N, L>
|
|
315
|
-
): void {
|
|
316
|
-
const { nodeLabel } = config
|
|
317
|
-
|
|
318
|
-
selection.each((d, i, elements) => {
|
|
319
|
-
const group: Selection<SVGGElement, N, SVGGElement, N> = select(elements[i])
|
|
320
|
-
const label: Selection<SVGGElement, N, SVGGElement, N> = group.select(`.${nodeSelectors.label}`)
|
|
321
|
-
setLabelRect(label, getString(d, nodeLabel, i), nodeSelectors.labelText)
|
|
322
|
-
})
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
const setLabelBackgroundRectThrottled = throttle(setLabelBackgroundRect, 1000) as typeof setLabelBackgroundRect
|
|
326
|
-
|
|
327
|
-
export function zoomNodes<N extends GraphInputNode, L extends GraphInputLink> (
|
|
328
|
-
selection: Selection<SVGGElement, GraphNode<N, L>, SVGGElement, unknown>,
|
|
329
|
-
config: GraphConfig<N, L>,
|
|
330
|
-
scale: number
|
|
331
|
-
): void {
|
|
332
|
-
selection.classed(generalSelectors.zoomOutLevel1, scale < ZoomLevel.Level1)
|
|
333
|
-
selection.classed(generalSelectors.zoomOutLevel2, scale < ZoomLevel.Level2)
|
|
334
|
-
|
|
335
|
-
selection.selectAll(`${nodeSelectors.sideLabelBackground}`)
|
|
336
|
-
.attr('transform', `scale(${1 / Math.pow(scale, 0.35)})`)
|
|
337
|
-
selection.selectAll(`.${nodeSelectors.sideLabel}`)
|
|
338
|
-
.attr('transform', `scale(${1 / Math.pow(scale, 0.45)})`)
|
|
339
|
-
|
|
340
|
-
if (scale >= ZoomLevel.Level3) selection.call(setLabelBackgroundRectThrottled, config)
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
export const zoomNodesThrottled = throttle(zoomNodes, 500)
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
import { Selection } from 'd3-selection'
|
|
2
|
-
|
|
3
|
-
// Types
|
|
4
|
-
import { NumericAccessor, BooleanAccessor } from 'types/accessor'
|
|
5
|
-
import { Position } from 'types/position'
|
|
6
|
-
import { GraphInputLink, GraphInputNode } from 'types/graph'
|
|
7
|
-
import { Spacing } from 'types/spacing'
|
|
8
|
-
|
|
9
|
-
// Utils
|
|
10
|
-
import { getBoolean, isPlainObject } from 'utils/data'
|
|
11
|
-
|
|
12
|
-
// Local Types
|
|
13
|
-
import { GraphNode, GraphPanel, GraphPanelConfig } from '../../types'
|
|
14
|
-
|
|
15
|
-
// Config
|
|
16
|
-
import { GraphConfig } from '../../config'
|
|
17
|
-
|
|
18
|
-
// Helpers
|
|
19
|
-
import { getX, getY, getNodeSize } from '../node/helper'
|
|
20
|
-
|
|
21
|
-
// Styles
|
|
22
|
-
import * as nodeSelectors from '../node/style'
|
|
23
|
-
|
|
24
|
-
export const DEFAULT_PADDING = 15
|
|
25
|
-
export const DEFAULT_LABEL_MARGIN = 16
|
|
26
|
-
export const OUTLINE_SELECTION_PADDING = 5
|
|
27
|
-
export const DEFAULT_SIDE_LABEL_SIZE = 25
|
|
28
|
-
|
|
29
|
-
export function getPanelPadding (padding: number | Spacing | undefined): Spacing {
|
|
30
|
-
const isPaddingAnObject = isPlainObject(padding)
|
|
31
|
-
return {
|
|
32
|
-
left: (isPaddingAnObject ? (padding as Spacing).left : (padding as number)) ?? DEFAULT_PADDING,
|
|
33
|
-
right: (isPaddingAnObject ? (padding as Spacing).right : (padding as number)) ?? DEFAULT_PADDING,
|
|
34
|
-
top: (isPaddingAnObject ? (padding as Spacing).top : (padding as number)) ?? DEFAULT_PADDING,
|
|
35
|
-
bottom: (isPaddingAnObject ? (padding as Spacing).bottom : (padding as number)) ?? DEFAULT_PADDING,
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export function initPanels (panelsConfig: GraphPanelConfig[] | undefined): GraphPanel[] {
|
|
40
|
-
const panels = (panelsConfig ?? []).map(p => ({
|
|
41
|
-
...p,
|
|
42
|
-
_padding: getPanelPadding(p.padding),
|
|
43
|
-
})) as GraphPanel[]
|
|
44
|
-
|
|
45
|
-
return panels
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export function setPanelForNodes<N extends GraphInputNode, L extends GraphInputLink> (
|
|
49
|
-
panels: GraphPanel[],
|
|
50
|
-
nodes: GraphNode<N, L>[],
|
|
51
|
-
config: GraphConfig<N, L>
|
|
52
|
-
): void {
|
|
53
|
-
if (!panels) return
|
|
54
|
-
|
|
55
|
-
// For each node store its related panels
|
|
56
|
-
nodes.forEach(node => {
|
|
57
|
-
// Find all panels to which node belong
|
|
58
|
-
const nodePanels = panels.filter(panel => panel.nodes && panel.nodes.includes(node._id))
|
|
59
|
-
node._panels = nodePanels
|
|
60
|
-
})
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export function setPanelBBox<N extends GraphInputNode, L extends GraphInputLink> (
|
|
64
|
-
panelConfig: GraphPanel,
|
|
65
|
-
panelNodes: Selection<SVGGElement, GraphNode<N, L>, SVGGElement, unknown>,
|
|
66
|
-
nodeSizeAccessor: NumericAccessor<N>,
|
|
67
|
-
nodeDisabledAccessor: BooleanAccessor<N>
|
|
68
|
-
): void {
|
|
69
|
-
const selection = panelNodes.select(`.${nodeSelectors.node}`)
|
|
70
|
-
if (selection.empty()) return
|
|
71
|
-
|
|
72
|
-
const labelApprxHeight = 40
|
|
73
|
-
const labelApprxWidth = 110
|
|
74
|
-
const labelMargin = 10
|
|
75
|
-
let box: { x1: number; x2: number; y1: number; y2: number }
|
|
76
|
-
|
|
77
|
-
selection.each((d, i) => {
|
|
78
|
-
const nodeSize = getNodeSize(d, nodeSizeAccessor, i)
|
|
79
|
-
const w = Math.max(nodeSize, labelApprxWidth)
|
|
80
|
-
const h = nodeSize + labelMargin + labelApprxHeight
|
|
81
|
-
// const nodeBBox = node.getBBox()
|
|
82
|
-
const yShift = 10 // This is hard to calculate, so we just use an approximation
|
|
83
|
-
|
|
84
|
-
const coords = {
|
|
85
|
-
x1: getX(d) - w / 2, // We use d.x and d.y instead of bBox values here because `gBBox` contains initial ...
|
|
86
|
-
y1: getY(d) - h / 2 + yShift, // ... coordinates (before transition starts), not target coordinates
|
|
87
|
-
x2: getX(d) + w / 2,
|
|
88
|
-
y2: getY(d) + h / 2 + yShift,
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
if (!box) {
|
|
92
|
-
box = {
|
|
93
|
-
...coords,
|
|
94
|
-
}
|
|
95
|
-
} else {
|
|
96
|
-
if (box.x1 > coords.x1) box.x1 = coords.x1
|
|
97
|
-
if (box.y1 > coords.y1) box.y1 = coords.y1
|
|
98
|
-
if (box.x2 < coords.x2) box.x2 = coords.x2
|
|
99
|
-
if (box.y2 < coords.y2) box.y2 = coords.y2
|
|
100
|
-
}
|
|
101
|
-
})
|
|
102
|
-
|
|
103
|
-
panelConfig._x = box.x1 - panelConfig._padding.left
|
|
104
|
-
panelConfig._y = box.y1 - panelConfig._padding.top
|
|
105
|
-
panelConfig._width = box.x2 - box.x1 + panelConfig._padding.left + panelConfig._padding.right
|
|
106
|
-
panelConfig._height = box.y2 - box.y1 + panelConfig._padding.top + panelConfig._padding.bottom
|
|
107
|
-
panelConfig._disabled = selection.data()
|
|
108
|
-
.map((node, i) => getBoolean(node, nodeDisabledAccessor, node._index) || node._state.greyout)
|
|
109
|
-
.every(d => d)
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
export function setPanelNumNodes<N extends GraphInputNode, L extends GraphInputLink> (
|
|
113
|
-
panelConfig: GraphPanel,
|
|
114
|
-
panelNodes: Selection<SVGGElement, GraphNode<N, L>, SVGGElement, unknown>
|
|
115
|
-
): void {
|
|
116
|
-
panelConfig._numNodes = panelNodes.size()
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
export function updatePanelBBoxSize<N extends GraphInputNode, L extends GraphInputLink> (
|
|
120
|
-
nodesSelection: Selection<SVGGElement, GraphNode<N, L>, SVGGElement, unknown>,
|
|
121
|
-
panels: GraphPanel[],
|
|
122
|
-
config: GraphConfig<N, L>
|
|
123
|
-
): void {
|
|
124
|
-
const { layoutNonConnectedAside } = config
|
|
125
|
-
if (!panels) return
|
|
126
|
-
|
|
127
|
-
panels.forEach(panelConfig => {
|
|
128
|
-
const panelNodes = nodesSelection.filter(node => {
|
|
129
|
-
return (!layoutNonConnectedAside || node._isConnected) && panelConfig.nodes.includes(node._id)
|
|
130
|
-
})
|
|
131
|
-
setPanelBBox(panelConfig, panelNodes, config.nodeSize, config.nodeDisabled)
|
|
132
|
-
})
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
export function updatePanelNumNodes<N extends GraphInputNode, L extends GraphInputLink> (
|
|
136
|
-
nodesSelection: Selection<SVGGElement, GraphNode<N, L>, SVGGElement, unknown>,
|
|
137
|
-
panels: GraphPanel[],
|
|
138
|
-
config: GraphConfig<N, L>
|
|
139
|
-
): void {
|
|
140
|
-
const { layoutNonConnectedAside } = config
|
|
141
|
-
if (!panels) return
|
|
142
|
-
|
|
143
|
-
panels.forEach(panelConfig => {
|
|
144
|
-
const panelNodes = nodesSelection.filter(node => {
|
|
145
|
-
return (!layoutNonConnectedAside || node._isConnected) && panelConfig.nodes.includes(node._id)
|
|
146
|
-
})
|
|
147
|
-
setPanelNumNodes(panelConfig, panelNodes)
|
|
148
|
-
})
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
export function getLabelTranslateTransform<N extends GraphInputNode, L extends GraphInputLink> (panel: GraphPanel): string {
|
|
152
|
-
const x = panel._width / 2
|
|
153
|
-
const dy = DEFAULT_LABEL_MARGIN + (panel.dashedOutline ? OUTLINE_SELECTION_PADDING : 0)
|
|
154
|
-
const y = panel.labelPosition === Position.Bottom
|
|
155
|
-
? panel._height + dy
|
|
156
|
-
: -dy
|
|
157
|
-
|
|
158
|
-
return `translate(${x}, ${y})`
|
|
159
|
-
}
|
|
160
|
-
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import { select, Selection } from 'd3-selection'
|
|
2
|
-
|
|
3
|
-
// Utils
|
|
4
|
-
import { trimString } from 'utils/text'
|
|
5
|
-
import { smartTransition } from 'utils/d3'
|
|
6
|
-
|
|
7
|
-
// Types
|
|
8
|
-
import { GraphInputLink, GraphInputNode } from 'types/graph'
|
|
9
|
-
|
|
10
|
-
// Local Types
|
|
11
|
-
import { GraphNode, GraphLink, GraphPanel } from '../../types'
|
|
12
|
-
|
|
13
|
-
// Config
|
|
14
|
-
import { GraphConfig } from '../../config'
|
|
15
|
-
|
|
16
|
-
// Helpers
|
|
17
|
-
import { setLabelRect } from '../node/helper'
|
|
18
|
-
import { getLabelTranslateTransform, OUTLINE_SELECTION_PADDING, DEFAULT_SIDE_LABEL_SIZE } from './helper'
|
|
19
|
-
|
|
20
|
-
// Styles
|
|
21
|
-
import * as panelSelectors from './style'
|
|
22
|
-
import { appendShape, updateShape } from '../shape'
|
|
23
|
-
|
|
24
|
-
export function createPanels<N extends GraphNode, L extends GraphLink> (
|
|
25
|
-
selection: Selection<SVGGElement, GraphPanel, SVGGElement, unknown>
|
|
26
|
-
): void {
|
|
27
|
-
selection
|
|
28
|
-
.attr('transform', d => `translate(${d._x}, ${d._y})`)
|
|
29
|
-
.style('opacity', 0)
|
|
30
|
-
|
|
31
|
-
selection.append('rect').attr('class', panelSelectors.panelSelection)
|
|
32
|
-
.attr('rx', 9)
|
|
33
|
-
.attr('ry', 9)
|
|
34
|
-
.attr('width', d => d._width)
|
|
35
|
-
.attr('height', d => d._height)
|
|
36
|
-
|
|
37
|
-
selection.append('rect').attr('class', panelSelectors.panel)
|
|
38
|
-
.attr('rx', 7)
|
|
39
|
-
.attr('ry', 7)
|
|
40
|
-
.attr('width', d => d._width)
|
|
41
|
-
.attr('height', d => d._height)
|
|
42
|
-
|
|
43
|
-
const panelLabel = selection.append('g').attr('class', panelSelectors.label)
|
|
44
|
-
.attr('transform', getLabelTranslateTransform)
|
|
45
|
-
panelLabel.append('rect').attr('class', panelSelectors.background)
|
|
46
|
-
panelLabel.append('text').attr('class', panelSelectors.labelText)
|
|
47
|
-
.attr('dy', '0.32em')
|
|
48
|
-
|
|
49
|
-
const sideIcon = selection.append('g')
|
|
50
|
-
.attr('class', panelSelectors.sideIconGroup)
|
|
51
|
-
.attr('transform', (d, i, elements) => {
|
|
52
|
-
const dx = -OUTLINE_SELECTION_PADDING
|
|
53
|
-
const dy = -OUTLINE_SELECTION_PADDING
|
|
54
|
-
return `translate(${d._width + dx}, ${-dy})`
|
|
55
|
-
})
|
|
56
|
-
appendShape(sideIcon, (d: GraphPanel) => d.sideIconShape, panelSelectors.sideIconShape, panelSelectors.customSideIcon)
|
|
57
|
-
sideIcon.append('text').attr('class', panelSelectors.sideIconSymbol)
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export function updatePanels<N extends GraphNode, L extends GraphLink> (
|
|
61
|
-
selection: Selection<SVGGElement, GraphPanel, SVGGElement, unknown>,
|
|
62
|
-
config: GraphConfig<GraphInputNode, GraphInputLink>,
|
|
63
|
-
duration: number
|
|
64
|
-
): void {
|
|
65
|
-
smartTransition(selection, duration)
|
|
66
|
-
.attr('transform', d => `translate(${d._x}, ${d._y})`)
|
|
67
|
-
.style('opacity', d => d._disabled ? 0.4 : 1)
|
|
68
|
-
|
|
69
|
-
const panels = selection.selectAll<SVGRectElement, GraphPanel>(`.${panelSelectors.panel}`).data(d => [d])
|
|
70
|
-
smartTransition(panels, duration)
|
|
71
|
-
.attr('width', d => d._width)
|
|
72
|
-
.attr('height', d => d._height)
|
|
73
|
-
.style('stroke', d => d.borderColor)
|
|
74
|
-
.style('stroke-width', d => d.borderWidth)
|
|
75
|
-
|
|
76
|
-
const panelSelection = selection.select<SVGRectElement>(`.${panelSelectors.panelSelection}`)
|
|
77
|
-
.classed(panelSelectors.panelSelectionActive, d => d.dashedOutline)
|
|
78
|
-
|
|
79
|
-
smartTransition(panelSelection, duration)
|
|
80
|
-
.attr('x', d => -OUTLINE_SELECTION_PADDING)
|
|
81
|
-
.attr('y', d => -OUTLINE_SELECTION_PADDING)
|
|
82
|
-
.attr('width', d => d._width + OUTLINE_SELECTION_PADDING * 2)
|
|
83
|
-
.attr('height', d => d._height + OUTLINE_SELECTION_PADDING * 2)
|
|
84
|
-
|
|
85
|
-
const sideIcon = selection.select<SVGGElement>(`.${panelSelectors.sideIconGroup}`)
|
|
86
|
-
|
|
87
|
-
sideIcon.select<SVGGElement>(`.${panelSelectors.sideIconShape}`)
|
|
88
|
-
.call(updateShape, (d: GraphPanel) => d.sideIconShape, (d: GraphPanel) => d.sideIconShapeSize ?? DEFAULT_SIDE_LABEL_SIZE)
|
|
89
|
-
.style('stroke', d => d.sideIconShapeStroke)
|
|
90
|
-
.style('cursor', d => d.sideIconCursor ?? null)
|
|
91
|
-
.style('opacity', d => d.sideIconShape ? 1 : 0)
|
|
92
|
-
|
|
93
|
-
sideIcon.select(`.${panelSelectors.sideIconSymbol}`)
|
|
94
|
-
.html(d => d.sideIconSymbol)
|
|
95
|
-
.attr('dy', 1)
|
|
96
|
-
.style('fill', d => d.sideIconSymbolColor)
|
|
97
|
-
.style('font-size', d => d.sideIconFontSize ?? ((d.sideIconShapeSize ?? DEFAULT_SIDE_LABEL_SIZE) / 2.5))
|
|
98
|
-
|
|
99
|
-
smartTransition(sideIcon, duration)
|
|
100
|
-
.attr('transform', d => {
|
|
101
|
-
const dx = -OUTLINE_SELECTION_PADDING
|
|
102
|
-
const dy = -OUTLINE_SELECTION_PADDING
|
|
103
|
-
return `translate(${d._width + dx}, ${-dy})`
|
|
104
|
-
})
|
|
105
|
-
|
|
106
|
-
const panelLabel = selection.select<SVGGElement>(`.${panelSelectors.label}`)
|
|
107
|
-
|
|
108
|
-
panelLabel.select<SVGTextElement>(`.${panelSelectors.labelText}`)
|
|
109
|
-
.text(d => trimString(d.label))
|
|
110
|
-
|
|
111
|
-
smartTransition(panelLabel, duration)
|
|
112
|
-
.attr('transform', getLabelTranslateTransform)
|
|
113
|
-
|
|
114
|
-
panelLabel
|
|
115
|
-
.on('mouseover', (event: MouseEvent, d) => {
|
|
116
|
-
const label = select<SVGGElement, GraphPanel<N, L>>(event.currentTarget as SVGGElement)
|
|
117
|
-
const labelContent = d.label
|
|
118
|
-
label.select('text').text(labelContent)
|
|
119
|
-
setLabelRect(label, labelContent, panelSelectors.labelText)
|
|
120
|
-
})
|
|
121
|
-
.on('mouseleave', (event: MouseEvent, d) => {
|
|
122
|
-
const label = select<SVGGElement, GraphPanel<N, L>>(event.currentTarget as SVGGElement)
|
|
123
|
-
const labelContent = trimString(d.label)
|
|
124
|
-
label.select('text').text(labelContent)
|
|
125
|
-
setLabelRect(label, labelContent, panelSelectors.labelText)
|
|
126
|
-
})
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
export function removePanels<N extends GraphNode, L extends GraphLink> (
|
|
130
|
-
selection: Selection<SVGGElement, GraphPanel, SVGGElement, unknown>,
|
|
131
|
-
config: GraphConfig<GraphInputNode, GraphInputLink>,
|
|
132
|
-
duration: number
|
|
133
|
-
): void {
|
|
134
|
-
smartTransition(selection, duration / 2)
|
|
135
|
-
.style('opacity', 0)
|
|
136
|
-
.remove()
|
|
137
|
-
}
|