@angelrove/forecast-utils 1.1.19 → 1.1.20
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/dist/types/OpenMeteo/index.d.ts +2 -1
- package/dist/types/OpenMeteo/types.d.ts +0 -1
- package/dist/types/OpenMeteo/weatherSymbol/weatherSymbol.d.ts +0 -1
- package/dist/types/astronomy/index.d.ts +7 -2
- package/dist/types/astronomy/moon/MoonCalc.d.ts +23 -77
- package/dist/types/astronomy/moon/types.d.ts +33 -0
- package/dist/types/astronomy/sun/SunCalc.d.ts +14 -21
- package/dist/types/geolocation/getGeolocation.d.ts +3 -27
- package/dist/types/geolocation/index.d.ts +3 -2
- package/dist/types/geolocation/lib/reversegeocoding.d.ts +3 -11
- package/dist/types/geolocation/timeFromLocation.d.ts +0 -2
- package/dist/types/geolocation/types.d.ts +16 -0
- package/dist/types/index.d.ts +3 -3
- package/dist/types/utils/degreesToCompass.d.ts +0 -1
- package/dist/types/utils/index.d.ts +7 -6
- package/dist/types/utils/timehelpers.d.ts +2 -6
- package/dist/types/utils/warning.d.ts +0 -3
- package/dist/types/utils/wind/WindArrow.d.ts +0 -2
- package/dist/types/utils/wind/windArrowTx.d.ts +0 -1
- package/dist/types/utils/wind/windLevel.d.ts +7 -23
- package/package.json +6 -3
- package/src/OpenMeteo/index.ts +2 -1
- package/src/OpenMeteo/types.ts +0 -1
- package/src/OpenMeteo/weatherSymbol/weatherSymbol.ts +0 -1
- package/src/astronomy/index.ts +9 -2
- package/src/astronomy/moon/{MoonCalc.js → MoonCalc.ts} +34 -91
- package/src/astronomy/moon/parseBasicData.js +2 -2
- package/src/astronomy/moon/types.ts +36 -0
- package/src/astronomy/sun/SunCalc.js +13 -15
- package/src/geolocation/{getGeolocation.js → getGeolocation.ts} +9 -26
- package/src/geolocation/index.ts +4 -2
- package/src/geolocation/lib/{geolocation.js → geolocation.ts} +2 -2
- package/src/geolocation/lib/{reversegeocoding.js → reversegeocoding.ts} +10 -10
- package/src/geolocation/timeFromLocation.js +0 -2
- package/src/geolocation/types.ts +18 -0
- package/src/index.ts +3 -3
- package/src/utils/degreesToCompass.js +0 -4
- package/src/utils/index.ts +8 -6
- package/src/utils/timehelpers.js +1 -6
- package/src/utils/warning.js +0 -5
- package/src/utils/wind/WindArrow.jsx +0 -2
- package/src/utils/wind/windArrowTx.js +0 -1
- package/src/utils/wind/{windLevel.js → windLevel.ts} +11 -20
- package/README.md +0 -376
- /package/src/geolocation/lib/{geolocationCapacitor.js → geolocationCapacitor.ts} +0 -0
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Use the OpenWeather forecast API
|
|
3
|
-
* @
|
|
3
|
+
* @module OpenMeteo
|
|
4
4
|
*
|
|
5
5
|
*/
|
|
6
6
|
export { useForecastCurrent } from "./current/useForecastCurrent";
|
|
7
7
|
export { useForecastDaily } from "./daily/useForecastDaily";
|
|
8
8
|
export { useForecastHourly } from "./hourly/useForecastHourly";
|
|
9
|
+
export type { ForecastData, WeatherSymbol } from "./types";
|
|
9
10
|
export { weatherSymbol } from "./weatherSymbol/weatherSymbol";
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { WeatherSymbol } from "../types";
|
|
2
2
|
/**
|
|
3
3
|
* Get weather symbol and description based on the weather code.
|
|
4
|
-
* @memberof module:OpenMeteo
|
|
5
4
|
*/
|
|
6
5
|
export declare function weatherSymbol(code: any, precipitation?: number | undefined, night?: boolean, dark?: boolean): WeatherSymbol;
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @module Astronomy
|
|
3
|
+
*
|
|
4
|
+
*/
|
|
5
|
+
export { MoonCalc } from "./moon/MoonCalc";
|
|
6
|
+
export type { AstroPosition, MoonData, MoonDataExt, MoonTimes } from "./moon/types";
|
|
7
|
+
export { SunCalc } from "./sun/SunCalc";
|
|
@@ -1,85 +1,31 @@
|
|
|
1
|
-
export default MoonCalc;
|
|
2
|
-
export type AstroPosition = {
|
|
3
|
-
altitude: number;
|
|
4
|
-
azimuth: number;
|
|
5
|
-
direction: string;
|
|
6
|
-
/**
|
|
7
|
-
* ``
|
|
8
|
-
*/
|
|
9
|
-
direction_full: string;
|
|
10
|
-
};
|
|
11
|
-
export type MoonDataExt = {
|
|
12
|
-
date: string;
|
|
13
|
-
time: string;
|
|
14
|
-
illumination: string;
|
|
15
|
-
phase: string;
|
|
16
|
-
phaseId: string;
|
|
17
|
-
emoji: string;
|
|
18
|
-
parallacticAngle: number;
|
|
19
|
-
angle: number;
|
|
20
|
-
position: AstroPosition;
|
|
21
|
-
next: object;
|
|
22
|
-
};
|
|
23
|
-
export type MoonData = {
|
|
24
|
-
position: AstroPosition;
|
|
25
|
-
next: {
|
|
26
|
-
newMoon: string;
|
|
27
|
-
fullMoon: string;
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
declare namespace MoonCalc {
|
|
31
|
-
export { data };
|
|
32
|
-
export { dataExt };
|
|
33
|
-
export { times };
|
|
34
|
-
export { emoji };
|
|
35
|
-
export { getUpOrDown };
|
|
36
|
-
}
|
|
37
1
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*/
|
|
45
|
-
declare function data(latitude: number, longitude: number, date?: Date, language?: string): MoonData;
|
|
46
|
-
/**
|
|
47
|
-
* Información de la luna para una fecha y hora dadas.
|
|
48
|
-
* La fecha y hora se devolverán en la zona horaria local.
|
|
2
|
+
* MoonCalc for calculating moon times, positions, and phases.
|
|
3
|
+
*
|
|
4
|
+
* import { MoonCalc } from ...
|
|
5
|
+
*
|
|
6
|
+
* Importante!:
|
|
7
|
+
* ¡Solo proporcionar HORA LOCAL DEL SISTEMA!: 'new Date()'
|
|
49
8
|
*
|
|
50
|
-
* @param {number} latitude
|
|
51
|
-
* @param {number} longitude
|
|
52
|
-
* @param {Date} [date=new Date()]
|
|
53
|
-
* @param {string} [language=es-ES]
|
|
54
|
-
* @returns {MoonDataExt} Full information
|
|
55
|
-
* @memberof module:Astronomy/MoonCalc
|
|
56
9
|
*/
|
|
57
|
-
|
|
10
|
+
import type { MoonData, MoonDataExt, MoonTimes } from "./types.js";
|
|
58
11
|
/**
|
|
59
|
-
*
|
|
60
|
-
* @
|
|
61
|
-
* @param {string} timezoneId
|
|
62
|
-
* @param {Date} date
|
|
63
|
-
* @returns {{rise: string, set: string, highest: string}} Moon times
|
|
64
|
-
* @memberof module:Astronomy/MoonCalc
|
|
12
|
+
* MoonCalc.
|
|
13
|
+
* @ignore
|
|
65
14
|
*/
|
|
66
|
-
declare
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
15
|
+
export declare const MoonCalc: {
|
|
16
|
+
data: typeof data;
|
|
17
|
+
dataExt: typeof dataExt;
|
|
18
|
+
times: typeof times;
|
|
19
|
+
emoji: typeof emoji;
|
|
20
|
+
getUpOrDown: typeof getUpOrDown;
|
|
70
21
|
};
|
|
22
|
+
export declare function data(latitude: number, longitude: number, date?: Date, language?: string): MoonData;
|
|
71
23
|
/**
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
* @returns {string} Emoji of the moon phase
|
|
76
|
-
* @memberof module:Astronomy/MoonCalc
|
|
77
|
-
*/
|
|
78
|
-
declare function emoji(latitude: number, longitude: number, date?: Date): string;
|
|
79
|
-
/**
|
|
80
|
-
* @param {number} altitude
|
|
81
|
-
* @param {Date} highest
|
|
82
|
-
* @returns {string} - Up or down emoji
|
|
83
|
-
* @memberof module:Astronomy/MoonCalc
|
|
24
|
+
* Información de la luna para una fecha y hora dadas.
|
|
25
|
+
* La fecha y hora se devolverán en la zona horaria local.
|
|
26
|
+
*
|
|
84
27
|
*/
|
|
85
|
-
declare function
|
|
28
|
+
export declare function dataExt(latitude: number, longitude: number, date?: Date, language?: string): MoonDataExt;
|
|
29
|
+
export declare function emoji(latitude: number, longitude: number, date?: Date): string;
|
|
30
|
+
export declare function times(latitude: number, longitude: number, timezoneId: string, date?: Date): MoonTimes;
|
|
31
|
+
export declare function getUpOrDown(altitude: number, highest: Date): string;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export type AstroPosition = {
|
|
2
|
+
altitude: number;
|
|
3
|
+
azimuth: number;
|
|
4
|
+
direction: string;
|
|
5
|
+
direction_full: string;
|
|
6
|
+
};
|
|
7
|
+
export type MoonDataExt = {
|
|
8
|
+
date: string;
|
|
9
|
+
time: string;
|
|
10
|
+
illumination: string;
|
|
11
|
+
phase: string;
|
|
12
|
+
phaseId: string;
|
|
13
|
+
emoji: string;
|
|
14
|
+
parallacticAngle: number;
|
|
15
|
+
angle: number;
|
|
16
|
+
position: AstroPosition;
|
|
17
|
+
next: {
|
|
18
|
+
newMoon: string;
|
|
19
|
+
fullMoon: string;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export type MoonData = {
|
|
23
|
+
position: AstroPosition;
|
|
24
|
+
next: {
|
|
25
|
+
newMoon: string;
|
|
26
|
+
fullMoon: string;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export type MoonTimes = {
|
|
30
|
+
rise: string;
|
|
31
|
+
set: string;
|
|
32
|
+
highest: string;
|
|
33
|
+
};
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
export default SunCalc;
|
|
2
|
-
declare namespace SunCalc {
|
|
3
|
-
export { all };
|
|
4
|
-
export { times };
|
|
5
|
-
export { getSolarTime };
|
|
6
|
-
export { position };
|
|
7
|
-
export { getIsNight };
|
|
8
|
-
export { getPhase };
|
|
9
|
-
}
|
|
10
1
|
/**
|
|
11
2
|
* @param {Date} date
|
|
12
3
|
* @param {number} latitude
|
|
@@ -14,9 +5,8 @@ declare namespace SunCalc {
|
|
|
14
5
|
* @param {string} timezoneId
|
|
15
6
|
* @returns {{ sunTimes: object, sunPosition: object, sunPhase: string }}
|
|
16
7
|
* { sunTimes: object, sunPosition: object, sunPhase: string }
|
|
17
|
-
* @memberof module:Astronomy/SunCalc
|
|
18
8
|
*/
|
|
19
|
-
|
|
9
|
+
export function all(date: Date, latitude: number, longitude: number, timezoneId: string): {
|
|
20
10
|
sunTimes: object;
|
|
21
11
|
sunPosition: object;
|
|
22
12
|
sunPhase: string;
|
|
@@ -28,9 +18,8 @@ declare function all(date: Date, latitude: number, longitude: number, timezoneId
|
|
|
28
18
|
* @param {string} timezoneId
|
|
29
19
|
* @returns {{ date: Date, sunrise: string, sunset: string, noon: string, dawn: string, dusk: string }}
|
|
30
20
|
* { date: Date, sunrise: string, sunset: string, noon: string, dawn: string, dusk: string }
|
|
31
|
-
* @memberof module:Astronomy/SunCalc
|
|
32
21
|
*/
|
|
33
|
-
|
|
22
|
+
export function times(date: Date, latitude: number, longitude: number, timezoneId: string): {
|
|
34
23
|
date: Date;
|
|
35
24
|
sunrise: string;
|
|
36
25
|
sunset: string;
|
|
@@ -44,17 +33,15 @@ declare function times(date: Date, latitude: number, longitude: number, timezone
|
|
|
44
33
|
* @param {string} offsetSign "+" or "-"
|
|
45
34
|
* @param {number} offset UTC offset in hours
|
|
46
35
|
* @returns {string} Local time in "HH:mm" format
|
|
47
|
-
* @memberof module:Astronomy/SunCalc
|
|
48
36
|
*/
|
|
49
|
-
|
|
37
|
+
export function getSolarTime(date: Date, lng: number, offsetSign: string, offset: number): string;
|
|
50
38
|
/**
|
|
51
39
|
* @param {number} latitude
|
|
52
40
|
* @param {number} longitude
|
|
53
41
|
* @returns {{date: string, azimuth: number, direction: string, direction_full: string, altitude: number, zenith: number, declination: number}}
|
|
54
42
|
* {date: string, azimuth: number, direction: string, direction_full: string, altitude: number, zenith: number, declination: number}
|
|
55
|
-
* @memberof module:Astronomy/SunCalc
|
|
56
43
|
*/
|
|
57
|
-
|
|
44
|
+
export function position(latitude: number, longitude: number, date?: Date, language?: string): {
|
|
58
45
|
date: string;
|
|
59
46
|
azimuth: number;
|
|
60
47
|
direction: string;
|
|
@@ -70,13 +57,19 @@ declare function position(latitude: number, longitude: number, date?: Date, lang
|
|
|
70
57
|
* @param {number | Date} date
|
|
71
58
|
* @param {string} dateStr
|
|
72
59
|
* @returns {boolean} true if it's night, false otherwise
|
|
73
|
-
* @memberof module:Astronomy/SunCalc
|
|
74
60
|
*/
|
|
75
|
-
|
|
61
|
+
export function getIsNight(lat: number, lon: number, timezoneId: string, date: number | Date, dateStr: string): boolean;
|
|
76
62
|
/**
|
|
77
63
|
* @param {number} altitude
|
|
78
64
|
* @param {string} noon
|
|
79
65
|
* @returns {string} The phase of the sun based on its altitude
|
|
80
|
-
* @memberof module:Astronomy/SunCalc
|
|
81
66
|
*/
|
|
82
|
-
|
|
67
|
+
export function getPhase(altitude: number, noon: string): string;
|
|
68
|
+
export namespace SunCalc {
|
|
69
|
+
export { all };
|
|
70
|
+
export { times };
|
|
71
|
+
export { getSolarTime };
|
|
72
|
+
export { position };
|
|
73
|
+
export { getIsNight };
|
|
74
|
+
export { getPhase };
|
|
75
|
+
}
|
|
@@ -1,32 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
* @memberof module:Geolocation
|
|
3
|
-
* @typedef {object} ResolvedLocation
|
|
4
|
-
* @property {number} latitude
|
|
5
|
-
* @property {number} longitude
|
|
6
|
-
* // Address
|
|
7
|
-
* @property {string} sublocality
|
|
8
|
-
* @property {string} locality
|
|
9
|
-
* @property {string} country
|
|
10
|
-
* @property {string} country_short
|
|
11
|
-
* @property {string} formatted_address
|
|
12
|
-
*/
|
|
1
|
+
import type { ResolvedLocation } from "./types";
|
|
13
2
|
/**
|
|
14
3
|
* Get the current geolocation of the device and reverse geocode it to get the address.
|
|
15
4
|
*
|
|
16
|
-
* @
|
|
17
|
-
* @returns {Promise<ResolvedLocation>} Promise
|
|
5
|
+
* @returns {Promise<ResolvedLocation>} Resolved location object.
|
|
18
6
|
* @throws {Error} If geolocation is not supported or permission is denied.
|
|
19
7
|
*/
|
|
20
|
-
export function getGeolocation(): Promise<ResolvedLocation>;
|
|
21
|
-
export type ResolvedLocation = {
|
|
22
|
-
latitude: number;
|
|
23
|
-
/**
|
|
24
|
-
* // Address
|
|
25
|
-
*/
|
|
26
|
-
longitude: number;
|
|
27
|
-
sublocality: string;
|
|
28
|
-
locality: string;
|
|
29
|
-
country: string;
|
|
30
|
-
country_short: string;
|
|
31
|
-
formatted_address: string;
|
|
32
|
-
};
|
|
8
|
+
export declare function getGeolocation(): Promise<ResolvedLocation>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module Geolocation
|
|
3
3
|
*/
|
|
4
|
-
export { getGeolocation } from "./getGeolocation
|
|
5
|
-
export { timeFromLocation } from "./timeFromLocation
|
|
4
|
+
export { getGeolocation } from "./getGeolocation";
|
|
5
|
+
export { timeFromLocation } from "./timeFromLocation";
|
|
6
|
+
export type { ResolvedLocation } from "./types";
|
|
@@ -1,19 +1,11 @@
|
|
|
1
|
+
import type { GeocodingAddress } from "../types";
|
|
1
2
|
/**
|
|
2
3
|
* Reverse Geocoding with GoogleMaps API
|
|
3
4
|
*
|
|
4
5
|
* @see https://developers.google.com/maps/documentation/geocoding/requests-reverse-geocoding?hl=es-419
|
|
5
6
|
* @see https://maps.googleapis.com/maps/api/geocode/json?latlng=36.7248,-4.541&key=[api_key]&result_type=sublocality
|
|
6
7
|
*
|
|
7
|
-
* @
|
|
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.
|
|
8
|
+
* @returns {Promise<GeocodingAddress>} - The address components.
|
|
11
9
|
* @throws {Error} - If the API key is invalid or the request fails.
|
|
12
10
|
*/
|
|
13
|
-
export default function reverseGeocoding(latitude: number, longitude: number, api_key: string): Promise<
|
|
14
|
-
sublocality: string;
|
|
15
|
-
locality: string;
|
|
16
|
-
country: string;
|
|
17
|
-
country_short: string;
|
|
18
|
-
formatted_address: string;
|
|
19
|
-
}>;
|
|
11
|
+
export default function reverseGeocoding(latitude: number, longitude: number, api_key: string): Promise<GeocodingAddress>;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @memberof module:Geolocation
|
|
3
2
|
* @typedef {object} LocalTimeData
|
|
4
3
|
* @property {Date} time - The local time.
|
|
5
4
|
* @property {string} timeStr - The formatted local time string.
|
|
@@ -17,7 +16,6 @@
|
|
|
17
16
|
* @param {number} lng
|
|
18
17
|
* @returns {Promise<any | LocalTimeData>} An object containing the local time and timezone information:
|
|
19
18
|
* @throws {Error} If the API request fails or returns an error status.
|
|
20
|
-
* @memberof module:Geolocation
|
|
21
19
|
*/
|
|
22
20
|
export function timeFromLocation(apiKey: string, lat: number, lng: number): Promise<any | LocalTimeData>;
|
|
23
21
|
export type LocalTimeData = {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type GeocodingAddress = {
|
|
2
|
+
sublocality: string;
|
|
3
|
+
locality: string;
|
|
4
|
+
country: string;
|
|
5
|
+
country_short: string;
|
|
6
|
+
formatted_address: string;
|
|
7
|
+
};
|
|
8
|
+
export type ResolvedLocation = {
|
|
9
|
+
latitude: number;
|
|
10
|
+
longitude: number;
|
|
11
|
+
sublocality: string;
|
|
12
|
+
locality: string;
|
|
13
|
+
country: string;
|
|
14
|
+
country_short: string;
|
|
15
|
+
formatted_address: string;
|
|
16
|
+
};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
1
|
+
export { MoonCalc } from "./astronomy/moon/MoonCalc";
|
|
2
|
+
export { SunCalc } from "./astronomy/sun/SunCalc";
|
|
3
3
|
export { timeFromLocation } from "./geolocation/timeFromLocation";
|
|
4
|
-
export {
|
|
4
|
+
export { TimeDateStr } from "./utils/timehelpers";
|
|
5
5
|
export { getGeolocation } from "./geolocation/getGeolocation";
|
|
6
6
|
export { useForecastCurrent } from "./OpenMeteo/current/useForecastCurrent";
|
|
7
7
|
export { useForecastDaily } from "./OpenMeteo/daily/useForecastDaily";
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
* @param {number} degrees
|
|
5
5
|
* @param {string} language - Language code ("en-US", "es-ES", "auto")
|
|
6
6
|
* @returns {{short: string, full: string}} {short: string, full: string}
|
|
7
|
-
* @memberof module:Utils
|
|
8
7
|
*/
|
|
9
8
|
export function degreesToCompass(degrees: number, language?: string): {
|
|
10
9
|
short: string;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module Utils
|
|
3
3
|
*/
|
|
4
|
-
export { degreesToCompass } from "./degreesToCompass
|
|
5
|
-
export {
|
|
6
|
-
export { getWarning, getWarningByDays } from "./warning
|
|
7
|
-
export { WindArrow } from "./wind/WindArrow
|
|
8
|
-
export { windArrowTx } from "./wind/windArrowTx
|
|
9
|
-
export { getWindLevel } from "./wind/windLevel
|
|
4
|
+
export { degreesToCompass } from "./degreesToCompass";
|
|
5
|
+
export { TimeDateStr } from "./timehelpers";
|
|
6
|
+
export { getWarning, getWarningByDays } from "./warning";
|
|
7
|
+
export { WindArrow } from "./wind/WindArrow";
|
|
8
|
+
export { windArrowTx } from "./wind/windArrowTx";
|
|
9
|
+
export { getWindLevel } from "./wind/windLevel";
|
|
10
|
+
export type { WindLevel } from "./wind/windLevel";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
export
|
|
2
|
-
declare namespace TimeDateStr {
|
|
1
|
+
export namespace TimeDateStr {
|
|
3
2
|
export { dateFormat };
|
|
4
3
|
export { nowString };
|
|
5
4
|
export { timeString };
|
|
@@ -10,7 +9,6 @@ declare namespace TimeDateStr {
|
|
|
10
9
|
*
|
|
11
10
|
* @param {Date} [date=new Date()] La fecha a formatear.
|
|
12
11
|
* @returns {string} La fecha formateada.
|
|
13
|
-
* @memberof module:Utils/TimeDateStr
|
|
14
12
|
*/
|
|
15
13
|
declare function dateFormat(date?: Date): string;
|
|
16
14
|
/**
|
|
@@ -18,7 +16,6 @@ declare function dateFormat(date?: Date): string;
|
|
|
18
16
|
*
|
|
19
17
|
* @param {boolean} sec
|
|
20
18
|
* @returns {String} now time as a formated string
|
|
21
|
-
* @memberof module:Utils/TimeDateStr
|
|
22
19
|
*/
|
|
23
20
|
declare function nowString(sec?: boolean): string;
|
|
24
21
|
/**
|
|
@@ -27,7 +24,6 @@ declare function nowString(sec?: boolean): string;
|
|
|
27
24
|
* @param {Date} [date]
|
|
28
25
|
* @param {boolean} [sec=false]
|
|
29
26
|
* @returns {string} La fecha formateada.
|
|
30
|
-
* @memberof module:Utils/TimeDateStr
|
|
31
27
|
*/
|
|
32
28
|
declare function timeString(date?: Date, sec?: boolean): string;
|
|
33
29
|
/**
|
|
@@ -36,6 +32,6 @@ declare function timeString(date?: Date, sec?: boolean): string;
|
|
|
36
32
|
* @param {string} timeZone - The timezone string (e.g., 'America/New_York').
|
|
37
33
|
* @param {Date | number} [date=new Date()] - The date object to format. Defaults to the current date.
|
|
38
34
|
* @returns {string} - The formatted local time string.
|
|
39
|
-
* @memberof module:Utils/TimeDateStr
|
|
40
35
|
*/
|
|
41
36
|
declare function getLocalTimeFromTz(timeZone: string, date?: Date | number): string;
|
|
37
|
+
export {};
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
* @param {number} showersSumTomorrow
|
|
8
8
|
* @returns {{ levelNum: number, level: string, message: string, day: number } | null}
|
|
9
9
|
* {{ levelNum: number, level: string, message: string, day: number } | null}
|
|
10
|
-
* @memberof module:Utils
|
|
11
10
|
*/
|
|
12
11
|
export function getWarningByDays(precipitationSumToday: number, precipitationSumTomorrow: number, showersSumToday: number, showersSumTomorrow: number): {
|
|
13
12
|
levelNum: number;
|
|
@@ -18,12 +17,10 @@ export function getWarningByDays(precipitationSumToday: number, precipitationSum
|
|
|
18
17
|
/**
|
|
19
18
|
* Get warning by precipitation and showers
|
|
20
19
|
*
|
|
21
|
-
* @export
|
|
22
20
|
* @param {number} precipitation
|
|
23
21
|
* @param {number} showers
|
|
24
22
|
* @returns {{ levelNum: number, level: string, message: string } | null}
|
|
25
23
|
* {{ levelNum: number, level: string, message: string } | null}
|
|
26
|
-
* @memberof module:Utils
|
|
27
24
|
*/
|
|
28
25
|
export function getWarning(precipitation: number, showers: number): {
|
|
29
26
|
levelNum: number;
|
|
@@ -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({ deg, size, strokeWidth, className, }: {
|
|
13
11
|
deg: number;
|
|
@@ -1,30 +1,14 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Return the wind level based on the speed.
|
|
3
|
-
*
|
|
4
|
-
* @param {number} speed Wind speed in km/h
|
|
5
|
-
* @return {WindLevel | null} Wind level object or null if speed is null
|
|
6
|
-
* @memberof module:Utils
|
|
7
|
-
*/
|
|
8
|
-
export function getWindLevel(speed: number): WindLevel | null;
|
|
9
1
|
export type WindLevel = {
|
|
10
|
-
/**
|
|
11
|
-
* - Level ID
|
|
12
|
-
*/
|
|
13
2
|
id: number;
|
|
14
|
-
/**
|
|
15
|
-
* - Minimum wind speed for this level
|
|
16
|
-
*/
|
|
17
3
|
speed: number;
|
|
18
|
-
/**
|
|
19
|
-
* - Color representing this level
|
|
20
|
-
*/
|
|
21
4
|
color: string;
|
|
22
|
-
/**
|
|
23
|
-
* - Text representing this level
|
|
24
|
-
*/
|
|
25
5
|
tx: string;
|
|
26
|
-
/**
|
|
27
|
-
* - Text representing this level
|
|
28
|
-
*/
|
|
29
6
|
txEn: string;
|
|
30
7
|
};
|
|
8
|
+
/**
|
|
9
|
+
* Return the wind level based on the speed.
|
|
10
|
+
*
|
|
11
|
+
* @param speed Wind speed in km/h
|
|
12
|
+
* @return Wind level object or null if speed is null
|
|
13
|
+
*/
|
|
14
|
+
export declare function getWindLevel(speed: number): WindLevel | null;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"author": "Jose Angel Romero Vegas",
|
|
3
3
|
"name": "@angelrove/forecast-utils",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.20",
|
|
5
5
|
"description": "Utilities for obtaining weather and astronomy forecast data.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"publishConfig": {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"homepage": "https://github.com/angelrove/forecast-utils",
|
|
11
11
|
"type": "module",
|
|
12
12
|
"scripts": {
|
|
13
|
-
"docs
|
|
13
|
+
"docs": "typedoc"
|
|
14
14
|
},
|
|
15
15
|
"types": "dist/types/index.d.ts",
|
|
16
16
|
"exports": {
|
|
@@ -41,7 +41,10 @@
|
|
|
41
41
|
"@biomejs/biome": "2.2.4",
|
|
42
42
|
"@types/react": "^19.1.12",
|
|
43
43
|
"@types/react-dom": "^19.1.9",
|
|
44
|
-
"jsdoc-to-markdown": "^9.1.2",
|
|
45
44
|
"typescript": "^5.9.2"
|
|
45
|
+
},
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"typedoc": "^0.28.12",
|
|
48
|
+
"typedoc-plugin-markdown": "^4.8.1"
|
|
46
49
|
}
|
|
47
50
|
}
|
package/src/OpenMeteo/index.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Use the OpenWeather forecast API
|
|
3
|
-
* @
|
|
3
|
+
* @module OpenMeteo
|
|
4
4
|
*
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
export { useForecastCurrent } from "./current/useForecastCurrent";
|
|
8
8
|
export { useForecastDaily } from "./daily/useForecastDaily";
|
|
9
9
|
export { useForecastHourly } from "./hourly/useForecastHourly";
|
|
10
|
+
export type { ForecastData, WeatherSymbol } from "./types";
|
|
10
11
|
export { weatherSymbol } from "./weatherSymbol/weatherSymbol";
|
|
11
12
|
|
package/src/OpenMeteo/types.ts
CHANGED
package/src/astronomy/index.ts
CHANGED
|
@@ -1,2 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @module Astronomy
|
|
3
|
+
*
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export { MoonCalc } from "./moon/MoonCalc";
|
|
7
|
+
export type { AstroPosition, MoonData, MoonDataExt, MoonTimes } from "./moon/types";
|
|
8
|
+
export { SunCalc } from "./sun/SunCalc";
|
|
9
|
+
|