@unovis/ts 1.4.4-beta.3 → 1.4.5-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -108,6 +108,7 @@ function setupMap(mapContainer, config) {
108
108
  // eslint-disable-next-line no-case-declarations
109
109
  const { getMaplibreGLLayer } = yield import('../renderer/mapboxgl-layer.js');
110
110
  layer = getMaplibreGLLayer(config, L, maplibre.default);
111
+ layer.addTo(leafletMap);
111
112
  maplibreMap = (_b = (_a = layer).getMaplibreMap) === null || _b === void 0 ? void 0 : _b.call(_a);
112
113
  select(mapContainer).on('wheel', (event) => {
113
114
  event.preventDefault();
@@ -116,9 +117,9 @@ function setupMap(mapContainer, config) {
116
117
  break;
117
118
  case LeafletMapRenderer.Raster:
118
119
  layer = L.tileLayer(style);
120
+ layer.addTo(leafletMap);
119
121
  break;
120
122
  }
121
- layer.addTo(leafletMap);
122
123
  // leaflet-mapbox-gl has a layer positioning issue on far zoom levels which leads to having wrong
123
124
  // map points projection. We constrain the view to prevent that.
124
125
  constraintMapView(leafletMap);
@@ -1 +1 @@
1
- {"version":3,"file":"map.js","sources":["../../../../src/components/leaflet-map/modules/map.ts"],"sourcesContent":["import type L from 'leaflet'\nimport { select, Selection } from 'd3-selection'\nimport type { GeoJSONSource, Map } from 'maplibre-gl'\nimport { feature } from 'topojson-client'\n\n// Types\nimport { GenericDataRecord } from 'types/data'\n\n// Config\nimport { LeafletMapConfigInterface } from '../config'\n\n// Local Types\n\n// Utils\nimport { constraintMapView, mapboxglWheelEventThrottled } from '../renderer/mapboxgl-utils'\n\n// Styles\nimport * as s from '../style'\nimport { LeafletMapRenderer } from '../types'\n\nexport const initialMapCenter: L.LatLngExpression = [36, 14]\nexport const initialMapZoom = 1.9\n\nexport function updateTopoJson<T extends GenericDataRecord> (maplibreMap: Map, config: LeafletMapConfigInterface<T>): void {\n const { topoJSONLayer } = config\n\n if (topoJSONLayer.sources) {\n const featureObject = topoJSONLayer.sources?.objects?.[topoJSONLayer.featureName]\n if (featureObject) {\n const mapSource = maplibreMap.getSource(topoJSONLayer.featureName) as GeoJSONSource\n const featureCollection = feature(topoJSONLayer.sources, featureObject)\n if (mapSource) {\n mapSource.setData(featureCollection)\n } else {\n maplibreMap.addSource(topoJSONLayer.featureName, { type: 'geojson', data: featureCollection })\n }\n }\n }\n\n const fillLayer = maplibreMap.getLayer(`${topoJSONLayer.featureName}-area`)\n if (topoJSONLayer.fillProperty) {\n if (!fillLayer) {\n maplibreMap.addLayer({\n id: `${topoJSONLayer.featureName}-area`,\n type: 'fill',\n source: topoJSONLayer.featureName,\n paint: {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n 'fill-antialias': false,\n // eslint-disable-next-line @typescript-eslint/naming-convention\n 'fill-opacity': topoJSONLayer.fillOpacity,\n },\n })\n }\n maplibreMap.setPaintProperty(`${topoJSONLayer.featureName}-area`, 'fill-color', [\n 'case',\n ['!', ['has', topoJSONLayer.fillProperty]],\n 'rgba(255, 255, 255, 0)',\n ['get', topoJSONLayer.fillProperty],\n ])\n } else if (fillLayer) maplibreMap.removeLayer(`${topoJSONLayer.featureName}-area`)\n\n const strokeLayer = maplibreMap.getLayer(`${topoJSONLayer.featureName}-stroke`)\n if (topoJSONLayer.strokeProperty) {\n if (!strokeLayer) {\n maplibreMap.addLayer({\n id: `${topoJSONLayer.featureName}-stroke`,\n type: 'line',\n source: topoJSONLayer.featureName,\n paint: {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n 'line-opacity': topoJSONLayer.strokeOpacity,\n // eslint-disable-next-line @typescript-eslint/naming-convention\n 'line-width': topoJSONLayer.strokeWidth,\n },\n })\n }\n maplibreMap.setPaintProperty(`${topoJSONLayer.featureName}-stroke`, 'line-color', [\n 'case',\n ['!', ['has', topoJSONLayer.strokeProperty]],\n 'rgba(255, 255, 255, 0)',\n ['get', topoJSONLayer.strokeProperty],\n ])\n } else if (strokeLayer) { maplibreMap.removeLayer(`${topoJSONLayer.featureName}-stroke`) }\n}\n\nexport async function setupMap<T extends GenericDataRecord> (mapContainer: HTMLElement, config: LeafletMapConfigInterface<T>): Promise<{\n leaflet: L.Map;\n layer: L.Layer;\n svgOverlay: Selection<SVGSVGElement, unknown, null, undefined>;\n svgGroup: Selection<SVGGElement, unknown, SVGElement, undefined>;\n}> {\n const { style, renderer, topoJSONLayer } = config\n const leaflet = await import('leaflet')\n const L = leaflet.default\n\n if (!style) {\n console.error('Unovis | Leaflet Map: Please provide style settings in the map configuration object')\n return\n }\n\n const leafletMap = L.map(mapContainer, {\n scrollWheelZoom: renderer === LeafletMapRenderer.Raster, // We define custom scroll event for MapboxGL to enabling smooth zooming\n zoomControl: false,\n zoomDelta: renderer === LeafletMapRenderer.Raster ? 1 : 0.5,\n zoomSnap: renderer === LeafletMapRenderer.Raster ? 1 : 0,\n attributionControl: true,\n center: initialMapCenter,\n zoom: initialMapZoom,\n minZoom: Math.sqrt(mapContainer.offsetWidth) / 17,\n maxZoom: 23,\n maxBounds: L.latLngBounds(\n [-75, -290],\n [85, 290]\n ),\n maxBoundsViscosity: 1,\n })\n\n for (const attr of config.attribution) {\n leafletMap.attributionControl.addAttribution(attr)\n }\n\n let layer: L.Layer | (L.Layer & { getMaplibreMap(): Map })\n let maplibreMap: Map = null\n\n switch (renderer) {\n case LeafletMapRenderer.MapLibre:\n // eslint-disable-next-line no-case-declarations\n const maplibre = await import('maplibre-gl')\n // eslint-disable-next-line no-case-declarations\n const { getMaplibreGLLayer } = await import('../renderer/mapboxgl-layer')\n layer = getMaplibreGLLayer(config, L, maplibre.default)\n maplibreMap = (layer as ReturnType<typeof getMaplibreGLLayer>).getMaplibreMap?.()\n\n select(mapContainer).on('wheel', (event: WheelEvent) => {\n event.preventDefault()\n mapboxglWheelEventThrottled(leafletMap, layer as (L.Layer & { getMaplibreMap(): Map }), event)\n })\n break\n case LeafletMapRenderer.Raster:\n layer = L.tileLayer(style as string)\n break\n }\n layer.addTo(leafletMap)\n\n // leaflet-mapbox-gl has a layer positioning issue on far zoom levels which leads to having wrong\n // map points projection. We constrain the view to prevent that.\n constraintMapView(leafletMap)\n\n if (maplibreMap && topoJSONLayer?.sources) {\n const canvas = maplibreMap.getCanvas()\n const canvasSelection = select(canvas).classed(s.mapboxglCanvas, true)\n const tilePaneSelection = select(leafletMap.getPanes().tilePane)\n\n maplibreMap.on('mousemove', (event) => {\n const layerName = `${topoJSONLayer.featureName}-area`\n const layer = maplibreMap.getLayer(layerName)\n if (!layer) return\n\n const features = maplibreMap.queryRenderedFeatures(event.point, { layers: [layerName] })\n tilePaneSelection.datum(features[0])\n canvasSelection.classed(s.onFeatureHover, Boolean(features[0]))\n })\n\n maplibreMap.on('load', () => {\n updateTopoJson(maplibreMap, config)\n })\n }\n\n const svgOverlay = select(leafletMap.getPanes().overlayPane).append('svg')\n const svgGroup = svgOverlay.append('g')\n\n return {\n leaflet: leafletMap,\n layer,\n svgOverlay,\n svgGroup,\n }\n}\n"],"names":["s.mapboxglCanvas","s.onFeatureHover"],"mappings":";;;;;;;MAoBa,gBAAgB,GAAuB,CAAC,EAAE,EAAE,EAAE,EAAC;AACrD,MAAM,cAAc,GAAG,IAAG;AAEjB,SAAA,cAAc,CAA+B,WAAgB,EAAE,MAAoC,EAAA;;AACjH,IAAA,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,CAAA;IAEhC,IAAI,aAAa,CAAC,OAAO,EAAE;AACzB,QAAA,MAAM,aAAa,GAAG,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,aAAa,CAAC,OAAO,MAAE,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,OAAO,MAAG,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,aAAa,CAAC,WAAW,CAAC,CAAA;AACjF,QAAA,IAAI,aAAa,EAAE;YACjB,MAAM,SAAS,GAAG,WAAW,CAAC,SAAS,CAAC,aAAa,CAAC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M,QAAQ,GAAG,WAAW,CAAC,qBAAqB,CAAC,KAAK,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;gBACxF,iBAAiB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAA;AACpC,gBAAA,eAAe,CAAC,OAAO,CAACC,cAAgB,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AACjE,aAAC,CAAC,CAAA;AAEF,YAAA,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAK;AAC1B,gBAAA,cAAc,CAAC,WAAW,EAAE,MAAM,CAAC,CAAA;AACrC,aAAC,CAAC,CAAA;AACH,SAAA;AAED,QAAA,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;QAC1E,MAAM,QAAQ,GAAG,UAAU,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;QAEvC,OAAO;AACL,YAAA,OAAO,EAAE,UAAU;YACnB,KAAK;YACL,UAAU;YACV,QAAQ;SACT,CAAA;;AACF;;;;"}
1
+ {"version":3,"file":"map.js","sources":["../../../../src/components/leaflet-map/modules/map.ts"],"sourcesContent":["import type L from 'leaflet'\nimport { select, Selection } from 'd3-selection'\nimport type { GeoJSONSource, Map } from 'maplibre-gl'\nimport { feature } from 'topojson-client'\n\n// Types\nimport { GenericDataRecord } from 'types/data'\n\n// Config\nimport { LeafletMapConfigInterface } from '../config'\n\n// Local Types\n\n// Utils\nimport { constraintMapView, mapboxglWheelEventThrottled } from '../renderer/mapboxgl-utils'\n\n// Styles\nimport * as s from '../style'\nimport { LeafletMapRenderer } from '../types'\n\nexport const initialMapCenter: L.LatLngExpression = [36, 14]\nexport const initialMapZoom = 1.9\n\nexport function updateTopoJson<T extends GenericDataRecord> (maplibreMap: Map, config: LeafletMapConfigInterface<T>): void {\n const { topoJSONLayer } = config\n\n if (topoJSONLayer.sources) {\n const featureObject = topoJSONLayer.sources?.objects?.[topoJSONLayer.featureName]\n if (featureObject) {\n const mapSource = maplibreMap.getSource(topoJSONLayer.featureName) as GeoJSONSource\n const featureCollection = feature(topoJSONLayer.sources, featureObject)\n if (mapSource) {\n mapSource.setData(featureCollection)\n } else {\n maplibreMap.addSource(topoJSONLayer.featureName, { type: 'geojson', data: featureCollection })\n }\n }\n }\n\n const fillLayer = maplibreMap.getLayer(`${topoJSONLayer.featureName}-area`)\n if (topoJSONLayer.fillProperty) {\n if (!fillLayer) {\n maplibreMap.addLayer({\n id: `${topoJSONLayer.featureName}-area`,\n type: 'fill',\n source: topoJSONLayer.featureName,\n paint: {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n 'fill-antialias': false,\n // eslint-disable-next-line @typescript-eslint/naming-convention\n 'fill-opacity': topoJSONLayer.fillOpacity,\n },\n })\n }\n maplibreMap.setPaintProperty(`${topoJSONLayer.featureName}-area`, 'fill-color', [\n 'case',\n ['!', ['has', topoJSONLayer.fillProperty]],\n 'rgba(255, 255, 255, 0)',\n ['get', topoJSONLayer.fillProperty],\n ])\n } else if (fillLayer) maplibreMap.removeLayer(`${topoJSONLayer.featureName}-area`)\n\n const strokeLayer = maplibreMap.getLayer(`${topoJSONLayer.featureName}-stroke`)\n if (topoJSONLayer.strokeProperty) {\n if (!strokeLayer) {\n maplibreMap.addLayer({\n id: `${topoJSONLayer.featureName}-stroke`,\n type: 'line',\n source: topoJSONLayer.featureName,\n paint: {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n 'line-opacity': topoJSONLayer.strokeOpacity,\n // eslint-disable-next-line @typescript-eslint/naming-convention\n 'line-width': topoJSONLayer.strokeWidth,\n },\n })\n }\n maplibreMap.setPaintProperty(`${topoJSONLayer.featureName}-stroke`, 'line-color', [\n 'case',\n ['!', ['has', topoJSONLayer.strokeProperty]],\n 'rgba(255, 255, 255, 0)',\n ['get', topoJSONLayer.strokeProperty],\n ])\n } else if (strokeLayer) { maplibreMap.removeLayer(`${topoJSONLayer.featureName}-stroke`) }\n}\n\nexport async function setupMap<T extends GenericDataRecord> (mapContainer: HTMLElement, config: LeafletMapConfigInterface<T>): Promise<{\n leaflet: L.Map;\n layer: L.Layer;\n svgOverlay: Selection<SVGSVGElement, unknown, null, undefined>;\n svgGroup: Selection<SVGGElement, unknown, SVGElement, undefined>;\n}> {\n const { style, renderer, topoJSONLayer } = config\n const leaflet = await import('leaflet')\n const L = leaflet.default\n\n if (!style) {\n console.error('Unovis | Leaflet Map: Please provide style settings in the map configuration object')\n return\n }\n\n const leafletMap = L.map(mapContainer, {\n scrollWheelZoom: renderer === LeafletMapRenderer.Raster, // We define custom scroll event for MapboxGL to enabling smooth zooming\n zoomControl: false,\n zoomDelta: renderer === LeafletMapRenderer.Raster ? 1 : 0.5,\n zoomSnap: renderer === LeafletMapRenderer.Raster ? 1 : 0,\n attributionControl: true,\n center: initialMapCenter,\n zoom: initialMapZoom,\n minZoom: Math.sqrt(mapContainer.offsetWidth) / 17,\n maxZoom: 23,\n maxBounds: L.latLngBounds(\n [-75, -290],\n [85, 290]\n ),\n maxBoundsViscosity: 1,\n })\n\n for (const attr of config.attribution) {\n leafletMap.attributionControl.addAttribution(attr)\n }\n\n let layer: L.Layer | (L.Layer & { getMaplibreMap(): Map })\n let maplibreMap: Map = null\n\n switch (renderer) {\n case LeafletMapRenderer.MapLibre:\n // eslint-disable-next-line no-case-declarations\n const maplibre = await import('maplibre-gl')\n // eslint-disable-next-line no-case-declarations\n const { getMaplibreGLLayer } = await import('../renderer/mapboxgl-layer')\n layer = getMaplibreGLLayer(config, L, maplibre.default)\n layer.addTo(leafletMap)\n maplibreMap = (layer as ReturnType<typeof getMaplibreGLLayer>).getMaplibreMap?.()\n\n select(mapContainer).on('wheel', (event: WheelEvent) => {\n event.preventDefault()\n mapboxglWheelEventThrottled(leafletMap, layer as (L.Layer & { getMaplibreMap(): Map }), event)\n })\n break\n case LeafletMapRenderer.Raster:\n layer = L.tileLayer(style as string)\n layer.addTo(leafletMap)\n break\n }\n // leaflet-mapbox-gl has a layer positioning issue on far zoom levels which leads to having wrong\n // map points projection. We constrain the view to prevent that.\n constraintMapView(leafletMap)\n\n if (maplibreMap && topoJSONLayer?.sources) {\n const canvas = maplibreMap.getCanvas()\n const canvasSelection = select(canvas).classed(s.mapboxglCanvas, true)\n const tilePaneSelection = select(leafletMap.getPanes().tilePane)\n\n maplibreMap.on('mousemove', (event) => {\n const layerName = `${topoJSONLayer.featureName}-area`\n const layer = maplibreMap.getLayer(layerName)\n if (!layer) return\n\n const features = maplibreMap.queryRenderedFeatures(event.point, { layers: [layerName] })\n tilePaneSelection.datum(features[0])\n canvasSelection.classed(s.onFeatureHover, Boolean(features[0]))\n })\n\n maplibreMap.on('load', () => {\n updateTopoJson(maplibreMap, config)\n })\n }\n\n const svgOverlay = select(leafletMap.getPanes().overlayPane).append('svg')\n const svgGroup = svgOverlay.append('g')\n\n return {\n leaflet: leafletMap,\n layer,\n svgOverlay,\n svgGroup,\n }\n}\n"],"names":["s.mapboxglCanvas","s.onFeatureHover"],"mappings":";;;;;;;MAoBa,gBAAgB,GAAuB,CAAC,EAAE,EAAE,EAAE,EAAC;AACrD,MAAM,cAAc,GAAG,IAAG;AAEjB,SAAA,cAAc,CAA+B,WAAgB,EAAE,MAAoC,EAAA;;AACjH,IAAA,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,CAAA;IAEhC,IAAI,aAAa,CAAC,OAAO,EAAE;AACzB,QAAA,MAAM,aAAa,GAAG,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,aAAa,CAAC,OAAO,MAAE,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,OAAO,MAAG,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,aAAa,CAAC,WAAW,CAAC,CAAA;AACjF,Q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,CAAA;gBACrD,MAAM,KAAK,GAAG,WAAW,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAA;AAC7C,gBAAA,IAAI,CAAC,KAAK;oBAAE,OAAM;AAElB,gBAAA,MAAM,QAAQ,GAAG,WAAW,CAAC,qBAAqB,CAAC,KAAK,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;gBACxF,iBAAiB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAA;AACpC,gBAAA,eAAe,CAAC,OAAO,CAACC,cAAgB,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AACjE,aAAC,CAAC,CAAA;AAEF,YAAA,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAK;AAC1B,gBAAA,cAAc,CAAC,WAAW,EAAE,MAAM,CAAC,CAAA;AACrC,aAAC,CAAC,CAAA;AACH,SAAA;AAED,QAAA,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;QAC1E,MAAM,QAAQ,GAAG,UAAU,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;QAEvC,OAAO;AACL,YAAA,OAAO,EAAE,UAAU;YACnB,KAAK;YACL,UAAU;YACV,QAAQ;SACT,CAAA;;AACF;;;;"}
@@ -1,7 +1,7 @@
1
1
  import { ComponentDefaultConfig } from '../../core/component/config.js';
2
- import { MapProjection, MapPointLabelPosition } from './types.js';
2
+ import { MapPointLabelPosition } from './types.js';
3
3
 
4
- const TopoJSONMapDefaultConfig = Object.assign(Object.assign({}, ComponentDefaultConfig), { projection: MapProjection.Kavrayskiy7(), duration: 1500, topojson: undefined, mapFeatureName: 'countries', mapFitToPoints: false, zoomExtent: [0.5, 6], zoomDuration: 400, disableZoom: false, zoomFactor: undefined, linkWidth: (d) => { var _a; return (_a = d.width) !== null && _a !== void 0 ? _a : 1; }, linkColor: (d) => { var _a; return (_a = d.color) !== null && _a !== void 0 ? _a : null; }, linkCursor: null, linkId: (d, i) => { var _a; return `${(_a = d.id) !== null && _a !== void 0 ? _a : i}`; }, linkSource: (d) => d.source, linkTarget: (d) => d.target, areaId: (d) => { var _a; return (_a = d.id) !== null && _a !== void 0 ? _a : ''; }, areaColor: (d) => { var _a; return (_a = d.color) !== null && _a !== void 0 ? _a : null; }, areaCursor: null, longitude: (d) => d.longitude, latitude: (d) => d.latitude, pointColor: (d) => { var _a; return (_a = d.color) !== null && _a !== void 0 ? _a : null; }, pointRadius: (d) => { var _a; return (_a = d.radius) !== null && _a !== void 0 ? _a : 8; }, pointStrokeWidth: (d) => { var _a; return (_a = d.strokeWidth) !== null && _a !== void 0 ? _a : 0; }, pointCursor: null, pointLabel: undefined, pointLabelPosition: MapPointLabelPosition.Bottom, pointLabelTextBrightnessRatio: 0.65, pointId: (d) => d.id, heatmapMode: false, heatmapModeBlurStdDeviation: 8, heatmapModeZoomLevelThreshold: 2.5 });
4
+ const TopoJSONMapDefaultConfig = Object.assign(Object.assign({}, ComponentDefaultConfig), { projection: undefined, duration: 1500, topojson: undefined, mapFeatureName: 'countries', mapFitToPoints: false, zoomExtent: [0.5, 6], zoomDuration: 400, disableZoom: false, zoomFactor: undefined, linkWidth: (d) => { var _a; return (_a = d.width) !== null && _a !== void 0 ? _a : 1; }, linkColor: (d) => { var _a; return (_a = d.color) !== null && _a !== void 0 ? _a : null; }, linkCursor: null, linkId: (d, i) => { var _a; return `${(_a = d.id) !== null && _a !== void 0 ? _a : i}`; }, linkSource: (d) => d.source, linkTarget: (d) => d.target, areaId: (d) => { var _a; return (_a = d.id) !== null && _a !== void 0 ? _a : ''; }, areaColor: (d) => { var _a; return (_a = d.color) !== null && _a !== void 0 ? _a : null; }, areaCursor: null, longitude: (d) => d.longitude, latitude: (d) => d.latitude, pointColor: (d) => { var _a; return (_a = d.color) !== null && _a !== void 0 ? _a : null; }, pointRadius: (d) => { var _a; return (_a = d.radius) !== null && _a !== void 0 ? _a : 8; }, pointStrokeWidth: (d) => { var _a; return (_a = d.strokeWidth) !== null && _a !== void 0 ? _a : 0; }, pointCursor: null, pointLabel: undefined, pointLabelPosition: MapPointLabelPosition.Bottom, pointLabelTextBrightnessRatio: 0.65, pointId: (d) => d.id, heatmapMode: false, heatmapModeBlurStdDeviation: 8, heatmapModeZoomLevelThreshold: 2.5 });
5
5
 
6
6
  export { TopoJSONMapDefaultConfig };
7
7
  //# sourceMappingURL=config.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sources":["../../../src/components/topojson-map/config.ts"],"sourcesContent":["import { GeoProjection } from 'd3-geo'\nimport { ComponentConfigInterface, ComponentDefaultConfig } from 'core/component/config'\n\n// Types\nimport { ColorAccessor, NumericAccessor, StringAccessor } from 'types/accessor'\n\n// Local Types\nimport { MapProjection, MapPointLabelPosition } from './types'\n\nexport interface TopoJSONMapConfigInterface<\n AreaDatum,\n PointDatum = unknown,\n LinkDatum = unknown,\n> extends ComponentConfigInterface {\n // General\n /** MapProjection (aka D3's GeoProjection) instance. Default: `MapProjection.Kavrayskiy7()` */\n projection?: GeoProjection;\n /** Map data in the TopoJSON topology format. Default: `undefined` */\n topojson?: TopoJSON.Topology;\n /** Name of the map features to be displayed, e.g. 'countries' or 'counties'. Default: `countries` */\n mapFeatureName?: string;\n /** Set initial map fit to points instead of topojson features. Default: `false` */\n mapFitToPoints?: boolean;\n /** Initial zoom level. Default: `undefined` */\n zoomFactor?: number;\n /** Disable pan / zoom interactions. Default: `false` */\n disableZoom?: boolean;\n /** Zoom extent. Default: `[0.5, 6]` */\n zoomExtent?: number[];\n /** Zoom animation duration. Default: `400` */\n zoomDuration?: number;\n\n /** Link width value or accessor function. Default: `d => d.width ?? 1` */\n linkWidth?: NumericAccessor<LinkDatum>;\n /** Link color value or accessor function. Default: `d => d.color ?? null` */\n linkColor?: ColorAccessor<LinkDatum>;\n /** Link cursor value or accessor function. Default: `null` */\n linkCursor?: StringAccessor<LinkDatum>;\n /** Link id accessor function. Default: `d => d.id` */\n linkId?: StringAccessor<LinkDatum>;\n /** Link source accessor function. Default: `d => d.source` */\n linkSource?: ((l: LinkDatum) => number | string | PointDatum);\n /** Link target accessor function. Default: `d => d.target` */\n linkTarget?: ((l: LinkDatum) => number | string | PointDatum);\n\n /** Area id accessor function corresponding to the feature id from TopoJSON. Default: `d => d.id ?? ''` */\n areaId?: StringAccessor<AreaDatum>;\n /** Area color value or accessor function. Default: `d => d.color ?? null` */\n areaColor?: ColorAccessor<AreaDatum>;\n /** Area cursor value or accessor function. Default: `null` */\n areaCursor?: StringAccessor<AreaDatum>;\n\n /** Point color accessor. Default: `d => d.color ?? null` */\n pointColor?: ColorAccessor<PointDatum>;\n /** Point radius accessor. Default: `d => d.radius ?? 8` */\n pointRadius?: NumericAccessor<PointDatum>;\n /** Point stroke width accessor. Default: `d => d.strokeWidth ?? null` */\n pointStrokeWidth?: NumericAccessor<PointDatum>;\n /** Point cursor constant value or accessor function. Default: `null` */\n pointCursor?: StringAccessor<PointDatum>;\n /** Point longitude accessor function. Default: `d => d.longitude ?? null` */\n longitude?: NumericAccessor<PointDatum>;\n /** Point latitude accessor function. Default: `d => d.latitude ?? null` */\n latitude?: NumericAccessor<PointDatum>;\n /** Point label accessor function. Default: `undefined` */\n pointLabel?: StringAccessor<PointDatum>;\n /** Point label position. Default: `Position.Bottom` */\n pointLabelPosition?: MapPointLabelPosition;\n /** Point color brightness ratio for switching between dark and light text label color. Default: `0.65` */\n pointLabelTextBrightnessRatio?: number;\n /** Point id accessor function. Default: `d => d.id` */\n pointId?: ((d: PointDatum, i: number) => string);\n\n /** Enables blur and blending between neighbouring points. Default: `false` */\n heatmapMode?: boolean;\n /** Heatmap blur filter stdDeviation value. Default: `10` */\n heatmapModeBlurStdDeviation?: number;\n /** Zoom level at which the heatmap mode will be disabled. Default: `2.5` */\n heatmapModeZoomLevelThreshold?: number;\n}\n\nexport const TopoJSONMapDefaultConfig: TopoJSONMapConfigInterface<unknown, unknown, unknown> = {\n ...ComponentDefaultConfig,\n projection: MapProjection.Kavrayskiy7(),\n duration: 1500,\n topojson: undefined,\n mapFeatureName: 'countries',\n mapFitToPoints: false,\n\n zoomExtent: [0.5, 6],\n zoomDuration: 400,\n disableZoom: false,\n zoomFactor: undefined,\n\n linkWidth: (d: unknown): number => (d as { width: number }).width ?? 1,\n linkColor: (d: unknown): string => (d as { color: string }).color ?? null,\n linkCursor: null,\n linkId: (d: unknown, i: number | undefined): string => `${(d as { id: string }).id ?? i}`,\n linkSource: (d: unknown): (number | string | unknown) => (d as { source: string }).source,\n linkTarget: (d: unknown): (number | string | unknown) => (d as { target: string }).target,\n\n areaId: (d: unknown): string => (d as { id: string }).id ?? '',\n areaColor: (d: unknown): string => (d as { color: string }).color ?? null,\n areaCursor: null,\n\n longitude: (d: unknown): number => (d as { longitude: number }).longitude,\n latitude: (d: unknown): number => (d as { latitude: number }).latitude,\n pointColor: (d: unknown): string => (d as { color: string }).color ?? null,\n pointRadius: (d: unknown): number => (d as { radius: number }).radius ?? 8,\n pointStrokeWidth: (d: unknown): number => (d as { strokeWidth: number }).strokeWidth ?? 0,\n pointCursor: null,\n pointLabel: undefined,\n pointLabelPosition: MapPointLabelPosition.Bottom,\n pointLabelTextBrightnessRatio: 0.65,\n pointId: (d: unknown): string => (d as { id: string }).id,\n\n heatmapMode: false,\n heatmapModeBlurStdDeviation: 8,\n heatmapModeZoomLevelThreshold: 2.5,\n}\n\n"],"names":[],"mappings":";;;AAiFO,MAAM,wBAAwB,GAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAChC,sBAAsB,CAAA,EAAA,EACzB,UAAU,EAAE,aAAa,CAAC,WAAW,EAAE,EACvC,QAAQ,EAAE,IAAI,EACd,QAAQ,EAAE,SAAS,EACnB,cAAc,EAAE,WAAW,EAC3B,cAAc,EAAE,KAAK,EAErB,UAAU,EAAE,CAAC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AU,KAAc,CAA0B,CAAC,QAAQ,EACtE,UAAU,EAAE,CAAC,CAAU,KAAa,EAAA,IAAA,EAAA,CAAA,CAAA,OAAA,CAAC,EAAA,GAAA,CAAuB,CAAC,KAAK,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAI,IAAI,CAAA,EAAA,EAC1E,WAAW,EAAE,CAAC,CAAU,KAAY,EAAA,IAAA,EAAA,CAAA,CAAC,OAAA,CAAA,EAAA,GAAC,CAAwB,CAAC,MAAM,MAAI,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAA,CAAC,CAAA,EAAA,EAC1E,gBAAgB,EAAE,CAAC,CAAU,KAAa,EAAA,IAAA,EAAA,CAAA,CAAA,OAAA,CAAC,EAAA,GAAA,CAA6B,CAAC,WAAW,mCAAI,CAAC,CAAA,EAAA,EACzF,WAAW,EAAE,IAAI,EACjB,UAAU,EAAE,SAAS,EACrB,kBAAkB,EAAE,qBAAqB,CAAC,MAAM,EAChD,6BAA6B,EAAE,IAAI,EACnC,OAAO,EAAE,CAAC,CAAU,KAAc,CAAoB,CAAC,EAAE,EAEzD,WAAW,EAAE,KAAK,EAClB,2BAA2B,EAAE,CAAC,EAC9B,6BAA6B,EAAE,GAAG;;;;"}
1
+ {"version":3,"file":"config.js","sources":["../../../src/components/topojson-map/config.ts"],"sourcesContent":["import { GeoProjection } from 'd3-geo'\nimport { ComponentConfigInterface, ComponentDefaultConfig } from 'core/component/config'\n\n// Types\nimport { ColorAccessor, NumericAccessor, StringAccessor } from 'types/accessor'\n\n// Local Types\nimport { MapPointLabelPosition } from './types'\n\nexport interface TopoJSONMapConfigInterface<\n AreaDatum,\n PointDatum = unknown,\n LinkDatum = unknown,\n> extends ComponentConfigInterface {\n // General\n /** MapProjection (aka D3's GeoProjection) instance. Default: `MapProjection.Kavrayskiy7()` */\n projection?: GeoProjection;\n /** Map data in the TopoJSON topology format. Default: `undefined` */\n topojson?: TopoJSON.Topology;\n /** Name of the map features to be displayed, e.g. 'countries' or 'counties'. Default: `countries` */\n mapFeatureName?: string;\n /** Set initial map fit to points instead of topojson features. Default: `false` */\n mapFitToPoints?: boolean;\n /** Initial zoom level. Default: `undefined` */\n zoomFactor?: number;\n /** Disable pan / zoom interactions. Default: `false` */\n disableZoom?: boolean;\n /** Zoom extent. Default: `[0.5, 6]` */\n zoomExtent?: number[];\n /** Zoom animation duration. Default: `400` */\n zoomDuration?: number;\n\n /** Link width value or accessor function. Default: `d => d.width ?? 1` */\n linkWidth?: NumericAccessor<LinkDatum>;\n /** Link color value or accessor function. Default: `d => d.color ?? null` */\n linkColor?: ColorAccessor<LinkDatum>;\n /** Link cursor value or accessor function. Default: `null` */\n linkCursor?: StringAccessor<LinkDatum>;\n /** Link id accessor function. Default: `d => d.id` */\n linkId?: StringAccessor<LinkDatum>;\n /** Link source accessor function. Default: `d => d.source` */\n linkSource?: ((l: LinkDatum) => number | string | PointDatum);\n /** Link target accessor function. Default: `d => d.target` */\n linkTarget?: ((l: LinkDatum) => number | string | PointDatum);\n\n /** Area id accessor function corresponding to the feature id from TopoJSON. Default: `d => d.id ?? ''` */\n areaId?: StringAccessor<AreaDatum>;\n /** Area color value or accessor function. Default: `d => d.color ?? null` */\n areaColor?: ColorAccessor<AreaDatum>;\n /** Area cursor value or accessor function. Default: `null` */\n areaCursor?: StringAccessor<AreaDatum>;\n\n /** Point color accessor. Default: `d => d.color ?? null` */\n pointColor?: ColorAccessor<PointDatum>;\n /** Point radius accessor. Default: `d => d.radius ?? 8` */\n pointRadius?: NumericAccessor<PointDatum>;\n /** Point stroke width accessor. Default: `d => d.strokeWidth ?? null` */\n pointStrokeWidth?: NumericAccessor<PointDatum>;\n /** Point cursor constant value or accessor function. Default: `null` */\n pointCursor?: StringAccessor<PointDatum>;\n /** Point longitude accessor function. Default: `d => d.longitude ?? null` */\n longitude?: NumericAccessor<PointDatum>;\n /** Point latitude accessor function. Default: `d => d.latitude ?? null` */\n latitude?: NumericAccessor<PointDatum>;\n /** Point label accessor function. Default: `undefined` */\n pointLabel?: StringAccessor<PointDatum>;\n /** Point label position. Default: `Position.Bottom` */\n pointLabelPosition?: MapPointLabelPosition;\n /** Point color brightness ratio for switching between dark and light text label color. Default: `0.65` */\n pointLabelTextBrightnessRatio?: number;\n /** Point id accessor function. Default: `d => d.id` */\n pointId?: ((d: PointDatum, i: number) => string);\n\n /** Enables blur and blending between neighbouring points. Default: `false` */\n heatmapMode?: boolean;\n /** Heatmap blur filter stdDeviation value. Default: `10` */\n heatmapModeBlurStdDeviation?: number;\n /** Zoom level at which the heatmap mode will be disabled. Default: `2.5` */\n heatmapModeZoomLevelThreshold?: number;\n}\n\nexport const TopoJSONMapDefaultConfig: TopoJSONMapConfigInterface<unknown, unknown, unknown> = {\n ...ComponentDefaultConfig,\n projection: undefined,\n duration: 1500,\n topojson: undefined,\n mapFeatureName: 'countries',\n mapFitToPoints: false,\n\n zoomExtent: [0.5, 6],\n zoomDuration: 400,\n disableZoom: false,\n zoomFactor: undefined,\n\n linkWidth: (d: unknown): number => (d as { width: number }).width ?? 1,\n linkColor: (d: unknown): string => (d as { color: string }).color ?? null,\n linkCursor: null,\n linkId: (d: unknown, i: number | undefined): string => `${(d as { id: string }).id ?? i}`,\n linkSource: (d: unknown): (number | string | unknown) => (d as { source: string }).source,\n linkTarget: (d: unknown): (number | string | unknown) => (d as { target: string }).target,\n\n areaId: (d: unknown): string => (d as { id: string }).id ?? '',\n areaColor: (d: unknown): string => (d as { color: string }).color ?? null,\n areaCursor: null,\n\n longitude: (d: unknown): number => (d as { longitude: number }).longitude,\n latitude: (d: unknown): number => (d as { latitude: number }).latitude,\n pointColor: (d: unknown): string => (d as { color: string }).color ?? null,\n pointRadius: (d: unknown): number => (d as { radius: number }).radius ?? 8,\n pointStrokeWidth: (d: unknown): number => (d as { strokeWidth: number }).strokeWidth ?? 0,\n pointCursor: null,\n pointLabel: undefined,\n pointLabelPosition: MapPointLabelPosition.Bottom,\n pointLabelTextBrightnessRatio: 0.65,\n pointId: (d: unknown): string => (d as { id: string }).id,\n\n heatmapMode: false,\n heatmapModeBlurStdDeviation: 8,\n heatmapModeZoomLevelThreshold: 2.5,\n}\n\n"],"names":[],"mappings":";;;AAiFO,MAAM,wBAAwB,GAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAChC,sBAAsB,CAAA,EAAA,EACzB,UAAU,EAAE,SAAS,EACrB,QAAQ,EAAE,IAAI,EACd,QAAQ,EAAE,SAAS,EACnB,cAAc,EAAE,WAAW,EAC3B,cAAc,EAAE,KAAK,EAErB,UAAU,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,EACpB,YAAY,EAAE,GAAG,EACjB,WAAW,EAAE,KAAK,EAClB,UAAU,EAAE,SAAS,EAErB,SAAS,EAAE,CAAC,CAAU,KAAa,EAAA,IAAA,EAAA,CAAA,CAAA,OAAA,CAAC,EAAA,GAAA,CAAuB,CAAC,KAAK,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAI,CAAC,CAAA,EAAA,EACtE,SAAS,EAAE,CAAC,CAAU,KAAY,EAAA,IAAA,EAAA,CAAA,CAAC,OAAA,CAAA,EAAA,GAAC,CAAuB,CAAC,KAAK,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAI,IAAI,CAAA,EAAA,EACzE,UAAU,EAAE,IAAI,EAChB,MAAM,EAAE,CAAC,CAAU,EAAE,CAAqB,KAAa,EAAA,IAAA,EAAA,CAAA,CAAA,OAAA,CAAG,EAAA,CAAA,EAAA,GAAC,CAAoB,CAAC,EAAE,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAI,CAAC,CAAE,CAAA,CAAA,EAAA,EACzF,UAAU,EAAE,CAAC,CAAU,KAAmC,CAAwB,CAAC,MAAM,EACzF,UAAU,EAAE,CAAC,CAAU,KAAmC,CAAwB,CAAC,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,EAClB,2BAA2B,EAAE,CAAC,EAC9B,6BAA6B,EAAE,GAAG;;;;"}
@@ -9,7 +9,7 @@ import { isNumber, getString, getNumber, clamp } from '../../utils/data.js';
9
9
  import { smartTransition } from '../../utils/d3.js';
10
10
  import { getColor, hexToBrightness } from '../../utils/color.js';
11
11
  import { isStringCSSVariable, getCSSVariableValue } from '../../utils/misc.js';
12
- import { MapPointLabelPosition } from './types.js';
12
+ import { MapProjection, MapPointLabelPosition } from './types.js';
13
13
  import { TopoJSONMapDefaultConfig } from './config.js';
14
14
  import { getLonLat, arc } from './utils.js';
15
15
  import * as style from './style.js';
@@ -54,10 +54,14 @@ class TopoJSONMap extends ComponentCore {
54
54
  this.datamodel.linkSource = config.linkSource;
55
55
  this.datamodel.linkTarget = config.linkTarget;
56
56
  this.datamodel.data = data;
57
+ // If there was a data change and mapFitToPoints is enabled, we will need to re-fit the map
58
+ this._firstRender = this._firstRender || config.mapFitToPoints;
57
59
  }
58
60
  setConfig(config) {
61
+ var _a;
59
62
  super.setConfig(config);
60
- const newProjection = this.config.projection;
63
+ // Setting the default here instead of defaultConfig to prevent mutation from other TopoJSONMap instances
64
+ const newProjection = (_a = this.config.projection) !== null && _a !== void 0 ? _a : MapProjection.Kavrayskiy7();
61
65
  if (this._projection) {
62
66
  newProjection.scale(this._projection.scale()).translate(this._projection.translate());
63
67
  }
@@ -180,7 +184,8 @@ class TopoJSONMap extends ComponentCore {
180
184
  .attr('transform', d => {
181
185
  const pos = this._projection(getLonLat(d, config.longitude, config.latitude));
182
186
  return `translate(${pos[0]},${pos[1]})`;
183
- });
187
+ })
188
+ .style('opacity', 0);
184
189
  pointsEnter.append('circle').attr('class', pointCircle)
185
190
  .attr('r', 0)
186
191
  .style('fill', (d, i) => getColor(d, config.pointColor, i))
@@ -194,7 +199,8 @@ class TopoJSONMap extends ComponentCore {
194
199
  const pos = this._projection(getLonLat(d, config.longitude, config.latitude));
195
200
  return `translate(${pos[0]},${pos[1]})`;
196
201
  })
197
- .style('cursor', d => getString(d, config.pointCursor));
202
+ .style('cursor', d => getString(d, config.pointCursor))
203
+ .style('opacity', 1);
198
204
  smartTransition(pointsMerged.select(`.${pointCircle}`), duration)
199
205
  .attr('r', d => getNumber(d, config.pointRadius) / this._currentZoomLevel)
200
206
  .style('fill', (d, i) => getColor(d, config.pointColor, i))
@@ -244,6 +250,7 @@ class TopoJSONMap extends ComponentCore {
244
250
  const pointData = points || datamodel.points;
245
251
  if (pointData.length === 0)
246
252
  return;
253
+ this.fitView();
247
254
  const featureCollection = {
248
255
  type: 'FeatureCollection',
249
256
  features: [{
@@ -265,8 +272,18 @@ class TopoJSONMap extends ComponentCore {
265
272
  [this._width * (1 - pad), this._height * (1 - pad)],
266
273
  ], featureCollection);
267
274
  const maxScale = config.zoomExtent[1] * this._initialScale;
268
- if (this._projection.scale() > maxScale)
275
+ const fittedScale = this._projection.scale();
276
+ if (fittedScale > maxScale) {
277
+ const fittedTranslate = this._projection.translate();
278
+ const scaleRatio = maxScale / fittedScale;
269
279
  this._projection.scale(maxScale);
280
+ this._projection.translate([
281
+ this._width / 2 - (this._width / 2 - fittedTranslate[0]) * scaleRatio,
282
+ this._height / 2 - (this._height / 2 - fittedTranslate[1]) * scaleRatio,
283
+ ]);
284
+ }
285
+ // If we don't update the center, the next zoom will be centered around the previous value
286
+ this._center = this._projection.translate();
270
287
  this._applyZoom();
271
288
  }
272
289
  _applyZoom() {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/topojson-map/index.ts"],"sourcesContent":["import { Selection } from 'd3-selection'\nimport { D3ZoomEvent, zoom, ZoomBehavior, zoomIdentity, ZoomTransform } from 'd3-zoom'\nimport { timeout } from 'd3-timer'\nimport { geoPath, GeoProjection, ExtendedFeatureCollection } from 'd3-geo'\nimport { color } from 'd3-color'\nimport { feature } from 'topojson-client'\n\n// Core\nimport { ComponentCore } from 'core/component'\nimport { MapGraphDataModel } from 'data-models/map-graph'\n\n// Utils\nimport { clamp, getNumber, getString, isNumber } from 'utils/data'\nimport { smartTransition } from 'utils/d3'\nimport { getColor, hexToBrightness } from 'utils/color'\nimport { getCSSVariableValue, isStringCSSVariable } from 'utils/misc'\n\n// Types\nimport { MapLink } from 'types/map'\n\n// Local Types\nimport { MapData, MapFeature, MapPointLabelPosition } from './types'\n\n// Config\nimport { TopoJSONMapDefaultConfig, TopoJSONMapConfigInterface } from './config'\n\n// Modules\nimport { arc, getLonLat } from './utils'\n\n// Styles\nimport * as s from './style'\n\nexport class TopoJSONMap<\n AreaDatum,\n PointDatum = unknown,\n LinkDatum = unknown,\n> extends ComponentCore<\n MapData<AreaDatum, PointDatum, LinkDatum>,\n TopoJSONMapConfigInterface<AreaDatum, PointDatum, LinkDatum>\n > {\n static selectors = s\n protected _defaultConfig = TopoJSONMapDefaultConfig as TopoJSONMapConfigInterface<AreaDatum, PointDatum, LinkDatum>\n public config: TopoJSONMapConfigInterface<AreaDatum, PointDatum, LinkDatum> = this._defaultConfig\n\n datamodel: MapGraphDataModel<AreaDatum, PointDatum, LinkDatum> = new MapGraphDataModel()\n g: Selection<SVGGElement, unknown, null, undefined>\n private _firstRender = true\n private _isResizing = false\n private _initialScale: number = undefined\n private _center: [number, number]\n private _currentZoomLevel: number = undefined\n private _transform: ZoomTransform\n private _path = geoPath()\n private _projection: GeoProjection\n private _prevWidth: number\n private _prevHeight: number\n private _animFrameId: number\n\n private _featureCollection: GeoJSON.FeatureCollection\n private _zoomBehavior: ZoomBehavior<SVGGElement, unknown> = zoom()\n private _backgroundRect = this.g.append('rect').attr('class', s.background)\n private _featuresGroup = this.g.append('g').attr('class', s.features)\n private _linksGroup = this.g.append('g').attr('class', s.links)\n private _pointsGroup = this.g.append('g').attr('class', s.points)\n\n events = {\n [TopoJSONMap.selectors.point]: {},\n [TopoJSONMap.selectors.feature]: {},\n }\n\n constructor (config?: TopoJSONMapConfigInterface<AreaDatum, PointDatum, LinkDatum>, data?: MapData<AreaDatum, PointDatum, LinkDatum>) {\n super()\n this._zoomBehavior.on('zoom', this._onZoom.bind(this))\n\n if (config) this.setConfig(config)\n if (data) this.setData(data)\n\n this.g.append('defs')\n .append('filter')\n .attr('id', 'heatmapFilter')\n .html(`\n <feGaussianBlur in=\"SourceGraphic\" stdDeviation=\"${this.config.heatmapModeBlurStdDeviation}\" color-interpolation-filters=\"sRGB\" result=\"blur\"></feGaussianBlur>\n <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>\n `)\n }\n\n setData (data: MapData<AreaDatum, PointDatum, LinkDatum>): void {\n const { config } = this\n\n this.datamodel.pointId = config.pointId\n this.datamodel.linkSource = config.linkSource\n this.datamodel.linkTarget = config.linkTarget\n this.datamodel.data = data\n }\n\n setConfig (config?: TopoJSONMapConfigInterface<AreaDatum, PointDatum, LinkDatum>): void {\n super.setConfig(config)\n\n const newProjection = this.config.projection\n if (this._projection) {\n newProjection.scale(this._projection.scale()).translate(this._projection.translate())\n }\n this._projection = newProjection\n }\n\n _render (customDuration?: number): void {\n const { config } = this\n const duration = isNumber(customDuration) ? customDuration : config.duration\n\n this._renderBackground()\n this._renderMap(duration)\n this._renderGroups(duration)\n this._renderLinks(duration)\n this._renderPoints(duration)\n\n // When animation is running we need to temporary disable zoom behaviour\n if (duration && !config.disableZoom) {\n this.g.on('.zoom', null)\n timeout(() => {\n this.g.call(this._zoomBehavior)\n }, duration)\n }\n\n // When zoom behaviour is active we assign the `draggable` class to show the grabbing cursor\n this.g.classed('draggable', !config.disableZoom)\n this._firstRender = false\n }\n\n _renderBackground (): void {\n this._backgroundRect\n .attr('width', '100%')\n .attr('height', '100%')\n .attr('transform', `translate(${-this.bleed.left}, ${-this.bleed.top})`)\n }\n\n _renderGroups (duration: number): void {\n const transformString = this._transform.toString()\n smartTransition(this._featuresGroup, duration)\n .attr('transform', transformString)\n .attr('stroke-width', 1 / this._currentZoomLevel)\n\n smartTransition(this._linksGroup, duration)\n .attr('transform', transformString)\n\n smartTransition(this._pointsGroup, duration)\n .attr('transform', transformString)\n }\n\n _renderMap (duration: number): void {\n const { bleed, config, datamodel } = this\n\n this.g.attr('transform', `translate(${bleed.left}, ${bleed.top})`)\n const mapData: TopoJSON.Topology = config.topojson\n const featureName = config.mapFeatureName\n const featureObject = mapData?.objects?.[featureName]\n if (!featureObject) return\n\n this._featureCollection = feature(mapData, featureObject) as GeoJSON.FeatureCollection\n const featureData = (this._featureCollection?.features ?? []) as MapFeature<AreaDatum>[]\n\n if (this._firstRender) {\n // Rendering the map for the first time.\n this._projection.fitExtent([[0, 0], [this._width, this._height]], this._featureCollection)\n this._initialScale = this._projection.scale()\n this._center = this._projection.translate()\n\n if (config.mapFitToPoints) {\n this._fitToPoints()\n }\n\n const zoomExtent = config.zoomExtent\n this._zoomBehavior.scaleExtent([zoomExtent[0] * this._initialScale, zoomExtent[1] * this._initialScale])\n this.setZoom(config.zoomFactor || 1)\n\n if (!config.disableZoom) {\n this.g.call(this._zoomBehavior)\n this._applyZoom()\n }\n\n this._prevWidth = this._width\n this._prevHeight = this._height\n }\n\n if (this._prevWidth !== this._width || this._prevHeight !== this._height) {\n this._onResize()\n }\n\n this._path.projection(this._projection)\n\n // Merge passed area data and map feature data\n const areaData = datamodel.areas\n areaData.forEach(a => {\n const feature = featureData.find(f => f.id.toString() === getString(a, config.areaId).toString())\n if (feature) feature.data = a\n else if (this._firstRender) console.warn(`Can't find feature by area code ${getString(a, config.areaId)}`)\n })\n\n const features = this._featuresGroup\n .selectAll<SVGPathElement, unknown>(`.${s.feature}`)\n .data(featureData)\n\n const featuresEnter = features.enter().append('path').attr('class', s.feature)\n smartTransition(featuresEnter.merge(features), duration)\n .attr('d', this._path)\n .style('fill', (d, i) => d.data ? getColor(d.data, config.areaColor, i) : null)\n .style('cursor', d => d.data ? getString(d.data, config.areaCursor) : null)\n features.exit().remove()\n }\n\n _renderLinks (duration: number): void {\n const { config, datamodel } = this\n const links = datamodel.links\n\n const edges = this._linksGroup\n .selectAll<SVGPathElement, MapLink<PointDatum, LinkDatum>>(`.${s.link}`)\n .data(links, (d, i) => getString(d, config.linkId, i))\n\n const edgesEnter = edges.enter().append('path').attr('class', s.link)\n .style('stroke-width', 0)\n\n smartTransition(edgesEnter.merge(edges), duration)\n .attr('d', link => {\n const source = this._projection(getLonLat(link.source, config.longitude, config.latitude))\n const target = this._projection(getLonLat(link.target, config.longitude, config.latitude))\n return arc(source, target)\n })\n .style('stroke-width', link => getNumber(link, config.linkWidth) / this._currentZoomLevel)\n .style('cursor', link => getString(link, config.linkCursor))\n .style('stroke', (link, i) => getColor(link, config.linkColor, i))\n edges.exit().remove()\n }\n\n _renderPoints (duration: number): void {\n const { config, datamodel } = this\n const pointData = datamodel.points\n\n const points = this._pointsGroup\n .selectAll<SVGGElement, PointDatum>(`.${s.point}`)\n .data(pointData, (d, i) => getString(d, config.pointId, i))\n\n // Enter\n const pointsEnter = points.enter().append('g').attr('class', s.point)\n .attr('transform', d => {\n const pos = this._projection(getLonLat(d, config.longitude, config.latitude))\n return `translate(${pos[0]},${pos[1]})`\n })\n\n pointsEnter.append('circle').attr('class', s.pointCircle)\n .attr('r', 0)\n .style('fill', (d, i) => getColor(d, config.pointColor, i))\n .style('stroke-width', d => getNumber(d, config.pointStrokeWidth))\n\n pointsEnter.append('text').attr('class', s.pointLabel)\n .style('opacity', 0)\n\n // Update\n const pointsMerged = pointsEnter.merge(points)\n smartTransition(pointsMerged, duration)\n .attr('transform', d => {\n const pos = this._projection(getLonLat(d, config.longitude, config.latitude))\n return `translate(${pos[0]},${pos[1]})`\n })\n .style('cursor', d => getString(d, config.pointCursor))\n\n smartTransition(pointsMerged.select(`.${s.pointCircle}`), duration)\n .attr('r', d => getNumber(d, config.pointRadius) / this._currentZoomLevel)\n .style('fill', (d, i) => getColor(d, config.pointColor, i))\n .style('stroke', (d, i) => getColor(d, config.pointColor, i))\n .style('stroke-width', d => getNumber(d, config.pointStrokeWidth) / this._currentZoomLevel)\n\n const pointLabelsMerged = pointsMerged.select(`.${s.pointLabel}`)\n pointLabelsMerged\n .text(d => getString(d, config.pointLabel) ?? '')\n .style('font-size', d => {\n if (config.pointLabelPosition === MapPointLabelPosition.Bottom) {\n return `calc(var(--vis-map-point-label-font-size) / ${this._currentZoomLevel}`\n }\n const pointDiameter = 2 * getNumber(d, config.pointRadius)\n const pointLabelText = getString(d, config.pointLabel) || ''\n const textLength = pointLabelText.length\n const fontSize = 0.5 * pointDiameter / Math.pow(textLength, 0.4)\n return clamp(fontSize, fontSize, 16)\n })\n .attr('y', d => {\n if (config.pointLabelPosition === MapPointLabelPosition.Center) return null\n\n const pointRadius = getNumber(d, config.pointRadius) / this._currentZoomLevel\n return pointRadius\n })\n .attr('dy', config.pointLabelPosition === MapPointLabelPosition.Center ? '0.32em' : '1em')\n\n smartTransition(pointLabelsMerged, duration)\n .style('fill', (d, i) => {\n if (config.pointLabelPosition === MapPointLabelPosition.Bottom) return null\n\n const pointColor = getColor(d, config.pointColor, i)\n const hex = color(isStringCSSVariable(pointColor) ? getCSSVariableValue(pointColor, this.element) : pointColor)?.hex()\n if (!hex) return null\n\n const brightness = hexToBrightness(hex)\n return brightness > config.pointLabelTextBrightnessRatio ? 'var(--vis-map-point-label-text-color-dark)' : 'var(--vis-map-point-label-text-color-light)'\n })\n .style('opacity', 1)\n\n // Exit\n points.exit().remove()\n\n // Heatmap\n this._pointsGroup.style('filter', (config.heatmapMode && this._currentZoomLevel < config.heatmapModeZoomLevelThreshold) ? 'url(#heatmapFilter)' : null)\n this._pointsGroup.selectAll(`.${s.pointLabel}`).style('display', (config.heatmapMode && (this._currentZoomLevel < config.heatmapModeZoomLevelThreshold)) ? 'none' : null)\n }\n\n _fitToPoints (points?: PointDatum[], pad = 0.1): void {\n const { config, datamodel } = this\n const pointData = points || datamodel.points\n if (pointData.length === 0) return\n\n const featureCollection: ExtendedFeatureCollection = {\n type: 'FeatureCollection',\n features: [{\n type: 'Feature',\n properties: {},\n geometry: {\n type: 'MultiPoint',\n coordinates: pointData.map(p => {\n return [\n getNumber(p, d => getNumber(d, config.longitude)),\n getNumber(p, d => getNumber(d, config.latitude)),\n ]\n }),\n },\n }],\n }\n\n this._projection.fitExtent([\n [this._width * pad, this._height * pad],\n [this._width * (1 - pad), this._height * (1 - pad)],\n ], featureCollection)\n\n const maxScale = config.zoomExtent[1] * this._initialScale\n if (this._projection.scale() > maxScale) this._projection.scale(maxScale)\n\n this._applyZoom()\n }\n\n _applyZoom (): void {\n const translate = this._center ?? this._projection.translate()\n const scale = this._initialScale * this._currentZoomLevel\n this.g.call(this._zoomBehavior.transform, zoomIdentity.translate(translate[0], translate[1]).scale(scale))\n }\n\n _onResize (): void {\n this._isResizing = true\n const prevTranslate = this._projection.translate()\n\n this._projection.fitExtent([[0, 0], [this._width, this._height]], this._featureCollection)\n this._initialScale = this._projection.scale()\n this._center = [\n this._projection.translate()[0] * this._center[0] / prevTranslate[0],\n this._projection.translate()[1] * this._center[1] / prevTranslate[1],\n ]\n this._applyZoom()\n\n this._isResizing = false\n this._prevWidth = this._width\n this._prevHeight = this._height\n }\n\n _onZoom (event: D3ZoomEvent<any, any>): void {\n if (this._firstRender) return // To prevent double render because of binding zoom behaviour\n const isMouseEvent = event.sourceEvent !== undefined\n const isExternalEvent = !event?.sourceEvent && !this._isResizing\n\n window.cancelAnimationFrame(this._animFrameId)\n this._animFrameId = window.requestAnimationFrame(this._onZoomHandler.bind(this, event.transform, isMouseEvent, isExternalEvent))\n\n if (isMouseEvent) {\n // Update the center coordinate so that the next call to _applyZoom()\n // will zoom with respect to the current view\n this._center = [event.transform.x, event.transform.y]\n }\n this._currentZoomLevel = (event?.transform.k / this._initialScale) || 1\n }\n\n _onZoomHandler (transform: ZoomTransform, isMouseEvent: boolean, isExternalEvent: boolean): void {\n const scale = transform.k / this._initialScale || 1\n const center = this._projection.translate()\n\n this._transform = zoomIdentity\n .translate(transform.x - center[0] * scale, transform.y - center[1] * scale)\n .scale(scale)\n\n const customDuration = isExternalEvent\n ? this.config.zoomDuration\n : (isMouseEvent ? 0 : null)\n\n // Call render functions that depend on this._transform\n this._renderGroups(customDuration)\n this._renderLinks(customDuration)\n this._renderPoints(customDuration)\n }\n\n public zoomIn (increment = 0.5): void {\n this.setZoom(this._currentZoomLevel + increment)\n }\n\n public zoomOut (increment = 0.5): void {\n this.setZoom(this._currentZoomLevel - increment)\n }\n\n public setZoom (zoomLevel: number): void {\n const { config } = this\n this._currentZoomLevel = clamp(zoomLevel, config.zoomExtent[0], config.zoomExtent[1])\n this._transform = zoomIdentity\n .translate(this._center[0] * (1 - this._currentZoomLevel), this._center[1] * (1 - this._currentZoomLevel))\n .scale(this._currentZoomLevel)\n // We are using this._applyZoom() instead of directly calling this._render(config.zoomDuration) because\n // we've to \"attach\" new transform to the map group element. Otherwise zoomBehavior will not know\n // that the zoom state has changed\n this._applyZoom()\n }\n\n public fitView (): void {\n this._projection.fitExtent([[0, 0], [this._width, this._height]], this._featureCollection)\n this._currentZoomLevel = (this._projection?.scale() / this._initialScale) || 1\n this._center = this._projection.translate()\n // We are using this._applyZoom() instead of directly calling this._render(config.zoomDuration) because\n // we've to \"attach\" new transform to the map group element. Otherwise zoomBehavior will not know\n // that the zoom state has changed\n this._applyZoom()\n }\n\n destroy (): void {\n window.cancelAnimationFrame(this._animFrameId)\n }\n}\n"],"names":["s.background","s.features","s.links","s.points","s.feature","s.link","s.point","s.pointCircle","s.pointLabel","s"],"mappings":";;;;;;;;;;;;;;;;;AAgCM,MAAO,WAIX,SAAQ,aAGP,CAAA;IA+BD,WAAa,CAAA,MAAqE,EAAE,IAAgD,EAAA;AAClI,QAAA,KAAK,EAAE,CAAA;QA9BC,IAAc,CAAA,cAAA,GAAG,wBAAwF,CAAA;AAC5G,QAAA,IAAA,CAAA,MAAM,GAAiE,IAAI,CAAC,cAAc,CAAA;AAEjG,QAAA,IAAA,CAAA,SAAS,GAAwD,IAAI,iBAAiB,EAAE,CAAA;QAEhF,IAAY,CAAA,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CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,EAAE,IAAI,CAAC,kBAAkB,CAAC,CAAA;AAC1F,QAAA,IAAI,CAAC,iBAAiB,GAAG,CAAC,CAAA,CAAA,EAAA,GAAA,IAAI,CAAC,WAAW,0CAAE,KAAK,EAAE,IAAG,IAAI,CAAC,aAAa,KAAK,CAAC,CAAA;QAC9E,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC,SAAS,EAAE,CAAA;;;;QAI3C,IAAI,CAAC,UAAU,EAAE,CAAA;KAClB;IAED,OAAO,GAAA;AACL,QAAA,MAAM,CAAC,oBAAoB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA;KAC/C;;AA1YM,WAAS,CAAA,SAAA,GAAGC,KAAC;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/topojson-map/index.ts"],"sourcesContent":["import { Selection } from 'd3-selection'\nimport { D3ZoomEvent, zoom, ZoomBehavior, zoomIdentity, ZoomTransform } from 'd3-zoom'\nimport { timeout } from 'd3-timer'\nimport { geoPath, GeoProjection, ExtendedFeatureCollection } from 'd3-geo'\nimport { color } from 'd3-color'\nimport { feature } from 'topojson-client'\n\n// Core\nimport { ComponentCore } from 'core/component'\nimport { MapGraphDataModel } from 'data-models/map-graph'\n\n// Utils\nimport { clamp, getNumber, getString, isNumber } from 'utils/data'\nimport { smartTransition } from 'utils/d3'\nimport { getColor, hexToBrightness } from 'utils/color'\nimport { getCSSVariableValue, isStringCSSVariable } from 'utils/misc'\n\n// Types\nimport { MapLink } from 'types/map'\n\n// Local Types\nimport { MapData, MapFeature, MapPointLabelPosition, MapProjection } from './types'\n\n// Config\nimport { TopoJSONMapDefaultConfig, TopoJSONMapConfigInterface } from './config'\n\n// Modules\nimport { arc, getLonLat } from './utils'\n\n// Styles\nimport * as s from './style'\n\nexport class TopoJSONMap<\n AreaDatum,\n PointDatum = unknown,\n LinkDatum = unknown,\n> extends ComponentCore<\n MapData<AreaDatum, PointDatum, LinkDatum>,\n TopoJSONMapConfigInterface<AreaDatum, PointDatum, LinkDatum>\n > {\n static selectors = s\n protected _defaultConfig = TopoJSONMapDefaultConfig as TopoJSONMapConfigInterface<AreaDatum, PointDatum, LinkDatum>\n public config: TopoJSONMapConfigInterface<AreaDatum, PointDatum, LinkDatum> = this._defaultConfig\n\n datamodel: MapGraphDataModel<AreaDatum, PointDatum, LinkDatum> = new MapGraphDataModel()\n g: Selection<SVGGElement, unknown, null, undefined>\n private _firstRender = true\n private _isResizing = false\n private _initialScale: number = undefined\n private _center: [number, number]\n private _currentZoomLevel: number = undefined\n private _transform: ZoomTransform\n private _path = geoPath()\n private _projection: GeoProjection\n private _prevWidth: number\n private _prevHeight: number\n private _animFrameId: number\n\n private _featureCollection: GeoJSON.FeatureCollection\n private _zoomBehavior: ZoomBehavior<SVGGElement, unknown> = zoom()\n private _backgroundRect = this.g.append('rect').attr('class', s.background)\n private _featuresGroup = this.g.append('g').attr('class', s.features)\n private _linksGroup = this.g.append('g').attr('class', s.links)\n private _pointsGroup = this.g.append('g').attr('class', s.points)\n\n events = {\n [TopoJSONMap.selectors.point]: {},\n [TopoJSONMap.selectors.feature]: {},\n }\n\n constructor (config?: TopoJSONMapConfigInterface<AreaDatum, PointDatum, LinkDatum>, data?: MapData<AreaDatum, PointDatum, LinkDatum>) {\n super()\n this._zoomBehavior.on('zoom', this._onZoom.bind(this))\n\n if (config) this.setConfig(config)\n if (data) this.setData(data)\n\n this.g.append('defs')\n .append('filter')\n .attr('id', 'heatmapFilter')\n .html(`\n <feGaussianBlur in=\"SourceGraphic\" stdDeviation=\"${this.config.heatmapModeBlurStdDeviation}\" color-interpolation-filters=\"sRGB\" result=\"blur\"></feGaussianBlur>\n <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>\n `)\n }\n\n setData (data: MapData<AreaDatum, PointDatum, LinkDatum>): void {\n const { config } = this\n\n this.datamodel.pointId = config.pointId\n this.datamodel.linkSource = config.linkSource\n this.datamodel.linkTarget = config.linkTarget\n this.datamodel.data = data\n\n // If there was a data change and mapFitToPoints is enabled, we will need to re-fit the map\n this._firstRender = this._firstRender || config.mapFitToPoints\n }\n\n setConfig (config?: TopoJSONMapConfigInterface<AreaDatum, PointDatum, LinkDatum>): void {\n super.setConfig(config)\n\n // Setting the default here instead of defaultConfig to prevent mutation from other TopoJSONMap instances\n const newProjection = this.config.projection ?? MapProjection.Kavrayskiy7()\n if (this._projection) {\n newProjection.scale(this._projection.scale()).translate(this._projection.translate())\n }\n this._projection = newProjection\n }\n\n _render (customDuration?: number): void {\n const { config } = this\n const duration = isNumber(customDuration) ? customDuration : config.duration\n\n this._renderBackground()\n this._renderMap(duration)\n this._renderGroups(duration)\n this._renderLinks(duration)\n this._renderPoints(duration)\n\n // When animation is running we need to temporary disable zoom behaviour\n if (duration && !config.disableZoom) {\n this.g.on('.zoom', null)\n timeout(() => {\n this.g.call(this._zoomBehavior)\n }, duration)\n }\n\n // When zoom behaviour is active we assign the `draggable` class to show the grabbing cursor\n this.g.classed('draggable', !config.disableZoom)\n this._firstRender = false\n }\n\n _renderBackground (): void {\n this._backgroundRect\n .attr('width', '100%')\n .attr('height', '100%')\n .attr('transform', `translate(${-this.bleed.left}, ${-this.bleed.top})`)\n }\n\n _renderGroups (duration: number): void {\n const transformString = this._transform.toString()\n smartTransition(this._featuresGroup, duration)\n .attr('transform', transformString)\n .attr('stroke-width', 1 / this._currentZoomLevel)\n\n smartTransition(this._linksGroup, duration)\n .attr('transform', transformString)\n\n smartTransition(this._pointsGroup, duration)\n .attr('transform', transformString)\n }\n\n _renderMap (duration: number): void {\n const { bleed, config, datamodel } = this\n\n this.g.attr('transform', `translate(${bleed.left}, ${bleed.top})`)\n const mapData: TopoJSON.Topology = config.topojson\n const featureName = config.mapFeatureName\n const featureObject = mapData?.objects?.[featureName]\n if (!featureObject) return\n\n this._featureCollection = feature(mapData, featureObject) as GeoJSON.FeatureCollection\n const featureData = (this._featureCollection?.features ?? []) as MapFeature<AreaDatum>[]\n\n if (this._firstRender) {\n // Rendering the map for the first time.\n this._projection.fitExtent([[0, 0], [this._width, this._height]], this._featureCollection)\n this._initialScale = this._projection.scale()\n this._center = this._projection.translate()\n\n if (config.mapFitToPoints) {\n this._fitToPoints()\n }\n\n const zoomExtent = config.zoomExtent\n this._zoomBehavior.scaleExtent([zoomExtent[0] * this._initialScale, zoomExtent[1] * this._initialScale])\n this.setZoom(config.zoomFactor || 1)\n\n if (!config.disableZoom) {\n this.g.call(this._zoomBehavior)\n this._applyZoom()\n }\n\n this._prevWidth = this._width\n this._prevHeight = this._height\n }\n\n if (this._prevWidth !== this._width || this._prevHeight !== this._height) {\n this._onResize()\n }\n\n\n this._path.projection(this._projection)\n\n // Merge passed area data and map feature data\n const areaData = datamodel.areas\n areaData.forEach(a => {\n const feature = featureData.find(f => f.id.toString() === getString(a, config.areaId).toString())\n if (feature) feature.data = a\n else if (this._firstRender) console.warn(`Can't find feature by area code ${getString(a, config.areaId)}`)\n })\n\n const features = this._featuresGroup\n .selectAll<SVGPathElement, unknown>(`.${s.feature}`)\n .data(featureData)\n\n const featuresEnter = features.enter().append('path').attr('class', s.feature)\n smartTransition(featuresEnter.merge(features), duration)\n .attr('d', this._path)\n .style('fill', (d, i) => d.data ? getColor(d.data, config.areaColor, i) : null)\n .style('cursor', d => d.data ? getString(d.data, config.areaCursor) : null)\n features.exit().remove()\n }\n\n _renderLinks (duration: number): void {\n const { config, datamodel } = this\n const links = datamodel.links\n\n const edges = this._linksGroup\n .selectAll<SVGPathElement, MapLink<PointDatum, LinkDatum>>(`.${s.link}`)\n .data(links, (d, i) => getString(d, config.linkId, i))\n\n const edgesEnter = edges.enter().append('path').attr('class', s.link)\n .style('stroke-width', 0)\n\n smartTransition(edgesEnter.merge(edges), duration)\n .attr('d', link => {\n const source = this._projection(getLonLat(link.source, config.longitude, config.latitude))\n const target = this._projection(getLonLat(link.target, config.longitude, config.latitude))\n return arc(source, target)\n })\n .style('stroke-width', link => getNumber(link, config.linkWidth) / this._currentZoomLevel)\n .style('cursor', link => getString(link, config.linkCursor))\n .style('stroke', (link, i) => getColor(link, config.linkColor, i))\n edges.exit().remove()\n }\n\n _renderPoints (duration: number): void {\n const { config, datamodel } = this\n const pointData = datamodel.points\n\n const points = this._pointsGroup\n .selectAll<SVGGElement, PointDatum>(`.${s.point}`)\n .data(pointData, (d, i) => getString(d, config.pointId, i))\n\n // Enter\n const pointsEnter = points.enter().append('g').attr('class', s.point)\n .attr('transform', d => {\n const pos = this._projection(getLonLat(d, config.longitude, config.latitude))\n return `translate(${pos[0]},${pos[1]})`\n })\n .style('opacity', 0)\n\n pointsEnter.append('circle').attr('class', s.pointCircle)\n .attr('r', 0)\n .style('fill', (d, i) => getColor(d, config.pointColor, i))\n .style('stroke-width', d => getNumber(d, config.pointStrokeWidth))\n\n pointsEnter.append('text').attr('class', s.pointLabel)\n .style('opacity', 0)\n\n // Update\n const pointsMerged = pointsEnter.merge(points)\n smartTransition(pointsMerged, duration)\n .attr('transform', d => {\n const pos = this._projection(getLonLat(d, config.longitude, config.latitude))\n return `translate(${pos[0]},${pos[1]})`\n })\n .style('cursor', d => getString(d, config.pointCursor))\n .style('opacity', 1)\n\n smartTransition(pointsMerged.select(`.${s.pointCircle}`), duration)\n .attr('r', d => getNumber(d, config.pointRadius) / this._currentZoomLevel)\n .style('fill', (d, i) => getColor(d, config.pointColor, i))\n .style('stroke', (d, i) => getColor(d, config.pointColor, i))\n .style('stroke-width', d => getNumber(d, config.pointStrokeWidth) / this._currentZoomLevel)\n\n const pointLabelsMerged = pointsMerged.select(`.${s.pointLabel}`)\n pointLabelsMerged\n .text(d => getString(d, config.pointLabel) ?? '')\n .style('font-size', d => {\n if (config.pointLabelPosition === MapPointLabelPosition.Bottom) {\n return `calc(var(--vis-map-point-label-font-size) / ${this._currentZoomLevel}`\n }\n const pointDiameter = 2 * getNumber(d, config.pointRadius)\n const pointLabelText = getString(d, config.pointLabel) || ''\n const textLength = pointLabelText.length\n const fontSize = 0.5 * pointDiameter / Math.pow(textLength, 0.4)\n return clamp(fontSize, fontSize, 16)\n })\n .attr('y', d => {\n if (config.pointLabelPosition === MapPointLabelPosition.Center) return null\n\n const pointRadius = getNumber(d, config.pointRadius) / this._currentZoomLevel\n return pointRadius\n })\n .attr('dy', config.pointLabelPosition === MapPointLabelPosition.Center ? '0.32em' : '1em')\n\n smartTransition(pointLabelsMerged, duration)\n .style('fill', (d, i) => {\n if (config.pointLabelPosition === MapPointLabelPosition.Bottom) return null\n\n const pointColor = getColor(d, config.pointColor, i)\n const hex = color(isStringCSSVariable(pointColor) ? getCSSVariableValue(pointColor, this.element) : pointColor)?.hex()\n if (!hex) return null\n\n const brightness = hexToBrightness(hex)\n return brightness > config.pointLabelTextBrightnessRatio ? 'var(--vis-map-point-label-text-color-dark)' : 'var(--vis-map-point-label-text-color-light)'\n })\n .style('opacity', 1)\n\n // Exit\n points.exit().remove()\n\n // Heatmap\n this._pointsGroup.style('filter', (config.heatmapMode && this._currentZoomLevel < config.heatmapModeZoomLevelThreshold) ? 'url(#heatmapFilter)' : null)\n this._pointsGroup.selectAll(`.${s.pointLabel}`).style('display', (config.heatmapMode && (this._currentZoomLevel < config.heatmapModeZoomLevelThreshold)) ? 'none' : null)\n }\n\n _fitToPoints (points?: PointDatum[], pad = 0.1): void {\n const { config, datamodel } = this\n const pointData = points || datamodel.points\n if (pointData.length === 0) return\n\n this.fitView()\n\n const featureCollection: ExtendedFeatureCollection = {\n type: 'FeatureCollection',\n features: [{\n type: 'Feature',\n properties: {},\n geometry: {\n type: 'MultiPoint',\n coordinates: pointData.map(p => {\n return [\n getNumber(p, d => getNumber(d, config.longitude)),\n getNumber(p, d => getNumber(d, config.latitude)),\n ]\n }),\n },\n }],\n }\n\n this._projection.fitExtent([\n [this._width * pad, this._height * pad],\n [this._width * (1 - pad), this._height * (1 - pad)],\n ], featureCollection)\n\n const maxScale = config.zoomExtent[1] * this._initialScale\n const fittedScale = this._projection.scale()\n\n if (fittedScale > maxScale) {\n const fittedTranslate = this._projection.translate()\n const scaleRatio = maxScale / fittedScale\n\n this._projection.scale(maxScale)\n this._projection.translate([\n this._width / 2 - (this._width / 2 - fittedTranslate[0]) * scaleRatio,\n this._height / 2 - (this._height / 2 - fittedTranslate[1]) * scaleRatio,\n ])\n }\n\n // If we don't update the center, the next zoom will be centered around the previous value\n this._center = this._projection.translate()\n this._applyZoom()\n }\n\n _applyZoom (): void {\n const translate = this._center ?? this._projection.translate()\n const scale = this._initialScale * this._currentZoomLevel\n this.g.call(this._zoomBehavior.transform, zoomIdentity.translate(translate[0], translate[1]).scale(scale))\n }\n\n _onResize (): void {\n this._isResizing = true\n const prevTranslate = this._projection.translate()\n\n this._projection.fitExtent([[0, 0], [this._width, this._height]], this._featureCollection)\n this._initialScale = this._projection.scale()\n this._center = [\n this._projection.translate()[0] * this._center[0] / prevTranslate[0],\n this._projection.translate()[1] * this._center[1] / prevTranslate[1],\n ]\n this._applyZoom()\n\n this._isResizing = false\n this._prevWidth = this._width\n this._prevHeight = this._height\n }\n\n _onZoom (event: D3ZoomEvent<any, any>): void {\n if (this._firstRender) return // To prevent double render because of binding zoom behaviour\n const isMouseEvent = event.sourceEvent !== undefined\n const isExternalEvent = !event?.sourceEvent && !this._isResizing\n\n window.cancelAnimationFrame(this._animFrameId)\n this._animFrameId = window.requestAnimationFrame(this._onZoomHandler.bind(this, event.transform, isMouseEvent, isExternalEvent))\n\n if (isMouseEvent) {\n // Update the center coordinate so that the next call to _applyZoom()\n // will zoom with respect to the current view\n this._center = [event.transform.x, event.transform.y]\n }\n this._currentZoomLevel = (event?.transform.k / this._initialScale) || 1\n }\n\n _onZoomHandler (transform: ZoomTransform, isMouseEvent: boolean, isExternalEvent: boolean): void {\n const scale = transform.k / this._initialScale || 1\n const center = this._projection.translate()\n\n this._transform = zoomIdentity\n .translate(transform.x - center[0] * scale, transform.y - center[1] * scale)\n .scale(scale)\n\n const customDuration = isExternalEvent\n ? this.config.zoomDuration\n : (isMouseEvent ? 0 : null)\n\n // Call render functions that depend on this._transform\n this._renderGroups(customDuration)\n this._renderLinks(customDuration)\n this._renderPoints(customDuration)\n }\n\n public zoomIn (increment = 0.5): void {\n this.setZoom(this._currentZoomLevel + increment)\n }\n\n public zoomOut (increment = 0.5): void {\n this.setZoom(this._currentZoomLevel - increment)\n }\n\n public setZoom (zoomLevel: number): void {\n const { config } = this\n this._currentZoomLevel = clamp(zoomLevel, config.zoomExtent[0], config.zoomExtent[1])\n this._transform = zoomIdentity\n .translate(this._center[0] * (1 - this._currentZoomLevel), this._center[1] * (1 - this._currentZoomLevel))\n .scale(this._currentZoomLevel)\n // We are using this._applyZoom() instead of directly calling this._render(config.zoomDuration) because\n // we've to \"attach\" new transform to the map group element. Otherwise zoomBehavior will not know\n // that the zoom state has changed\n this._applyZoom()\n }\n\n public fitView (): void {\n this._projection.fitExtent([[0, 0], [this._width, this._height]], this._featureCollection)\n this._currentZoomLevel = (this._projection?.scale() / this._initialScale) || 1\n this._center = this._projection.translate()\n // We are using this._applyZoom() instead of directly calling this._render(config.zoomDuration) because\n // we've to \"attach\" new transform to the map group element. Otherwise zoomBehavior will not know\n // that the zoom state has changed\n this._applyZoom()\n }\n\n destroy (): void {\n window.cancelAnimationFrame(this._animFrameId)\n }\n}\n"],"names":["s.background","s.features","s.links","s.points","s.feature","s.link","s.point","s.pointCircle","s.pointLabel","s"],"mappings":";;;;;;;;;;;;;;;;;AAgCM,MAAO,WAIX,SAAQ,aAGP,CAAA;IA+BD,WAAa,CAAA,MAAqE,EAAE,IAAgD,EAAA;AAClI,QAAA,KAAK,EAAE,CAAA;QA9BC,IAAc,CAAA,cAAA,GAAG,wBAAwF,CAAA;AAC5G,QAAA,IAAA,CAAA,MAAM,GAAiE,IAAI,CAAC,cAAc,CAAA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AG,IAAI,CAAC,aAAa,KAAK,CAAC,CAAA;QAC9E,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC,SAAS,EAAE,CAAA;;;;QAI3C,IAAI,CAAC,UAAU,EAAE,CAAA;KAClB;IAED,OAAO,GAAA;AACL,QAAA,MAAM,CAAC,oBAAoB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA;KAC/C;;AAhaM,WAAS,CAAA,SAAA,GAAGC,KAAC;;;;"}
@@ -38,7 +38,7 @@ class ContainerCore {
38
38
  _render(duration) {
39
39
  const { config, prevConfig } = this;
40
40
  // Add `svgDefs` if provided in the config
41
- if (config.svgDefs !== prevConfig.svgDefs) {
41
+ if ((config === null || config === void 0 ? void 0 : config.svgDefs) !== (prevConfig === null || prevConfig === void 0 ? void 0 : prevConfig.svgDefs)) {
42
42
  this._svgDefsExternal.selectAll('*').remove();
43
43
  this._svgDefsExternal.html(config.svgDefs);
44
44
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/core/container/index.ts"],"sourcesContent":["import { select, Selection } from 'd3-selection'\n\n// Types\nimport { Sizing } from 'types/component'\n\n// Utils\nimport { isEqual, clamp, merge } from 'utils/data'\nimport { ResizeObserver } from 'utils/resize-observer'\n\n// Config\nimport { ContainerDefaultConfig, ContainerConfigInterface } from './config'\n\nexport class ContainerCore {\n public svg: Selection<SVGSVGElement, unknown, null, undefined>\n public element: SVGSVGElement\n public prevConfig: ContainerConfigInterface\n public config: ContainerConfigInterface\n\n protected _defaultConfig: ContainerConfigInterface = ContainerDefaultConfig\n protected _container: HTMLElement\n protected _requestedAnimationFrame: number\n protected _isFirstRender = true\n protected _resizeObserver: ResizeObserver | undefined\n protected _svgDefs: Selection<SVGDefsElement, unknown, null, undefined>\n protected _svgDefsExternal: Selection<SVGDefsElement, unknown, null, undefined>\n private _containerSize: { width: number; height: number }\n\n // eslint-disable-next-line @typescript-eslint/naming-convention\n static DEFAULT_CONTAINER_HEIGHT = 300\n\n constructor (element: HTMLElement) {\n this._requestedAnimationFrame = null\n this._container = element\n\n // Setting `role` attribute to `image` to make the container accessible\n const container = select(this._container)\n container.attr('role', 'figure')\n\n // Create SVG element for visualizations\n this.svg = container.append('svg')\n // We set `display` to `block` because inline elements have an invisible\n // inline space that adds 4px to the height of the container\n .style('display', 'block')\n .attr('xmlns', 'http://www.w3.org/2000/svg')\n .attr('height', ContainerCore.DEFAULT_CONTAINER_HEIGHT) // Overriding default SVG height of 150\n .attr('aria-hidden', true)\n\n this._svgDefs = this.svg.append('defs')\n this._svgDefsExternal = this.svg.append('defs')\n this.element = this.svg.node()\n }\n\n public updateContainer<T extends ContainerConfigInterface> (config: T): void {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n this.prevConfig = this.config\n this.config = merge(this._defaultConfig, config)\n }\n\n // The `_preRender` step should be used to perform some actions before rendering.\n // For example, calculating scales, setting component sizes, etc ...\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n protected _preRender (): void {}\n\n // The `_render` step should be used to perform the actual rendering\n protected _render (duration?: number): void {\n const { config, prevConfig } = this\n\n // Add `svgDefs` if provided in the config\n if (config.svgDefs !== prevConfig.svgDefs) {\n this._svgDefsExternal.selectAll('*').remove()\n this._svgDefsExternal.html(config.svgDefs)\n }\n\n // Apply the `aria-label` attribute\n select(this._container)\n .attr('aria-label', config.ariaLabel)\n\n this._isFirstRender = false\n }\n\n // Warning: Some Containers (i.e. Single Container) may override this method, so if you introduce any changes here,\n // make sure to check that other containers didn't break after them.\n public render (duration = this.config.duration): void {\n const width = this.config.width || this.containerWidth\n const height = this.config.height || this.containerHeight\n\n // We set SVG size in `render()` instead of `_render()`, because the size values in pixels will become\n // available only in the next animation when being accessed via `element.clientWidth` and `element.clientHeight`,\n // and we rely on those values when setting width and size of the components.\n this.svg\n .attr('width', width)\n .attr('height', height)\n\n // Set up Resize Observer. We do it in `render()` to capture container size change if it happened\n // in the next animation frame after the initial `render` was called.\n if (!this._resizeObserver) this._setUpResizeObserver()\n\n // Schedule the actual rendering in the next frame\n cancelAnimationFrame(this._requestedAnimationFrame)\n this._requestedAnimationFrame = requestAnimationFrame(() => {\n this._preRender()\n this._render(duration)\n })\n }\n\n get containerWidth (): number {\n return this.config.width\n ? this.element.clientWidth\n : (this._container.clientWidth || this._container.getBoundingClientRect().width)\n }\n\n get containerHeight (): number {\n return this.config.height\n ? this.element.clientHeight\n : (this._container.clientHeight || this._container.getBoundingClientRect().height || ContainerCore.DEFAULT_CONTAINER_HEIGHT)\n }\n\n get width (): number {\n return clamp(this.containerWidth - this.config.margin.left - this.config.margin.right, 0, Number.POSITIVE_INFINITY)\n }\n\n get height (): number {\n return clamp(this.containerHeight - this.config.margin.top - this.config.margin.bottom, 0, Number.POSITIVE_INFINITY)\n }\n\n protected _removeAllChildren (): void {\n while (this.element.firstChild) {\n this.element.removeChild(this.element.firstChild)\n }\n }\n\n protected _onResize (): void {\n const { config } = this\n const redrawOnResize = config.sizing === Sizing.Fit || config.sizing === Sizing.FitWidth\n if (redrawOnResize) this.render(0)\n }\n\n protected _setUpResizeObserver (): void {\n if (this._resizeObserver) return\n const containerRect = this._container.getBoundingClientRect()\n this._containerSize = { width: containerRect.width, height: containerRect.height }\n\n this._resizeObserver = new ResizeObserver((entries, observer) => {\n const resizedContainerRect = this._container.getBoundingClientRect()\n const resizedContainerSize = { width: resizedContainerRect.width, height: resizedContainerRect.height }\n const hasSizeChanged = !isEqual(this._containerSize, resizedContainerSize)\n // Do resize only if element is attached to the DOM\n // will come in useful when some ancestor of container becomes detached\n if (hasSizeChanged && resizedContainerSize.width && resizedContainerSize.height) {\n this._containerSize = resizedContainerSize\n this._onResize()\n }\n })\n this._resizeObserver.observe(this._container)\n }\n\n public destroy (): void {\n cancelAnimationFrame(this._requestedAnimationFrame)\n this._resizeObserver?.disconnect()\n this.svg.remove()\n }\n}\n"],"names":[],"mappings":";;;;;;MAYa,aAAa,CAAA;AAkBxB,IAAA,WAAA,CAAa,OAAoB,EAAA;QAZvB,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;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/core/container/index.ts"],"sourcesContent":["import { select, Selection } from 'd3-selection'\n\n// Types\nimport { Sizing } from 'types/component'\n\n// Utils\nimport { isEqual, clamp, merge } from 'utils/data'\nimport { ResizeObserver } from 'utils/resize-observer'\n\n// Config\nimport { ContainerDefaultConfig, ContainerConfigInterface } from './config'\n\nexport class ContainerCore {\n public svg: Selection<SVGSVGElement, unknown, null, undefined>\n public element: SVGSVGElement\n public prevConfig: ContainerConfigInterface\n public config: ContainerConfigInterface\n\n protected _defaultConfig: ContainerConfigInterface = ContainerDefaultConfig\n protected _container: HTMLElement\n protected _requestedAnimationFrame: number\n protected _isFirstRender = true\n protected _resizeObserver: ResizeObserver | undefined\n protected _svgDefs: Selection<SVGDefsElement, unknown, null, undefined>\n protected _svgDefsExternal: Selection<SVGDefsElement, unknown, null, undefined>\n private _containerSize: { width: number; height: number }\n\n // eslint-disable-next-line @typescript-eslint/naming-convention\n static DEFAULT_CONTAINER_HEIGHT = 300\n\n constructor (element: HTMLElement) {\n this._requestedAnimationFrame = null\n this._container = element\n\n // Setting `role` attribute to `image` to make the container accessible\n const container = select(this._container)\n container.attr('role', 'figure')\n\n // Create SVG element for visualizations\n this.svg = container.append('svg')\n // We set `display` to `block` because inline elements have an invisible\n // inline space that adds 4px to the height of the container\n .style('display', 'block')\n .attr('xmlns', 'http://www.w3.org/2000/svg')\n .attr('height', ContainerCore.DEFAULT_CONTAINER_HEIGHT) // Overriding default SVG height of 150\n .attr('aria-hidden', true)\n\n this._svgDefs = this.svg.append('defs')\n this._svgDefsExternal = this.svg.append('defs')\n this.element = this.svg.node()\n }\n\n public updateContainer<T extends ContainerConfigInterface> (config: T): void {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n this.prevConfig = this.config\n this.config = merge(this._defaultConfig, config)\n }\n\n // The `_preRender` step should be used to perform some actions before rendering.\n // For example, calculating scales, setting component sizes, etc ...\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n protected _preRender (): void {}\n\n // The `_render` step should be used to perform the actual rendering\n protected _render (duration?: number): void {\n const { config, prevConfig } = this\n\n // Add `svgDefs` if provided in the config\n if (config?.svgDefs !== prevConfig?.svgDefs) {\n this._svgDefsExternal.selectAll('*').remove()\n this._svgDefsExternal.html(config.svgDefs)\n }\n\n // Apply the `aria-label` attribute\n select(this._container)\n .attr('aria-label', config.ariaLabel)\n\n this._isFirstRender = false\n }\n\n // Warning: Some Containers (i.e. Single Container) may override this method, so if you introduce any changes here,\n // make sure to check that other containers didn't break after them.\n public render (duration = this.config.duration): void {\n const width = this.config.width || this.containerWidth\n const height = this.config.height || this.containerHeight\n\n // We set SVG size in `render()` instead of `_render()`, because the size values in pixels will become\n // available only in the next animation when being accessed via `element.clientWidth` and `element.clientHeight`,\n // and we rely on those values when setting width and size of the components.\n this.svg\n .attr('width', width)\n .attr('height', height)\n\n // Set up Resize Observer. We do it in `render()` to capture container size change if it happened\n // in the next animation frame after the initial `render` was called.\n if (!this._resizeObserver) this._setUpResizeObserver()\n\n // Schedule the actual rendering in the next frame\n cancelAnimationFrame(this._requestedAnimationFrame)\n this._requestedAnimationFrame = requestAnimationFrame(() => {\n this._preRender()\n this._render(duration)\n })\n }\n\n get containerWidth (): number {\n return this.config.width\n ? this.element.clientWidth\n : (this._container.clientWidth || this._container.getBoundingClientRect().width)\n }\n\n get containerHeight (): number {\n return this.config.height\n ? this.element.clientHeight\n : (this._container.clientHeight || this._container.getBoundingClientRect().height || ContainerCore.DEFAULT_CONTAINER_HEIGHT)\n }\n\n get width (): number {\n return clamp(this.containerWidth - this.config.margin.left - this.config.margin.right, 0, Number.POSITIVE_INFINITY)\n }\n\n get height (): number {\n return clamp(this.containerHeight - this.config.margin.top - this.config.margin.bottom, 0, Number.POSITIVE_INFINITY)\n }\n\n protected _removeAllChildren (): void {\n while (this.element.firstChild) {\n this.element.removeChild(this.element.firstChild)\n }\n }\n\n protected _onResize (): void {\n const { config } = this\n const redrawOnResize = config.sizing === Sizing.Fit || config.sizing === Sizing.FitWidth\n if (redrawOnResize) this.render(0)\n }\n\n protected _setUpResizeObserver (): void {\n if (this._resizeObserver) return\n const containerRect = this._container.getBoundingClientRect()\n this._containerSize = { width: containerRect.width, height: containerRect.height }\n\n this._resizeObserver = new ResizeObserver((entries, observer) => {\n const resizedContainerRect = this._container.getBoundingClientRect()\n const resizedContainerSize = { width: resizedContainerRect.width, height: resizedContainerRect.height }\n const hasSizeChanged = !isEqual(this._containerSize, resizedContainerSize)\n // Do resize only if element is attached to the DOM\n // will come in useful when some ancestor of container becomes detached\n if (hasSizeChanged && resizedContainerSize.width && resizedContainerSize.height) {\n this._containerSize = resizedContainerSize\n this._onResize()\n }\n })\n this._resizeObserver.observe(this._container)\n }\n\n public destroy (): void {\n cancelAnimationFrame(this._requestedAnimationFrame)\n this._resizeObserver?.disconnect()\n this.svg.remove()\n }\n}\n"],"names":[],"mappings":";;;;;;MAYa,aAAa,CAAA;AAkBxB,IAAA,WAAA,CAAa,OAAoB,EAAA;QAZvB,IAAc,CAAA,cAAA,GAA6B,sBAAsB,CAAA;QAGjE,IAAc,CAAA,cAAA,GAAG,IAAI,CAAA;AAU7B,QAAA,IAAI,CAAC,wBAAwB,GAAG,IAAI,CAAA;AACpC,QAAA,IAAI,CAAC,UAAU,GAAG,OAAO,CAAA;;QAGzB,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;AACzC,QAAA,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;;QAGhC,IAAI,CAAC,GAAG,GAAG,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC;;;AAG/B,aAAA,KAAK,CAAC,SAAS,EAAE,OAAO,CAAC;AACzB,aAAA,IAAI,CAAC,OAAO,EAAE,4BAA4B,CAAC;aAC3C,IAAI,CAAC,QAAQ,EAAE,aAAa,CAAC,wBAAwB,CAAC;AACtD,aAAA,IAAI,CAAC,aAAa,EAAE,IAAI,CA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