@johnmorrisdotca/chikyu-earth 0.5.0 → 0.7.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/CHANGELOG.md +42 -0
- package/NOTICE.md +11 -0
- package/README.md +172 -27
- package/dist/countries.d.ts +11 -0
- package/dist/countries.js +11 -0
- package/dist/element.d.ts +18 -0
- package/dist/element.js +15 -2
- package/dist/globe.d.ts +15 -1
- package/dist/globe.js +15 -1
- package/dist/index.d.ts +12 -1
- package/dist/index.js +12 -1
- package/dist/markers/cluster.d.ts +27 -0
- package/dist/markers/cluster.js +16 -0
- package/dist/markers/labels.d.ts +40 -0
- package/dist/markers/labels.js +18 -0
- package/dist/markers/layer.d.ts +80 -0
- package/dist/markers/layer.js +21 -0
- package/dist/markers/project.d.ts +63 -2
- package/dist/markers/project.js +52 -2
- package/dist/markers/types.d.ts +48 -3
- package/dist/realistic/earth.d.ts +30 -5
- package/dist/realistic/earth.js +41 -134
- package/dist/realistic/element.d.ts +47 -7
- package/dist/realistic/element.js +48 -44
- package/dist/realistic/gate.d.ts +45 -1
- package/dist/realistic/gate.js +33 -1
- package/dist/realistic/shaders.d.ts +9 -4
- package/dist/realistic/shaders.js +54 -9
- package/dist/realistic/shared.d.ts +23 -0
- package/dist/realistic/shared.js +51 -0
- package/dist/realistic/sun.d.ts +40 -3
- package/dist/realistic/sun.js +40 -3
- package/dist/realistic/textures.d.ts +40 -0
- package/dist/realistic/textures.js +141 -0
- package/dist/realistic/tiers.d.ts +80 -6
- package/dist/realistic/tiers.js +69 -5
- package/dist/rotate.d.ts +59 -4
- package/dist/rotate.js +59 -4
- package/dist/space/element.d.ts +134 -0
- package/dist/space/element.js +394 -0
- package/dist/space/ephemeris.d.ts +151 -0
- package/dist/space/ephemeris.js +162 -0
- package/dist/space/index.d.ts +3 -0
- package/dist/space/index.js +5 -0
- package/dist/space/scale.d.ts +124 -0
- package/dist/space/scale.js +141 -0
- package/dist/space/scene.d.ts +131 -0
- package/dist/space/scene.js +295 -0
- package/dist/styles.d.ts +65 -2
- package/dist/styles.js +43 -2
- package/dist/textures/moon-1024.webp +0 -0
- package/dist/textures/moon-2048.webp +0 -0
- package/dist/types.d.ts +55 -5
- package/dist/view.d.ts +63 -4
- package/dist/view.js +52 -4
- package/package.json +55 -8
package/dist/view.d.ts
CHANGED
|
@@ -1,14 +1,73 @@
|
|
|
1
1
|
import type { GeoPoint, GlobeView, Rotation } from "./types.ts";
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* The view when it opens: the home centre, upright, at 1x with no pan.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* import { HOME_VIEW } from "@johnmorrisdotca/chikyu-earth";
|
|
8
|
+
*
|
|
9
|
+
* console.log(HOME_VIEW);
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
3
12
|
export declare const HOME_VIEW: GlobeView;
|
|
13
|
+
/**
|
|
14
|
+
* What d3-geo's orthographic projection is given for a view: its rotation, scale and translation.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* import { projectionView, type ProjectionView } from "@johnmorrisdotca/chikyu-earth";
|
|
19
|
+
*
|
|
20
|
+
* const view: ProjectionView = projectionView({ lon: 0, lat: 0 }, 400);
|
|
21
|
+
* console.log(view.scale, view.translate);
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
4
24
|
export interface ProjectionView {
|
|
5
25
|
rotation: Rotation;
|
|
6
26
|
scale: number;
|
|
7
27
|
translate: [number, number];
|
|
8
28
|
}
|
|
9
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* The radius of an unzoomed globe in a square of `size` pixels.
|
|
31
|
+
*
|
|
32
|
+
* @param size - The width and height of the square, in pixels.
|
|
33
|
+
* @returns The radius in pixels, one less than half the size so the rim is not cut off.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* import { globeBaseScale } from "@johnmorrisdotca/chikyu-earth";
|
|
38
|
+
*
|
|
39
|
+
* console.log(globeBaseScale(420));
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
10
42
|
export declare const globeBaseScale: (size: number) => number;
|
|
11
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
* Where the view is centred on the globe: the home centre, turned by yaw (west) and tipped by tilt (north), held to the poles.
|
|
45
|
+
*
|
|
46
|
+
* @param centre - The home centre.
|
|
47
|
+
* @param view - The turn, tip, zoom and pan from the view controls.
|
|
48
|
+
* @returns The place now in the middle of the disc.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```ts
|
|
52
|
+
* import { lookAt } from "@johnmorrisdotca/chikyu-earth/realistic";
|
|
53
|
+
*
|
|
54
|
+
* console.log(lookAt({ lon: 10, lat: 80 }, { yaw: 25, tilt: 30, zoom: 1, panX: 0, panY: 0 }));
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
12
57
|
export declare const lookAt: (centre: GeoPoint, view: GlobeView) => GeoPoint;
|
|
13
|
-
/**
|
|
58
|
+
/**
|
|
59
|
+
* What the projection is given for a view: yaw turns longitude, tilt tips latitude, zoom scales and pan moves the disc in CSS pixels.
|
|
60
|
+
*
|
|
61
|
+
* @param centre - The home centre.
|
|
62
|
+
* @param size - The width and height of the square the globe is drawn in, in pixels.
|
|
63
|
+
* @param view - The turn, tip, zoom and pan; the home view when left out.
|
|
64
|
+
* @returns The rotation, scale and translation for d3-geo's orthographic projection.
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```ts
|
|
68
|
+
* import { projectionView } from "@johnmorrisdotca/chikyu-earth";
|
|
69
|
+
*
|
|
70
|
+
* console.log(projectionView({ lon: 139.7, lat: 35.7 }, 420, { yaw: 10, tilt: 5, zoom: 2, panX: 0, panY: 0 }));
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
14
73
|
export declare function projectionView(centre: GeoPoint, size: number, view?: GlobeView): ProjectionView;
|
package/dist/view.js
CHANGED
|
@@ -1,13 +1,61 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* The view when it opens: the home centre, upright, at 1x with no pan.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```ts
|
|
6
|
+
* import { HOME_VIEW } from "@johnmorrisdotca/chikyu-earth";
|
|
7
|
+
*
|
|
8
|
+
* console.log(HOME_VIEW);
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
2
11
|
export const HOME_VIEW = Object.freeze({ yaw: 0, tilt: 0, zoom: 1, panX: 0, panY: 0 });
|
|
3
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* The radius of an unzoomed globe in a square of `size` pixels.
|
|
14
|
+
*
|
|
15
|
+
* @param size - The width and height of the square, in pixels.
|
|
16
|
+
* @returns The radius in pixels, one less than half the size so the rim is not cut off.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* import { globeBaseScale } from "@johnmorrisdotca/chikyu-earth";
|
|
21
|
+
*
|
|
22
|
+
* console.log(globeBaseScale(420));
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
4
25
|
export const globeBaseScale = (size) => size / 2 - 1;
|
|
5
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* Where the view is centred on the globe: the home centre, turned by yaw (west) and tipped by tilt (north), held to the poles.
|
|
28
|
+
*
|
|
29
|
+
* @param centre - The home centre.
|
|
30
|
+
* @param view - The turn, tip, zoom and pan from the view controls.
|
|
31
|
+
* @returns The place now in the middle of the disc.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```ts
|
|
35
|
+
* import { lookAt } from "@johnmorrisdotca/chikyu-earth/realistic";
|
|
36
|
+
*
|
|
37
|
+
* console.log(lookAt({ lon: 10, lat: 80 }, { yaw: 25, tilt: 30, zoom: 1, panX: 0, panY: 0 }));
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
6
40
|
export const lookAt = (centre, view) => ({
|
|
7
41
|
lon: centre.lon - view.yaw,
|
|
8
42
|
lat: Math.max(-90, Math.min(90, centre.lat + view.tilt)),
|
|
9
43
|
});
|
|
10
|
-
/**
|
|
44
|
+
/**
|
|
45
|
+
* What the projection is given for a view: yaw turns longitude, tilt tips latitude, zoom scales and pan moves the disc in CSS pixels.
|
|
46
|
+
*
|
|
47
|
+
* @param centre - The home centre.
|
|
48
|
+
* @param size - The width and height of the square the globe is drawn in, in pixels.
|
|
49
|
+
* @param view - The turn, tip, zoom and pan; the home view when left out.
|
|
50
|
+
* @returns The rotation, scale and translation for d3-geo's orthographic projection.
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```ts
|
|
54
|
+
* import { projectionView } from "@johnmorrisdotca/chikyu-earth";
|
|
55
|
+
*
|
|
56
|
+
* console.log(projectionView({ lon: 139.7, lat: 35.7 }, 420, { yaw: 10, tilt: 5, zoom: 2, panX: 0, panY: 0 }));
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
11
59
|
export function projectionView(centre, size, view = HOME_VIEW) {
|
|
12
60
|
return {
|
|
13
61
|
rotation: [-centre.lon + view.yaw, -centre.lat - view.tilt],
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@johnmorrisdotca/chikyu-earth",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Chikyu Earth
|
|
3
|
+
"version": "0.7.0",
|
|
4
|
+
"description": "Chikyu Earth 地球 — A line-drawn globe for the web: country outlines that turn at the Earth's own rate, centred on where you are, with an optional realistic Earth from space (three.js), the Sun, Moon and planets, and markers for any place. A web component and an SVG string.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"earth",
|
|
7
7
|
"globe",
|
|
@@ -26,7 +26,12 @@
|
|
|
26
26
|
"markers",
|
|
27
27
|
"satellite-imagery",
|
|
28
28
|
"webgl",
|
|
29
|
-
"three"
|
|
29
|
+
"three",
|
|
30
|
+
"astronomy",
|
|
31
|
+
"solar-system",
|
|
32
|
+
"moon",
|
|
33
|
+
"planets",
|
|
34
|
+
"ephemeris"
|
|
30
35
|
],
|
|
31
36
|
"homepage": "https://johnmorrisdotca.github.io/chikyu-earth/",
|
|
32
37
|
"repository": {
|
|
@@ -43,7 +48,9 @@
|
|
|
43
48
|
"./dist/element.js",
|
|
44
49
|
"./src/element.ts",
|
|
45
50
|
"./dist/realistic/element.js",
|
|
46
|
-
"./src/realistic/element.ts"
|
|
51
|
+
"./src/realistic/element.ts",
|
|
52
|
+
"./dist/space/element.js",
|
|
53
|
+
"./src/space/element.ts"
|
|
47
54
|
],
|
|
48
55
|
"main": "./dist/index.js",
|
|
49
56
|
"module": "./dist/index.js",
|
|
@@ -74,6 +81,16 @@
|
|
|
74
81
|
"import": "./dist/markers/index.js",
|
|
75
82
|
"default": "./dist/markers/index.js"
|
|
76
83
|
},
|
|
84
|
+
"./space": {
|
|
85
|
+
"types": "./dist/space/index.d.ts",
|
|
86
|
+
"import": "./dist/space/index.js",
|
|
87
|
+
"default": "./dist/space/index.js"
|
|
88
|
+
},
|
|
89
|
+
"./space/element": {
|
|
90
|
+
"types": "./dist/space/element.d.ts",
|
|
91
|
+
"import": "./dist/space/element.js",
|
|
92
|
+
"default": "./dist/space/element.js"
|
|
93
|
+
},
|
|
77
94
|
"./package.json": "./package.json"
|
|
78
95
|
},
|
|
79
96
|
"files": [
|
|
@@ -95,12 +112,20 @@
|
|
|
95
112
|
"test:package": "pnpm build && node scripts/check-package.ts",
|
|
96
113
|
"check": "pnpm lint && pnpm typecheck && pnpm test && pnpm build && node scripts/check-package.ts",
|
|
97
114
|
"prepublishOnly": "pnpm check",
|
|
115
|
+
"family:readme": "node scripts/family-readme.mjs",
|
|
98
116
|
"site": "pnpm build && node scripts/site.ts",
|
|
99
117
|
"dev": "pnpm site && node scripts/dev.ts",
|
|
100
|
-
"test:demo": "pnpm site && playwright test --project=chromium-desk --project=chromium-phone --project=webkit-desk --project=webkit-phone --project=chromium-gl",
|
|
118
|
+
"test:demo": "pnpm site && node scripts/docs-site.mjs build && playwright test --project=chromium-desk --project=chromium-phone --project=webkit-desk --project=webkit-phone --project=chromium-gl",
|
|
101
119
|
"screenshots": "pnpm site && node scripts/screenshots.ts",
|
|
102
120
|
"textures": "python3 scripts/make-textures.py",
|
|
103
|
-
"test:soak": "pnpm site && playwright test --project=soak"
|
|
121
|
+
"test:soak": "pnpm site && playwright test --project=soak",
|
|
122
|
+
"docs:site": "pnpm build && node scripts/docs-site.mjs build",
|
|
123
|
+
"docs:check": "pnpm build && node scripts/docs-site.mjs check",
|
|
124
|
+
"size": "node scripts/docs-site.mjs size",
|
|
125
|
+
"test:usage": "pnpm site && node scripts/check-usage.ts",
|
|
126
|
+
"test:readme": "pnpm build && node scripts/check-usage.ts readme",
|
|
127
|
+
"check:standard": "node scripts/check-standard.mjs",
|
|
128
|
+
"test:freeze": "pnpm site && playwright test e2e/freeze.demo.ts --project=chromium-desk"
|
|
104
129
|
},
|
|
105
130
|
"dependencies": {
|
|
106
131
|
"@johnmorrisdotca/chizu": "^1.6.0",
|
|
@@ -108,7 +133,8 @@
|
|
|
108
133
|
},
|
|
109
134
|
"peerDependencies": {
|
|
110
135
|
"@johnmorrisdotca/kazoku-ui": ">=0.9.0",
|
|
111
|
-
"three": ">=0.160.0"
|
|
136
|
+
"three": ">=0.160.0",
|
|
137
|
+
"astronomy-engine": ">=2.1.0"
|
|
112
138
|
},
|
|
113
139
|
"peerDependenciesMeta": {
|
|
114
140
|
"@johnmorrisdotca/kazoku-ui": {
|
|
@@ -116,22 +142,43 @@
|
|
|
116
142
|
},
|
|
117
143
|
"three": {
|
|
118
144
|
"optional": true
|
|
145
|
+
},
|
|
146
|
+
"astronomy-engine": {
|
|
147
|
+
"optional": true
|
|
119
148
|
}
|
|
120
149
|
},
|
|
121
150
|
"devDependencies": {
|
|
151
|
+
"@angular/common": "^22.2.4",
|
|
152
|
+
"@angular/compiler": "^22.2.4",
|
|
153
|
+
"@angular/core": "^22.2.4",
|
|
154
|
+
"@angular/platform-browser": "^22.2.4",
|
|
122
155
|
"@eslint/js": "^9.0.0",
|
|
123
156
|
"@johnmorrisdotca/kazoku-ui": "^0.9.0",
|
|
124
157
|
"@playwright/test": "1.64.0",
|
|
158
|
+
"@sveltejs/vite-plugin-svelte": "^7.3.1",
|
|
125
159
|
"@types/d3-geo": "^3.1.0",
|
|
126
160
|
"@types/geojson": "^7946.0.14",
|
|
127
161
|
"@types/node": "^24.0.0",
|
|
162
|
+
"@types/react": "^19.3.0",
|
|
163
|
+
"@types/react-dom": "^19.3.0",
|
|
128
164
|
"@types/three": "^0.187.0",
|
|
165
|
+
"@vitejs/plugin-vue": "^6.0.10",
|
|
129
166
|
"astronomy-engine": "2.1.19",
|
|
130
167
|
"esbuild": "^0.25.0",
|
|
131
168
|
"eslint": "^9.0.0",
|
|
169
|
+
"marked": "^18.1.2",
|
|
170
|
+
"pagefind": "^1.6.0",
|
|
171
|
+
"react": "^19.3.1",
|
|
172
|
+
"react-dom": "^19.3.1",
|
|
173
|
+
"rxjs": "^7.8.2",
|
|
174
|
+
"svelte": "^5.57.3",
|
|
132
175
|
"three": "0.186.1",
|
|
133
176
|
"typescript": "^5.9.0",
|
|
134
|
-
"typescript-eslint": "^8.0.0"
|
|
177
|
+
"typescript-eslint": "^8.0.0",
|
|
178
|
+
"vite": "^8.3.5",
|
|
179
|
+
"vue": "^3.5.44",
|
|
180
|
+
"webpack": "^5.112.2",
|
|
181
|
+
"webpack-cli": "^7.3.1"
|
|
135
182
|
},
|
|
136
183
|
"publishConfig": {
|
|
137
184
|
"access": "public"
|