nuxt-weather-module 1.0.3 → 1.0.4

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/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": "^4.0.0"
6
6
  },
7
- "version": "1.0.3",
7
+ "version": "1.0.4",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.2",
10
10
  "unbuild": "3.6.1"
@@ -1,5 +1,5 @@
1
1
  type __VLS_ModelProps = {
2
- 'status'?: 'idle' | 'pending' | 'success' | 'error';
2
+ "status"?: "idle" | "pending" | "success" | "error";
3
3
  };
4
4
  declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
5
5
  "update:status": (value: "idle" | "pending" | "success" | "error") => any;
@@ -1,6 +1,10 @@
1
1
  <template>
2
2
  <div>
3
- <Icon v-if="status === 'success'" class="dynamic-weather-icon" :name="`weather:${setIcon}`" />
3
+ <Icon
4
+ v-if="status === 'success'"
5
+ class="dynamic-weather-icon"
6
+ :name="`weather:${setIcon}`"
7
+ />
4
8
  </div>
5
9
  </template>
6
10
 
@@ -12,17 +16,34 @@ import { WEATHER_CODE_MAP } from "../utils/constants";
12
16
  const status = defineModel("status", { type: String, ...{
13
17
  default: "pending"
14
18
  } });
19
+ watch(
20
+ status,
21
+ (newStatus) => {
22
+ if (newStatus === void 0) {
23
+ status.value = "pending";
24
+ }
25
+ },
26
+ { immediate: true }
27
+ );
15
28
  const config = useRuntimeConfig();
16
29
  const { latitude, longitude } = config.public.weatherModule;
17
- const { status: asyncStatus, data, error } = await useLazyAsyncData(
30
+ const {
31
+ status: asyncStatus,
32
+ data,
33
+ error
34
+ } = await useLazyAsyncData(
18
35
  "weather-icon",
19
36
  () => $fetch(
20
37
  `https://api.open-meteo.com/v1/forecast?latitude=${latitude}&longitude=${longitude}&current_weather=true`
21
38
  )
22
39
  );
23
- watch(asyncStatus, (newStatus) => {
24
- status.value = newStatus;
25
- }, { immediate: true });
40
+ watch(
41
+ asyncStatus,
42
+ (newStatus) => {
43
+ status.value = newStatus;
44
+ },
45
+ { immediate: true }
46
+ );
26
47
  if (error.value) {
27
48
  console.error("Error fetching weather data:", error.value);
28
49
  }
@@ -1,5 +1,5 @@
1
1
  type __VLS_ModelProps = {
2
- 'status'?: 'idle' | 'pending' | 'success' | 'error';
2
+ "status"?: "idle" | "pending" | "success" | "error";
3
3
  };
4
4
  declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
5
5
  "update:status": (value: "idle" | "pending" | "success" | "error") => any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-weather-module",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "A Nuxt module for displaying dynamic weather icons from Open-Meteo API with configurable coordinates",
5
5
  "author": "LobergDesign",
6
6
  "homepage": "https://github.com/LobergDesign/weather-module#readme",