ascii-side-of-the-moon 1.0.7 → 1.0.9

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/README.md CHANGED
@@ -15,10 +15,20 @@ You can use this package directly from the command line:
15
15
  npx ascii-side-of-the-moon
16
16
 
17
17
  # Show moon for a specific date
18
- npx ascii-side-of-the-moon 2025-09-21
18
+ npx ascii-side-of-the-moon 2025-09-19
19
+
20
+ # Include a specific UTC time (quote when using spaces)
21
+ npx ascii-side-of-the-moon "2025-09-19 21:30"
22
+
23
+ # Provide an observer location (latitude/longitude in degrees, optional elevation in meters)
24
+ # (Latitude and longitude are optional, but both must be supplied together;
25
+ # elevation is ignored unless lat/lon are provided.)
26
+ npx ascii-side-of-the-moon 2025-09-19T21:30 --lat 37.7749 --lon -122.4194 --elevation 25
19
27
  ```
20
28
 
21
29
  The CLI will display the ASCII moon art along with information about the moon's phase, illumination percentage, distance, and angular diameter.
30
+ When an observer location is supplied, the renderer also knows the altitude/azimuth
31
+ and can draw the horizon line to show whether the moon is above or below your local horizon.
22
32
 
23
33
  ## Example
24
34
 
@@ -42,11 +52,16 @@ console.log(moonAscii);
42
52
 
43
53
  ## API Reference
44
54
 
45
- ### `getMoonState(date: Date): MoonState`
55
+ ### `getMoonState(date: Date, observer?: ObserverLocation): MoonState`
46
56
  Returns detailed moon information including phase, size, and libration data.
57
+ If you pass an `observer` (latitude/longitude in degrees, optional elevation in meters),
58
+ the returned `MoonState` also contains topocentric position (altitude, azimuth, parallactic angle);
59
+ this enables horizon-aware rendering and correct rotation for your sky.
47
60
 
48
61
  ### `renderMoon(moonState: MoonState, options?: RenderOptions): string`
49
62
  Renders the moon as ASCII art. Returns a 29×60 character string.
63
+ `RenderOptions` now includes `showHorizon` (default `true`): set it to `false`
64
+ if you want to suppress the horizon overlay even when altitude data is available.
50
65
 
51
66
  ### `getMoonPhase(moonState: MoonState): string`
52
67
  Returns the English name of the moon phase (e.g., "New Moon", "Waxing Crescent", "First Quarter", "Waxing Gibbous", "Full Moon", "Waning Gibbous", "Last Quarter", "Waning Crescent").
@@ -56,12 +71,31 @@ Inside of repository for `ascii-side-of-the-moon`.
56
71
 
57
72
  Render a single date:
58
73
  ```sh
74
+ # Show moon for current date
75
+ pnpm run render:demo
76
+
77
+ # Show moon for a specific date
59
78
  pnpm run render:demo 2025-01-01
79
+
80
+ # Include a specific UTC time
81
+ pnpm run render:demo 2025-01-01 21:30
82
+
83
+ # Include observer location (enables parallactic rotation and horizon display)
84
+ pnpm run render:demo 2025-01-01 21:30 --lat 40.7128 --lon -74.0060
85
+
86
+ # With elevation (meters)
87
+ pnpm run render:demo 2025-01-01 21:30 --lat 37.7749 --lon -122.4194 --elevation 25
88
+
89
+ # Just observer location (uses current date/time)
90
+ pnpm run render:demo --lat 40.7128 --lon -74.0060
60
91
  ```
61
92
 
62
93
  Render an animation:
63
94
  ```sh
64
95
  pnpm run render:demo_animate 2025-01-01 2025-12-30
96
+
97
+ # Include observer coordinates (latitude/longitude degrees, optional elevation meters)
98
+ pnpm run render:demo_animate 2025-07-25 2025-08-23 --lat 37.7749 --lon -122.4194 --elevation 25
65
99
  ```
66
100
 
67
101
  Both demo scripts now include the moon phase name in their output.