eurostat-map 4.8.2 → 4.8.3

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.3",
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eurostat-map",
3
- "version": "4.8.2",
3
+ "version": "4.8.3",
4
4
  "description": "Reusable library to quickly create and customise web maps showing Eurostat data directly retrieved from Eurostat database.",
5
5
  "keywords": [
6
6
  "cartography",