@johnmorrisdotca/wakusei-planets 0.59.0 → 0.60.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 +4 -0
- package/README.md +16 -3
- package/dist/flat/bodies.d.ts +122 -0
- package/dist/flat/bodies.js +115 -0
- package/dist/flat/define.d.ts +3 -0
- package/dist/flat/define.js +6 -0
- package/dist/flat/element.d.ts +145 -0
- package/dist/flat/element.js +1614 -0
- package/dist/flat/geometry.d.ts +127 -0
- package/dist/flat/geometry.js +121 -0
- package/dist/flat/index.d.ts +5 -0
- package/dist/flat/index.js +6 -0
- package/dist/flat/scene.d.ts +152 -0
- package/dist/flat/scene.js +195 -0
- package/dist/flat/words.d.ts +55 -0
- package/dist/flat/words.js +133 -0
- package/package.json +13 -1
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
// The flat map's own words, in English and Japanese. The names of the bodies, the orbiters and the places come from the package's own tables (`BODIES`, `ORBITER_FACTS`, each place's `name`), not from here.
|
|
2
|
+
// The keys that chikyu-earth's flat map also has (`map`, `controls`, `myPlace`, `footprint`, `groundTrack`, `zoomIn`, `zoomOut`, `all`, `help`) say the same thing in the same words, so a page that swaps one map for the other keeps its wording.
|
|
3
|
+
/**
|
|
4
|
+
* The words the flat map writes, one table for each language: `{body}`, `{name}`, `{altitude}` and the like are filled in. The Japanese is standard, polite Japanese.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* import { FLAT_WORDS } from "@johnmorrisdotca/wakusei-planets/flat";
|
|
9
|
+
*
|
|
10
|
+
* console.log(FLAT_WORDS.en.footprint, FLAT_WORDS.ja.footprint);
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
export const FLAT_WORDS = {
|
|
14
|
+
en: {
|
|
15
|
+
map: "Flat map of {body}",
|
|
16
|
+
controls: "Map controls",
|
|
17
|
+
myPlace: "My place",
|
|
18
|
+
centreHome: "Centre the map on my place",
|
|
19
|
+
centreOn: "Centre the map on {where}",
|
|
20
|
+
nearSide: "Near side",
|
|
21
|
+
farSide: "Far side",
|
|
22
|
+
primeMeridian: "Prime meridian",
|
|
23
|
+
layersFilter: "What to show",
|
|
24
|
+
orbiters: "Orbiters",
|
|
25
|
+
landing: "Landing and rover sites",
|
|
26
|
+
crash: "Crash and impact sites",
|
|
27
|
+
planned: "Planned landings",
|
|
28
|
+
feature: "Named features",
|
|
29
|
+
footprint: "Footprint",
|
|
30
|
+
groundTrack: "Ground track",
|
|
31
|
+
zoomIn: "Zoom in",
|
|
32
|
+
zoomOut: "Zoom out",
|
|
33
|
+
all: "All",
|
|
34
|
+
kind_crewed: "crewed landing",
|
|
35
|
+
kind_landing: "landing",
|
|
36
|
+
kind_rover: "rover",
|
|
37
|
+
kind_crash: "crash",
|
|
38
|
+
kind_impact: "impact",
|
|
39
|
+
kind_entry: "entry",
|
|
40
|
+
kind_planned: "planned landing",
|
|
41
|
+
kind_feature: "named feature",
|
|
42
|
+
kind_orbiter: "orbiter",
|
|
43
|
+
status_tracked: "path fitted to tracking",
|
|
44
|
+
status_predicted: "path carried on from tracking",
|
|
45
|
+
status_modelled: "mean orbit only, position approximate",
|
|
46
|
+
status_none: "no public path",
|
|
47
|
+
announceOrbiter: "{name}, orbiting {body}, {altitude} km up{note}",
|
|
48
|
+
announcePlace: "{name}, {kind} on {body}, {lat}, {lon}",
|
|
49
|
+
approximate: ", position approximate",
|
|
50
|
+
mapMissing: "The map picture could not be loaded. The marks are still in place.",
|
|
51
|
+
nothing: "Nothing to show.",
|
|
52
|
+
help: "Arrow keys move from one orbiter or mark to the next, Enter chooses it, plus and minus zoom.",
|
|
53
|
+
shown: "{orbiters} orbiters and {places} places shown",
|
|
54
|
+
},
|
|
55
|
+
ja: {
|
|
56
|
+
map: "{body}の平面地図",
|
|
57
|
+
controls: "地図の操作",
|
|
58
|
+
myPlace: "自分の場所",
|
|
59
|
+
centreHome: "地図の中心を自分の場所にする",
|
|
60
|
+
centreOn: "地図の中心を{where}にする",
|
|
61
|
+
nearSide: "表側",
|
|
62
|
+
farSide: "裏側",
|
|
63
|
+
primeMeridian: "本初子午線",
|
|
64
|
+
layersFilter: "表示するもの",
|
|
65
|
+
orbiters: "周回機",
|
|
66
|
+
landing: "着陸地点と探査車の地点",
|
|
67
|
+
crash: "墜落・衝突地点",
|
|
68
|
+
planned: "着陸予定地点",
|
|
69
|
+
feature: "地形の名前",
|
|
70
|
+
footprint: "可視範囲",
|
|
71
|
+
groundTrack: "地上軌跡",
|
|
72
|
+
zoomIn: "拡大",
|
|
73
|
+
zoomOut: "縮小",
|
|
74
|
+
all: "すべて",
|
|
75
|
+
kind_crewed: "有人着陸",
|
|
76
|
+
kind_landing: "着陸",
|
|
77
|
+
kind_rover: "探査車",
|
|
78
|
+
kind_crash: "墜落",
|
|
79
|
+
kind_impact: "衝突",
|
|
80
|
+
kind_entry: "大気圏突入",
|
|
81
|
+
kind_planned: "着陸予定",
|
|
82
|
+
kind_feature: "地形",
|
|
83
|
+
kind_orbiter: "周回機",
|
|
84
|
+
status_tracked: "追跡データに合わせた軌道",
|
|
85
|
+
status_predicted: "追跡データから延長した軌道",
|
|
86
|
+
status_modelled: "平均軌道のみ、位置はおおよそ",
|
|
87
|
+
status_none: "公開された軌道データなし",
|
|
88
|
+
announceOrbiter: "{name}、{body}の周回機、高度 {altitude} km{note}",
|
|
89
|
+
announcePlace: "{name}、{body}の{kind}、{lat}、{lon}",
|
|
90
|
+
approximate: "、位置はおおよそ",
|
|
91
|
+
mapMissing: "地図の画像を読み込めませんでした。印はそのまま表示します。",
|
|
92
|
+
nothing: "表示するものがありません。",
|
|
93
|
+
help: "矢印キーで次の周回機や印へ移り、Enter キーで選びます。プラスとマイナスのキーで拡大・縮小します。",
|
|
94
|
+
shown: "周回機{orbiters}機と地点{places}か所を表示中",
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* The words with their `{name}` places filled in; a key a language does not have is said in English, and a key neither has comes back as it is.
|
|
99
|
+
*
|
|
100
|
+
* @param lang - `en` or `ja`.
|
|
101
|
+
* @param key - A key of `FLAT_WORDS`.
|
|
102
|
+
* @param values - What goes in the `{...}` places.
|
|
103
|
+
* @returns The sentence.
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* ```ts
|
|
107
|
+
* import { say } from "@johnmorrisdotca/wakusei-planets/flat";
|
|
108
|
+
*
|
|
109
|
+
* console.log(say("en", "map", { body: "Mars" }), "|", say("ja", "map", { body: "火星" }));
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
export const say = (lang, key, values = {}) => (FLAT_WORDS[lang][key] ?? FLAT_WORDS.en[key] ?? key).replace(/\{(\w+)\}/g, (all, name) => String(values[name] ?? all));
|
|
113
|
+
/**
|
|
114
|
+
* A latitude or longitude with its hemisphere, in the language's way: `3.01° S` and `23.47° E`, or `南緯3.01°` and `東経23.47°`.
|
|
115
|
+
*
|
|
116
|
+
* @param lang - `en` or `ja`.
|
|
117
|
+
* @param axis - `lat` or `lon`.
|
|
118
|
+
* @param degrees - Degrees, north and east positive.
|
|
119
|
+
* @returns The text.
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
* ```ts
|
|
123
|
+
* import { coordinateText } from "@johnmorrisdotca/wakusei-planets/flat";
|
|
124
|
+
*
|
|
125
|
+
* console.log(coordinateText("en", "lat", -3.01), "|", coordinateText("ja", "lon", 23.47));
|
|
126
|
+
* ```
|
|
127
|
+
*/
|
|
128
|
+
export function coordinateText(lang, axis, degrees) {
|
|
129
|
+
const value = Math.abs(degrees).toFixed(2);
|
|
130
|
+
if (lang === "ja")
|
|
131
|
+
return `${axis === "lat" ? (degrees < 0 ? "南緯" : "北緯") : degrees < 0 ? "西経" : "東経"}${value}°`;
|
|
132
|
+
return `${value}° ${axis === "lat" ? (degrees < 0 ? "S" : "N") : degrees < 0 ? "W" : "E"}`;
|
|
133
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@johnmorrisdotca/wakusei-planets",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.60.0",
|
|
4
4
|
"description": "Wakusei Planets 惑星 — The Sun, planets and moons for the web: each as a clean line drawing, a shaded realistic drawing or a painted surface map, with real sizes, axial tilt and rotation as data, and positions of the moons for any date and time. SVG for the lines, three.js (optional) for the rest.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"planets",
|
|
@@ -92,6 +92,7 @@
|
|
|
92
92
|
"./dist/lineup/element.js",
|
|
93
93
|
"./dist/space/element.js",
|
|
94
94
|
"./dist/plan/element.js",
|
|
95
|
+
"./dist/flat/define.js",
|
|
95
96
|
"./dist/surface/element.js",
|
|
96
97
|
"./dist/surface/land.js",
|
|
97
98
|
"./dist/earth-places.js",
|
|
@@ -103,6 +104,7 @@
|
|
|
103
104
|
"./src/lineup/element.ts",
|
|
104
105
|
"./src/space/element.ts",
|
|
105
106
|
"./src/plan/element.ts",
|
|
107
|
+
"./src/flat/define.ts",
|
|
106
108
|
"./src/surface/element.ts",
|
|
107
109
|
"./src/surface/land.ts",
|
|
108
110
|
"./src/earth-places.ts",
|
|
@@ -154,6 +156,16 @@
|
|
|
154
156
|
"import": "./dist/plan/element.js",
|
|
155
157
|
"default": "./dist/plan/element.js"
|
|
156
158
|
},
|
|
159
|
+
"./flat": {
|
|
160
|
+
"types": "./dist/flat/index.d.ts",
|
|
161
|
+
"import": "./dist/flat/index.js",
|
|
162
|
+
"default": "./dist/flat/index.js"
|
|
163
|
+
},
|
|
164
|
+
"./flat/define": {
|
|
165
|
+
"types": "./dist/flat/define.d.ts",
|
|
166
|
+
"import": "./dist/flat/define.js",
|
|
167
|
+
"default": "./dist/flat/define.js"
|
|
168
|
+
},
|
|
157
169
|
"./surface": {
|
|
158
170
|
"types": "./dist/surface/index.d.ts",
|
|
159
171
|
"import": "./dist/surface/index.js",
|