cool-globe 0.1.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/LICENSE +21 -0
- package/README.md +82 -0
- package/dist/cool-globe.cjs +9 -0
- package/dist/cool-globe.js +2532 -0
- package/dist/index.d.ts +3 -0
- package/dist/lib/CoolGlobe.constants.d.ts +6 -0
- package/dist/lib/CoolGlobe.d.ts +3 -0
- package/dist/lib/CoolGlobe.types.d.ts +28 -0
- package/dist/lib/dashboardGlobe.types.d.ts +12 -0
- package/dist/lib/dashboardGlobe.utils.d.ts +5 -0
- package/dist/lib/types.d.ts +9 -0
- package/package.json +64 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ColorScaleInput } from "./dashboardGlobe.types";
|
|
2
|
+
export declare const GLOBAL_COUNTRIES_GEOJSON_URL = "https://raw.githubusercontent.com/nvkelso/natural-earth-vector/master/geojson/ne_110m_admin_0_countries.geojson";
|
|
3
|
+
export declare const WORLD_TOPOJSON_URL = "https://cdn.jsdelivr.net/npm/world-atlas@2/countries-110m.json";
|
|
4
|
+
export declare const GLOBAL_ADMIN1_GEOJSON_URL = "https://raw.githubusercontent.com/nvkelso/natural-earth-vector/master/geojson/ne_10m_admin_1_states_provinces.geojson";
|
|
5
|
+
export declare const WHITE_GLOBE_TEXTURE = "data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='4' height='4'><rect width='4' height='4' fill='%23f5f5f5'/></svg>";
|
|
6
|
+
export declare const DEFAULT_COLOR_SCALE: ColorScaleInput;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export interface TopoJsonObject {
|
|
2
|
+
type: string;
|
|
3
|
+
arcs: number[][][];
|
|
4
|
+
}
|
|
5
|
+
export interface TopologyRoot {
|
|
6
|
+
type: "Topology";
|
|
7
|
+
objects: Record<string, TopoJsonObject>;
|
|
8
|
+
}
|
|
9
|
+
export interface PolygonFeatureProperties {
|
|
10
|
+
name?: string;
|
|
11
|
+
iso_a2?: string;
|
|
12
|
+
__isoA2?: string;
|
|
13
|
+
__regionName?: string;
|
|
14
|
+
__countryCode?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface CountryFeatureProperties extends PolygonFeatureProperties {
|
|
17
|
+
NAME?: string;
|
|
18
|
+
name_en?: string;
|
|
19
|
+
ADMIN?: string;
|
|
20
|
+
ISO_A2?: string;
|
|
21
|
+
iso_a2_eh?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface Bounds {
|
|
24
|
+
minLat: number;
|
|
25
|
+
maxLat: number;
|
|
26
|
+
minLng: number;
|
|
27
|
+
maxLng: number;
|
|
28
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type GlobeLevel = 0 | 1 | 2;
|
|
2
|
+
export interface MetricRecord {
|
|
3
|
+
[key: string]: unknown;
|
|
4
|
+
}
|
|
5
|
+
export interface StatisticsData {
|
|
6
|
+
countries: Record<string, MetricRecord>;
|
|
7
|
+
regions: Record<string, Record<string, MetricRecord>>;
|
|
8
|
+
}
|
|
9
|
+
export interface ColorScaleInput {
|
|
10
|
+
minColor: string;
|
|
11
|
+
maxColor: string;
|
|
12
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ColorScaleInput, GlobeLevel, MetricRecord } from "./dashboardGlobe.types";
|
|
2
|
+
export declare const getMetricValue: (metricRecord: MetricRecord | undefined, metricKey: string) => number;
|
|
3
|
+
export declare const createColorResolver: (values: number[], colorScale: ColorScaleInput) => (value: number) => string;
|
|
4
|
+
export declare const getZoomLevelByAltitude: (altitude: number) => GlobeLevel;
|
|
5
|
+
export declare const formatMetric: (value: number) => string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ColorScaleInput, StatisticsData } from "./dashboardGlobe.types";
|
|
2
|
+
export interface CoolGlobeProps {
|
|
3
|
+
statisticsData: StatisticsData;
|
|
4
|
+
resetSignal?: string | number;
|
|
5
|
+
primaryMetric?: string;
|
|
6
|
+
colorScale?: ColorScaleInput;
|
|
7
|
+
countryNumericToIsoMap?: Record<string, string>;
|
|
8
|
+
countryNameToIsoMap?: Record<string, string>;
|
|
9
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "cool-globe",
|
|
3
|
+
"private": false,
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"description": "Reusable interactive React globe component library.",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"react",
|
|
9
|
+
"globe",
|
|
10
|
+
"geojson",
|
|
11
|
+
"visualization",
|
|
12
|
+
"maps"
|
|
13
|
+
],
|
|
14
|
+
"main": "./dist/cool-globe.cjs",
|
|
15
|
+
"module": "./dist/cool-globe.js",
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"files": [
|
|
18
|
+
"dist"
|
|
19
|
+
],
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"import": "./dist/cool-globe.js",
|
|
24
|
+
"require": "./dist/cool-globe.cjs"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"type": "module",
|
|
28
|
+
"scripts": {
|
|
29
|
+
"dev": "vite",
|
|
30
|
+
"build": "vite build && tsc -p tsconfig.build.json",
|
|
31
|
+
"lint": "eslint .",
|
|
32
|
+
"preview": "vite preview",
|
|
33
|
+
"prepublishOnly": "npm run build"
|
|
34
|
+
},
|
|
35
|
+
"peerDependencies": {
|
|
36
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
37
|
+
"react-dom": "^18.0.0 || ^19.0.0",
|
|
38
|
+
"react-globe.gl": "^2.37.1"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"d3-interpolate": "^3.0.1",
|
|
42
|
+
"d3-scale": "^4.0.2",
|
|
43
|
+
"three": "^0.180.0",
|
|
44
|
+
"topojson-client": "^3.1.0"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@eslint/js": "^9.39.1",
|
|
48
|
+
"@types/d3-interpolate": "^3.0.4",
|
|
49
|
+
"@types/d3-scale": "^4.0.9",
|
|
50
|
+
"@types/node": "^24.10.1",
|
|
51
|
+
"@types/react": "^19.2.7",
|
|
52
|
+
"@types/react-dom": "^19.2.3",
|
|
53
|
+
"@types/three": "^0.180.0",
|
|
54
|
+
"@types/topojson-client": "^3.1.5",
|
|
55
|
+
"@vitejs/plugin-react": "^5.1.1",
|
|
56
|
+
"eslint": "^9.39.1",
|
|
57
|
+
"eslint-plugin-react-hooks": "^7.0.1",
|
|
58
|
+
"eslint-plugin-react-refresh": "^0.4.24",
|
|
59
|
+
"globals": "^16.5.0",
|
|
60
|
+
"typescript": "~5.9.3",
|
|
61
|
+
"typescript-eslint": "^8.48.0",
|
|
62
|
+
"vite": "^7.3.1"
|
|
63
|
+
}
|
|
64
|
+
}
|