eurostat-map 4.8.2 → 4.8.5

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.
@@ -1,87 +1,87 @@
1
- {
2
- "name": "eurostat-map",
3
- "version": "4.8.2",
4
- "description": "Reusable library to quickly create and customise web maps showing Eurostat data directly retrieved from Eurostat database.",
5
- "keywords": [
6
- "eurostat",
7
- "statistics",
8
- "europe",
9
- "SVG",
10
- "NUTS",
11
- "map",
12
- "D3",
13
- "cartography",
14
- "thematic",
15
- "mapping",
16
- "eurostat-map",
17
- "dataviz",
18
- "data visualization"
19
- ],
20
- "homepage": "https://github.com/eurostat/eurostat-map",
21
- "author": "",
22
- "license": "EUPL-1.2",
23
- "repository": {
24
- "type": "git",
25
- "url": "https://github.com/eurostat/eurostat-map.git"
26
- },
27
- "main": "build/eurostatmap.min.js",
28
- "unpkg": "build/eurostatmap.min.js",
29
- "module": "build/eurostatmap.js",
30
- "types": "build/types/index.d.ts",
31
- "typings": "build/types/index.d.ts",
32
- "files": [
33
- "build"
34
- ],
35
- "scripts": {
36
- "start": "webpack --config webpack/webpack.config.dev.js",
37
- "server": "webpack-dev-server --open --watch",
38
- "build-types": "tsc --project tsconfig.json",
39
- "build-prod": "npm run build-types && webpack --config webpack/webpack.config.prod.js",
40
- "build-prod-debug": "webpack --config webpack/webpack.config.debug-size.js",
41
- "format": "prettier --write .",
42
- "test": "jest",
43
- "type-check": "tsc --noEmit"
44
- },
45
- "dependencies": {
46
- "d3-array": "^3.2.4",
47
- "d3-axis": "^3.0.0",
48
- "d3-ease": "^3.0.1",
49
- "d3-fetch": "^3.0.1",
50
- "d3-force": "^3.0.0",
51
- "d3-format": "^3.1.0",
52
- "d3-geo": "^3.1.1",
53
- "d3-geo-projection": "^3.0.0",
54
- "d3-interpolate": "^3.0.1",
55
- "d3-scale": "^4.0.2",
56
- "d3-scale-chromatic": "^3.1.0",
57
- "d3-selection": "^3.0.0",
58
- "d3-shape": "^3.2.0",
59
- "d3-svg-annotation": "^2.5.1",
60
- "d3-zoom": "^3.0.0",
61
- "idb-keyval": "^6.2.2",
62
- "jsonstat-toolkit": "^1.0.8",
63
- "proj4": "^2.17.0",
64
- "simple-statistics": "^7.8.8",
65
- "topojson-client": "^3.1.0"
66
- },
67
- "overrides": {
68
- "d3-color": "3.1.0"
69
- },
70
- "devDependencies": {
71
- "@babel/core": "^7.22.6",
72
- "@babel/plugin-transform-runtime": "^7.22.6",
73
- "@babel/preset-env": "^7.22.6",
74
- "@babel/runtime": "^7.12.1",
75
- "babel-loader": "^9.1.2",
76
- "css-loader": "^7.1.2",
77
- "prettier": "^3.4.1",
78
- "style-loader": "^4.0.0",
79
- "ts-loader": "^9.5.4",
80
- "typescript": "^5.9.3",
81
- "webpack": "^5.88.1",
82
- "webpack-bundle-analyzer": "^4.10.2",
83
- "webpack-cli": "^5.0.0",
84
- "webpack-dev-server": "^5.2.2",
85
- "webpack-livereload-plugin": "^3.0.2"
86
- }
87
- }
1
+ {
2
+ "name": "eurostat-map",
3
+ "version": "4.8.5",
4
+ "description": "Reusable library to quickly create and customise web maps showing Eurostat data directly retrieved from Eurostat database.",
5
+ "keywords": [
6
+ "eurostat",
7
+ "statistics",
8
+ "europe",
9
+ "SVG",
10
+ "NUTS",
11
+ "map",
12
+ "D3",
13
+ "cartography",
14
+ "thematic",
15
+ "mapping",
16
+ "eurostat-map",
17
+ "dataviz",
18
+ "data visualization"
19
+ ],
20
+ "homepage": "https://github.com/eurostat/eurostat-map",
21
+ "author": "",
22
+ "license": "EUPL-1.2",
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "https://github.com/eurostat/eurostat-map.git"
26
+ },
27
+ "main": "build/eurostatmap.min.js",
28
+ "unpkg": "build/eurostatmap.min.js",
29
+ "module": "build/eurostatmap.js",
30
+ "types": "build/types/index.d.ts",
31
+ "typings": "build/types/index.d.ts",
32
+ "files": [
33
+ "build"
34
+ ],
35
+ "scripts": {
36
+ "start": "webpack --config webpack/webpack.config.dev.js",
37
+ "server": "webpack-dev-server --open --watch",
38
+ "build-types": "tsc --project tsconfig.json",
39
+ "build-prod": "npm run build-types && webpack --config webpack/webpack.config.prod.js",
40
+ "build-prod-debug": "webpack --config webpack/webpack.config.debug-size.js",
41
+ "format": "prettier --write .",
42
+ "test": "jest",
43
+ "type-check": "tsc --noEmit"
44
+ },
45
+ "dependencies": {
46
+ "d3-array": "^3.2.4",
47
+ "d3-axis": "^3.0.0",
48
+ "d3-ease": "^3.0.1",
49
+ "d3-fetch": "^3.0.1",
50
+ "d3-force": "^3.0.0",
51
+ "d3-format": "^3.1.0",
52
+ "d3-geo": "^3.1.1",
53
+ "d3-geo-projection": "^3.0.0",
54
+ "d3-interpolate": "^3.0.1",
55
+ "d3-scale": "^4.0.2",
56
+ "d3-scale-chromatic": "^3.1.0",
57
+ "d3-selection": "^3.0.0",
58
+ "d3-shape": "^3.2.0",
59
+ "d3-svg-annotation": "^2.5.1",
60
+ "d3-zoom": "^3.0.0",
61
+ "idb-keyval": "^6.2.2",
62
+ "jsonstat-toolkit": "^1.0.8",
63
+ "proj4": "^2.17.0",
64
+ "simple-statistics": "^7.8.8",
65
+ "topojson-client": "^3.1.0"
66
+ },
67
+ "overrides": {
68
+ "d3-color": "3.1.0"
69
+ },
70
+ "devDependencies": {
71
+ "@babel/core": "^7.22.6",
72
+ "@babel/plugin-transform-runtime": "^7.22.6",
73
+ "@babel/preset-env": "^7.22.6",
74
+ "@babel/runtime": "^7.12.1",
75
+ "babel-loader": "^9.1.2",
76
+ "css-loader": "^7.1.2",
77
+ "prettier": "^3.4.1",
78
+ "style-loader": "^4.0.0",
79
+ "ts-loader": "^9.5.4",
80
+ "typescript": "^5.9.3",
81
+ "webpack": "^5.88.1",
82
+ "webpack-bundle-analyzer": "^4.10.2",
83
+ "webpack-cli": "^5.0.0",
84
+ "webpack-dev-server": "^5.2.2",
85
+ "webpack-livereload-plugin": "^3.0.2"
86
+ }
87
+ }
@@ -1,23 +1,71 @@
1
- /**
2
- * Configuration for map insets (smaller additional maps)
3
- */
4
- export interface InsetConfig {
5
- /** Geographic code (e.g., 'MT', 'PT20', 'CARIB'). */
6
- geo?: string
7
- /** Title. */
8
- title?: string
9
- /** Scale. */
10
- scale?: string | number
11
- /** Width. */
12
- width?: number
13
- /** Height. */
14
- height?: number
15
- /** X. */
16
- x?: number
17
- /** Y. */
18
- y?: number
19
- /** Proj. */
20
- proj?: string
21
-
22
- [key: string]: any
23
- }
1
+ import type { LabelsConfig } from './decoration/LabelsConfig'
2
+ import type { ScalebarConfig } from './decoration/ScalebarConfig'
3
+
4
+ /**
5
+ * Configuration for map insets (smaller additional maps, e.g. overseas territories)
6
+ */
7
+ export interface InsetConfig {
8
+ /** Geographic code (e.g., 'MT', 'PT20', 'CARIB'). */
9
+ geo?: string
10
+ /** Title. */
11
+ title?: string
12
+ /** Position of the title, relative to the inset's top-left corner. */
13
+ titlePosition?: [number, number]
14
+ /** Subtitle. */
15
+ subtitle?: string
16
+ /** Position of the subtitle, relative to the inset's top-left corner. */
17
+ subtitlePosition?: [number, number]
18
+ /** Scale. Named nuts2json scale (e.g. '01M', '03M', '10M', '20M', '60M') or a number. */
19
+ scale?: string | number
20
+ /** Width. */
21
+ width?: number
22
+ /** Height. */
23
+ height?: number
24
+ /** X position of the inset within the inset box. */
25
+ x?: number
26
+ /** Y position of the inset within the inset box. */
27
+ y?: number
28
+ /** Proj. */
29
+ proj?: string
30
+ /** Id of the `<svg>` element the inset is drawn into. Auto-generated if omitted. */
31
+ svgId?: string
32
+ /** Manual re-centering/zoom of the inset's own projection. */
33
+ position?: { x?: number; y?: number; z?: number }
34
+ /** Label rendering settings for this inset. */
35
+ labels?: LabelsConfig
36
+ /** Whether to show zoom buttons on this inset. @default false */
37
+ zoomButtons?: boolean
38
+ /** Custom base URL for this inset's nuts2json boundary data. */
39
+ nuts2jsonBaseURL?: string
40
+ /** Custom D3 projection function for this inset. */
41
+ projectionFunction?: Function | boolean
42
+
43
+ /** Scalebar settings for this inset. `true` uses the default scalebar config. */
44
+ scalebar?: ScalebarConfig | boolean
45
+
46
+ /** @deprecated Use `scalebar: { show: true }` instead. */
47
+ showScalebar?: boolean
48
+ /** @deprecated Use `scalebar: { position: [x, y] }` instead. */
49
+ scalebarPosition?: [number, number]
50
+ /** @deprecated Use `scalebar: { tickHeight }` instead. */
51
+ scalebarTickHeight?: number
52
+ /** @deprecated Use `scalebar: { segmentHeight }` instead. */
53
+ scalebarSegmentHeight?: number
54
+ /** Scalebar label font size in pixels. */
55
+ scalebarFontSize?: number
56
+ /** @deprecated Use `scalebar: { units }` instead. */
57
+ scalebarUnits?: string
58
+ /** @deprecated Use `scalebar: { textOffset }` instead. */
59
+ scalebarTextOffset?: [number, number]
60
+ /** @deprecated Use `scalebar: { maxWidth }` instead. */
61
+ scalebarMaxWidth?: number
62
+ /** Minimum width of the scalebar in pixels. */
63
+ scalebarMinWidth?: number
64
+
65
+ /** Nested insets belonging to this inset (e.g. bivariate choropleth per-inset legend classification). */
66
+ insets?: InsetConfig[]
67
+ /** Position of nested insets' inset box, relative to this inset. */
68
+ insetBoxPosition?: [number, number]
69
+
70
+ [key: string]: any
71
+ }
@@ -1,3 +1,19 @@
1
+ /**
2
+ * A single map label (country name, statistical value label, etc.)
3
+ */
4
+ export interface Label {
5
+ text: string
6
+ x: number
7
+ y: number
8
+ class?: string
9
+ /** Font size in pixels. @deprecated Use CSS classes instead. */
10
+ size?: number
11
+ rotate?: number | null
12
+ letterSpacing?: number
13
+ /** Country code, when this label represents a country. */
14
+ cc?: string
15
+ }
16
+
1
17
  /**
2
18
  * Configuration for map labels (country names, statistical values, etc.)
3
19
  */
@@ -6,16 +22,7 @@ export interface LabelsConfig {
6
22
  * Array of label objects with text and coordinates.
7
23
  * Use eurostatmap.getDefaultLabels() to get predefined geographic labels.
8
24
  */
9
- labels?: Array<{
10
- text: string
11
- x: number
12
- y: number
13
- class?: string
14
- size?: number
15
- rotate?: number
16
- letterSpacing?: number
17
- cc?: string
18
- }>
25
+ labels?: Label[]
19
26
 
20
27
  /**
21
28
  * Show statistical values as labels on regions.
@@ -64,10 +64,11 @@ export type { InsetConfig } from './core/InsetConfig'
64
64
  export type { CoastalMarginSettings } from './core/decoration/CoastalMarginSettings'
65
65
  export type { ScalebarConfig } from './core/decoration/ScalebarConfig'
66
66
  export type { StampConfig } from './core/decoration/StampConfig'
67
+ export type { LabelsConfig, Label } from './core/decoration/LabelsConfig'
67
68
  export type { GridCartogramSettings, GridCartogramMargins } from './core/GridCartogramSettings'
68
69
  export type { DorlingSettings, DorlingStrength } from './core/DorlingSettings'
69
70
  export type { MinimapConfig } from './core/minimaps'
70
- export type { LocationConfig } from './core/locations'
71
+ export type { LocationConfig, LocationLabelStyle, LocationShape } from './core/locations'
71
72
  export type { GeometriesClass } from './core/geo/geometries'
72
73
  export type { Layer } from './core/layer/Layer'
73
74
  export type { LayerConfig } from './core/layer/LayerConfig'
@@ -6,6 +6,8 @@ import type { MapConfig } from '../core/MapConfig'
6
6
  export interface CategoricalMapConfig extends MapConfig {
7
7
  /** Category-to-color mapping */
8
8
  classToFillStyle?: Record<string, string>
9
+ /** Category-to-label mapping, used for legend text and tooltips */
10
+ classToText?: Record<string, string>
9
11
  /** Fill style for regions with no data */
10
12
  noDataFillStyle?: string
11
13
  }
@@ -1,73 +1,73 @@
1
- /**
2
- * Parent configuration for map legends. Each map type will extend this with its own specific properties, but these are the common ones that apply to all legend types.
3
- */
4
- export interface LegendConfig {
5
- /** Legend origin x-coordinate in pixels. */
6
- x?: number
7
- /** Legend origin y-coordinate in pixels. */
8
- y?: number
9
- /** Automatically position the legend in a map corner. Manual x/y coordinates take precedence. */
10
- position?: 'top right' | 'bottom right' | 'top left' | 'bottom left'
11
- /** Legend width in pixels. */
12
- width?: number
13
- /** Legend height in pixels. */
14
- height?: number
15
-
16
- /** Legend title text. */
17
- title?: string
18
- /** Legend subtitle text. */
19
- subtitle?: string
20
- /** Legend title font size in pixels. */
21
- titleFontSize?: number
22
-
23
- /** Box styling. */
24
- /** Inner spacing around legend content. */
25
- boxPadding?: number
26
- /** Background opacity of the legend box. */
27
- boxOpacity?: number
28
- /** Apply legend hover opacity/highlighting only while the map is currently zoomed in (scale != 1); disabled again once zoomed back out to the initial view. */
29
- onlyApplyOpacityWhileZoomed?: boolean
30
- /** Padding between the title block and legend body. */
31
- titlePadding?: number
32
-
33
- /** Shape styling (for proportional symbol legends). */
34
- /** Symbol swatch width in pixels. */
35
- shapeWidth?: number
36
- /** Symbol swatch height in pixels. */
37
- shapeHeight?: number
38
- /** Horizontal gap between shape and label. */
39
- shapePadding?: number
40
- /** Length of separator lines in discrete legends. */
41
- sepLineLength?: number
42
-
43
- /** Label styling. */
44
- /** Label font size in pixels. */
45
- labelFontSize?: number
46
- /** Pixel offsets applied to labels. */
47
- labelOffsets?: { x: number; y: number }
48
- /** Custom formatter for legend labels. */
49
- labelFormatter?: ((value: number, index?: number) => string) | null
50
- /** Number of decimal places for auto-formatted labels. */
51
- decimals?: number
52
-
53
- /** Legend layout direction. */
54
- orientation?: 'vertical' | 'horizontal'
55
- /** Sort legend entries in ascending order when true. */
56
- ascending?: boolean
57
- /** Whether to display the no-data legend item. */
58
- noData?: boolean
59
- /** Label used for no-data legend item. */
60
- noDataText?: string
61
- /** Vertical gap before the no-data swatch in pixels. */
62
- noDataPadding?: number
63
- /** Width of the no-data swatch in pixels. */
64
- noDataShapeWidth?: number
65
- /** Height of the no-data swatch in pixels. */
66
- noDataShapeHeight?: number
67
-
68
- /** Whether to show dataset min/max labels when supported. */
69
- maxMin?: boolean
70
- /** Text affixes for min/max labels as [minSuffix, maxSuffix]. */
71
- maxMinLabels?: [string, string]
72
- layer?: any
73
- }
1
+ /**
2
+ * Parent configuration for map legends. Each map type will extend this with its own specific properties, but these are the common ones that apply to all legend types.
3
+ */
4
+ export interface LegendConfig {
5
+ /** Legend origin x-coordinate in pixels. */
6
+ x?: number
7
+ /** Legend origin y-coordinate in pixels. */
8
+ y?: number
9
+ /** Automatically position the legend in a map corner. Manual x/y coordinates take precedence. */
10
+ position?: 'top right' | 'bottom right' | 'top left' | 'bottom left'
11
+ /** Legend width in pixels. */
12
+ width?: number
13
+ /** Legend height in pixels. */
14
+ height?: number
15
+
16
+ /** Legend title text. */
17
+ title?: string
18
+ /** Legend subtitle text. */
19
+ subtitle?: string
20
+ /** Legend title font size in pixels. */
21
+ titleFontSize?: number
22
+
23
+ /** Box styling. */
24
+ /** Inner spacing around legend content. */
25
+ boxPadding?: number
26
+ /** Background opacity of the legend box. */
27
+ boxOpacity?: number
28
+ /** Apply legend hover opacity/highlighting only while the map is currently zoomed in (scale != 1). The legend box is transparent at the initial view and returns to its configured opacity while zoomed. */
29
+ onlyApplyOpacityWhileZoomed?: boolean
30
+ /** Padding between the title block and legend body. */
31
+ titlePadding?: number
32
+
33
+ /** Shape styling (for proportional symbol legends). */
34
+ /** Symbol swatch width in pixels. */
35
+ shapeWidth?: number
36
+ /** Symbol swatch height in pixels. */
37
+ shapeHeight?: number
38
+ /** Horizontal gap between shape and label. */
39
+ shapePadding?: number
40
+ /** Length of separator lines in discrete legends. */
41
+ sepLineLength?: number
42
+
43
+ /** Label styling. */
44
+ /** Label font size in pixels. */
45
+ labelFontSize?: number
46
+ /** Pixel offsets applied to labels. */
47
+ labelOffsets?: { x: number; y: number }
48
+ /** Custom formatter for legend labels. */
49
+ labelFormatter?: ((value: number, index?: number) => string) | null
50
+ /** Number of decimal places for auto-formatted labels. */
51
+ decimals?: number
52
+
53
+ /** Legend layout direction. */
54
+ orientation?: 'vertical' | 'horizontal'
55
+ /** Sort legend entries in ascending order when true. */
56
+ ascending?: boolean
57
+ /** Whether to display the no-data legend item. */
58
+ noData?: boolean
59
+ /** Label used for no-data legend item. */
60
+ noDataText?: string
61
+ /** Vertical gap before the no-data swatch in pixels. */
62
+ noDataPadding?: number
63
+ /** Width of the no-data swatch in pixels. */
64
+ noDataShapeWidth?: number
65
+ /** Height of the no-data swatch in pixels. */
66
+ noDataShapeHeight?: number
67
+
68
+ /** Whether to show dataset min/max labels when supported. */
69
+ maxMin?: boolean
70
+ /** Text affixes for min/max labels as [minSuffix, maxSuffix]. */
71
+ maxMinLabels?: [string, string]
72
+ layer?: any
73
+ }