@angelrove/forecast-utils 1.1.19 → 1.1.21

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.
Files changed (45) hide show
  1. package/dist/types/OpenMeteo/index.d.ts +2 -1
  2. package/dist/types/OpenMeteo/types.d.ts +0 -1
  3. package/dist/types/OpenMeteo/weatherSymbol/weatherSymbol.d.ts +0 -1
  4. package/dist/types/astronomy/index.d.ts +7 -2
  5. package/dist/types/astronomy/moon/MoonCalc.d.ts +23 -77
  6. package/dist/types/astronomy/moon/types.d.ts +33 -0
  7. package/dist/types/astronomy/sun/SunCalc.d.ts +14 -21
  8. package/dist/types/geolocation/getGeolocation.d.ts +3 -27
  9. package/dist/types/geolocation/index.d.ts +3 -2
  10. package/dist/types/geolocation/lib/reversegeocoding.d.ts +3 -11
  11. package/dist/types/geolocation/timeFromLocation.d.ts +0 -2
  12. package/dist/types/geolocation/types.d.ts +16 -0
  13. package/dist/types/index.d.ts +3 -3
  14. package/dist/types/utils/degreesToCompass.d.ts +0 -1
  15. package/dist/types/utils/index.d.ts +7 -6
  16. package/dist/types/utils/timehelpers.d.ts +2 -6
  17. package/dist/types/utils/warning.d.ts +0 -3
  18. package/dist/types/utils/wind/WindArrow.d.ts +0 -2
  19. package/dist/types/utils/wind/windArrowTx.d.ts +0 -1
  20. package/dist/types/utils/wind/windLevel.d.ts +7 -23
  21. package/package.json +6 -3
  22. package/src/OpenMeteo/index.ts +2 -1
  23. package/src/OpenMeteo/types.ts +0 -1
  24. package/src/OpenMeteo/weatherSymbol/weatherSymbol.ts +0 -1
  25. package/src/astronomy/index.ts +9 -2
  26. package/src/astronomy/moon/{MoonCalc.js → MoonCalc.ts} +34 -91
  27. package/src/astronomy/moon/parseBasicData.js +2 -2
  28. package/src/astronomy/moon/types.ts +36 -0
  29. package/src/astronomy/sun/SunCalc.js +13 -15
  30. package/src/geolocation/{getGeolocation.js → getGeolocation.ts} +9 -26
  31. package/src/geolocation/index.ts +4 -2
  32. package/src/geolocation/lib/{geolocation.js → geolocation.ts} +2 -2
  33. package/src/geolocation/lib/{reversegeocoding.js → reversegeocoding.ts} +10 -10
  34. package/src/geolocation/timeFromLocation.js +1 -3
  35. package/src/geolocation/types.ts +18 -0
  36. package/src/index.ts +3 -3
  37. package/src/utils/degreesToCompass.js +0 -4
  38. package/src/utils/index.ts +8 -6
  39. package/src/utils/timehelpers.js +1 -6
  40. package/src/utils/warning.js +0 -5
  41. package/src/utils/wind/WindArrow.jsx +0 -2
  42. package/src/utils/wind/windArrowTx.js +0 -1
  43. package/src/utils/wind/{windLevel.js → windLevel.ts} +11 -20
  44. package/README.md +0 -376
  45. /package/src/geolocation/lib/{geolocationCapacitor.js → geolocationCapacitor.ts} +0 -0
@@ -6,66 +6,27 @@
6
6
  * Importante!:
7
7
  * ¡Solo proporcionar HORA LOCAL DEL SISTEMA!: 'new Date()'
8
8
  *
9
- * @module Astronomy/MoonCalc
10
9
  */
11
10
 
12
11
  /* @ts-expect-error */
13
12
  import SunCalc from "suncalc3";
14
- import TimeDateStr from "../../utils/timehelpers.js";
13
+ import { TimeDateStr } from "../../utils/timehelpers.js";
15
14
  import { parseBasicData } from "./parseBasicData.js";
15
+ import type { MoonData, MoonDataExt, MoonTimes } from "./types.js";
16
16
 
17
17
  /**
18
18
  * MoonCalc.
19
19
  * @ignore
20
20
  */
21
- const MoonCalc = {
22
- data,
23
- dataExt,
24
- times,
25
- emoji,
26
- getUpOrDown,
21
+ export const MoonCalc = {
22
+ data, dataExt, times, emoji, getUpOrDown,
27
23
  };
28
- export default MoonCalc;
29
-
30
- /**
31
- * @memberof module:Astronomy
32
- * @typedef {object} AstroPosition
33
- * @property {number} altitude
34
- * @property {number} azimuth
35
- * @property {string} direction
36
- * @property {string} direction_full``
37
- */
38
-
39
- /**
40
- * @memberof module:Astronomy/MoonCalc
41
- * @typedef {object} MoonDataExt
42
- * @property {string} date
43
- * @property {string} time
44
- * @property {string} illumination
45
- * @property {string} phase
46
- * @property {string} phaseId
47
- * @property {string} emoji
48
- * @property {number} parallacticAngle
49
- * @property {number} angle
50
- * @property {AstroPosition} position
51
- * @property {object} next
52
- */
53
-
54
- /**
55
- * @memberof module:Astronomy/MoonCalc
56
- * @typedef {object} MoonData
57
- * @property {AstroPosition} position
58
- * @property {object} next
59
- * @property {string} next.newMoon - Date of the next new moon.
60
- * @property {string} next.fullMoon - Date of the next full moon.
61
- */
62
24
 
63
25
  /**
64
26
  * Mapa de fases lunares.
65
27
  * { phaseId, phaseName }
66
28
  *
67
29
  * @type {Object.<string, string>}
68
- * @memberof module:Astronomy/MoonCalc
69
30
  */
70
31
  const phasesES = {
71
32
  newMoon: "Luna Nueva",
@@ -78,16 +39,15 @@ const phasesES = {
78
39
  waningCrescentMoon: "Luna Menguante",
79
40
  };
80
41
 
42
+ type PhaseId = keyof typeof phasesES;
43
+
81
44
  //--------------------------------------------------------------------
82
- /**
83
- * @param {number} latitude
84
- * @param {number} longitude
85
- * @param {Date} [date=new Date()]
86
- * @param {string} [language=es-ES]
87
- * @returns {MoonData} Moon info object
88
- * @memberof module:Astronomy/MoonCalc
89
- */
90
- function data(latitude, longitude, date = new Date(), language = "es-ES") {
45
+ export function data(
46
+ latitude: number,
47
+ longitude: number,
48
+ date: Date = new Date(),
49
+ language: string = "es-ES"): MoonData
50
+ {
91
51
  // date.setHours(date.getHours() + 0); // debug
92
52
  const data = SunCalc.getMoonData(date, latitude, longitude);
93
53
  // console.log("%cdebug:", "color:yellow", data.illumination.next.newMoon.value);
@@ -99,14 +59,13 @@ function data(latitude, longitude, date = new Date(), language = "es-ES") {
99
59
  * Información de la luna para una fecha y hora dadas.
100
60
  * La fecha y hora se devolverán en la zona horaria local.
101
61
  *
102
- * @param {number} latitude
103
- * @param {number} longitude
104
- * @param {Date} [date=new Date()]
105
- * @param {string} [language=es-ES]
106
- * @returns {MoonDataExt} Full information
107
- * @memberof module:Astronomy/MoonCalc
108
62
  */
109
- function dataExt(latitude, longitude, date = new Date(), language = "es-ES") {
63
+ export function dataExt(
64
+ latitude: number,
65
+ longitude: number,
66
+ date: Date = new Date(),
67
+ language: string = "es-ES"): MoonDataExt
68
+ {
110
69
  const data = SunCalc.getMoonData(date, latitude, longitude);
111
70
 
112
71
  // Illumination
@@ -114,8 +73,8 @@ function dataExt(latitude, longitude, date = new Date(), language = "es-ES") {
114
73
  Number((data.illumination.fraction * 100).toFixed(1)) + "%";
115
74
 
116
75
  // Phase
117
- const emoji = data.illumination.phase.emoji;
118
- const phaseId = String(data.illumination.phase.id);
76
+ const emojiStr = data.illumination.phase.emoji;
77
+ const phaseId = String(data.illumination.phase.id) as PhaseId;
119
78
  const phase = phasesES[phaseId];
120
79
 
121
80
  // Angle
@@ -133,7 +92,7 @@ function dataExt(latitude, longitude, date = new Date(), language = "es-ES") {
133
92
  illumination: illumination,
134
93
  phase: phase,
135
94
  phaseId: phaseId,
136
- emoji: emoji,
95
+ emoji: emojiStr,
137
96
  parallacticAngle: parallacticAngle,
138
97
  angle: Math.round(angle),
139
98
  position: basicData.position,
@@ -141,32 +100,22 @@ function dataExt(latitude, longitude, date = new Date(), language = "es-ES") {
141
100
  };
142
101
  }
143
102
  //--------------------------------------------------------------------
144
- /**
145
- * @param {number} latitude
146
- * @param {number} longitude
147
- * @param {Date} [date=new Date()]
148
- * @returns {string} Emoji of the moon phase
149
- * @memberof module:Astronomy/MoonCalc
150
- */
151
- function emoji(latitude, longitude, date = new Date()) {
103
+ export function emoji(
104
+ latitude: number,
105
+ longitude: number,
106
+ date: Date = new Date()): string
107
+ {
152
108
  const data = SunCalc.getMoonData(date, latitude, longitude);
153
109
  return data.illumination.phase.emoji;
154
110
  }
155
111
  //--------------------------------------------------------------------
156
- /**
157
- * @param {number} latitude
158
- * @param {number} longitude
159
- * @param {string} timezoneId
160
- * @param {Date} date
161
- * @returns {{rise: string, set: string, highest: string}} Moon times
162
- * @memberof module:Astronomy/MoonCalc
163
- */
164
- function times(latitude, longitude, timezoneId, date = new Date()) {
165
- const ret = {
166
- rise: "",
167
- set: "",
168
- highest: "",
169
- };
112
+ export function times(
113
+ latitude: number,
114
+ longitude: number,
115
+ timezoneId: string,
116
+ date: Date = new Date()): MoonTimes
117
+ {
118
+ const ret = {} as MoonTimes;
170
119
 
171
120
  const times = SunCalc.getMoonTimes(date, latitude, longitude);
172
121
  if (times.alwaysUp) {
@@ -189,13 +138,7 @@ function times(latitude, longitude, timezoneId, date = new Date()) {
189
138
  return ret;
190
139
  }
191
140
  //--------------------------------------------------------------------
192
- /**
193
- * @param {number} altitude
194
- * @param {Date} highest
195
- * @returns {string} - Up or down emoji
196
- * @memberof module:Astronomy/MoonCalc
197
- */
198
- function getUpOrDown(altitude, highest) {
141
+ export function getUpOrDown(altitude: number, highest: Date): string {
199
142
  const now = new Date();
200
143
  let upOrDown = ""; // ◓ ◒
201
144
 
@@ -1,6 +1,6 @@
1
1
  // @ts-nocheck
2
- import { degreesToCompass } from "../../utils/degreesToCompass.js";
3
- import TimeDateStr from "../../utils/timehelpers.js";
2
+ import { degreesToCompass } from "../../utils/degreesToCompass";
3
+ import { TimeDateStr } from "../../utils/timehelpers";
4
4
 
5
5
  /**
6
6
  * Parse basic data from SunCalc
@@ -0,0 +1,36 @@
1
+ export type AstroPosition = {
2
+ altitude: number;
3
+ azimuth: number;
4
+ direction: string;
5
+ direction_full: string;
6
+ };
7
+
8
+ export type MoonDataExt = {
9
+ date: string;
10
+ time: string;
11
+ illumination: string;
12
+ phase: string;
13
+ phaseId: string;
14
+ emoji: string;
15
+ parallacticAngle: number;
16
+ angle: number;
17
+ position: AstroPosition;
18
+ next: {
19
+ newMoon: string;
20
+ fullMoon: string;
21
+ };
22
+ }
23
+
24
+ export type MoonData = {
25
+ position: AstroPosition;
26
+ next: {
27
+ newMoon: string;
28
+ fullMoon: string;
29
+ };
30
+ };
31
+
32
+ export type MoonTimes = {
33
+ rise: string;
34
+ set: string;
35
+ highest: string;
36
+ };
@@ -13,13 +13,13 @@
13
13
  /* @ts-expect-error */
14
14
  import { default as SunCalc3 } from "suncalc3";
15
15
  import { degreesToCompass } from "../../utils/degreesToCompass.js";
16
- import TimeDateStr from "../../utils/timehelpers.js";
16
+ import { TimeDateStr } from "../../utils/timehelpers.js";
17
17
 
18
18
  /**
19
19
  * SunCalc.
20
20
  * @ignore
21
21
  */
22
- const SunCalc = {
22
+ export const SunCalc = {
23
23
  all,
24
24
  times,
25
25
  getSolarTime,
@@ -27,7 +27,6 @@ const SunCalc = {
27
27
  getIsNight,
28
28
  getPhase,
29
29
  };
30
- export default SunCalc;
31
30
 
32
31
  //-------------------------------------------------------
33
32
  /**
@@ -37,9 +36,8 @@ export default SunCalc;
37
36
  * @param {string} timezoneId
38
37
  * @returns {{ sunTimes: object, sunPosition: object, sunPhase: string }}
39
38
  * { sunTimes: object, sunPosition: object, sunPhase: string }
40
- * @memberof module:Astronomy/SunCalc
41
39
  */
42
- function all(date, latitude, longitude, timezoneId) {
40
+ export function all(date, latitude, longitude, timezoneId) {
43
41
  const sunTimes = SunCalc.times(date, latitude, longitude, timezoneId);
44
42
  const sunPosition = SunCalc.position(latitude, longitude, date);
45
43
  const sunPhase = SunCalc.getPhase(sunPosition.altitude, sunTimes.noon);
@@ -59,9 +57,8 @@ function all(date, latitude, longitude, timezoneId) {
59
57
  * @param {string} timezoneId
60
58
  * @returns {{ date: Date, sunrise: string, sunset: string, noon: string, dawn: string, dusk: string }}
61
59
  * { date: Date, sunrise: string, sunset: string, noon: string, dawn: string, dusk: string }
62
- * @memberof module:Astronomy/SunCalc
63
60
  */
64
- function times(date, latitude, longitude, timezoneId) {
61
+ export function times(date, latitude, longitude, timezoneId) {
65
62
  const times = SunCalc3.getSunTimes(date, latitude, longitude);
66
63
 
67
64
  const sunTimes = {
@@ -86,9 +83,8 @@ function times(date, latitude, longitude, timezoneId) {
86
83
  * @param {string} offsetSign "+" or "-"
87
84
  * @param {number} offset UTC offset in hours
88
85
  * @returns {string} Local time in "HH:mm" format
89
- * @memberof module:Astronomy/SunCalc
90
86
  */
91
- function getSolarTime(date, lng, offsetSign, offset) {
87
+ export function getSolarTime(date, lng, offsetSign, offset) {
92
88
  // Convert offsetSign and offset to a numeric UTC offset (e.g., -3, +2)
93
89
  const utcOffset = (offsetSign === "-" ? -1 : 1) * Math.abs(Number(offset));
94
90
  const solarTime = SunCalc3.getSolarTime(date, lng, utcOffset);
@@ -100,9 +96,13 @@ function getSolarTime(date, lng, offsetSign, offset) {
100
96
  * @param {number} longitude
101
97
  * @returns {{date: string, azimuth: number, direction: string, direction_full: string, altitude: number, zenith: number, declination: number}}
102
98
  * {date: string, azimuth: number, direction: string, direction_full: string, altitude: number, zenith: number, declination: number}
103
- * @memberof module:Astronomy/SunCalc
104
99
  */
105
- function position(latitude, longitude, date = new Date(), language = "es-ES") {
100
+ export function position(
101
+ latitude,
102
+ longitude,
103
+ date = new Date(),
104
+ language = "es-ES",
105
+ ) {
106
106
  const position = SunCalc3.getPosition(date, latitude, longitude);
107
107
 
108
108
  // Get text
@@ -128,9 +128,8 @@ function position(latitude, longitude, date = new Date(), language = "es-ES") {
128
128
  * @param {number | Date} date
129
129
  * @param {string} dateStr
130
130
  * @returns {boolean} true if it's night, false otherwise
131
- * @memberof module:Astronomy/SunCalc
132
131
  */
133
- function getIsNight(lat, lon, timezoneId, date, dateStr) {
132
+ export function getIsNight(lat, lon, timezoneId, date, dateStr) {
134
133
  const times = SunCalc3.getSunTimes(date, lat, lon);
135
134
 
136
135
  // se pueden comparar horas(hh:mm) estando en formato texto
@@ -151,9 +150,8 @@ function getIsNight(lat, lon, timezoneId, date, dateStr) {
151
150
  * @param {number} altitude
152
151
  * @param {string} noon
153
152
  * @returns {string} The phase of the sun based on its altitude
154
- * @memberof module:Astronomy/SunCalc
155
153
  */
156
- function getPhase(altitude, noon) {
154
+ export function getPhase(altitude, noon) {
157
155
  const nowTime = TimeDateStr.nowString();
158
156
 
159
157
  let phase = "day";
@@ -1,29 +1,16 @@
1
- import geolocationCapacitor from "./lib/geolocation.js";
2
- import reverseGeocoding from "./lib/reversegeocoding.js";
3
-
4
- /**
5
- * @memberof module:Geolocation
6
- * @typedef {object} ResolvedLocation
7
- * @property {number} latitude
8
- * @property {number} longitude
9
- * // Address
10
- * @property {string} sublocality
11
- * @property {string} locality
12
- * @property {string} country
13
- * @property {string} country_short
14
- * @property {string} formatted_address
15
- */
1
+ import geolocationCapacitor from "./lib/geolocation";
2
+ import reverseGeocoding from "./lib/reversegeocoding";
3
+ import type { GeocodingAddress, ResolvedLocation } from "./types";
16
4
 
17
5
  /**
18
6
  * Get the current geolocation of the device and reverse geocode it to get the address.
19
7
  *
20
- * @memberof module:Geolocation
21
- * @returns {Promise<ResolvedLocation>} Promise
8
+ * @returns {Promise<ResolvedLocation>} Resolved location object.
22
9
  * @throws {Error} If geolocation is not supported or permission is denied.
23
10
  */
24
- export async function getGeolocation() {
25
- let location;
26
- let address = null;
11
+ export async function getGeolocation(): Promise<ResolvedLocation> {
12
+ let location: { latitude: number; longitude: number };
13
+ let address = {} as GeocodingAddress;
27
14
 
28
15
  // Location ---
29
16
  try {
@@ -57,13 +44,9 @@ export async function getGeolocation() {
57
44
 
58
45
  // Return data ---
59
46
  return {
47
+ ...address,
60
48
  latitude: location.latitude,
61
- longitude: location.longitude,
62
- sublocality: address.sublocality,
63
- locality: address.locality,
64
- country: address.country,
65
- country_short: address.country_short,
66
- formatted_address: address.formatted_address,
49
+ longitude: location.longitude
67
50
  };
68
51
  }
69
52
  //--------------------------------------------
@@ -2,5 +2,7 @@
2
2
  * @module Geolocation
3
3
  */
4
4
 
5
- export { getGeolocation } from "./getGeolocation.js";
6
- export { timeFromLocation } from "./timeFromLocation.js";
5
+ export { getGeolocation } from "./getGeolocation";
6
+ export { timeFromLocation } from "./timeFromLocation";
7
+ export type { ResolvedLocation } from "./types";
8
+
@@ -4,7 +4,7 @@
4
4
  * @returns {Promise<{latitude: number, longitude: number}>}
5
5
  * @throws {Error} If geolocation is not supported or permission is denied.
6
6
  */
7
- export default async function geolocation() {
7
+ export default async function geolocation(): Promise<{latitude: number, longitude: number}> {
8
8
  const geolocOptions = {
9
9
  enableHighAccuracy: true,
10
10
  timeout: 6 * 1000,
@@ -12,7 +12,7 @@ export default async function geolocation() {
12
12
  };
13
13
 
14
14
  try {
15
- const data = await new Promise((resolve, reject) => {
15
+ const data = await new Promise<GeolocationPosition>((resolve, reject) => {
16
16
  if ("geolocation" in navigator) {
17
17
  navigator.geolocation.getCurrentPosition(
18
18
  resolve,
@@ -1,16 +1,20 @@
1
+ import type { GeocodingAddress } from "../types";
2
+
1
3
  /**
2
4
  * Reverse Geocoding with GoogleMaps API
3
5
  *
4
6
  * @see https://developers.google.com/maps/documentation/geocoding/requests-reverse-geocoding?hl=es-419
5
7
  * @see https://maps.googleapis.com/maps/api/geocode/json?latlng=36.7248,-4.541&key=[api_key]&result_type=sublocality
6
8
  *
7
- * @param {number} latitude - Latitude of the location.
8
- * @param {number} longitude - Longitude of the location.
9
- * @param {string} api_key - Google Maps API key.
10
- * @returns {Promise<{ sublocality: string; locality: string; country: string; country_short: string; formatted_address: string; }>} - The address components.
9
+ * @returns {Promise<GeocodingAddress>} - The address components.
11
10
  * @throws {Error} - If the API key is invalid or the request fails.
12
11
  */
13
- export default async function reverseGeocoding(latitude, longitude, api_key) {
12
+
13
+ export default async function reverseGeocoding(
14
+ latitude: number,
15
+ longitude: number,
16
+ api_key: string): Promise<GeocodingAddress>
17
+ {
14
18
  // Validate --
15
19
  if (!api_key) {
16
20
  console.error("ReverseGeocoding: invalid api key");
@@ -97,11 +101,7 @@ export default async function reverseGeocoding(latitude, longitude, api_key) {
97
101
  };
98
102
  }
99
103
 
100
- /**
101
- * @param {string} title
102
- * @param {any} url
103
- */
104
- function devLog(title, url) {
104
+ function devLog(title: string, url: any) {
105
105
  /* @ts-expect-error */
106
106
  if (import.meta.env.MODE === "development") {
107
107
  console.log(`> fetch [${title}]:`, url);
@@ -1,8 +1,7 @@
1
1
  // @ts-nocheck
2
- import TimeDateStr from "../utils/timehelpers.js";
2
+ import { TimeDateStr } from "../utils/timehelpers.js";
3
3
 
4
4
  /**
5
- * @memberof module:Geolocation
6
5
  * @typedef {object} LocalTimeData
7
6
  * @property {Date} time - The local time.
8
7
  * @property {string} timeStr - The formatted local time string.
@@ -22,7 +21,6 @@ import TimeDateStr from "../utils/timehelpers.js";
22
21
  * @param {number} lng
23
22
  * @returns {Promise<any | LocalTimeData>} An object containing the local time and timezone information:
24
23
  * @throws {Error} If the API request fails or returns an error status.
25
- * @memberof module:Geolocation
26
24
  */
27
25
  export async function timeFromLocation(apiKey, lat, lng) {
28
26
  const timestamp = Math.floor(Date.now() / 1000);
@@ -0,0 +1,18 @@
1
+ export type GeocodingAddress = {
2
+ sublocality: string;
3
+ locality: string;
4
+ country: string;
5
+ country_short: string;
6
+ formatted_address: string;
7
+ };
8
+
9
+ export type ResolvedLocation = {
10
+ latitude: number;
11
+ longitude: number;
12
+ // Address
13
+ sublocality: string;
14
+ locality: string;
15
+ country: string;
16
+ country_short: string;
17
+ formatted_address: string;
18
+ };
package/src/index.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  // Astronomy
2
- export { default as MoonCalc } from "./astronomy/moon/MoonCalc";
3
- export { default as SunCalc } from "./astronomy/sun/SunCalc";
2
+ export { MoonCalc } from "./astronomy/moon/MoonCalc";
3
+ export { SunCalc } from "./astronomy/sun/SunCalc";
4
4
  export { timeFromLocation } from "./geolocation/timeFromLocation";
5
- export { default as TimeDateStr } from "./utils/timehelpers";
5
+ export { TimeDateStr } from "./utils/timehelpers";
6
6
 
7
7
  // Geolocation
8
8
  export { getGeolocation } from "./geolocation/getGeolocation";
@@ -6,7 +6,6 @@
6
6
  * @typedef {object} Compass
7
7
  * @property {string} short - Short compass designation
8
8
  * @property {string} full - Full compass designation
9
- * @memberof module:Utils
10
9
  */
11
10
 
12
11
  /**
@@ -15,7 +14,6 @@
15
14
  * @constant
16
15
  * @property {string} short - Short compass designation
17
16
  * @property {string} full - Full compass designation
18
- * @memberof module:Utils
19
17
  */
20
18
  const directions = [
21
19
  { short: "N", full: "North" },
@@ -34,7 +32,6 @@ const directions = [
34
32
  * @constant
35
33
  * @property {string} short - Short compass designation
36
34
  * @property {string} full - Full compass designation
37
- * @memberof module:Utils
38
35
  */
39
36
  const directionsEs = [
40
37
  { short: "N", full: "Norte" },
@@ -53,7 +50,6 @@ const directionsEs = [
53
50
  * @param {number} degrees
54
51
  * @param {string} language - Language code ("en-US", "es-ES", "auto")
55
52
  * @returns {{short: string, full: string}} {short: string, full: string}
56
- * @memberof module:Utils
57
53
  */
58
54
  export function degreesToCompass(degrees, language = "auto") {
59
55
  if (degrees == null) return { short: "?", full: "?" };
@@ -2,9 +2,11 @@
2
2
  * @module Utils
3
3
  */
4
4
 
5
- export { degreesToCompass } from "./degreesToCompass.js";
6
- export { default as TimeDateStr } from "./timehelpers.js";
7
- export { getWarning, getWarningByDays } from "./warning.js";
8
- export { WindArrow } from "./wind/WindArrow.jsx";
9
- export { windArrowTx } from "./wind/windArrowTx.js";
10
- export { getWindLevel } from "./wind/windLevel.js";
5
+ export { degreesToCompass } from "./degreesToCompass";
6
+ export { TimeDateStr } from "./timehelpers";
7
+ export { getWarning, getWarningByDays } from "./warning";
8
+ export { WindArrow } from "./wind/WindArrow";
9
+ export { windArrowTx } from "./wind/windArrowTx";
10
+ export { getWindLevel } from "./wind/windLevel";
11
+ export type { WindLevel } from "./wind/windLevel";
12
+
@@ -8,13 +8,12 @@
8
8
  * TimeDateStr.
9
9
  * @ignore
10
10
  */
11
- const TimeDateStr = {
11
+ export const TimeDateStr = {
12
12
  dateFormat,
13
13
  nowString,
14
14
  timeString,
15
15
  getLocalTimeFromTz,
16
16
  };
17
- export default TimeDateStr;
18
17
 
19
18
  //------------------------------------------------------
20
19
  /**
@@ -22,7 +21,6 @@ export default TimeDateStr;
22
21
  *
23
22
  * @param {Date} [date=new Date()] La fecha a formatear.
24
23
  * @returns {string} La fecha formateada.
25
- * @memberof module:Utils/TimeDateStr
26
24
  */
27
25
  function dateFormat(date = new Date()) {
28
26
  const options = {
@@ -40,7 +38,6 @@ function dateFormat(date = new Date()) {
40
38
  * @param {Date} [date]
41
39
  * @param {boolean} [sec=false]
42
40
  * @returns {string} La fecha formateada.
43
- * @memberof module:Utils/TimeDateStr
44
41
  */
45
42
  function timeString(date = new Date(), sec = false) {
46
43
  if (sec) {
@@ -64,7 +61,6 @@ function timeString(date = new Date(), sec = false) {
64
61
  *
65
62
  * @param {boolean} sec
66
63
  * @returns {String} now time as a formated string
67
- * @memberof module:Utils/TimeDateStr
68
64
  */
69
65
  function nowString(sec = false) {
70
66
  return timeString(new Date(), sec);
@@ -76,7 +72,6 @@ function nowString(sec = false) {
76
72
  * @param {string} timeZone - The timezone string (e.g., 'America/New_York').
77
73
  * @param {Date | number} [date=new Date()] - The date object to format. Defaults to the current date.
78
74
  * @returns {string} - The formatted local time string.
79
- * @memberof module:Utils/TimeDateStr
80
75
  */
81
76
  function getLocalTimeFromTz(timeZone, date = new Date()) {
82
77
  // Timezone example
@@ -4,14 +4,12 @@
4
4
  * @property {string} level - The alert level string (e.g., "red", "orange", "yellow").
5
5
  * @property {number} precipitation - The precipitation threshold for the alert level.
6
6
  * @property {number} showers - The showers threshold for the alert level.
7
- * @memberof module:Utils
8
7
  */
9
8
 
10
9
  /**
11
10
  * Alert levels for rain and showers
12
11
  *
13
12
  * @type {AlertLevel[]}
14
- * @memberof module:Utils
15
13
  */
16
14
  const ALERT_LEVEL = [
17
15
  { levelNum: 3, level: "red", precipitation: 120, showers: 60 },
@@ -28,7 +26,6 @@ const ALERT_LEVEL = [
28
26
  * @param {number} showersSumTomorrow
29
27
  * @returns {{ levelNum: number, level: string, message: string, day: number } | null}
30
28
  * {{ levelNum: number, level: string, message: string, day: number } | null}
31
- * @memberof module:Utils
32
29
  */
33
30
  export function getWarningByDays(
34
31
  precipitationSumToday,
@@ -60,12 +57,10 @@ export function getWarningByDays(
60
57
  /**
61
58
  * Get warning by precipitation and showers
62
59
  *
63
- * @export
64
60
  * @param {number} precipitation
65
61
  * @param {number} showers
66
62
  * @returns {{ levelNum: number, level: string, message: string } | null}
67
63
  * {{ levelNum: number, level: string, message: string } | null}
68
- * @memberof module:Utils
69
64
  */
70
65
  export function getWarning(precipitation, showers) {
71
66
  const warningRain = getWarningRain(precipitation);
@@ -1,13 +1,11 @@
1
1
  /**
2
2
  * SVG arrow indicating wind direction.
3
3
  *
4
- * @component JSX
5
4
  * @param {object} props - Component props.
6
5
  * @param {number} props.deg - Wind direction in degrees (0 = North, 90 = East, etc.).
7
6
  * @param {string} [props.size] - Tailwind CSS size class (e.g., 'size-10')
8
7
  * @param {number} [props.strokeWidth] - Stroke width of the arrow (range: 1–6).
9
8
  * @param {string} [props.className] - Additional CSS classes.
10
- * @memberof module:Utils
11
9
  */
12
10
  export function WindArrow({
13
11
  deg,
@@ -3,7 +3,6 @@
3
3
  *
4
4
  * @param {number} deg - Wind direction in degrees.
5
5
  * @returns {string} Arrow representation of the wind direction.
6
- * @memberof module:Utils
7
6
  */
8
7
  export function windArrowTx(deg) {
9
8
  if (deg == null) {