@ktnpm_devops/react-component 0.16.0 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -2
- package/dist/composites/CustomRangePicker/CustomRangePicker.d.ts.map +1 -1
- package/dist/composites/DatePickerDropdown/DatePickerDropdown.d.ts.map +1 -1
- package/dist/composites/FilterDropdown/FilterDropdown.d.ts.map +1 -1
- package/dist/composites/MultiSelectDropdown/MultiSelectDropdown.d.ts.map +1 -1
- package/dist/composites/SingleSelectDropdown/SingleSelectDropdown.d.ts.map +1 -1
- package/dist/constants.d.ts +9 -3
- package/dist/constants.d.ts.map +1 -1
- package/dist/geo/GeoMapCard/GeoMapCard.d.ts +1 -1
- package/dist/geo/GeoMapCard/GeoMapCard.d.ts.map +1 -1
- package/dist/geo/GeoMapCard/GeoMapCard.types.d.ts +28 -2
- package/dist/geo/GeoMapCard/GeoMapCard.types.d.ts.map +1 -1
- package/dist/geo/GeoMapCard/MapStatusBars.d.ts +11 -0
- package/dist/geo/GeoMapCard/MapStatusBars.d.ts.map +1 -0
- package/dist/geo/GeoMapCard/ViewportReporter.d.ts +15 -0
- package/dist/geo/GeoMapCard/ViewportReporter.d.ts.map +1 -0
- package/dist/geo/GeoMapCard/describePoints.d.ts +7 -0
- package/dist/geo/GeoMapCard/describePoints.d.ts.map +1 -0
- package/dist/geo/GeoMapCard/normalizeViewport.d.ts +13 -0
- package/dist/geo/GeoMapCard/normalizeViewport.d.ts.map +1 -0
- package/dist/geo/GeoMapCard/normalizeViewport.test.d.ts +2 -0
- package/dist/geo/GeoMapCard/normalizeViewport.test.d.ts.map +1 -0
- package/dist/geo/GeoMapCard/resolveTiles.d.ts +9 -0
- package/dist/geo/GeoMapCard/resolveTiles.d.ts.map +1 -0
- package/dist/geo/GeoMapCard/warnMissingBasemapKey.d.ts +9 -0
- package/dist/geo/GeoMapCard/warnMissingBasemapKey.d.ts.map +1 -0
- package/dist/hooks/usePanelPlacement.d.ts +24 -0
- package/dist/hooks/usePanelPlacement.d.ts.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index10.cjs +1 -1
- package/dist/index10.js +1 -1
- package/dist/index100.cjs +17 -23
- package/dist/index100.cjs.map +1 -1
- package/dist/index100.js +18 -24
- package/dist/index100.js.map +1 -1
- package/dist/index101.cjs +14 -50
- package/dist/index101.cjs.map +1 -1
- package/dist/index101.js +14 -50
- package/dist/index101.js.map +1 -1
- package/dist/index102.cjs +26 -30
- package/dist/index102.cjs.map +1 -1
- package/dist/index102.js +26 -30
- package/dist/index102.js.map +1 -1
- package/dist/index103.cjs +36 -85
- package/dist/index103.cjs.map +1 -1
- package/dist/index103.js +36 -85
- package/dist/index103.js.map +1 -1
- package/dist/index104.cjs +24 -39
- package/dist/index104.cjs.map +1 -1
- package/dist/index104.js +23 -38
- package/dist/index104.js.map +1 -1
- package/dist/index105.cjs +39 -115
- package/dist/index105.cjs.map +1 -1
- package/dist/index105.js +39 -115
- package/dist/index105.js.map +1 -1
- package/dist/index106.cjs +9 -43
- package/dist/index106.cjs.map +1 -1
- package/dist/index106.js +8 -42
- package/dist/index106.js.map +1 -1
- package/dist/index107.cjs +10 -21
- package/dist/index107.cjs.map +1 -1
- package/dist/index107.js +9 -20
- package/dist/index107.js.map +1 -1
- package/dist/index108.cjs +20 -10
- package/dist/index108.cjs.map +1 -1
- package/dist/index108.js +19 -9
- package/dist/index108.js.map +1 -1
- package/dist/index109.cjs +13 -35
- package/dist/index109.cjs.map +1 -1
- package/dist/index109.js +13 -35
- package/dist/index109.js.map +1 -1
- package/dist/index11.cjs +1 -1
- package/dist/index11.js +1 -1
- package/dist/index110.cjs +7 -40
- package/dist/index110.cjs.map +1 -1
- package/dist/index110.js +7 -40
- package/dist/index110.js.map +1 -1
- package/dist/index111.cjs +69 -24
- package/dist/index111.cjs.map +1 -1
- package/dist/index111.js +68 -23
- package/dist/index111.js.map +1 -1
- package/dist/index112.cjs +55 -20
- package/dist/index112.cjs.map +1 -1
- package/dist/index112.js +54 -19
- package/dist/index112.js.map +1 -1
- package/dist/index113.cjs +22 -14
- package/dist/index113.cjs.map +1 -1
- package/dist/index113.js +21 -13
- package/dist/index113.js.map +1 -1
- package/dist/index114.cjs +2 -56
- package/dist/index114.cjs.map +1 -1
- package/dist/index114.js +3 -57
- package/dist/index114.js.map +1 -1
- package/dist/index115.cjs +48 -22
- package/dist/index115.cjs.map +1 -1
- package/dist/index115.js +47 -21
- package/dist/index115.js.map +1 -1
- package/dist/index116.cjs +18 -19
- package/dist/index116.cjs.map +1 -1
- package/dist/index116.js +17 -18
- package/dist/index116.js.map +1 -1
- package/dist/index117.cjs +31 -16
- package/dist/index117.cjs.map +1 -1
- package/dist/index117.js +31 -16
- package/dist/index117.js.map +1 -1
- package/dist/index118.cjs +22 -15
- package/dist/index118.cjs.map +1 -1
- package/dist/index118.js +21 -14
- package/dist/index118.js.map +1 -1
- package/dist/index119.cjs +69 -39
- package/dist/index119.cjs.map +1 -1
- package/dist/index119.js +68 -38
- package/dist/index119.js.map +1 -1
- package/dist/index12.cjs +1 -1
- package/dist/index12.js +1 -1
- package/dist/index120.cjs +7 -47
- package/dist/index120.cjs.map +1 -1
- package/dist/index120.js +7 -47
- package/dist/index120.js.map +1 -1
- package/dist/index121.cjs +40 -18
- package/dist/index121.cjs.map +1 -1
- package/dist/index121.js +39 -17
- package/dist/index121.js.map +1 -1
- package/dist/index122.cjs +37 -31
- package/dist/index122.cjs.map +1 -1
- package/dist/index122.js +37 -31
- package/dist/index122.js.map +1 -1
- package/dist/index123.cjs +2 -38
- package/dist/index123.cjs.map +1 -1
- package/dist/index123.js +3 -39
- package/dist/index123.js.map +1 -1
- package/dist/index124.cjs +58 -1164
- package/dist/index124.cjs.map +1 -1
- package/dist/index124.js +56 -1163
- package/dist/index124.js.map +1 -1
- package/dist/index125.cjs +57 -1575
- package/dist/index125.cjs.map +1 -1
- package/dist/index125.js +56 -1575
- package/dist/index125.js.map +1 -1
- package/dist/index126.cjs +42 -0
- package/dist/index126.cjs.map +1 -0
- package/dist/index126.js +42 -0
- package/dist/index126.js.map +1 -0
- package/dist/index127.cjs +95 -0
- package/dist/index127.cjs.map +1 -0
- package/dist/index127.js +95 -0
- package/dist/index127.js.map +1 -0
- package/dist/index128.cjs +42 -0
- package/dist/index128.cjs.map +1 -0
- package/dist/index128.js +42 -0
- package/dist/index128.js.map +1 -0
- package/dist/index129.cjs +17 -0
- package/dist/index129.cjs.map +1 -0
- package/dist/index129.js +17 -0
- package/dist/index129.js.map +1 -0
- package/dist/index13.cjs +1 -1
- package/dist/index13.js +1 -1
- package/dist/index130.cjs +1166 -0
- package/dist/index130.cjs.map +1 -0
- package/dist/index130.js +1167 -0
- package/dist/index130.js.map +1 -0
- package/dist/index131.cjs +1578 -0
- package/dist/index131.cjs.map +1 -0
- package/dist/index131.js +1579 -0
- package/dist/index131.js.map +1 -0
- package/dist/index132.cjs +37 -0
- package/dist/index132.cjs.map +1 -0
- package/dist/index132.js +37 -0
- package/dist/index132.js.map +1 -0
- package/dist/index14.cjs +1 -1
- package/dist/index14.js +1 -1
- package/dist/index15.cjs +1 -1
- package/dist/index15.js +1 -1
- package/dist/index16.cjs +2 -2
- package/dist/index16.js +2 -2
- package/dist/index17.cjs +1 -1
- package/dist/index17.js +1 -1
- package/dist/index18.cjs +1 -1
- package/dist/index18.js +1 -1
- package/dist/index19.cjs +1 -1
- package/dist/index19.js +1 -1
- package/dist/index20.cjs +1 -1
- package/dist/index20.js +1 -1
- package/dist/index21.cjs +1 -1
- package/dist/index21.js +1 -1
- package/dist/index22.cjs +2 -2
- package/dist/index22.js +2 -2
- package/dist/index23.cjs +2 -2
- package/dist/index23.js +2 -2
- package/dist/index24.cjs +2 -2
- package/dist/index24.js +2 -2
- package/dist/index25.cjs +49 -35
- package/dist/index25.cjs.map +1 -1
- package/dist/index25.js +49 -35
- package/dist/index25.js.map +1 -1
- package/dist/index26.cjs +1 -1
- package/dist/index26.js +1 -1
- package/dist/index27.cjs +83 -56
- package/dist/index27.cjs.map +1 -1
- package/dist/index27.js +83 -56
- package/dist/index27.js.map +1 -1
- package/dist/index28.cjs +1 -1
- package/dist/index28.js +1 -1
- package/dist/index29.cjs +51 -39
- package/dist/index29.cjs.map +1 -1
- package/dist/index29.js +51 -39
- package/dist/index29.js.map +1 -1
- package/dist/index30.cjs +37 -35
- package/dist/index30.cjs.map +1 -1
- package/dist/index30.js +35 -33
- package/dist/index30.js.map +1 -1
- package/dist/index31.cjs +4 -4
- package/dist/index31.js +4 -4
- package/dist/index32.cjs +3 -3
- package/dist/index32.js +3 -3
- package/dist/index33.cjs +1 -1
- package/dist/index33.js +1 -1
- package/dist/index34.cjs +2 -2
- package/dist/index34.js +2 -2
- package/dist/index35.cjs +2 -2
- package/dist/index35.js +2 -2
- package/dist/index36.cjs +2 -2
- package/dist/index36.js +2 -2
- package/dist/index37.cjs +1 -1
- package/dist/index37.js +1 -1
- package/dist/index38.cjs +138 -62
- package/dist/index38.cjs.map +1 -1
- package/dist/index38.js +138 -62
- package/dist/index38.js.map +1 -1
- package/dist/index39.cjs +1 -1
- package/dist/index39.js +1 -1
- package/dist/index40.cjs +2 -2
- package/dist/index40.js +2 -2
- package/dist/index41.cjs +2 -2
- package/dist/index41.js +2 -2
- package/dist/index42.cjs +2 -2
- package/dist/index42.js +2 -2
- package/dist/index43.cjs +1 -1
- package/dist/index43.js +1 -1
- package/dist/index44.cjs +2 -2
- package/dist/index44.js +2 -2
- package/dist/index45.cjs +4 -4
- package/dist/index45.js +4 -4
- package/dist/index46.cjs +1 -1
- package/dist/index46.js +1 -1
- package/dist/index47.cjs +1 -1
- package/dist/index47.js +1 -1
- package/dist/index48.cjs +1 -1
- package/dist/index48.js +1 -1
- package/dist/index49.cjs +2 -2
- package/dist/index49.js +2 -2
- package/dist/index50.cjs +86 -47
- package/dist/index50.cjs.map +1 -1
- package/dist/index50.js +86 -47
- package/dist/index50.js.map +1 -1
- package/dist/index51.cjs +1 -1
- package/dist/index51.js +1 -1
- package/dist/index52.cjs +3 -3
- package/dist/index52.js +3 -3
- package/dist/index53.cjs +1 -1
- package/dist/index53.js +1 -1
- package/dist/index54.cjs +1 -1
- package/dist/index54.js +1 -1
- package/dist/index55.cjs +3 -3
- package/dist/index55.js +3 -3
- package/dist/index56.cjs +1 -1
- package/dist/index56.js +1 -1
- package/dist/index57.cjs +1 -1
- package/dist/index57.js +1 -1
- package/dist/index58.cjs +2 -2
- package/dist/index58.js +2 -2
- package/dist/index60.cjs +19 -22
- package/dist/index60.cjs.map +1 -1
- package/dist/index60.js +19 -22
- package/dist/index60.js.map +1 -1
- package/dist/index61.cjs +15 -24
- package/dist/index61.cjs.map +1 -1
- package/dist/index61.js +15 -24
- package/dist/index61.js.map +1 -1
- package/dist/index62.cjs +145 -19
- package/dist/index62.cjs.map +1 -1
- package/dist/index62.js +143 -17
- package/dist/index62.js.map +1 -1
- package/dist/index63.cjs +28 -143
- package/dist/index63.cjs.map +1 -1
- package/dist/index63.js +26 -141
- package/dist/index63.js.map +1 -1
- package/dist/index64.cjs +10 -16
- package/dist/index64.cjs.map +1 -1
- package/dist/index64.js +11 -17
- package/dist/index64.js.map +1 -1
- package/dist/index65.cjs +2 -14
- package/dist/index65.cjs.map +1 -1
- package/dist/index65.js +3 -15
- package/dist/index65.js.map +1 -1
- package/dist/index66.cjs +10 -13
- package/dist/index66.cjs.map +1 -1
- package/dist/index66.js +11 -14
- package/dist/index66.js.map +1 -1
- package/dist/index67.cjs +20 -14
- package/dist/index67.cjs.map +1 -1
- package/dist/index67.js +20 -14
- package/dist/index67.js.map +1 -1
- package/dist/index68.cjs +5 -17
- package/dist/index68.cjs.map +1 -1
- package/dist/index68.js +6 -18
- package/dist/index68.js.map +1 -1
- package/dist/index69.cjs +13 -28
- package/dist/index69.cjs.map +1 -1
- package/dist/index69.js +13 -28
- package/dist/index69.js.map +1 -1
- package/dist/index70.cjs +16 -19
- package/dist/index70.cjs.map +1 -1
- package/dist/index70.js +16 -19
- package/dist/index70.js.map +1 -1
- package/dist/index71.cjs +17 -44
- package/dist/index71.cjs.map +1 -1
- package/dist/index71.js +18 -45
- package/dist/index71.js.map +1 -1
- package/dist/index72.cjs +20 -2
- package/dist/index72.cjs.map +1 -1
- package/dist/index72.js +21 -3
- package/dist/index72.js.map +1 -1
- package/dist/index73.cjs +10 -79
- package/dist/index73.cjs.map +1 -1
- package/dist/index73.js +10 -79
- package/dist/index73.js.map +1 -1
- package/dist/index74.cjs +2 -53
- package/dist/index74.cjs.map +1 -1
- package/dist/index74.js +3 -54
- package/dist/index74.js.map +1 -1
- package/dist/index75.cjs +19 -34
- package/dist/index75.cjs.map +1 -1
- package/dist/index75.js +20 -35
- package/dist/index75.js.map +1 -1
- package/dist/index76.cjs +45 -16
- package/dist/index76.cjs.map +1 -1
- package/dist/index76.js +45 -16
- package/dist/index76.js.map +1 -1
- package/dist/index77.cjs +29 -2
- package/dist/index77.cjs.map +1 -1
- package/dist/index77.js +30 -3
- package/dist/index77.js.map +1 -1
- package/dist/index78.cjs +17 -6
- package/dist/index78.cjs.map +1 -1
- package/dist/index78.js +16 -5
- package/dist/index78.js.map +1 -1
- package/dist/index79.cjs +1 -4
- package/dist/index79.cjs.map +1 -1
- package/dist/index79.js +1 -4
- package/dist/index79.js.map +1 -1
- package/dist/index80.cjs +3 -30
- package/dist/index80.cjs.map +1 -1
- package/dist/index80.js +3 -30
- package/dist/index80.js.map +1 -1
- package/dist/index81.cjs +64 -16
- package/dist/index81.cjs.map +1 -1
- package/dist/index81.js +65 -17
- package/dist/index81.js.map +1 -1
- package/dist/index82.cjs +46 -10
- package/dist/index82.cjs.map +1 -1
- package/dist/index82.js +46 -10
- package/dist/index82.js.map +1 -1
- package/dist/index83.cjs +13 -19
- package/dist/index83.cjs.map +1 -1
- package/dist/index83.js +14 -20
- package/dist/index83.js.map +1 -1
- package/dist/index84.cjs +30 -3
- package/dist/index84.cjs.map +1 -1
- package/dist/index84.js +30 -3
- package/dist/index84.js.map +1 -1
- package/dist/index85.cjs +36 -21
- package/dist/index85.cjs.map +1 -1
- package/dist/index85.js +36 -21
- package/dist/index85.js.map +1 -1
- package/dist/index86.cjs +34 -64
- package/dist/index86.cjs.map +1 -1
- package/dist/index86.js +34 -64
- package/dist/index86.js.map +1 -1
- package/dist/index87.cjs +11 -17
- package/dist/index87.cjs.map +1 -1
- package/dist/index87.js +12 -18
- package/dist/index87.js.map +1 -1
- package/dist/index88.cjs +17 -2
- package/dist/index88.cjs.map +1 -1
- package/dist/index88.js +18 -3
- package/dist/index88.js.map +1 -1
- package/dist/index89.cjs +17 -2
- package/dist/index89.cjs.map +1 -1
- package/dist/index89.js +18 -3
- package/dist/index89.js.map +1 -1
- package/dist/index90.cjs +8 -8
- package/dist/index90.js +8 -8
- package/dist/index91.cjs +116 -19
- package/dist/index91.cjs.map +1 -1
- package/dist/index91.js +115 -18
- package/dist/index91.js.map +1 -1
- package/dist/index92.cjs +36 -48
- package/dist/index92.cjs.map +1 -1
- package/dist/index92.js +36 -48
- package/dist/index92.js.map +1 -1
- package/dist/index93.cjs +40 -134
- package/dist/index93.cjs.map +1 -1
- package/dist/index93.js +39 -133
- package/dist/index93.js.map +1 -1
- package/dist/index94.cjs +15 -39
- package/dist/index94.cjs.map +1 -1
- package/dist/index94.js +16 -40
- package/dist/index94.js.map +1 -1
- package/dist/index95.cjs +81 -36
- package/dist/index95.cjs.map +1 -1
- package/dist/index95.js +81 -36
- package/dist/index95.js.map +1 -1
- package/dist/index96.cjs +4 -28
- package/dist/index96.cjs.map +1 -1
- package/dist/index96.js +5 -29
- package/dist/index96.js.map +1 -1
- package/dist/index97.cjs +130 -19
- package/dist/index97.cjs.map +1 -1
- package/dist/index97.js +130 -19
- package/dist/index97.js.map +1 -1
- package/dist/index98.cjs +45 -69
- package/dist/index98.cjs.map +1 -1
- package/dist/index98.js +44 -68
- package/dist/index98.js.map +1 -1
- package/dist/index99.cjs +24 -7
- package/dist/index99.cjs.map +1 -1
- package/dist/index99.js +23 -6
- package/dist/index99.js.map +1 -1
- package/dist/style.css +87 -4
- package/dist/types/geo.types.d.ts +14 -0
- package/dist/types/geo.types.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/clippingRect.d.ts +15 -0
- package/dist/utils/clippingRect.d.ts.map +1 -0
- package/dist/utils/clippingRect.test.d.ts +2 -0
- package/dist/utils/clippingRect.test.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/index103.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index103.js","sources":["../src/
|
|
1
|
+
{"version":3,"file":"index103.js","sources":["../src/geo/GeoMapCard/buildMarkerStyle.ts"],"sourcesContent":["import { CHART_COLORS, GEO_MAP } from '../../constants';\nimport { orbitTokens } from '../../tokens/tokens';\nimport type { ThemeMode } from '../../hooks/useThemeMode';\nimport type { GeoLegendItem, GeoPoint } from '../../types/geo.types';\n\n/**\n * Leaflet draws its markers as SVG paths, out of reach of the CSS custom\n * properties, so colours are resolved here as hex — the same exception the\n * ECharts family makes. Everything styled with CSS still uses the tokens.\n */\nexport interface MarkerStyle {\n radius: number;\n /** Stroke colour. */\n color: string;\n /** Stroke width. */\n weight: number;\n fillColor: string;\n fillOpacity: number;\n}\n\n/** Weight range actually present in the data, or `null` when it carries none. */\nexport interface WeightScale {\n min: number;\n max: number;\n}\n\nexport interface MarkerStyleOptions {\n categoryColors: Map<string, string>;\n weightScale: WeightScale | null;\n selected: boolean;\n theme: ThemeMode;\n}\n\n/** Ring drawn around a selected marker: maximum contrast against the basemap. */\nconst SELECTION_RING: Record<ThemeMode, string> = {\n light: orbitTokens.purple.base,\n dark: '#FFFFFF',\n};\n\n/** Colour used when no point carries a category. */\nconst UNCATEGORISED_COLOR = orbitTokens.brand.orange;\n\n/**\n * Categories are sorted before being indexed into the palette, so a colour\n * belongs to a category and not to the order the rows happened to arrive in.\n */\nexport const buildCategoryColors = (points: GeoPoint[]): Map<string, string> => {\n const categories = [...new Set(points.map((p) => p.category).filter((c): c is string => c != null))];\n\n categories.sort((a, b) => a.localeCompare(b));\n\n return new Map(categories.map((category, i) => [category, CHART_COLORS[i % CHART_COLORS.length]]));\n};\n\n/**\n * Null when nothing carries a weight, and also when every weight is equal:\n * a dataset with no size information should render at the base radius rather\n * than paint every marker at the maximum.\n */\nexport const buildWeightScale = (points: GeoPoint[]): WeightScale | null => {\n const weights = points\n .map((p) => p.weight)\n .filter((w): w is number => w != null && Number.isFinite(w));\n\n if (weights.length === 0) return null;\n\n const min = Math.min(...weights);\n const max = Math.max(...weights);\n\n return min === max ? null : { min, max };\n};\n\n/**\n * Interpolate on the *area*, which is what a reader actually compares, and take\n * the square root to get back to a radius.\n */\nconst radiusFor = (weight: number | null | undefined, scale: WeightScale | null): number => {\n if (scale == null || weight == null || !Number.isFinite(weight)) return GEO_MAP.BASE_MARKER_RADIUS;\n\n const ratio = (weight - scale.min) / (scale.max - scale.min);\n const clamped = Math.min(Math.max(ratio, 0), 1);\n const minArea = GEO_MAP.MIN_MARKER_RADIUS ** 2;\n const maxArea = GEO_MAP.MAX_MARKER_RADIUS ** 2;\n\n return Math.sqrt(minArea + clamped * (maxArea - minArea));\n};\n\n/**\n * Selection changes the radius and the stroke as well as the colour, because\n * colour is never allowed to be the only indicator of a state.\n */\nexport const buildMarkerStyle = (\n point: GeoPoint,\n { categoryColors, weightScale, selected, theme }: MarkerStyleOptions,\n): MarkerStyle => {\n const fillColor =\n (point.category != null ? categoryColors.get(point.category) : undefined) ?? UNCATEGORISED_COLOR;\n const radius = radiusFor(point.weight, weightScale);\n\n return {\n radius: selected ? radius + GEO_MAP.SELECTED_RADIUS_BOOST : radius,\n color: selected ? SELECTION_RING[theme] : fillColor,\n weight: selected ? GEO_MAP.SELECTED_STROKE_WIDTH : GEO_MAP.MARKER_STROKE_WIDTH,\n fillColor,\n fillOpacity: selected ? 1 : GEO_MAP.MARKER_FILL_OPACITY,\n };\n};\n\n/** Legend swatches, in the same order the palette was handed out. */\nexport const buildLegendItems = (categoryColors: Map<string, string>): GeoLegendItem[] =>\n [...categoryColors].map(([label, color]) => ({ label, color }));\n"],"names":[],"mappings":";;AAkCA,MAAM,iBAA4C;AAAA,EAChD,OAAO,YAAY,OAAO;AAAA,EAC1B,MAAM;AACR;AAGA,MAAM,sBAAsB,YAAY,MAAM;AAMvC,MAAM,sBAAsB,CAAC,WAA4C;AAC9E,QAAM,aAAa,CAAC,GAAG,IAAI,IAAI,OAAO,IAAI,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC,MAAmB,KAAK,IAAI,CAAC,CAAC;AAEnG,aAAW,KAAK,CAAC,GAAG,MAAM,EAAE,cAAc,CAAC,CAAC;AAE5C,SAAO,IAAI,IAAI,WAAW,IAAI,CAAC,UAAU,MAAM,CAAC,UAAU,aAAa,IAAI,aAAa,MAAM,CAAC,CAAC,CAAC;AACnG;AAOO,MAAM,mBAAmB,CAAC,WAA2C;AAC1E,QAAM,UAAU,OACb,IAAI,CAAC,MAAM,EAAE,MAAM,EACnB,OAAO,CAAC,MAAmB,KAAK,QAAQ,OAAO,SAAS,CAAC,CAAC;AAE7D,MAAI,QAAQ,WAAW,EAAG,QAAO;AAEjC,QAAM,MAAM,KAAK,IAAI,GAAG,OAAO;AAC/B,QAAM,MAAM,KAAK,IAAI,GAAG,OAAO;AAE/B,SAAO,QAAQ,MAAM,OAAO,EAAE,KAAK,IAAA;AACrC;AAMA,MAAM,YAAY,CAAC,QAAmC,UAAsC;AAC1F,MAAI,SAAS,QAAQ,UAAU,QAAQ,CAAC,OAAO,SAAS,MAAM,EAAG,QAAO,QAAQ;AAEhF,QAAM,SAAS,SAAS,MAAM,QAAQ,MAAM,MAAM,MAAM;AACxD,QAAM,UAAU,KAAK,IAAI,KAAK,IAAI,OAAO,CAAC,GAAG,CAAC;AAC9C,QAAM,UAAU,QAAQ,qBAAqB;AAC7C,QAAM,UAAU,QAAQ,qBAAqB;AAE7C,SAAO,KAAK,KAAK,UAAU,WAAW,UAAU,QAAQ;AAC1D;AAMO,MAAM,mBAAmB,CAC9B,OACA,EAAE,gBAAgB,aAAa,UAAU,YACzB;AAChB,QAAM,aACH,MAAM,YAAY,OAAO,eAAe,IAAI,MAAM,QAAQ,IAAI,WAAc;AAC/E,QAAM,SAAS,UAAU,MAAM,QAAQ,WAAW;AAElD,SAAO;AAAA,IACL,QAAQ,WAAW,SAAS,QAAQ,wBAAwB;AAAA,IAC5D,OAAO,WAAW,eAAe,KAAK,IAAI;AAAA,IAC1C,QAAQ,WAAW,QAAQ,wBAAwB,QAAQ;AAAA,IAC3D;AAAA,IACA,aAAa,WAAW,IAAI,QAAQ;AAAA,EAAA;AAExC;AAGO,MAAM,mBAAmB,CAAC,mBAC/B,CAAC,GAAG,cAAc,EAAE,IAAI,CAAC,CAAC,OAAO,KAAK,OAAO,EAAE,OAAO,QAAQ;"}
|
package/dist/index104.cjs
CHANGED
|
@@ -1,42 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
empty,
|
|
25
|
-
error,
|
|
26
|
-
retryButton,
|
|
27
|
-
compact
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const react = require("react");
|
|
4
|
+
const reactLeaflet = require("react-leaflet");
|
|
5
|
+
const useResizeObserver = require("./index6.cjs");
|
|
6
|
+
const constants = require("./index62.cjs");
|
|
7
|
+
const MapViewport = ({ bounds, fitBounds }) => {
|
|
8
|
+
const map = reactLeaflet.useMap();
|
|
9
|
+
const containerRef = react.useRef(null);
|
|
10
|
+
if (containerRef.current === null) containerRef.current = map.getContainer();
|
|
11
|
+
const { width, height } = useResizeObserver.useResizeObserver(containerRef);
|
|
12
|
+
react.useEffect(() => {
|
|
13
|
+
map.invalidateSize();
|
|
14
|
+
}, [map, width, height]);
|
|
15
|
+
react.useEffect(() => {
|
|
16
|
+
if (!fitBounds || bounds == null) return;
|
|
17
|
+
map.fitBounds(bounds, {
|
|
18
|
+
padding: [...constants.GEO_MAP.FIT_BOUNDS_PADDING],
|
|
19
|
+
// A single point makes `fitBounds` collapse to the maximum zoom level.
|
|
20
|
+
maxZoom: constants.GEO_MAP.SINGLE_POINT_ZOOM
|
|
21
|
+
});
|
|
22
|
+
}, [map, bounds, fitBounds]);
|
|
23
|
+
return null;
|
|
28
24
|
};
|
|
29
|
-
|
|
30
|
-
exports.
|
|
31
|
-
exports.default = styles;
|
|
32
|
-
exports.empty = empty;
|
|
33
|
-
exports.error = error;
|
|
34
|
-
exports.header = header;
|
|
35
|
-
exports.headerActions = headerActions;
|
|
36
|
-
exports.loading = loading;
|
|
37
|
-
exports.retryButton = retryButton;
|
|
38
|
-
exports.root = root;
|
|
39
|
-
exports.title = title;
|
|
40
|
-
exports.toolbar = toolbar;
|
|
41
|
-
exports.warning = warning;
|
|
25
|
+
MapViewport.displayName = "MapViewport";
|
|
26
|
+
exports.MapViewport = MapViewport;
|
|
42
27
|
//# sourceMappingURL=index104.cjs.map
|
package/dist/index104.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index104.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index104.cjs","sources":["../src/geo/GeoMapCard/MapViewport.tsx"],"sourcesContent":["import { useEffect, useRef } from 'react';\nimport { useMap } from 'react-leaflet';\nimport { useResizeObserver } from '../../hooks/useResizeObserver';\nimport { GEO_MAP } from '../../constants';\nimport type { MapViewportProps } from './GeoMapCard.types';\n\n/**\n * A childless child of `MapContainer`, which is the only place `useMap()` works.\n * It owns the two things Leaflet cannot work out on its own:\n *\n * - **Framing**: `fitBounds` over the drawn points, instead of a centroid at a\n * fixed zoom that leaves half a province outside the viewport.\n * - **Sizing**: `invalidateSize()` on every resize. Leaflet caches its container\n * size, so a map mounted hidden — a wizard step, a collapsed split panel —\n * renders grey tiles forever without this.\n */\nexport const MapViewport = ({ bounds, fitBounds }: MapViewportProps) => {\n const map = useMap();\n const containerRef = useRef<HTMLElement | null>(null);\n\n if (containerRef.current === null) containerRef.current = map.getContainer();\n\n const { width, height } = useResizeObserver(containerRef);\n\n useEffect(() => {\n map.invalidateSize();\n }, [map, width, height]);\n\n useEffect(() => {\n if (!fitBounds || bounds == null) return;\n\n map.fitBounds(bounds, {\n padding: [...GEO_MAP.FIT_BOUNDS_PADDING],\n // A single point makes `fitBounds` collapse to the maximum zoom level.\n maxZoom: GEO_MAP.SINGLE_POINT_ZOOM,\n });\n }, [map, bounds, fitBounds]);\n\n return null;\n};\n\nMapViewport.displayName = 'MapViewport';\n"],"names":["useMap","useRef","useResizeObserver","useEffect","GEO_MAP"],"mappings":";;;;;;AAgBO,MAAM,cAAc,CAAC,EAAE,QAAQ,gBAAkC;AACtE,QAAM,MAAMA,aAAAA,OAAA;AACZ,QAAM,eAAeC,MAAAA,OAA2B,IAAI;AAEpD,MAAI,aAAa,YAAY,KAAM,cAAa,UAAU,IAAI,aAAA;AAE9D,QAAM,EAAE,OAAO,WAAWC,kBAAAA,kBAAkB,YAAY;AAExDC,QAAAA,UAAU,MAAM;AACd,QAAI,eAAA;AAAA,EACN,GAAG,CAAC,KAAK,OAAO,MAAM,CAAC;AAEvBA,QAAAA,UAAU,MAAM;AACd,QAAI,CAAC,aAAa,UAAU,KAAM;AAElC,QAAI,UAAU,QAAQ;AAAA,MACpB,SAAS,CAAC,GAAGC,UAAAA,QAAQ,kBAAkB;AAAA;AAAA,MAEvC,SAASA,UAAAA,QAAQ;AAAA,IAAA,CAClB;AAAA,EACH,GAAG,CAAC,KAAK,QAAQ,SAAS,CAAC;AAE3B,SAAO;AACT;AAEA,YAAY,cAAc;;"}
|
package/dist/index104.js
CHANGED
|
@@ -1,42 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
empty,
|
|
23
|
-
error,
|
|
24
|
-
retryButton,
|
|
25
|
-
compact
|
|
1
|
+
import { useRef, useEffect } from "react";
|
|
2
|
+
import { useMap } from "react-leaflet";
|
|
3
|
+
import { useResizeObserver } from "./index6.js";
|
|
4
|
+
import { GEO_MAP } from "./index62.js";
|
|
5
|
+
const MapViewport = ({ bounds, fitBounds }) => {
|
|
6
|
+
const map = useMap();
|
|
7
|
+
const containerRef = useRef(null);
|
|
8
|
+
if (containerRef.current === null) containerRef.current = map.getContainer();
|
|
9
|
+
const { width, height } = useResizeObserver(containerRef);
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
map.invalidateSize();
|
|
12
|
+
}, [map, width, height]);
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
if (!fitBounds || bounds == null) return;
|
|
15
|
+
map.fitBounds(bounds, {
|
|
16
|
+
padding: [...GEO_MAP.FIT_BOUNDS_PADDING],
|
|
17
|
+
// A single point makes `fitBounds` collapse to the maximum zoom level.
|
|
18
|
+
maxZoom: GEO_MAP.SINGLE_POINT_ZOOM
|
|
19
|
+
});
|
|
20
|
+
}, [map, bounds, fitBounds]);
|
|
21
|
+
return null;
|
|
26
22
|
};
|
|
23
|
+
MapViewport.displayName = "MapViewport";
|
|
27
24
|
export {
|
|
28
|
-
|
|
29
|
-
compact,
|
|
30
|
-
styles as default,
|
|
31
|
-
empty,
|
|
32
|
-
error,
|
|
33
|
-
header,
|
|
34
|
-
headerActions,
|
|
35
|
-
loading,
|
|
36
|
-
retryButton,
|
|
37
|
-
root,
|
|
38
|
-
title,
|
|
39
|
-
toolbar,
|
|
40
|
-
warning
|
|
25
|
+
MapViewport
|
|
41
26
|
};
|
|
42
27
|
//# sourceMappingURL=index104.js.map
|
package/dist/index104.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index104.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index104.js","sources":["../src/geo/GeoMapCard/MapViewport.tsx"],"sourcesContent":["import { useEffect, useRef } from 'react';\nimport { useMap } from 'react-leaflet';\nimport { useResizeObserver } from '../../hooks/useResizeObserver';\nimport { GEO_MAP } from '../../constants';\nimport type { MapViewportProps } from './GeoMapCard.types';\n\n/**\n * A childless child of `MapContainer`, which is the only place `useMap()` works.\n * It owns the two things Leaflet cannot work out on its own:\n *\n * - **Framing**: `fitBounds` over the drawn points, instead of a centroid at a\n * fixed zoom that leaves half a province outside the viewport.\n * - **Sizing**: `invalidateSize()` on every resize. Leaflet caches its container\n * size, so a map mounted hidden — a wizard step, a collapsed split panel —\n * renders grey tiles forever without this.\n */\nexport const MapViewport = ({ bounds, fitBounds }: MapViewportProps) => {\n const map = useMap();\n const containerRef = useRef<HTMLElement | null>(null);\n\n if (containerRef.current === null) containerRef.current = map.getContainer();\n\n const { width, height } = useResizeObserver(containerRef);\n\n useEffect(() => {\n map.invalidateSize();\n }, [map, width, height]);\n\n useEffect(() => {\n if (!fitBounds || bounds == null) return;\n\n map.fitBounds(bounds, {\n padding: [...GEO_MAP.FIT_BOUNDS_PADDING],\n // A single point makes `fitBounds` collapse to the maximum zoom level.\n maxZoom: GEO_MAP.SINGLE_POINT_ZOOM,\n });\n }, [map, bounds, fitBounds]);\n\n return null;\n};\n\nMapViewport.displayName = 'MapViewport';\n"],"names":[],"mappings":";;;;AAgBO,MAAM,cAAc,CAAC,EAAE,QAAQ,gBAAkC;AACtE,QAAM,MAAM,OAAA;AACZ,QAAM,eAAe,OAA2B,IAAI;AAEpD,MAAI,aAAa,YAAY,KAAM,cAAa,UAAU,IAAI,aAAA;AAE9D,QAAM,EAAE,OAAO,WAAW,kBAAkB,YAAY;AAExD,YAAU,MAAM;AACd,QAAI,eAAA;AAAA,EACN,GAAG,CAAC,KAAK,OAAO,MAAM,CAAC;AAEvB,YAAU,MAAM;AACd,QAAI,CAAC,aAAa,UAAU,KAAM;AAElC,QAAI,UAAU,QAAQ;AAAA,MACpB,SAAS,CAAC,GAAG,QAAQ,kBAAkB;AAAA;AAAA,MAEvC,SAAS,QAAQ;AAAA,IAAA,CAClB;AAAA,EACH,GAAG,CAAC,KAAK,QAAQ,SAAS,CAAC;AAE3B,SAAO;AACT;AAEA,YAAY,cAAc;"}
|
package/dist/index105.cjs
CHANGED
|
@@ -1,118 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
},
|
|
43
|
-
{ xAxis: a.end }
|
|
44
|
-
]);
|
|
45
|
-
}
|
|
46
|
-
function buildMarkLines(annotations) {
|
|
47
|
-
return annotations.filter((a) => !a.end).map((a) => ({
|
|
48
|
-
name: a.label,
|
|
49
|
-
xAxis: a.start,
|
|
50
|
-
lineStyle: { color: a.color ?? constants.CHART_COLORS[0], type: "dashed" },
|
|
51
|
-
label: { formatter: a.label, position: "end" }
|
|
52
|
-
}));
|
|
53
|
-
}
|
|
54
|
-
function buildReferenceLines(referenceLines) {
|
|
55
|
-
return referenceLines.map((r) => ({
|
|
56
|
-
name: r.label ?? String(r.value),
|
|
57
|
-
yAxis: r.value,
|
|
58
|
-
lineStyle: {
|
|
59
|
-
color: r.color ?? constants.CHART_COLORS[0],
|
|
60
|
-
type: r.dashed === false ? "solid" : "dashed"
|
|
61
|
-
},
|
|
62
|
-
label: {
|
|
63
|
-
formatter: r.label ?? String(r.value),
|
|
64
|
-
position: "insideEndTop"
|
|
65
|
-
}
|
|
66
|
-
}));
|
|
67
|
-
}
|
|
68
|
-
function buildLegendSelected(seriesGroups, hiddenSeries) {
|
|
69
|
-
if (!hiddenSeries) return void 0;
|
|
70
|
-
const hidden = hiddenSeries instanceof Set ? hiddenSeries : new Set(hiddenSeries);
|
|
71
|
-
return Object.fromEntries(seriesGroups.map(([name]) => [name, !hidden.has(name)]));
|
|
72
|
-
}
|
|
73
|
-
function buildTemporalTrendOption(seriesGroups, config) {
|
|
74
|
-
const markAreas = buildMarkAreas(config.annotations);
|
|
75
|
-
const markLines = [
|
|
76
|
-
...buildMarkLines(config.annotations),
|
|
77
|
-
...buildReferenceLines(config.referenceLines)
|
|
78
|
-
];
|
|
79
|
-
const series = seriesGroups.map(([name, points], idx) => ({
|
|
80
|
-
name,
|
|
81
|
-
type: "line",
|
|
82
|
-
...config.stacked ? { stack: "total", areaStyle: {} } : {},
|
|
83
|
-
emphasis: { focus: "series" },
|
|
84
|
-
color: constants.CHART_COLORS[idx % constants.CHART_COLORS.length],
|
|
85
|
-
data: points.sort((a, b) => a.ts < b.ts ? -1 : 1).map((p) => [p.ts, p.value]),
|
|
86
|
-
...idx === 0 && (markAreas.length > 0 || markLines.length > 0) ? {
|
|
87
|
-
markArea: markAreas.length > 0 ? { silent: true, data: markAreas } : void 0,
|
|
88
|
-
markLine: markLines.length > 0 ? { silent: true, symbol: "none", data: markLines } : void 0
|
|
89
|
-
} : {}
|
|
90
|
-
}));
|
|
91
|
-
return {
|
|
92
|
-
tooltip: {
|
|
93
|
-
trigger: "axis",
|
|
94
|
-
axisPointer: { type: "cross" }
|
|
95
|
-
},
|
|
96
|
-
legend: {
|
|
97
|
-
show: config.showLegend,
|
|
98
|
-
type: "scroll",
|
|
99
|
-
bottom: 0,
|
|
100
|
-
selected: buildLegendSelected(seriesGroups, config.hiddenSeries)
|
|
101
|
-
},
|
|
102
|
-
grid: {
|
|
103
|
-
left: "3%",
|
|
104
|
-
right: "4%",
|
|
105
|
-
bottom: config.showLegend ? "15%" : "3%",
|
|
106
|
-
containLabel: true
|
|
107
|
-
},
|
|
108
|
-
xAxis: { type: "time" },
|
|
109
|
-
yAxis: { type: "value" },
|
|
110
|
-
series
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
exports.buildMarkAreas = buildMarkAreas;
|
|
114
|
-
exports.buildMarkLines = buildMarkLines;
|
|
115
|
-
exports.buildReferenceLines = buildReferenceLines;
|
|
116
|
-
exports.buildTemporalTrendOption = buildTemporalTrendOption;
|
|
117
|
-
exports.groupByCategory = groupByCategory;
|
|
3
|
+
const react = require("react");
|
|
4
|
+
const reactLeaflet = require("react-leaflet");
|
|
5
|
+
const normalizeViewport = require("./index132.cjs");
|
|
6
|
+
const VIEWPORT_EVENTS = "moveend resize";
|
|
7
|
+
const ViewportReporter = ({ onViewportChange }) => {
|
|
8
|
+
const map = reactLeaflet.useMap();
|
|
9
|
+
const handlerRef = react.useRef(onViewportChange);
|
|
10
|
+
const lastRef = react.useRef(null);
|
|
11
|
+
react.useEffect(() => {
|
|
12
|
+
handlerRef.current = onViewportChange;
|
|
13
|
+
});
|
|
14
|
+
react.useEffect(() => {
|
|
15
|
+
const report = () => {
|
|
16
|
+
const bounds = map.getBounds();
|
|
17
|
+
const center = map.getCenter();
|
|
18
|
+
const next = normalizeViewport.normalizeViewport(
|
|
19
|
+
{
|
|
20
|
+
west: bounds.getWest(),
|
|
21
|
+
south: bounds.getSouth(),
|
|
22
|
+
east: bounds.getEast(),
|
|
23
|
+
north: bounds.getNorth()
|
|
24
|
+
},
|
|
25
|
+
map.getZoom(),
|
|
26
|
+
[center.lat, center.lng]
|
|
27
|
+
);
|
|
28
|
+
if (lastRef.current != null && normalizeViewport.sameViewport(lastRef.current, next)) return;
|
|
29
|
+
lastRef.current = next;
|
|
30
|
+
handlerRef.current(next);
|
|
31
|
+
};
|
|
32
|
+
report();
|
|
33
|
+
map.on(VIEWPORT_EVENTS, report);
|
|
34
|
+
return () => {
|
|
35
|
+
map.off(VIEWPORT_EVENTS, report);
|
|
36
|
+
};
|
|
37
|
+
}, [map]);
|
|
38
|
+
return null;
|
|
39
|
+
};
|
|
40
|
+
ViewportReporter.displayName = "ViewportReporter";
|
|
41
|
+
exports.ViewportReporter = ViewportReporter;
|
|
118
42
|
//# sourceMappingURL=index105.cjs.map
|
package/dist/index105.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index105.cjs","sources":["../src/
|
|
1
|
+
{"version":3,"file":"index105.cjs","sources":["../src/geo/GeoMapCard/ViewportReporter.tsx"],"sourcesContent":["import { useEffect, useRef } from 'react';\nimport { useMap } from 'react-leaflet';\nimport type { GeoViewport } from '../../types/geo.types';\nimport type { ViewportReporterProps } from './GeoMapCard.types';\nimport { normalizeViewport, sameViewport } from './normalizeViewport';\n\n/** `moveend` closes every pan, zoom and keyboard move; `resize` a size change without one. */\nconst VIEWPORT_EVENTS = 'moveend resize';\n\n/**\n * A childless child of `MapContainer` that tells the consumer what is visible,\n * so it can fetch points by area instead of all at once.\n *\n * The handler is read through a ref: a new function on every parent render must\n * neither re-subscribe nor re-emit. Identical viewports are dropped, since a resize\n * is usually followed by a `moveend` for the same view.\n */\nexport const ViewportReporter = ({ onViewportChange }: ViewportReporterProps) => {\n const map = useMap();\n const handlerRef = useRef(onViewportChange);\n const lastRef = useRef<GeoViewport | null>(null);\n\n useEffect(() => {\n handlerRef.current = onViewportChange;\n });\n\n useEffect(() => {\n const report = () => {\n const bounds = map.getBounds();\n const center = map.getCenter();\n const next = normalizeViewport(\n {\n west: bounds.getWest(),\n south: bounds.getSouth(),\n east: bounds.getEast(),\n north: bounds.getNorth(),\n },\n map.getZoom(),\n [center.lat, center.lng],\n );\n\n if (lastRef.current != null && sameViewport(lastRef.current, next)) return;\n\n lastRef.current = next;\n handlerRef.current(next);\n };\n\n // react-leaflet renders children once the map exists with its initial view.\n report();\n map.on(VIEWPORT_EVENTS, report);\n\n return () => {\n map.off(VIEWPORT_EVENTS, report);\n };\n }, [map]);\n\n return null;\n};\n\nViewportReporter.displayName = 'ViewportReporter';\n"],"names":["useMap","useRef","useEffect","normalizeViewport","sameViewport"],"mappings":";;;;;AAOA,MAAM,kBAAkB;AAUjB,MAAM,mBAAmB,CAAC,EAAE,uBAA8C;AAC/E,QAAM,MAAMA,aAAAA,OAAA;AACZ,QAAM,aAAaC,MAAAA,OAAO,gBAAgB;AAC1C,QAAM,UAAUA,MAAAA,OAA2B,IAAI;AAE/CC,QAAAA,UAAU,MAAM;AACd,eAAW,UAAU;AAAA,EACvB,CAAC;AAEDA,QAAAA,UAAU,MAAM;AACd,UAAM,SAAS,MAAM;AACnB,YAAM,SAAS,IAAI,UAAA;AACnB,YAAM,SAAS,IAAI,UAAA;AACnB,YAAM,OAAOC,kBAAAA;AAAAA,QACX;AAAA,UACE,MAAM,OAAO,QAAA;AAAA,UACb,OAAO,OAAO,SAAA;AAAA,UACd,MAAM,OAAO,QAAA;AAAA,UACb,OAAO,OAAO,SAAA;AAAA,QAAS;AAAA,QAEzB,IAAI,QAAA;AAAA,QACJ,CAAC,OAAO,KAAK,OAAO,GAAG;AAAA,MAAA;AAGzB,UAAI,QAAQ,WAAW,QAAQC,kBAAAA,aAAa,QAAQ,SAAS,IAAI,EAAG;AAEpE,cAAQ,UAAU;AAClB,iBAAW,QAAQ,IAAI;AAAA,IACzB;AAGA,WAAA;AACA,QAAI,GAAG,iBAAiB,MAAM;AAE9B,WAAO,MAAM;AACX,UAAI,IAAI,iBAAiB,MAAM;AAAA,IACjC;AAAA,EACF,GAAG,CAAC,GAAG,CAAC;AAER,SAAO;AACT;AAEA,iBAAiB,cAAc;;"}
|
package/dist/index105.js
CHANGED
|
@@ -1,118 +1,42 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
itemStyle: { color: a.color ?? "rgba(255,107,90,0.1)" }
|
|
40
|
-
},
|
|
41
|
-
{ xAxis: a.end }
|
|
42
|
-
]);
|
|
43
|
-
}
|
|
44
|
-
function buildMarkLines(annotations) {
|
|
45
|
-
return annotations.filter((a) => !a.end).map((a) => ({
|
|
46
|
-
name: a.label,
|
|
47
|
-
xAxis: a.start,
|
|
48
|
-
lineStyle: { color: a.color ?? CHART_COLORS[0], type: "dashed" },
|
|
49
|
-
label: { formatter: a.label, position: "end" }
|
|
50
|
-
}));
|
|
51
|
-
}
|
|
52
|
-
function buildReferenceLines(referenceLines) {
|
|
53
|
-
return referenceLines.map((r) => ({
|
|
54
|
-
name: r.label ?? String(r.value),
|
|
55
|
-
yAxis: r.value,
|
|
56
|
-
lineStyle: {
|
|
57
|
-
color: r.color ?? CHART_COLORS[0],
|
|
58
|
-
type: r.dashed === false ? "solid" : "dashed"
|
|
59
|
-
},
|
|
60
|
-
label: {
|
|
61
|
-
formatter: r.label ?? String(r.value),
|
|
62
|
-
position: "insideEndTop"
|
|
63
|
-
}
|
|
64
|
-
}));
|
|
65
|
-
}
|
|
66
|
-
function buildLegendSelected(seriesGroups, hiddenSeries) {
|
|
67
|
-
if (!hiddenSeries) return void 0;
|
|
68
|
-
const hidden = hiddenSeries instanceof Set ? hiddenSeries : new Set(hiddenSeries);
|
|
69
|
-
return Object.fromEntries(seriesGroups.map(([name]) => [name, !hidden.has(name)]));
|
|
70
|
-
}
|
|
71
|
-
function buildTemporalTrendOption(seriesGroups, config) {
|
|
72
|
-
const markAreas = buildMarkAreas(config.annotations);
|
|
73
|
-
const markLines = [
|
|
74
|
-
...buildMarkLines(config.annotations),
|
|
75
|
-
...buildReferenceLines(config.referenceLines)
|
|
76
|
-
];
|
|
77
|
-
const series = seriesGroups.map(([name, points], idx) => ({
|
|
78
|
-
name,
|
|
79
|
-
type: "line",
|
|
80
|
-
...config.stacked ? { stack: "total", areaStyle: {} } : {},
|
|
81
|
-
emphasis: { focus: "series" },
|
|
82
|
-
color: CHART_COLORS[idx % CHART_COLORS.length],
|
|
83
|
-
data: points.sort((a, b) => a.ts < b.ts ? -1 : 1).map((p) => [p.ts, p.value]),
|
|
84
|
-
...idx === 0 && (markAreas.length > 0 || markLines.length > 0) ? {
|
|
85
|
-
markArea: markAreas.length > 0 ? { silent: true, data: markAreas } : void 0,
|
|
86
|
-
markLine: markLines.length > 0 ? { silent: true, symbol: "none", data: markLines } : void 0
|
|
87
|
-
} : {}
|
|
88
|
-
}));
|
|
89
|
-
return {
|
|
90
|
-
tooltip: {
|
|
91
|
-
trigger: "axis",
|
|
92
|
-
axisPointer: { type: "cross" }
|
|
93
|
-
},
|
|
94
|
-
legend: {
|
|
95
|
-
show: config.showLegend,
|
|
96
|
-
type: "scroll",
|
|
97
|
-
bottom: 0,
|
|
98
|
-
selected: buildLegendSelected(seriesGroups, config.hiddenSeries)
|
|
99
|
-
},
|
|
100
|
-
grid: {
|
|
101
|
-
left: "3%",
|
|
102
|
-
right: "4%",
|
|
103
|
-
bottom: config.showLegend ? "15%" : "3%",
|
|
104
|
-
containLabel: true
|
|
105
|
-
},
|
|
106
|
-
xAxis: { type: "time" },
|
|
107
|
-
yAxis: { type: "value" },
|
|
108
|
-
series
|
|
109
|
-
};
|
|
110
|
-
}
|
|
1
|
+
import { useRef, useEffect } from "react";
|
|
2
|
+
import { useMap } from "react-leaflet";
|
|
3
|
+
import { normalizeViewport, sameViewport } from "./index132.js";
|
|
4
|
+
const VIEWPORT_EVENTS = "moveend resize";
|
|
5
|
+
const ViewportReporter = ({ onViewportChange }) => {
|
|
6
|
+
const map = useMap();
|
|
7
|
+
const handlerRef = useRef(onViewportChange);
|
|
8
|
+
const lastRef = useRef(null);
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
handlerRef.current = onViewportChange;
|
|
11
|
+
});
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
const report = () => {
|
|
14
|
+
const bounds = map.getBounds();
|
|
15
|
+
const center = map.getCenter();
|
|
16
|
+
const next = normalizeViewport(
|
|
17
|
+
{
|
|
18
|
+
west: bounds.getWest(),
|
|
19
|
+
south: bounds.getSouth(),
|
|
20
|
+
east: bounds.getEast(),
|
|
21
|
+
north: bounds.getNorth()
|
|
22
|
+
},
|
|
23
|
+
map.getZoom(),
|
|
24
|
+
[center.lat, center.lng]
|
|
25
|
+
);
|
|
26
|
+
if (lastRef.current != null && sameViewport(lastRef.current, next)) return;
|
|
27
|
+
lastRef.current = next;
|
|
28
|
+
handlerRef.current(next);
|
|
29
|
+
};
|
|
30
|
+
report();
|
|
31
|
+
map.on(VIEWPORT_EVENTS, report);
|
|
32
|
+
return () => {
|
|
33
|
+
map.off(VIEWPORT_EVENTS, report);
|
|
34
|
+
};
|
|
35
|
+
}, [map]);
|
|
36
|
+
return null;
|
|
37
|
+
};
|
|
38
|
+
ViewportReporter.displayName = "ViewportReporter";
|
|
111
39
|
export {
|
|
112
|
-
|
|
113
|
-
buildMarkLines,
|
|
114
|
-
buildReferenceLines,
|
|
115
|
-
buildTemporalTrendOption,
|
|
116
|
-
groupByCategory
|
|
40
|
+
ViewportReporter
|
|
117
41
|
};
|
|
118
42
|
//# sourceMappingURL=index105.js.map
|
package/dist/index105.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index105.js","sources":["../src/
|
|
1
|
+
{"version":3,"file":"index105.js","sources":["../src/geo/GeoMapCard/ViewportReporter.tsx"],"sourcesContent":["import { useEffect, useRef } from 'react';\nimport { useMap } from 'react-leaflet';\nimport type { GeoViewport } from '../../types/geo.types';\nimport type { ViewportReporterProps } from './GeoMapCard.types';\nimport { normalizeViewport, sameViewport } from './normalizeViewport';\n\n/** `moveend` closes every pan, zoom and keyboard move; `resize` a size change without one. */\nconst VIEWPORT_EVENTS = 'moveend resize';\n\n/**\n * A childless child of `MapContainer` that tells the consumer what is visible,\n * so it can fetch points by area instead of all at once.\n *\n * The handler is read through a ref: a new function on every parent render must\n * neither re-subscribe nor re-emit. Identical viewports are dropped, since a resize\n * is usually followed by a `moveend` for the same view.\n */\nexport const ViewportReporter = ({ onViewportChange }: ViewportReporterProps) => {\n const map = useMap();\n const handlerRef = useRef(onViewportChange);\n const lastRef = useRef<GeoViewport | null>(null);\n\n useEffect(() => {\n handlerRef.current = onViewportChange;\n });\n\n useEffect(() => {\n const report = () => {\n const bounds = map.getBounds();\n const center = map.getCenter();\n const next = normalizeViewport(\n {\n west: bounds.getWest(),\n south: bounds.getSouth(),\n east: bounds.getEast(),\n north: bounds.getNorth(),\n },\n map.getZoom(),\n [center.lat, center.lng],\n );\n\n if (lastRef.current != null && sameViewport(lastRef.current, next)) return;\n\n lastRef.current = next;\n handlerRef.current(next);\n };\n\n // react-leaflet renders children once the map exists with its initial view.\n report();\n map.on(VIEWPORT_EVENTS, report);\n\n return () => {\n map.off(VIEWPORT_EVENTS, report);\n };\n }, [map]);\n\n return null;\n};\n\nViewportReporter.displayName = 'ViewportReporter';\n"],"names":[],"mappings":";;;AAOA,MAAM,kBAAkB;AAUjB,MAAM,mBAAmB,CAAC,EAAE,uBAA8C;AAC/E,QAAM,MAAM,OAAA;AACZ,QAAM,aAAa,OAAO,gBAAgB;AAC1C,QAAM,UAAU,OAA2B,IAAI;AAE/C,YAAU,MAAM;AACd,eAAW,UAAU;AAAA,EACvB,CAAC;AAED,YAAU,MAAM;AACd,UAAM,SAAS,MAAM;AACnB,YAAM,SAAS,IAAI,UAAA;AACnB,YAAM,SAAS,IAAI,UAAA;AACnB,YAAM,OAAO;AAAA,QACX;AAAA,UACE,MAAM,OAAO,QAAA;AAAA,UACb,OAAO,OAAO,SAAA;AAAA,UACd,MAAM,OAAO,QAAA;AAAA,UACb,OAAO,OAAO,SAAA;AAAA,QAAS;AAAA,QAEzB,IAAI,QAAA;AAAA,QACJ,CAAC,OAAO,KAAK,OAAO,GAAG;AAAA,MAAA;AAGzB,UAAI,QAAQ,WAAW,QAAQ,aAAa,QAAQ,SAAS,IAAI,EAAG;AAEpE,cAAQ,UAAU;AAClB,iBAAW,QAAQ,IAAI;AAAA,IACzB;AAGA,WAAA;AACA,QAAI,GAAG,iBAAiB,MAAM;AAE9B,WAAO,MAAM;AACX,UAAI,IAAI,iBAAiB,MAAM;AAAA,IACjC;AAAA,EACF,GAAG,CAAC,GAAG,CAAC;AAER,SAAO;AACT;AAEA,iBAAiB,cAAc;"}
|