@angelrove/forecast-utils 1.1.18 → 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/current/transformer.d.ts +2 -2
- package/dist/types/OpenMeteo/current/useForecastCurrent.d.ts +2 -7
- package/dist/types/OpenMeteo/daily/transformer.d.ts +2 -2
- package/dist/types/OpenMeteo/daily/useForecastDaily.d.ts +2 -8
- package/dist/types/OpenMeteo/hourly/useForecastHourly.d.ts +2 -9
- package/dist/types/OpenMeteo/index.d.ts +10 -4
- package/dist/types/OpenMeteo/types.d.ts +9 -15
- package/dist/types/OpenMeteo/weatherSymbol/lib/WeatherCodesEn.d.ts +1 -1
- package/dist/types/OpenMeteo/weatherSymbol/lib/WeatherCodesEs.d.ts +1 -1
- package/dist/types/OpenMeteo/weatherSymbol/weatherSymbol.d.ts +2 -12
- 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 +18 -25
- package/dist/types/geolocation/getGeolocation.d.ts +3 -27
- package/dist/types/geolocation/index.d.ts +6 -2
- package/dist/types/geolocation/lib/reversegeocoding.d.ts +3 -11
- package/dist/types/geolocation/timeFromLocation.d.ts +1 -3
- package/dist/types/geolocation/types.d.ts +16 -0
- package/dist/types/index.d.ts +4 -4
- package/dist/types/utils/degreesToCompass.d.ts +0 -1
- package/dist/types/utils/index.d.ts +10 -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 +1 -3
- package/dist/types/utils/wind/windArrowTx.d.ts +0 -1
- package/dist/types/utils/wind/windLevel.d.ts +7 -23
- package/package.json +8 -6
- package/src/OpenMeteo/conf.js +1 -1
- package/src/OpenMeteo/current/transformer.js +1 -1
- package/src/OpenMeteo/current/{useForecastCurrent.js → useForecastCurrent.ts} +9 -9
- package/src/OpenMeteo/daily/transformer.js +1 -1
- package/src/OpenMeteo/daily/{useForecastDaily.js → useForecastDaily.ts} +7 -10
- package/src/OpenMeteo/hourly/{useForecastHourly.js → useForecastHourly.ts} +11 -10
- package/src/OpenMeteo/index.ts +12 -0
- package/src/OpenMeteo/types.ts +14 -0
- package/src/OpenMeteo/weatherSymbol/lib/WeatherCodesEn.js +1 -1
- package/src/OpenMeteo/weatherSymbol/lib/WeatherCodesEs.js +1 -1
- package/src/OpenMeteo/weatherSymbol/{weatherSymbol.js → weatherSymbol.ts} +7 -13
- package/src/astronomy/index.ts +9 -0
- package/src/astronomy/moon/{MoonCalc.js → MoonCalc.ts} +35 -92
- package/src/astronomy/moon/parseBasicData.js +2 -2
- package/src/astronomy/moon/types.ts +36 -0
- package/src/astronomy/sun/SunCalc.js +16 -18
- package/src/geolocation/{getGeolocation.js → getGeolocation.ts} +10 -27
- package/src/geolocation/index.ts +8 -0
- package/src/geolocation/lib/{geolocation.js → geolocation.ts} +5 -5
- package/src/geolocation/lib/{reversegeocoding.js → reversegeocoding.ts} +11 -11
- package/src/geolocation/timeFromLocation.js +2 -4
- package/src/geolocation/types.ts +18 -0
- package/src/{index.js → index.ts} +3 -3
- package/src/utils/degreesToCompass.js +1 -5
- package/src/utils/index.ts +12 -0
- package/src/utils/timehelpers.js +2 -7
- package/src/utils/warning.js +1 -6
- package/src/utils/wind/WindArrow.jsx +2 -5
- package/src/utils/wind/windArrowTx.js +0 -1
- package/src/utils/wind/{windLevel.js → windLevel.ts} +11 -20
- package/README.md +0 -789
- package/src/OpenMeteo/index.js +0 -10
- package/src/OpenMeteo/types.js +0 -8
- package/src/astronomy/index.js +0 -2
- package/src/geolocation/index.js +0 -6
- package/src/utils/index.js +0 -10
- /package/src/geolocation/lib/{geolocationCapacitor.js → geolocationCapacitor.ts} +0 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Transforms the OpenMeteo API data into a more usable format.
|
|
3
3
|
*
|
|
4
4
|
* @param {{current: any, daily: any, hourly: any, latitude: number, longitude: number}} data - The data object to transform.
|
|
5
|
-
* @returns {
|
|
5
|
+
* @returns {object|null} - The transformed data object or null if the input is invalid.
|
|
6
6
|
*/
|
|
7
7
|
export default function transformer(data: {
|
|
8
8
|
current: any;
|
|
@@ -10,4 +10,4 @@ export default function transformer(data: {
|
|
|
10
10
|
hourly: any;
|
|
11
11
|
latitude: number;
|
|
12
12
|
longitude: number;
|
|
13
|
-
}):
|
|
13
|
+
}): object | null;
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
+
import type { ForecastData } from "../types";
|
|
1
2
|
/**
|
|
2
3
|
* Custom hook to fetch current weather data from OpenMeteo API.
|
|
3
|
-
*
|
|
4
|
-
* @param {number} lat
|
|
5
|
-
* @param {number} lon
|
|
6
|
-
* @param {number} refreshIntervalMin
|
|
7
|
-
* @returns {ForecastData} {data, isLoading, isError, apiUrl}
|
|
8
|
-
* @memberof module:OpenMeteo
|
|
9
4
|
*/
|
|
10
|
-
export function useForecastCurrent(lat: number, lon: number, refreshIntervalMin?: number): ForecastData;
|
|
5
|
+
export declare function useForecastCurrent(lat: number | undefined, lon: number | undefined, refreshIntervalMin?: number): ForecastData;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Transforms the OpenMeteo API data into a more usable format.
|
|
3
3
|
*
|
|
4
4
|
* @param {{daily: any}} data - The data object to transform.
|
|
5
|
-
* @returns {
|
|
5
|
+
* @returns {object|null} - The transformed data object or null if the input is invalid.
|
|
6
6
|
*/
|
|
7
7
|
export default function transformer(data: {
|
|
8
8
|
daily: any;
|
|
9
|
-
}):
|
|
9
|
+
}): object | null;
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
+
import type { ForecastData } from "../types";
|
|
1
2
|
/**
|
|
2
3
|
* Custom hook to fetch daily forecast (10 days) data from OpenMeteo API.
|
|
3
|
-
*
|
|
4
4
|
* https://api.open-meteo.com/v1/forecast?timezone=auto&latitude=36.6644363&longitude=-4.5108962&forecast_days=10&daily=weathercode
|
|
5
|
-
*
|
|
6
|
-
* @param {number} lat
|
|
7
|
-
* @param {number} lon
|
|
8
|
-
* @param {number} refreshIntervalMin
|
|
9
|
-
* @returns {ForecastData} {data, isLoading, isError, apiUrl}
|
|
10
|
-
* @memberof module:OpenMeteo
|
|
11
5
|
*/
|
|
12
|
-
export function useForecastDaily(lat: number, lon: number, refreshIntervalMin?: number): ForecastData;
|
|
6
|
+
export declare function useForecastDaily(lat: number | undefined, lon: number | undefined, refreshIntervalMin?: number): ForecastData;
|
|
@@ -1,12 +1,5 @@
|
|
|
1
|
+
import type { ForecastData } from "../types";
|
|
1
2
|
/**
|
|
2
3
|
* Custom hook to fetch hourly forecast data for a given location and number of days from OpenMeteo API.
|
|
3
|
-
*
|
|
4
|
-
* @param {{ latitude: number, longitude: number }} location
|
|
5
|
-
* @param {number} dayNum Number of days from today: -1 = 24 hours, 0 = today, 1 = tomorrow, ...
|
|
6
|
-
* @returns {ForecastData} {data, isLoading, isError, apiUrl}
|
|
7
|
-
* @memberof module:OpenMeteo
|
|
8
4
|
*/
|
|
9
|
-
export function useForecastHourly(
|
|
10
|
-
latitude: number;
|
|
11
|
-
longitude: number;
|
|
12
|
-
}, dayNum: number): ForecastData;
|
|
5
|
+
export declare function useForecastHourly(lat: number, lon: number, dayNum: number): ForecastData;
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Use the OpenWeather forecast API
|
|
3
|
+
* @module OpenMeteo
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
export { useForecastCurrent } from "./current/useForecastCurrent";
|
|
7
|
+
export { useForecastDaily } from "./daily/useForecastDaily";
|
|
8
|
+
export { useForecastHourly } from "./hourly/useForecastHourly";
|
|
9
|
+
export type { ForecastData, WeatherSymbol } from "./types";
|
|
10
|
+
export { weatherSymbol } from "./weatherSymbol/weatherSymbol";
|
|
@@ -1,18 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*/
|
|
1
|
+
/**
|
|
2
|
+
*/
|
|
3
|
+
export type ForecastData = {
|
|
5
4
|
data: any;
|
|
6
|
-
/**
|
|
7
|
-
* - Loading state
|
|
8
|
-
*/
|
|
9
|
-
isLoading: boolean;
|
|
10
|
-
/**
|
|
11
|
-
* - Error state
|
|
12
|
-
*/
|
|
13
|
-
isError: any;
|
|
14
|
-
/**
|
|
15
|
-
* - API URL
|
|
16
|
-
*/
|
|
17
5
|
apiUrl: string;
|
|
6
|
+
isLoading: boolean;
|
|
7
|
+
isError: unknown;
|
|
8
|
+
};
|
|
9
|
+
export type WeatherSymbol = {
|
|
10
|
+
icon: string;
|
|
11
|
+
description: string;
|
|
18
12
|
};
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* 96, 99 * Thunderstorm with slight and heavy hail
|
|
21
21
|
*/
|
|
22
22
|
/**
|
|
23
|
-
* @typedef {
|
|
23
|
+
* @typedef {object} WeatherCodeEntry
|
|
24
24
|
* @property {number} code - WMO Weather interpretation codes (WW).
|
|
25
25
|
* @property {string} icon - Icon name.
|
|
26
26
|
* @property {string} description - Description.
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* 96, 99 * Thunderstorm with slight and heavy hail
|
|
21
21
|
*/
|
|
22
22
|
/**
|
|
23
|
-
* @typedef {
|
|
23
|
+
* @typedef {object} WeatherCodeEntry
|
|
24
24
|
* @property {number} code - WMO Weather interpretation codes (WW).
|
|
25
25
|
* @property {string} icon - Icon name.
|
|
26
26
|
* @property {string} description - Description.
|
|
@@ -1,15 +1,5 @@
|
|
|
1
|
+
import type { WeatherSymbol } from "../types";
|
|
1
2
|
/**
|
|
2
3
|
* Get weather symbol and description based on the weather code.
|
|
3
|
-
*
|
|
4
|
-
* @param {any} code
|
|
5
|
-
* @param {number} [precipitation]
|
|
6
|
-
* @param {boolean} night
|
|
7
|
-
* @param {boolean} dark
|
|
8
|
-
* @returns {{ icon: string, description: string }}
|
|
9
|
-
* { icon: string, description: string }
|
|
10
|
-
* @memberof module:OpenMeteo
|
|
11
4
|
*/
|
|
12
|
-
export function weatherSymbol(code: any, precipitation?: number, night?: boolean, dark?: boolean):
|
|
13
|
-
icon: string;
|
|
14
|
-
description: string;
|
|
15
|
-
};
|
|
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,24 +1,14 @@
|
|
|
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
|
|
13
4
|
* @param {number} longitude
|
|
14
5
|
* @param {string} timezoneId
|
|
15
|
-
* @returns {{ sunTimes:
|
|
16
|
-
* { sunTimes:
|
|
17
|
-
* @memberof module:Astronomy/SunCalc
|
|
6
|
+
* @returns {{ sunTimes: object, sunPosition: object, sunPhase: string }}
|
|
7
|
+
* { sunTimes: object, sunPosition: object, sunPhase: string }
|
|
18
8
|
*/
|
|
19
|
-
|
|
20
|
-
sunTimes:
|
|
21
|
-
sunPosition:
|
|
9
|
+
export function all(date: Date, latitude: number, longitude: number, timezoneId: string): {
|
|
10
|
+
sunTimes: object;
|
|
11
|
+
sunPosition: object;
|
|
22
12
|
sunPhase: string;
|
|
23
13
|
};
|
|
24
14
|
/**
|
|
@@ -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,2 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @module Geolocation
|
|
3
|
+
*/
|
|
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,6 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @
|
|
3
|
-
* @typedef {Object} LocalTimeData
|
|
2
|
+
* @typedef {object} LocalTimeData
|
|
4
3
|
* @property {Date} time - The local time.
|
|
5
4
|
* @property {string} timeStr - The formatted local time string.
|
|
6
5
|
* @property {string} timezone - The timezone name.
|
|
@@ -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,14 +1,14 @@
|
|
|
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";
|
|
8
8
|
export { useForecastHourly } from "./OpenMeteo/hourly/useForecastHourly";
|
|
9
9
|
export { weatherSymbol } from "./OpenMeteo/weatherSymbol/weatherSymbol";
|
|
10
10
|
export { degreesToCompass } from "./utils/degreesToCompass";
|
|
11
|
+
export { getWarning, getWarningByDays } from "./utils/warning";
|
|
11
12
|
export { WindArrow } from "./utils/wind/WindArrow";
|
|
12
13
|
export { windArrowTx } from "./utils/wind/windArrowTx";
|
|
13
14
|
export { getWindLevel } from "./utils/wind/windLevel";
|
|
14
|
-
export { getWarning, getWarningByDays } from "./utils/warning";
|
|
@@ -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,6 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export { getWarning, getWarningByDays } from "./warning
|
|
1
|
+
/**
|
|
2
|
+
* @module Utils
|
|
3
|
+
*/
|
|
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
|
-
* @
|
|
5
|
-
* @param {Object} props - Component props.
|
|
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;
|