@johnmorrisdotca/hoshi-stars 0.0.0-stage → 0.2.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 +25 -0
- package/LICENSE +21 -0
- package/NOTICE.md +146 -0
- package/README.md +337 -2
- package/dist/boundaries.d.ts +95 -0
- package/dist/boundaries.js +195 -0
- package/dist/constellations.d.ts +72 -0
- package/dist/constellations.js +105 -0
- package/dist/data/boundaries.d.ts +4 -0
- package/dist/data/boundaries.js +449 -0
- package/dist/data/constellations.d.ts +1 -0
- package/dist/data/constellations.js +91 -0
- package/dist/data/lines.d.ts +2 -0
- package/dist/data/lines.js +92 -0
- package/dist/data/messier.d.ts +2 -0
- package/dist/data/messier.js +116 -0
- package/dist/data/milky-way.d.ts +5 -0
- package/dist/data/milky-way.js +7 -0
- package/dist/data/ngc-ic.d.ts +2 -0
- package/dist/data/ngc-ic.js +11794 -0
- package/dist/data/star-names-ja.d.ts +2 -0
- package/dist/data/star-names-ja.js +4 -0
- package/dist/data/stars.d.ts +4 -0
- package/dist/data/stars.js +5088 -0
- package/dist/deep-sky-core.d.ts +123 -0
- package/dist/deep-sky-core.js +139 -0
- package/dist/deep-sky-ngc-ic.d.ts +34 -0
- package/dist/deep-sky-ngc-ic.js +43 -0
- package/dist/deep-sky.d.ts +49 -0
- package/dist/deep-sky.js +59 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/lines.d.ts +49 -0
- package/dist/lines.js +64 -0
- package/dist/milky-way.d.ts +144 -0
- package/dist/milky-way.js +242 -0
- package/dist/projection.d.ts +127 -0
- package/dist/projection.js +284 -0
- package/dist/sky.d.ts +202 -0
- package/dist/sky.js +283 -0
- package/dist/stars.d.ts +162 -0
- package/dist/stars.js +195 -0
- package/dist/time-scale.d.ts +14 -0
- package/dist/time-scale.js +71 -0
- package/dist/when.d.ts +16 -0
- package/dist/when.js +18 -0
- package/package.json +184 -4
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
// From UTC (as JavaScript counts it) to Terrestrial Time, the scale the IAU rotation rates of the planets are in. TT runs ahead of UTC by the leap seconds (TAI - UTC) plus 32.184 s.
|
|
2
|
+
// Before 1972, when UTC had no leap seconds, TT - UT is delta T, from the polynomial fits of F. Espenak and J. Meeus (NASA, "Polynomial Expressions for Delta T", 2006), which are formulas, written out here.
|
|
3
|
+
// After the last leap second in the table (2017) the offset stays at 37 s + 32.184 s until a new leap second is announced: add a row below. TDB - TT, under 2 milliseconds, is ignored.
|
|
4
|
+
// Pure: no DOM, no clock. Not an entry point of the package; `horizontalFrom` in `/sky` uses it.
|
|
5
|
+
/** Each leap second's day (UTC, as milliseconds since 1970) and TAI - UTC in seconds from that day on. */
|
|
6
|
+
const LEAPS = [
|
|
7
|
+
[Date.UTC(1972, 0, 1), 10], [Date.UTC(1972, 6, 1), 11], [Date.UTC(1973, 0, 1), 12], [Date.UTC(1974, 0, 1), 13], [Date.UTC(1975, 0, 1), 14], [Date.UTC(1976, 0, 1), 15],
|
|
8
|
+
[Date.UTC(1977, 0, 1), 16], [Date.UTC(1978, 0, 1), 17], [Date.UTC(1979, 0, 1), 18], [Date.UTC(1980, 0, 1), 19], [Date.UTC(1981, 6, 1), 20], [Date.UTC(1982, 6, 1), 21],
|
|
9
|
+
[Date.UTC(1983, 6, 1), 22], [Date.UTC(1985, 6, 1), 23], [Date.UTC(1988, 0, 1), 24], [Date.UTC(1990, 0, 1), 25], [Date.UTC(1991, 0, 1), 26], [Date.UTC(1992, 6, 1), 27],
|
|
10
|
+
[Date.UTC(1993, 6, 1), 28], [Date.UTC(1994, 6, 1), 29], [Date.UTC(1996, 0, 1), 30], [Date.UTC(1997, 6, 1), 31], [Date.UTC(1999, 0, 1), 32], [Date.UTC(2006, 0, 1), 33],
|
|
11
|
+
[Date.UTC(2009, 0, 1), 34], [Date.UTC(2012, 6, 1), 35], [Date.UTC(2015, 6, 1), 36], [Date.UTC(2017, 0, 1), 37],
|
|
12
|
+
];
|
|
13
|
+
const TT_MINUS_TAI = 32.184;
|
|
14
|
+
/** The first moment of a year (UTC), for any year: `Date.UTC` reads 0 to 99 as 1900 to 1999. */
|
|
15
|
+
function startOf(year) {
|
|
16
|
+
const date = new Date(0);
|
|
17
|
+
date.setUTCFullYear(year, 0, 1);
|
|
18
|
+
return date.getTime();
|
|
19
|
+
}
|
|
20
|
+
/** Espenak and Meeus's delta T (TT - UT, seconds) for a year with a fraction. */
|
|
21
|
+
function deltaT(y) {
|
|
22
|
+
const poly = (t, ...c) => c.reduceRight((sum, k) => sum * t + k, 0);
|
|
23
|
+
if (y < -500)
|
|
24
|
+
return -20 + 32 * ((y - 1820) / 100) ** 2;
|
|
25
|
+
if (y < 500)
|
|
26
|
+
return poly(y / 100, 10583.6, -1014.41, 33.78311, -5.952053, -0.1798452, 0.022174192, 0.0090316521);
|
|
27
|
+
if (y < 1600)
|
|
28
|
+
return poly((y - 1000) / 100, 1574.2, -556.01, 71.23472, 0.319781, -0.8503463, -0.005050998, 0.0083572073);
|
|
29
|
+
if (y < 1700)
|
|
30
|
+
return poly(y - 1600, 120, -0.9808, -0.01532, 1 / 7129);
|
|
31
|
+
if (y < 1800)
|
|
32
|
+
return poly(y - 1700, 8.83, 0.1603, -0.0059285, 0.00013336, -1 / 1_174_000);
|
|
33
|
+
if (y < 1860)
|
|
34
|
+
return poly(y - 1800, 13.72, -0.332447, 0.0068612, 0.0041116, -0.00037436, 0.0000121272, -0.0000001699, 0.000000000875);
|
|
35
|
+
if (y < 1900)
|
|
36
|
+
return poly(y - 1860, 7.62, 0.5737, -0.251754, 0.01680668, -0.0004473624, 1 / 233_174);
|
|
37
|
+
if (y < 1920)
|
|
38
|
+
return poly(y - 1900, -2.79, 1.494119, -0.0598939, 0.0061966, -0.000197);
|
|
39
|
+
if (y < 1941)
|
|
40
|
+
return poly(y - 1920, 21.2, 0.84493, -0.0761, 0.0020936);
|
|
41
|
+
if (y < 1961)
|
|
42
|
+
return poly(y - 1950, 29.07, 0.407, -1 / 233, 1 / 2547);
|
|
43
|
+
if (y < 1986)
|
|
44
|
+
return poly(y - 1975, 45.45, 1.067, -1 / 260, -1 / 718);
|
|
45
|
+
return poly(y - 2000, 63.86, 0.3345, -0.060374, 0.0017275, 0.000651814, 0.00002373599);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The offset TT - UTC in seconds at a moment given in UTC: 42.184 s at the start of 1972 and 69.184 s from 2017 on; before 1972, delta T (TT - UT) from the Espenak and Meeus fit.
|
|
49
|
+
*
|
|
50
|
+
* @param utcMs - Milliseconds since 1970 (UTC), finite.
|
|
51
|
+
* @returns Seconds to add to UTC to get Terrestrial Time.
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```ts
|
|
55
|
+
* import { terrestrialMinusUtc } from "./time-scale.ts";
|
|
56
|
+
*
|
|
57
|
+
* console.log(terrestrialMinusUtc(Date.UTC(2026, 10, 8)), terrestrialMinusUtc(Date.UTC(2000, 0, 1)));
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
export function terrestrialMinusUtc(utcMs) {
|
|
61
|
+
if (utcMs >= LEAPS[0][0]) {
|
|
62
|
+
let tai = LEAPS[0][1];
|
|
63
|
+
for (const [from, seconds] of LEAPS)
|
|
64
|
+
if (utcMs >= from)
|
|
65
|
+
tai = seconds;
|
|
66
|
+
return tai + TT_MINUS_TAI;
|
|
67
|
+
}
|
|
68
|
+
const year = new Date(utcMs).getUTCFullYear();
|
|
69
|
+
const start = startOf(year);
|
|
70
|
+
return deltaT(year + (utcMs - start) / (startOf(year + 1) - start));
|
|
71
|
+
}
|
package/dist/when.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** The J2000.0 epoch (2000 January 1, 12:00 UTC, which is TT to within the 64 seconds this package ignores) in milliseconds since 1970. */
|
|
2
|
+
export declare const J2000_MS = 946728000000;
|
|
3
|
+
/**
|
|
4
|
+
* A moment: a `Date` or a number of milliseconds since 1970 (UTC, as JavaScript counts).
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* import { starPosition, starByName, type When } from "@johnmorrisdotca/hoshi-stars";
|
|
9
|
+
*
|
|
10
|
+
* const when: When = new Date(Date.UTC(2026, 10, 7));
|
|
11
|
+
* console.log(starPosition(starByName("Sirius")!, when).declination.toFixed(4));
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export type When = Date | number;
|
|
15
|
+
/** A moment as milliseconds since 1970. A `Date` is never changed. An invalid `Date`, a number that is not finite or anything else throws, naming the argument and the value. */
|
|
16
|
+
export declare function moment(when: When, name?: string): number;
|
package/dist/when.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// A moment as the star functions take it: a `Date` or milliseconds since 1970 (UTC as JavaScript counts it). Pure: no DOM.
|
|
2
|
+
/** The J2000.0 epoch (2000 January 1, 12:00 UTC, which is TT to within the 64 seconds this package ignores) in milliseconds since 1970. */
|
|
3
|
+
export const J2000_MS = 946_728_000_000;
|
|
4
|
+
/** A moment as milliseconds since 1970. A `Date` is never changed. An invalid `Date`, a number that is not finite or anything else throws, naming the argument and the value. */
|
|
5
|
+
export function moment(when, name = "when") {
|
|
6
|
+
if (typeof when === "number") {
|
|
7
|
+
if (Number.isFinite(when))
|
|
8
|
+
return when;
|
|
9
|
+
}
|
|
10
|
+
else if (typeof when?.getTime === "function") {
|
|
11
|
+
const ms = when.getTime();
|
|
12
|
+
if (Number.isFinite(ms))
|
|
13
|
+
return ms;
|
|
14
|
+
}
|
|
15
|
+
else
|
|
16
|
+
throw new TypeError(`${name} must be a Date or a number of milliseconds since 1970, got ${typeof when}`);
|
|
17
|
+
throw new RangeError(`${name} must be a valid Date or a finite number of milliseconds since 1970, got ${String(when)}`);
|
|
18
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,186 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@johnmorrisdotca/hoshi-stars",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Hoshi 星: stars you can see without a telescope, as data and as sky charts. 5,080 stars with names, distance and colour, the 88 constellations with lines and boundaries, the Messier objects and seven map projections. Typed, no dependencies.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"stars",
|
|
7
|
+
"milky-way",
|
|
8
|
+
"star-catalog",
|
|
9
|
+
"bright-star-catalogue",
|
|
10
|
+
"yale",
|
|
11
|
+
"astronomy",
|
|
12
|
+
"constellations",
|
|
13
|
+
"constellation-boundaries",
|
|
14
|
+
"deep-sky",
|
|
15
|
+
"messier",
|
|
16
|
+
"ngc",
|
|
17
|
+
"proper-motion",
|
|
18
|
+
"javascript",
|
|
19
|
+
"typescript",
|
|
20
|
+
"zero-dependencies",
|
|
21
|
+
"itsutsu",
|
|
22
|
+
"spaceprogramx",
|
|
23
|
+
"spx",
|
|
24
|
+
"space",
|
|
25
|
+
"star",
|
|
26
|
+
"star-chart",
|
|
27
|
+
"star-map",
|
|
28
|
+
"starmap",
|
|
29
|
+
"sky-chart",
|
|
30
|
+
"sky-map",
|
|
31
|
+
"night-sky",
|
|
32
|
+
"sky",
|
|
33
|
+
"planetarium",
|
|
34
|
+
"celestial",
|
|
35
|
+
"celestial-sphere",
|
|
36
|
+
"astrometry",
|
|
37
|
+
"cartography",
|
|
38
|
+
"visualization",
|
|
39
|
+
"map-projection",
|
|
40
|
+
"stereographic",
|
|
41
|
+
"svg",
|
|
42
|
+
"constellation",
|
|
43
|
+
"star-names",
|
|
44
|
+
"galaxies",
|
|
45
|
+
"nebulae",
|
|
46
|
+
"star-clusters",
|
|
47
|
+
"observer",
|
|
48
|
+
"altitude",
|
|
49
|
+
"azimuth",
|
|
50
|
+
"horizon",
|
|
51
|
+
"sidereal-time",
|
|
52
|
+
"precession",
|
|
53
|
+
"japanese",
|
|
54
|
+
"katakana"
|
|
55
|
+
],
|
|
56
|
+
"homepage": "https://johnmorrisdotca.github.io/hoshi-stars/",
|
|
57
|
+
"repository": {
|
|
58
|
+
"type": "git",
|
|
59
|
+
"url": "git+https://github.com/johnmorrisdotca/hoshi-stars.git"
|
|
60
|
+
},
|
|
61
|
+
"bugs": {
|
|
62
|
+
"url": "https://github.com/johnmorrisdotca/hoshi-stars/issues"
|
|
63
|
+
},
|
|
64
|
+
"author": "John Morris",
|
|
65
|
+
"license": "MIT",
|
|
66
|
+
"type": "module",
|
|
67
|
+
"sideEffects": false,
|
|
68
|
+
"main": "./dist/index.js",
|
|
69
|
+
"module": "./dist/index.js",
|
|
70
|
+
"types": "./dist/index.d.ts",
|
|
71
|
+
"exports": {
|
|
72
|
+
".": {
|
|
73
|
+
"types": "./dist/index.d.ts",
|
|
74
|
+
"import": "./dist/index.js",
|
|
75
|
+
"default": "./dist/index.js"
|
|
76
|
+
},
|
|
77
|
+
"./constellations": {
|
|
78
|
+
"types": "./dist/constellations.d.ts",
|
|
79
|
+
"import": "./dist/constellations.js",
|
|
80
|
+
"default": "./dist/constellations.js"
|
|
81
|
+
},
|
|
82
|
+
"./lines": {
|
|
83
|
+
"types": "./dist/lines.d.ts",
|
|
84
|
+
"import": "./dist/lines.js",
|
|
85
|
+
"default": "./dist/lines.js"
|
|
86
|
+
},
|
|
87
|
+
"./boundaries": {
|
|
88
|
+
"types": "./dist/boundaries.d.ts",
|
|
89
|
+
"import": "./dist/boundaries.js",
|
|
90
|
+
"default": "./dist/boundaries.js"
|
|
91
|
+
},
|
|
92
|
+
"./deep-sky": {
|
|
93
|
+
"types": "./dist/deep-sky.d.ts",
|
|
94
|
+
"import": "./dist/deep-sky.js",
|
|
95
|
+
"default": "./dist/deep-sky.js"
|
|
96
|
+
},
|
|
97
|
+
"./deep-sky/ngc-ic": {
|
|
98
|
+
"types": "./dist/deep-sky-ngc-ic.d.ts",
|
|
99
|
+
"import": "./dist/deep-sky-ngc-ic.js",
|
|
100
|
+
"default": "./dist/deep-sky-ngc-ic.js"
|
|
101
|
+
},
|
|
102
|
+
"./projection": {
|
|
103
|
+
"types": "./dist/projection.d.ts",
|
|
104
|
+
"import": "./dist/projection.js",
|
|
105
|
+
"default": "./dist/projection.js"
|
|
106
|
+
},
|
|
107
|
+
"./milky-way": {
|
|
108
|
+
"types": "./dist/milky-way.d.ts",
|
|
109
|
+
"import": "./dist/milky-way.js",
|
|
110
|
+
"default": "./dist/milky-way.js"
|
|
111
|
+
},
|
|
112
|
+
"./sky": {
|
|
113
|
+
"types": "./dist/sky.d.ts",
|
|
114
|
+
"import": "./dist/sky.js",
|
|
115
|
+
"default": "./dist/sky.js"
|
|
116
|
+
},
|
|
117
|
+
"./package.json": "./package.json"
|
|
118
|
+
},
|
|
119
|
+
"files": [
|
|
120
|
+
"dist",
|
|
121
|
+
"LICENSE",
|
|
122
|
+
"NOTICE.md",
|
|
123
|
+
"CHANGELOG.md",
|
|
124
|
+
"README.md"
|
|
125
|
+
],
|
|
126
|
+
"engines": {
|
|
127
|
+
"node": ">=22"
|
|
128
|
+
},
|
|
129
|
+
"publishConfig": {
|
|
130
|
+
"access": "public"
|
|
131
|
+
},
|
|
132
|
+
"packageManager": "pnpm@10.11.0",
|
|
133
|
+
"scripts": {
|
|
134
|
+
"build": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\" && tsc -p tsconfig.json",
|
|
135
|
+
"lint": "eslint .",
|
|
136
|
+
"typecheck": "tsc -p tsconfig.check.json && tsc -p tsconfig.tools.json && tsc -p tsconfig.demo.json",
|
|
137
|
+
"test": "node --test test/*.test.ts",
|
|
138
|
+
"check": "pnpm lint && pnpm typecheck && pnpm test && pnpm build && node scripts/check-package.ts",
|
|
139
|
+
"test:package": "pnpm build && node scripts/check-package.ts",
|
|
140
|
+
"prepublishOnly": "pnpm check",
|
|
141
|
+
"site": "pnpm build && node scripts/site.ts",
|
|
142
|
+
"dev": "pnpm site && node scripts/dev.ts",
|
|
143
|
+
"test:demo": "pnpm site && node scripts/docs-site.mjs build && playwright test",
|
|
144
|
+
"family:readme": "node scripts/family-readme.mjs",
|
|
145
|
+
"test:demo:one": "pnpm site && node scripts/docs-site.mjs build && playwright test",
|
|
146
|
+
"test:usage": "pnpm site && node scripts/check-usage.ts",
|
|
147
|
+
"docs:site": "pnpm build && node scripts/docs-site.mjs build",
|
|
148
|
+
"docs:check": "pnpm build && node scripts/docs-site.mjs check",
|
|
149
|
+
"size": "node scripts/docs-site.mjs size",
|
|
150
|
+
"check:standard": "node scripts/check-standard.mjs"
|
|
151
|
+
},
|
|
152
|
+
"devDependencies": {
|
|
153
|
+
"@angular/common": "^22.2.5",
|
|
154
|
+
"@angular/compiler": "^22.2.5",
|
|
155
|
+
"@angular/core": "^22.2.5",
|
|
156
|
+
"@angular/platform-browser": "^22.2.5",
|
|
157
|
+
"@eslint/js": "^9.0.0",
|
|
158
|
+
"@johnmorrisdotca/kazoku-ui": "^0.20.0",
|
|
159
|
+
"@johnmorrisdotca/wakusei-planets": "^0.20.0",
|
|
160
|
+
"@playwright/test": "1.64.0",
|
|
161
|
+
"@sveltejs/vite-plugin-svelte": "^7.3.1",
|
|
162
|
+
"@types/node": "^24.0.0",
|
|
163
|
+
"@types/react": "^19.3.0",
|
|
164
|
+
"@types/react-dom": "^19.3.0",
|
|
165
|
+
"@vitejs/plugin-vue": "^6.0.10",
|
|
166
|
+
"esbuild": "^0.25.0",
|
|
167
|
+
"eslint": "^9.0.0",
|
|
168
|
+
"marked": "^18.1.3",
|
|
169
|
+
"pagefind": "^1.6.0",
|
|
170
|
+
"react": "^19.3.1",
|
|
171
|
+
"react-dom": "^19.3.1",
|
|
172
|
+
"rxjs": "^7.8.2",
|
|
173
|
+
"svelte": "^5.57.3",
|
|
174
|
+
"typescript": "^5.9.0",
|
|
175
|
+
"typescript-eslint": "^8.0.0",
|
|
176
|
+
"vite": "^8.3.6",
|
|
177
|
+
"vue": "^3.5.45",
|
|
178
|
+
"webpack": "^5.112.2",
|
|
179
|
+
"webpack-cli": "^7.3.1"
|
|
180
|
+
},
|
|
181
|
+
"pnpm": {
|
|
182
|
+
"onlyBuiltDependencies": [
|
|
183
|
+
"esbuild"
|
|
184
|
+
]
|
|
185
|
+
}
|
|
186
|
+
}
|