@johnmorrisdotca/chikyu-earth 0.4.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 +78 -0
- package/NOTICE.md +39 -1
- package/README.md +199 -24
- package/dist/countries.d.ts +11 -0
- package/dist/countries.js +11 -0
- package/dist/element.d.ts +24 -1
- package/dist/element.js +70 -5
- 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 +38 -0
- package/dist/markers/cluster.js +42 -0
- package/dist/markers/index.d.ts +5 -0
- package/dist/markers/index.js +6 -0
- package/dist/markers/labels.d.ts +64 -0
- package/dist/markers/labels.js +70 -0
- package/dist/markers/layer.d.ts +129 -0
- package/dist/markers/layer.js +455 -0
- package/dist/markers/project.d.ts +82 -0
- package/dist/markers/project.js +93 -0
- package/dist/markers/types.d.ts +83 -0
- package/dist/markers/types.js +1 -0
- package/dist/realistic/earth.d.ts +81 -0
- package/dist/realistic/earth.js +163 -0
- package/dist/realistic/element.d.ts +93 -0
- package/dist/realistic/element.js +284 -0
- package/dist/realistic/gate.d.ts +64 -0
- package/dist/realistic/gate.js +72 -0
- package/dist/realistic/index.d.ts +5 -0
- package/dist/realistic/index.js +6 -0
- package/dist/realistic/shaders.d.ts +10 -0
- package/dist/realistic/shaders.js +124 -0
- package/dist/realistic/shared.d.ts +23 -0
- package/dist/realistic/shared.js +51 -0
- package/dist/realistic/sun.d.ts +44 -0
- package/dist/realistic/sun.js +65 -0
- package/dist/realistic/textures.d.ts +40 -0
- package/dist/realistic/textures.js +141 -0
- package/dist/realistic/tiers.d.ts +94 -0
- package/dist/realistic/tiers.js +94 -0
- 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/clouds-1024.webp +0 -0
- package/dist/textures/clouds-2048.webp +0 -0
- package/dist/textures/day-1024.webp +0 -0
- package/dist/textures/day-2048.webp +0 -0
- package/dist/textures/day-4096.webp +0 -0
- package/dist/textures/moon-1024.webp +0 -0
- package/dist/textures/moon-2048.webp +0 -0
- package/dist/textures/night-1024.webp +0 -0
- package/dist/textures/night-2048.webp +0 -0
- package/dist/textures/water-1024.webp +0 -0
- package/dist/textures/water-2048.webp +0 -0
- package/dist/types.d.ts +55 -5
- package/dist/view.d.ts +64 -3
- package/dist/view.js +56 -3
- package/package.json +93 -8
package/dist/view.js
CHANGED
|
@@ -1,8 +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
|
+
*/
|
|
40
|
+
export const lookAt = (centre, view) => ({
|
|
41
|
+
lon: centre.lon - view.yaw,
|
|
42
|
+
lat: Math.max(-90, Math.min(90, centre.lat + view.tilt)),
|
|
43
|
+
});
|
|
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
|
+
*/
|
|
6
59
|
export function projectionView(centre, size, view = HOME_VIEW) {
|
|
7
60
|
return {
|
|
8
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",
|
|
@@ -22,7 +22,16 @@
|
|
|
22
22
|
"custom-element",
|
|
23
23
|
"d3-geo",
|
|
24
24
|
"natural-earth",
|
|
25
|
-
"typescript"
|
|
25
|
+
"typescript",
|
|
26
|
+
"markers",
|
|
27
|
+
"satellite-imagery",
|
|
28
|
+
"webgl",
|
|
29
|
+
"three",
|
|
30
|
+
"astronomy",
|
|
31
|
+
"solar-system",
|
|
32
|
+
"moon",
|
|
33
|
+
"planets",
|
|
34
|
+
"ephemeris"
|
|
26
35
|
],
|
|
27
36
|
"homepage": "https://johnmorrisdotca.github.io/chikyu-earth/",
|
|
28
37
|
"repository": {
|
|
@@ -37,7 +46,11 @@
|
|
|
37
46
|
"type": "module",
|
|
38
47
|
"sideEffects": [
|
|
39
48
|
"./dist/element.js",
|
|
40
|
-
"./src/element.ts"
|
|
49
|
+
"./src/element.ts",
|
|
50
|
+
"./dist/realistic/element.js",
|
|
51
|
+
"./src/realistic/element.ts",
|
|
52
|
+
"./dist/space/element.js",
|
|
53
|
+
"./src/space/element.ts"
|
|
41
54
|
],
|
|
42
55
|
"main": "./dist/index.js",
|
|
43
56
|
"module": "./dist/index.js",
|
|
@@ -53,6 +66,31 @@
|
|
|
53
66
|
"import": "./dist/element.js",
|
|
54
67
|
"default": "./dist/element.js"
|
|
55
68
|
},
|
|
69
|
+
"./realistic": {
|
|
70
|
+
"types": "./dist/realistic/index.d.ts",
|
|
71
|
+
"import": "./dist/realistic/index.js",
|
|
72
|
+
"default": "./dist/realistic/index.js"
|
|
73
|
+
},
|
|
74
|
+
"./realistic/element": {
|
|
75
|
+
"types": "./dist/realistic/element.d.ts",
|
|
76
|
+
"import": "./dist/realistic/element.js",
|
|
77
|
+
"default": "./dist/realistic/element.js"
|
|
78
|
+
},
|
|
79
|
+
"./markers": {
|
|
80
|
+
"types": "./dist/markers/index.d.ts",
|
|
81
|
+
"import": "./dist/markers/index.js",
|
|
82
|
+
"default": "./dist/markers/index.js"
|
|
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
|
+
},
|
|
56
94
|
"./package.json": "./package.json"
|
|
57
95
|
},
|
|
58
96
|
"files": [
|
|
@@ -67,33 +105,80 @@
|
|
|
67
105
|
"node": ">=24"
|
|
68
106
|
},
|
|
69
107
|
"scripts": {
|
|
70
|
-
"build": "node -e \"require('node:fs').rmSync('dist',
|
|
108
|
+
"build": "node -e \"const fs=require('node:fs');fs.rmSync('dist',{recursive:true,force:true})\" && tsc -p tsconfig.json && node -e \"require('node:fs').cpSync('textures','dist/textures',{recursive:true})\"",
|
|
71
109
|
"lint": "eslint .",
|
|
72
110
|
"typecheck": "tsc -p tsconfig.check.json && tsc -p tsconfig.tools.json && tsc -p tsconfig.demo.json",
|
|
73
111
|
"test": "node --test test/*.test.ts",
|
|
74
112
|
"test:package": "pnpm build && node scripts/check-package.ts",
|
|
75
113
|
"check": "pnpm lint && pnpm typecheck && pnpm test && pnpm build && node scripts/check-package.ts",
|
|
76
114
|
"prepublishOnly": "pnpm check",
|
|
115
|
+
"family:readme": "node scripts/family-readme.mjs",
|
|
77
116
|
"site": "pnpm build && node scripts/site.ts",
|
|
78
117
|
"dev": "pnpm site && node scripts/dev.ts",
|
|
79
|
-
"test:demo": "pnpm site && playwright test",
|
|
80
|
-
"screenshots": "pnpm site && node scripts/screenshots.ts"
|
|
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",
|
|
119
|
+
"screenshots": "pnpm site && node scripts/screenshots.ts",
|
|
120
|
+
"textures": "python3 scripts/make-textures.py",
|
|
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"
|
|
81
129
|
},
|
|
82
130
|
"dependencies": {
|
|
83
131
|
"@johnmorrisdotca/chizu": "^1.6.0",
|
|
84
132
|
"d3-geo": "^3.1.1"
|
|
85
133
|
},
|
|
134
|
+
"peerDependencies": {
|
|
135
|
+
"@johnmorrisdotca/kazoku-ui": ">=0.9.0",
|
|
136
|
+
"three": ">=0.160.0",
|
|
137
|
+
"astronomy-engine": ">=2.1.0"
|
|
138
|
+
},
|
|
139
|
+
"peerDependenciesMeta": {
|
|
140
|
+
"@johnmorrisdotca/kazoku-ui": {
|
|
141
|
+
"optional": true
|
|
142
|
+
},
|
|
143
|
+
"three": {
|
|
144
|
+
"optional": true
|
|
145
|
+
},
|
|
146
|
+
"astronomy-engine": {
|
|
147
|
+
"optional": true
|
|
148
|
+
}
|
|
149
|
+
},
|
|
86
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",
|
|
87
155
|
"@eslint/js": "^9.0.0",
|
|
88
156
|
"@johnmorrisdotca/kazoku-ui": "^0.9.0",
|
|
89
157
|
"@playwright/test": "1.64.0",
|
|
158
|
+
"@sveltejs/vite-plugin-svelte": "^7.3.1",
|
|
90
159
|
"@types/d3-geo": "^3.1.0",
|
|
91
160
|
"@types/geojson": "^7946.0.14",
|
|
92
161
|
"@types/node": "^24.0.0",
|
|
162
|
+
"@types/react": "^19.3.0",
|
|
163
|
+
"@types/react-dom": "^19.3.0",
|
|
164
|
+
"@types/three": "^0.187.0",
|
|
165
|
+
"@vitejs/plugin-vue": "^6.0.10",
|
|
166
|
+
"astronomy-engine": "2.1.19",
|
|
93
167
|
"esbuild": "^0.25.0",
|
|
94
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",
|
|
175
|
+
"three": "0.186.1",
|
|
95
176
|
"typescript": "^5.9.0",
|
|
96
|
-
"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"
|
|
97
182
|
},
|
|
98
183
|
"publishConfig": {
|
|
99
184
|
"access": "public"
|