eurostat-map 4.10.9 → 4.10.11

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.
Files changed (120) hide show
  1. package/build/215.eurostatmap.min.js +1 -1
  2. package/build/eurostatmap.js +2757 -2689
  3. package/build/eurostatmap.min.js +2 -2
  4. package/build/eurostatmap.min.js.map +1 -1
  5. package/build/package.json +1 -1
  6. package/build/types/core/InsetConfig.d.ts +92 -71
  7. package/build/types/core/MapConfig.d.ts +103 -12
  8. package/build/types/core/MapInstance.d.ts +624 -555
  9. package/build/types/core/TooltipConfig.d.ts +33 -5
  10. package/build/types/core/decoration/PatternFillConfig.d.ts +34 -0
  11. package/build/types/core/geo/geometries.d.ts +13 -1
  12. package/build/types/core/layer/Layer.d.ts +49 -31
  13. package/build/types/core/minimaps.d.ts +11 -3
  14. package/build/types/core/stat/StatData.d.ts +2 -2
  15. package/build/types/core/utils.d.ts +44 -0
  16. package/build/types/index.d.ts +37 -6
  17. package/build/types/layers/CategoricalMap.d.ts +9 -9
  18. package/build/types/layers/choropleth/BivariateChoroplethConfig.d.ts +3 -0
  19. package/build/types/layers/choropleth/BivariateChoroplethMap.d.ts +9 -6
  20. package/build/types/layers/choropleth/ChoroplethConfig.d.ts +3 -3
  21. package/build/types/layers/choropleth/ChoroplethMap.d.ts +16 -4
  22. package/build/types/layers/choropleth/TrivariateChoroplethMap.d.ts +4 -0
  23. package/build/types/layers/choropleth/ValueByAlphaMap.d.ts +4 -3
  24. package/build/types/layers/composition/bar/BarMap.d.ts +170 -97
  25. package/build/types/layers/composition/bar/BarMapConfig.d.ts +83 -76
  26. package/build/types/layers/composition/coxcomb/CoxcombMap.d.ts +7 -6
  27. package/build/types/layers/composition/coxcomb/CoxcombMapConfig.d.ts +2 -2
  28. package/build/types/layers/composition/pie/PieMap.d.ts +8 -4
  29. package/build/types/layers/composition/pie/PieMapConfig.d.ts +0 -4
  30. package/build/types/layers/composition/stripe/StripeMap.d.ts +4 -4
  31. package/build/types/layers/composition/waffle/WaffleMap.d.ts +4 -4
  32. package/build/types/layers/flow/FlowMap.d.ts +8 -8
  33. package/build/types/layers/proportional-symbol/ProportionalSymbolConfig.d.ts +105 -52
  34. package/build/types/layers/proportional-symbol/ProportionalSymbolMap.d.ts +104 -100
  35. package/build/types/layers/proportional-symbol/mushroom/MushroomMap.d.ts +16 -12
  36. package/build/types/layers/spark/SparkMap.d.ts +14 -8
  37. package/build/types/layers/spark/SparkMapConfig.d.ts +8 -12
  38. package/build/types/legend/LegendConfig.d.ts +72 -73
  39. package/build/types/legend/MushroomLegendConfig.d.ts +15 -0
  40. package/build/types/legend/choropleth/BivariateLegendConfig.d.ts +6 -6
  41. package/build/types/legend/choropleth/TrivariateLegendConfig.d.ts +5 -5
  42. package/build/types/legend/composition/BarChartLegendConfig.d.ts +32 -0
  43. package/build/types/legend/composition/StripeCompositionLegendConfig.d.ts +34 -2
  44. package/package.json +1 -1
  45. package/build/types/core/MinimapConfig.d.ts +0 -11
  46. package/build/types/legend/CoxcombLegendConfig.d.ts +0 -85
  47. package/build/types/legend/PieChartLegendConfig.d.ts +0 -68
  48. package/build/types/legend/SparklineLegendConfig.d.ts +0 -6
  49. package/build/types/legend/StripeCompositionLegendConfig.d.ts +0 -11
  50. package/build/types/legend/WaffleLegendConfig.d.ts +0 -74
  51. package/build/types/legend/choropleth/legend-choropleth-bivariate.d.ts +0 -2
  52. package/build/types/legend/choropleth/legend-choropleth-trivariate.d.ts +0 -2
  53. package/build/types/legend/choropleth/legend-choropleth.d.ts +0 -2
  54. package/build/types/legend/composition/legend-bar-chart.d.ts +0 -2
  55. package/build/types/legend/flow/legend-flow.d.ts +0 -2
  56. package/build/types/legend/legend-categorical.d.ts +0 -2
  57. package/build/types/legend/legend-continuous.d.ts +0 -2
  58. package/build/types/legend/legend-discrete.d.ts +0 -2
  59. package/build/types/legend/legend.d.ts +0 -13
  60. package/build/types/legend/proportional-symbol/PropSymbolLegendConfig.d.ts +0 -0
  61. package/build/types/legend/proportional-symbol/legend-proportional-symbols.d.ts +0 -2
  62. package/build/types/map-types/CategoricalMap.d.ts +0 -21
  63. package/build/types/map-types/CategoricalMapConfig.d.ts +0 -11
  64. package/build/types/map-types/CateogricalMapConfig.d.ts +0 -11
  65. package/build/types/map-types/MapType.d.ts +0 -34
  66. package/build/types/map-types/choropleth/BivariateChoroplethConfig.d.ts +0 -27
  67. package/build/types/map-types/choropleth/BivariateChoroplethMap.d.ts +0 -39
  68. package/build/types/map-types/choropleth/ChoroplethConfig.d.ts +0 -39
  69. package/build/types/map-types/choropleth/ChoroplethMap.d.ts +0 -48
  70. package/build/types/map-types/choropleth/TrivariateChoroplethConfig.d.ts +0 -41
  71. package/build/types/map-types/choropleth/TrivariateChoroplethMap.d.ts +0 -18
  72. package/build/types/map-types/choropleth/ValueByAlphaConfig.d.ts +0 -8
  73. package/build/types/map-types/choropleth/ValueByAlphaMap.d.ts +0 -9
  74. package/build/types/map-types/choropleth/map-choropleth-bivariate.d.ts +0 -4
  75. package/build/types/map-types/choropleth/map-choropleth-trivariate.d.ts +0 -4
  76. package/build/types/map-types/choropleth/map-choropleth.d.ts +0 -47
  77. package/build/types/map-types/choropleth/map-value-by-alpha.d.ts +0 -4
  78. package/build/types/map-types/composition/BarMap.d.ts +0 -86
  79. package/build/types/map-types/composition/BarMapConfig.d.ts +0 -30
  80. package/build/types/map-types/composition/CompositionStatConfig.d.ts +0 -57
  81. package/build/types/map-types/composition/CoxcombMap.d.ts +0 -42
  82. package/build/types/map-types/composition/CoxcombMapConfig.d.ts +0 -18
  83. package/build/types/map-types/composition/PieMap.d.ts +0 -62
  84. package/build/types/map-types/composition/PieMapConfig.d.ts +0 -24
  85. package/build/types/map-types/composition/SparkMap.d.ts +0 -46
  86. package/build/types/map-types/composition/SparkMapConfig.d.ts +0 -25
  87. package/build/types/map-types/composition/StripeMap.d.ts +0 -43
  88. package/build/types/map-types/composition/StripeMapConfig.d.ts +0 -16
  89. package/build/types/map-types/composition/WaffleMap.d.ts +0 -71
  90. package/build/types/map-types/composition/WaffleMapConfig.d.ts +0 -25
  91. package/build/types/map-types/composition/bar/BarMap.d.ts +0 -97
  92. package/build/types/map-types/composition/bar/BarMapConfig.d.ts +0 -76
  93. package/build/types/map-types/composition/composition-map.d.ts +0 -25
  94. package/build/types/map-types/composition/coxcomb/CoxcombMap.d.ts +0 -75
  95. package/build/types/map-types/composition/coxcomb/CoxcombMapConfig.d.ts +0 -47
  96. package/build/types/map-types/composition/coxcomb/CoxcombStatConfig.d.ts +0 -13
  97. package/build/types/map-types/composition/map-bar.d.ts +0 -5
  98. package/build/types/map-types/composition/map-coxcomb.d.ts +0 -5
  99. package/build/types/map-types/composition/map-pie.d.ts +0 -10
  100. package/build/types/map-types/composition/map-spark.d.ts +0 -5
  101. package/build/types/map-types/composition/map-stripe.d.ts +0 -5
  102. package/build/types/map-types/composition/map-waffle.d.ts +0 -5
  103. package/build/types/map-types/composition/pie/PieMap.d.ts +0 -84
  104. package/build/types/map-types/composition/pie/PieMapConfig.d.ts +0 -50
  105. package/build/types/map-types/composition/stripe/StripeMap.d.ts +0 -80
  106. package/build/types/map-types/composition/stripe/StripeMapConfig.d.ts +0 -45
  107. package/build/types/map-types/composition/waffle/WaffleMap.d.ts +0 -124
  108. package/build/types/map-types/composition/waffle/WaffleMapConfig.d.ts +0 -58
  109. package/build/types/map-types/flow/FlowMap.d.ts +0 -218
  110. package/build/types/map-types/flow/FlowMapConfig.d.ts +0 -220
  111. package/build/types/map-types/flow/map-flow.d.ts +0 -5
  112. package/build/types/map-types/map-categorical.d.ts +0 -19
  113. package/build/types/map-types/proportional-symbol/ProportionalSymbolConfig.d.ts +0 -47
  114. package/build/types/map-types/proportional-symbol/ProportionalSymbolMap.d.ts +0 -94
  115. package/build/types/map-types/proportional-symbol/map-proportional-symbols.d.ts +0 -35
  116. package/build/types/map-types/proportional-symbol/mushroom/MushroomMap.d.ts +0 -67
  117. package/build/types/map-types/proportional-symbol/mushroom/MushroomMapConfig.d.ts +0 -39
  118. package/build/types/map-types/spark/SparkMap.d.ts +0 -56
  119. package/build/types/map-types/spark/SparkMapConfig.d.ts +0 -74
  120. package/build/types/map-types/spark/SparkStatConfig.d.ts +0 -32
@@ -4,13 +4,41 @@ import type { MapInstance as EurostatMap } from './MapInstance'
4
4
  * Configuration for tooltips
5
5
  */
6
6
  export interface TooltipConfig {
7
+ /** Custom tooltip text/HTML builder, called with the hovered region/symbol datum and the
8
+ * map instance. @example (region, map) => `<b>${region.properties.na}</b>` */
7
9
  textFunction?: (region: any, map: EurostatMap) => string
8
- /** Omit regions. */
10
+
11
+ /** Region IDs to skip showing/updating the tooltip for. */
9
12
  omitRegions?: string[]
10
- /** Max width. */
11
- maxWidth?: number
12
- /** Font size. */
13
- fontSize?: number
13
+
14
+ /**
15
+ * Fixed decimal places for the tooltip's displayed value (choropleth maps). Preserves
16
+ * trailing zeros (e.g. 7 -> "7.0") that the default formatter otherwise drops. Defaults to
17
+ * the max precision seen across the stat dataset's own values when unset.
18
+ */
19
+ decimals?: number
20
+
21
+ /** Show status flags (e.g. estimated/provisional) next to the value. Pass 'short' for the
22
+ * raw flag code instead of the expanded label. @default false */
23
+ showFlags?: boolean | 'short'
24
+
25
+ /** Id of the container element used to constrain the tooltip's position/bounds.
26
+ * @default the map's containerId, or svgId, or 'map' */
27
+ containerId?: string
28
+
29
+ /** Id of the tooltip's own `<div>` element. @default `em-tooltip-${containerId}` */
30
+ id?: string
31
+
32
+ /** Pixel offset {x, y} of the tooltip from the pointer. Takes precedence over xOffset/yOffset. */
33
+ offset?: { x?: number; y?: number }
34
+
35
+ /** X pixel offset of the tooltip from the pointer, used when offset.x is unset. @default 30 */
36
+ xOffset?: number
37
+ /** Y pixel offset of the tooltip from the pointer, used when offset.y is unset. @default 20 */
38
+ yOffset?: number
39
+
40
+ /** Opacity of the tooltip when shown. @default 1 */
41
+ opacity?: number
14
42
 
15
43
  [key: string]: any
16
44
  }
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Configuration for a single fill pattern overlay applied to specific regions.
3
+ * Pass an array of these to `map.patternFill([...])` to hatch/dot/cross-hatch specific
4
+ * regions on top of their normal fill (e.g. to flag missing/estimated data).
5
+ */
6
+ export interface PatternFillConfig {
7
+ /** Built-in pattern name, or any string when using a customPattern with a matching id. @default 'hatching' */
8
+ pattern?: 'hatching' | 'crosshatch' | 'dots' | (string & {})
9
+
10
+ /** Region IDs to apply this pattern to. */
11
+ regionIds?: string[]
12
+
13
+ /** Stroke/dot color for the pattern. @default '#000' */
14
+ color?: string
15
+
16
+ /** Stroke width (hatching/crosshatch) or dot radius (dots). @default 1 */
17
+ strokeWidth?: number
18
+
19
+ /** Distance between repeated pattern elements in pixels. @default 8 */
20
+ spacing?: number
21
+
22
+ /**
23
+ * Raw SVG markup for a custom `<pattern>` element, used instead of a built-in pattern.
24
+ * Must include an `id` attribute; that id is then used to reference the pattern.
25
+ * @example '<pattern id="my-pattern" ...>...</pattern>'
26
+ */
27
+ customPattern?: string
28
+
29
+ /** Label shown for this pattern in the legend. Patterns without a label are omitted from the legend. */
30
+ legendLabel?: string
31
+
32
+ /** Internal: resolved pattern element id, set automatically. */
33
+ patternId?: string
34
+ }
@@ -35,8 +35,16 @@ export interface GeometriesClass {
35
35
  /** Master copy of all centroid features before filtering */
36
36
  _allCentroidsFeatures: any[]
37
37
 
38
+ /** Returns GeoJSON features for all statistical regions at the map's current NUTS level
39
+ * (or the 4-level array [rg0,rg1,rg2,rg3] when nutsLevel is 'mixed', or worldrg for WORLD geo). */
40
+ getRegionFeatures(): any[]
41
+
38
42
  /** Fetches default geographic data from NUTS2JSON */
39
- getDefaultGeoData(geo: string, filterFunction: any, nutsLevel: number | string): Promise<void>
43
+ getDefaultGeoData(geo: string, filterFunction: any, nutsLevel: number | string): Promise<any[]>
44
+ /** Returns the array of NUTS2JSON fetch promises used by getDefaultGeoData(). */
45
+ getDefaultGeoDataPromise(): Promise<any>[]
46
+ /** Returns true once default geo data (or user geometries) has loaded for this map and every inset. */
47
+ isGeoReady(): boolean
40
48
  /** Sets user-defined custom geometries */
41
49
  setUserGeometries(geometries: any[]): void
42
50
  /** Adds default NUTS geometries to the map */
@@ -60,6 +68,10 @@ export interface GeometriesClass {
60
68
  ): void
61
69
  /** Adds user-defined geometries to the map */
62
70
  addUserGeometriesToMap(geometries: any[], zoomGroup: any, pathFunction: any): void
71
+ /** Returns all statistical region features (used e.g. for statistical value labelling). */
72
+ getAllRegionFeatures(): any[]
73
+ /** Returns a Map of region id -> projected [x, y] centroid, computed via the given d3 path function. */
74
+ getRegionCentroids(pathFunction: any): Map<string, [number, number]>
63
75
  }
64
76
 
65
77
  /**
@@ -1,31 +1,49 @@
1
- import type { MapInstance } from '../MapInstance'
2
- import type { EncodingConfig } from '../encoding/EncodingConfig'
3
- import type { StatData } from '../stat/StatData'
4
- import type { LayerRole } from './LayerRole'
5
-
6
- export interface Layer {
7
- map: MapInstance
8
- isLayer: true
9
- id: string
10
- type: string
11
- role: LayerRole
12
-
13
- encodings_: Record<string, EncodingConfig>
14
-
15
- encoding(): Record<string, EncodingConfig>
16
- encoding(channel: string): EncodingConfig | undefined
17
- encoding(channel: string, config: EncodingConfig): Layer
18
- encoding(map: Record<string, EncodingConfig>): Layer
19
-
20
- getEncodingStat(channel: string, fallback?: string): string | undefined
21
- getEncodingStats(channel: string, fallback?: string[]): string[] | undefined
22
- getEncodingStatKey(channel: string, categoryCode?: string, fallbackStat?: string): string
23
- getEncodingStatData(channel: string, categoryCode?: string, fallbackStat?: string): StatData
24
- getEncodingValue(channel: string, regionId: string, categoryCode?: string, fallbackStat?: string): number | string | undefined
25
- getEncodingUnitText(channel: string, categoryCode?: string, fallbackStat?: string): string
26
-
27
- updateClassification(): Layer
28
- updateStyle(): Layer
29
- getLegendConstructor(): (map: MapInstance, config?: any) => any
30
- group(): any // d3 selection
31
- }
1
+ import type { MapInstance } from '../MapInstance'
2
+ import type { EncodingConfig } from '../encoding/EncodingConfig'
3
+ import type { StatData } from '../stat/StatData'
4
+ import type { StatConfig } from '../stat/StatConfig'
5
+ import type { CompositionStatConfig } from '../../layers/composition/CompositionStatConfig'
6
+ import type { LegendConfig } from '../../legend/LegendConfig'
7
+ import type { LayerRole } from './LayerRole'
8
+
9
+ export interface Layer {
10
+ map: MapInstance
11
+ isLayer: true
12
+ id: string
13
+ type: string
14
+ role: LayerRole
15
+
16
+ encodings_: Record<string, EncodingConfig>
17
+
18
+ encoding(): Record<string, EncodingConfig>
19
+ encoding(channel: string): EncodingConfig | undefined
20
+ encoding(channel: string, config: EncodingConfig): Layer
21
+ encoding(map: Record<string, EncodingConfig>): Layer
22
+
23
+ getEncodingStat(channel: string, fallback?: string): string | undefined
24
+ getEncodingStats(channel: string, fallback?: string[]): string[] | undefined
25
+ getEncodingStatKey(channel: string, categoryCode?: string, fallbackStat?: string): string
26
+ getEncodingStatData(channel: string, categoryCode?: string, fallbackStat?: string): StatData
27
+ getEncodingValue(channel: string, regionId: string, categoryCode?: string, fallbackStat?: string): number | string | undefined
28
+ getEncodingUnitText(channel: string, categoryCode?: string, fallbackStat?: string): string
29
+
30
+ /** Forwards to the owning map's stat() - statistical data is always map-level. */
31
+ stat(): StatConfig | CompositionStatConfig | undefined
32
+ stat(config: StatConfig | CompositionStatConfig): this
33
+ stat(key: string): StatConfig | CompositionStatConfig | undefined
34
+ stat(key: string, config: StatConfig | CompositionStatConfig): this
35
+
36
+ /** Forwards to the owning map's statData() - statistical data is always map-level. */
37
+ statData(): StatData
38
+ statData(key: string): StatData
39
+ statData(key: string, data: StatData): this
40
+
41
+ /** Get or set this layer's own legend configuration, independent of the map facade's. */
42
+ legend(): LegendConfig | false | undefined
43
+ legend(config: LegendConfig | false): this
44
+
45
+ updateClassification(): Layer
46
+ updateStyle(): Layer
47
+ getLegendConstructor(): (map: MapInstance, config?: any) => any
48
+ group(): any // d3 selection
49
+ }
@@ -4,12 +4,20 @@ import type { MapInstance } from './MapInstance'
4
4
  * Configuration for the minimap globe feature.
5
5
  */
6
6
  export interface MinimapConfig {
7
- /** Size of the minimap in pixels. @default 150 */
7
+ /** Diameter of the minimap in pixels. @default 160 (defaults to 150 if unset before first draw) */
8
8
  size?: number
9
9
  /** Debounce delay in milliseconds for updating the minimap during zoom/pan. @default 3 */
10
10
  debounce?: number
11
- /** Position [x, y] in pixels. If not specified, positioned in top-left corner */
12
- position?: [number, number]
11
+ /** X position of the minimap center in pixels. @default 80 */
12
+ x?: number
13
+ /** Y position of the minimap center in pixels. @default 80 */
14
+ y?: number
15
+ /** Orthographic projection scale (globe zoom level) in pixels. @default 160 */
16
+ z?: number
17
+ /** Color of the outer ring and highlighted region(s). @default '#929292ff' */
18
+ color?: string
19
+ /** Region/country IDs to highlight on the globe (e.g. the main map's current country focus). */
20
+ highlightIds?: string[]
13
21
  }
14
22
 
15
23
  /**
@@ -1,5 +1,3 @@
1
- import type { StatConfig } from './StatConfig'
2
-
3
1
  /**
4
2
  * A statistical dataset indexed by NUTS region ID.
5
3
  * Returned by map.statData() and created internally by statData().
@@ -101,6 +99,8 @@ export interface StatData {
101
99
  eurostatDatasetCode_?: string
102
100
  /** CSV source URL. */
103
101
  csvURL_?: string
102
+ /** Dataset label/name from the Eurostat API response or stat() config. */
103
+ label_?: string
104
104
 
105
105
  /**
106
106
  * Fetches data from the configured remote source (Eurostat API or CSV).
@@ -196,3 +196,47 @@ export const compactFormatter: Intl.NumberFormat
196
196
  * Long number formatter.
197
197
  */
198
198
  export const longFormatter: Intl.NumberFormat
199
+
200
+ /**
201
+ * Formats a raw numeric value as a space-thousands-separated string (e.g. 1234567 -> "1 234 567").
202
+ * Returns '0' for null/undefined/NaN input.
203
+ */
204
+ export function formatRawValue(value: number | null | undefined): string
205
+
206
+ /**
207
+ * Prefix used to encode extra categorical values (e.g. "no data" exceptions) mixed into an
208
+ * otherwise-numeric choropleth classification, so they don't collide with numeric class indices.
209
+ */
210
+ export const CATEGORY_ECL_PREFIX: string
211
+
212
+ /**
213
+ * Encodes a raw categorical value as an `ecl` attribute value, prefixed with CATEGORY_ECL_PREFIX.
214
+ */
215
+ export function toCategoryEcl(rawValue: string | number): string
216
+
217
+ /**
218
+ * Decodes an `ecl` attribute value produced by toCategoryEcl() back to its raw categorical value.
219
+ * Returns undefined if the input isn't a category-prefixed ecl value.
220
+ */
221
+ export function fromCategoryEcl(ecl: string): string | undefined
222
+
223
+ /**
224
+ * Rounds a value to the nearest "nice" number (1, 1.5, 2, 2.5, 3, 4, 5, 6, 7, 8, 9, or 10 times a
225
+ * power of ten), clamped to the given [min, max] range (with a small margin).
226
+ */
227
+ export function roundToNiceNumber(value: number, min: number, max: number): number
228
+
229
+ /**
230
+ * Adjusts a sorted array of unique threshold values to have exactly targetCount entries, splitting
231
+ * the largest gap (including the gaps to min/max) when rounding produced duplicates/fewer values
232
+ * than requested.
233
+ */
234
+ export function adjustDuplicateThresholds(uniqueThresholds: number[], targetCount: number, min: number, max: number): number[]
235
+
236
+ /**
237
+ * Rounds classification thresholds to nice, legible values while preserving the original
238
+ * threshold count, resolving any duplicates introduced by rounding.
239
+ * @param thresholds - Raw threshold values from the classifier
240
+ * @param values - Full data array (used to derive min/max bounds)
241
+ */
242
+ export function applyNiceNumbers(thresholds: number[], values: number[]): number[]
@@ -65,6 +65,7 @@ export type { CoastalMarginSettings } from './core/decoration/CoastalMarginSetti
65
65
  export type { ScalebarConfig } from './core/decoration/ScalebarConfig'
66
66
  export type { StampConfig } from './core/decoration/StampConfig'
67
67
  export type { LabelsConfig, Label } from './core/decoration/LabelsConfig'
68
+ export type { PatternFillConfig } from './core/decoration/PatternFillConfig'
68
69
  export type { RankedBarChartConfig } from './core/decoration/RankedBarChartConfig'
69
70
  export type { GridCartogramSettings, GridCartogramMargins } from './core/GridCartogramSettings'
70
71
  export type { DorlingSettings, DorlingStrength } from './core/DorlingSettings'
@@ -75,6 +76,8 @@ export type { Layer } from './core/layer/Layer'
75
76
  export type { LayerConfig } from './core/layer/LayerConfig'
76
77
  export type { LayerRole } from './core/layer/LayerRole'
77
78
 
79
+ import type { LayerRole } from './core/layer/LayerRole'
80
+
78
81
  // ==================== Legend Configuration Type Exports ====================
79
82
 
80
83
  // Main legend types
@@ -91,14 +94,14 @@ export type { TrivariateLegendConfig } from './legend/choropleth/TrivariateLegen
91
94
 
92
95
  // Composition legend types
93
96
  export type { BarChartLegendConfig } from './legend/composition/BarChartLegendConfig'
94
- export type { BarChartSizeLegendConfig, BarChartColorLegendConfig } from './legend/composition/BarChartLegendConfig'
97
+ export type { BarChartSizeLegendConfig, BarChartWidthLegendConfig, BarChartColorLegendConfig } from './legend/composition/BarChartLegendConfig'
95
98
  export type { CoxcombLegendConfig } from './legend/composition/CoxcombLegendConfig'
96
99
  export type { CoxcombSizeLegendConfig, CoxcombColorLegendConfig, CoxcombTimeLegendConfig } from './legend/composition/CoxcombLegendConfig'
97
100
  export type { PieChartLegendConfig } from './legend/composition/PieChartLegendConfig'
98
101
  export type { PieChartSizeLegendConfig, PieChartColorLegendConfig } from './legend/composition/PieChartLegendConfig'
99
102
  export type { WaffleLegendConfig } from './legend/composition/WaffleLegendConfig'
100
103
  export type { WaffleSizeLegendConfig, WaffleColorLegendConfig } from './legend/composition/WaffleLegendConfig'
101
- export type { StripeCompositionLegendConfig } from './legend/composition/StripeCompositionLegendConfig'
104
+ export type { StripeCompositionLegendConfig, StripeCompositionColorLegendConfig } from './legend/composition/StripeCompositionLegendConfig'
102
105
  export type {
103
106
  SparklineLegendConfig,
104
107
  SparklineScaleLegendConfig,
@@ -235,20 +238,42 @@ export function map(type: MapType, config?: MapConfig): MapInstance
235
238
  */
236
239
  export function getFillPatternDefinitionFunction(opts?: FillPatternOptions): (svg: any, numberOfClasses: number) => void
237
240
 
241
+ /**
242
+ * @deprecated Use getFillPatternDefinitionFunction instead. Kept as an alias for backwards
243
+ * compatibility.
244
+ */
245
+ export function getFillPatternDefinitionFun(opts?: FillPatternOptions): (svg: any, numberOfClasses: number) => void
246
+
238
247
  /**
239
248
  * Get default labels for the map
240
249
  */
241
250
  export function getDefaultLabels(): { [key: string]: any }
242
251
 
252
+ /**
253
+ * Registers a custom layer type so it can be used with map.addLayer() and, once the type
254
+ * itself is recognized elsewhere in the build chain, with eurostatmap.map(type).
255
+ *
256
+ * @param type - Unique layer type identifier
257
+ * @param role - 'base' (paints shared region geometry, at most one per map) or 'overlay'
258
+ * @param decorate - Function that attaches the layer's fluent API/behavior onto a created Layer
259
+ */
260
+ export function registerLayerType(type: string, role: LayerRole, decorate: (layer: any, config: any) => void): void
261
+
262
+ /**
263
+ * Returns true if the given layer type has been registered via registerLayerType (or is a
264
+ * built-in type available through the multi-layer API).
265
+ */
266
+ export function isLayerTypeRegistered(type: string): boolean
267
+
243
268
  /**
244
269
  * Project coordinates from map pixel space to geographic coordinates
245
270
  *
246
271
  * @param map - The map object
247
272
  * @param x - X pixel coordinate
248
273
  * @param y - Y pixel coordinate
249
- * @returns [longitude, latitude]
274
+ * @returns [longitude, latitude], or null if projection fails
250
275
  */
251
- export function projectFromMap(map: MapInstance, x: number, y: number): [number, number]
276
+ export function projectFromMap(map: MapInstance, x: number, y: number): [number, number] | null
252
277
 
253
278
  /**
254
279
  * Project geographic coordinates to map pixel space
@@ -256,9 +281,9 @@ export function projectFromMap(map: MapInstance, x: number, y: number): [number,
256
281
  * @param map - The map object
257
282
  * @param lon - Longitude
258
283
  * @param lat - Latitude
259
- * @returns [x, y] pixel coordinates
284
+ * @returns [x, y] pixel coordinates, or null if projection fails
260
285
  */
261
- export function projectToMap(map: MapInstance, lon: number, lat: number): [number, number]
286
+ export function projectToMap(map: MapInstance, lon: number, lat: number): [number, number] | null
262
287
 
263
288
  /**
264
289
  * Library version
@@ -272,12 +297,18 @@ declare const eurostatmap: {
272
297
  map: typeof map
273
298
  /** Get fill pattern definition function. */
274
299
  getFillPatternDefinitionFunction: typeof getFillPatternDefinitionFunction
300
+ /** @deprecated Use getFillPatternDefinitionFunction instead. */
301
+ getFillPatternDefinitionFun: typeof getFillPatternDefinitionFun
275
302
  /** Get default labels. */
276
303
  getDefaultLabels: typeof getDefaultLabels
277
304
  /** Project from map. */
278
305
  projectFromMap: typeof projectFromMap
279
306
  /** Project to map. */
280
307
  projectToMap: typeof projectToMap
308
+ /** Register a custom layer type. */
309
+ registerLayerType: typeof registerLayerType
310
+ /** Check whether a layer type is registered. */
311
+ isLayerTypeRegistered: typeof isLayerTypeRegistered
281
312
  /** Version. */
282
313
  version: typeof version
283
314
  }
@@ -4,18 +4,18 @@ import type { MapInstance } from '../core/MapInstance'
4
4
  * Categorical map type.
5
5
  */
6
6
  export interface CategoricalMap extends MapInstance {
7
- classToFillStyle(): any
8
- classToFillStyle(v: any): this
7
+ /** Fill color for each category value. Auto-generated from a default palette when unset. */
8
+ classToFillStyle(): Record<string, string> | undefined
9
+ classToFillStyle(v: Record<string, string>): this
9
10
 
10
- classToText(): any
11
- classToText(v: any): this
11
+ /** Legend/tooltip label for each category value. */
12
+ classToText(): Record<string, string> | undefined
13
+ classToText(v: Record<string, string>): this
12
14
 
13
15
  noDataFillStyle(): string
14
16
  noDataFillStyle(v: string): this
15
17
 
16
- tooltipText(): any
17
- tooltipText(v: any): this
18
-
19
- classifier(): any
20
- classifier(v: any): this
18
+ /** The classifier (d3 ordinal scale) mapping a category value to a class number. */
19
+ classifier(): ((value: string | number) => number) & { domain: (d?: (string | number)[]) => any }
20
+ classifier(v: ((value: string | number) => number) & { domain?: (d?: (string | number)[]) => any }): this
21
21
  }
@@ -22,6 +22,9 @@ export interface BivariateChoroplethConfig extends MapConfig {
22
22
  color2?: string
23
23
  /** End color. */
24
24
  endColor?: string
25
+ /** Function mapping the two class indices (ecl1, ecl2) to a fill color. Auto-derived from
26
+ * startColor/color1/color2/endColor (or the legacy oranges/blues default) when unset. */
27
+ classToFillStyle?: (ecl1: number, ecl2: number) => string | null
25
28
  /** No data fill style. */
26
29
  noDataFillStyle?: string
27
30
  }
@@ -25,15 +25,18 @@ export interface BivariateChoroplethMap extends MapInstance {
25
25
  endColor(): string
26
26
  endColor(v: string): this
27
27
 
28
- classToFillStyle(): any
29
- classToFillStyle(v: any): this
28
+ /** Function mapping the two class indices (ecl1, ecl2) to a fill color. */
29
+ classToFillStyle(): (ecl1: number, ecl2: number) => string | null
30
+ classToFillStyle(v: (ecl1: number, ecl2: number) => string | null): this
30
31
 
31
32
  noDataFillStyle(): string
32
33
  noDataFillStyle(v: string): this
33
34
 
34
- classifier1(): any
35
- classifier1(v: any): this
35
+ /** The classifier (d3 scale) mapping the first variable's stat value to a class number. */
36
+ classifier1(): ((value: number) => number) | undefined
37
+ classifier1(v: (value: number) => number): this
36
38
 
37
- classifier2(): any
38
- classifier2(v: any): this
39
+ /** The classifier (d3 scale) mapping the second variable's stat value to a class number. */
40
+ classifier2(): ((value: number) => number) | undefined
41
+ classifier2(v: (value: number) => number): this
39
42
  }
@@ -22,8 +22,8 @@ export interface ChoroplethConfig extends MapConfig {
22
22
  colorFunction?: (t: number) => string
23
23
  /** Color scheme type. */
24
24
  colorSchemeType?: 'discrete' | 'continuous'
25
- /** Class to fill style. */
26
- classToFillStyle?: { [classIndex: number]: string }
25
+ /** Function mapping a class index (or category ecl code) and the number of classes to a fill color. */
26
+ classToFillStyle?: (ecl: number | string, numberOfClasses: number) => string
27
27
 
28
28
  /** No-data styling. */
29
29
  noDataFillStyle?: string
@@ -44,5 +44,5 @@ export interface ChoroplethConfig extends MapConfig {
44
44
  skipNormalization?: boolean
45
45
 
46
46
  /** Diverging schemes. */
47
- pointOfDivergence?: number
47
+ pointOfDivergence?: number | null
48
48
  }
@@ -22,11 +22,13 @@ export interface ChoroplethMap extends MapInstance {
22
22
  makeClassifNice(): boolean
23
23
  makeClassifNice(v: boolean): this
24
24
 
25
- classToFillStyle(): any
26
- classToFillStyle(v: any): this
25
+ /** Function mapping a class index (or category ecl code) and the number of classes to a fill color. */
26
+ classToFillStyle(): (ecl: number | string, numberOfClasses: number) => string
27
+ classToFillStyle(v: (ecl: number | string, numberOfClasses: number) => string): this
27
28
 
28
- classifier(): any
29
- classifier(v: any): this
29
+ /** The classifier function/scale mapping a stat value to a class number. */
30
+ classifier(): (value: number) => number
31
+ classifier(v: (value: number) => number): this
30
32
 
31
33
  colorSchemeType(): string
32
34
  colorSchemeType(type: 'discrete' | 'continuous'): this
@@ -51,4 +53,14 @@ export interface ChoroplethMap extends MapInstance {
51
53
 
52
54
  categoryText(): { [rawValue: string]: string } | undefined
53
55
  categoryText(v: { [rawValue: string]: string }): this
56
+
57
+ /** SVG filter/pattern definition function used for fill patterns (e.g. dot density). */
58
+ filtersDefinitionFunction(): ((svg: any, numberOfClasses: number) => void) | undefined
59
+ filtersDefinitionFunction(fn: (svg: any, numberOfClasses: number) => void): this
60
+
61
+ /** Manually highlight a region by ID, simulating a mouseover (fill + tooltip). */
62
+ highlightRegion(regionId: string): this
63
+
64
+ /** Clear any region highlighted via highlightRegion(), simulating a mouseout. */
65
+ clearHighlight(): this
54
66
  }
@@ -7,6 +7,10 @@ type TernarySettings = TrivariateTernarySettings
7
7
  * Trivariate choropleth map type.
8
8
  */
9
9
  export interface TrivariateChoroplethMap extends MapInstance {
10
+ /** Returns the resolved [v1, v2, v3] stat codes for the three ternary variables, honoring
11
+ * any 'color' encoding before falling back to ternaryCodes. */
12
+ getTernaryStatCodes(): [string, string, string]
13
+
10
14
  ternaryCodes(): string[]
11
15
  ternaryCodes(v: string[]): this
12
16
 
@@ -1,9 +1,10 @@
1
- import type { MapInstance } from '../../core/MapInstance'
1
+ import type { ChoroplethMap } from './ChoroplethMap'
2
2
 
3
3
  /**
4
- * Value-by-alpha choropleth map type.
4
+ * Value-by-alpha choropleth map type. Extends the choropleth map API (it reuses
5
+ * decorateChoroplethLayer internally) with an opacity channel driven by a second stat.
5
6
  */
6
- export interface ValueByAlphaMap extends MapInstance {
7
+ export interface ValueByAlphaMap extends ChoroplethMap {
7
8
  opacityScale(): ((value: number) => number) | null
8
9
  opacityScale(v: ((value: number) => number) | null): this
9
10
  }