@gui-chat-plugin/weather 0.0.1
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 +85 -0
- package/dist/core/definition.d.ts +16 -0
- package/dist/core/index.d.ts +4 -0
- package/dist/core/plugin.d.ts +6 -0
- package/dist/core/samples.d.ts +2 -0
- package/dist/core/types.d.ts +55 -0
- package/dist/core.cjs +1 -0
- package/dist/core.js +322 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +7 -0
- package/dist/style.css +1 -0
- package/dist/vue/Preview.vue.d.ts +8 -0
- package/dist/vue/View.vue.d.ts +9 -0
- package/dist/vue/components/TemperatureChart.vue.d.ts +9 -0
- package/dist/vue/index.d.ts +11 -0
- package/dist/vue.cjs +1 -0
- package/dist/vue.js +554 -0
- package/package.json +57 -0
package/README.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# @gui-chat-plugin/weather
|
|
2
|
+
|
|
3
|
+
Weather forecast plugin for GUI Chat applications. Fetches weather data from Japan Meteorological Agency (JMA) API.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Real-time weather forecast from JMA API
|
|
8
|
+
- Support for all 47 Japanese prefectures and 59 regional areas
|
|
9
|
+
- Interactive weather display with temperature charts
|
|
10
|
+
- Extended forecast with daily cards
|
|
11
|
+
- Precipitation probability visualization
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
yarn add @gui-chat-plugin/weather
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
### Vue Integration
|
|
22
|
+
|
|
23
|
+
```typescript
|
|
24
|
+
// In src/tools/index.ts
|
|
25
|
+
import WeatherPlugin from "@gui-chat-plugin/weather/vue";
|
|
26
|
+
|
|
27
|
+
const pluginList = [
|
|
28
|
+
// ... other plugins
|
|
29
|
+
WeatherPlugin,
|
|
30
|
+
];
|
|
31
|
+
|
|
32
|
+
// In src/main.ts
|
|
33
|
+
import "@gui-chat-plugin/weather/style.css";
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Core-only Usage
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
import { executeWeather, TOOL_DEFINITION } from "@gui-chat-plugin/weather";
|
|
40
|
+
|
|
41
|
+
// Fetch weather for Tokyo
|
|
42
|
+
const result = await executeWeather(context, {
|
|
43
|
+
areaCode: "130000",
|
|
44
|
+
});
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## API
|
|
48
|
+
|
|
49
|
+
### WeatherArgs
|
|
50
|
+
|
|
51
|
+
```typescript
|
|
52
|
+
interface WeatherArgs {
|
|
53
|
+
areaCode: string; // JMA area code (e.g., "130000" for Tokyo)
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Area Codes
|
|
58
|
+
|
|
59
|
+
Common area codes:
|
|
60
|
+
- Tokyo: `130000`
|
|
61
|
+
- Osaka: `270000`
|
|
62
|
+
- Kyoto: `260000`
|
|
63
|
+
- Fukuoka: `400000`
|
|
64
|
+
- Hokkaido (Ishikari): `016000`
|
|
65
|
+
- Okinawa: `471000`
|
|
66
|
+
|
|
67
|
+
## Development
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
# Install dependencies
|
|
71
|
+
yarn install
|
|
72
|
+
|
|
73
|
+
# Run demo
|
|
74
|
+
yarn dev
|
|
75
|
+
|
|
76
|
+
# Build
|
|
77
|
+
yarn build
|
|
78
|
+
|
|
79
|
+
# Lint
|
|
80
|
+
yarn lint
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## License
|
|
84
|
+
|
|
85
|
+
MIT
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const TOOL_NAME = "fetchWeather";
|
|
2
|
+
export declare const TOOL_DEFINITION: {
|
|
3
|
+
type: "function";
|
|
4
|
+
name: string;
|
|
5
|
+
description: string;
|
|
6
|
+
parameters: {
|
|
7
|
+
type: "object";
|
|
8
|
+
properties: {
|
|
9
|
+
areaCode: {
|
|
10
|
+
type: string;
|
|
11
|
+
description: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
required: string[];
|
|
15
|
+
};
|
|
16
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ToolContext, ToolResult } from "gui-chat-protocol/vue";
|
|
2
|
+
import type { WeatherToolData, WeatherJsonData, WeatherArgs } from "./types";
|
|
3
|
+
import { TOOL_DEFINITION } from "./definition";
|
|
4
|
+
export type WeatherResult = ToolResult<WeatherToolData, WeatherJsonData>;
|
|
5
|
+
export declare const fetchWeather: (_context: ToolContext, args: WeatherArgs) => Promise<WeatherResult>;
|
|
6
|
+
export { TOOL_DEFINITION };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export interface WeatherToolData {
|
|
2
|
+
areaCode: string;
|
|
3
|
+
areaName: string;
|
|
4
|
+
publishingOffice?: string;
|
|
5
|
+
reportDatetime?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface WeatherJsonData {
|
|
8
|
+
publishingOffice?: string;
|
|
9
|
+
reportDatetime?: string;
|
|
10
|
+
timeSeries?: Array<{
|
|
11
|
+
timeDefines: string[];
|
|
12
|
+
areas: Array<{
|
|
13
|
+
area: {
|
|
14
|
+
name: string;
|
|
15
|
+
code?: string;
|
|
16
|
+
};
|
|
17
|
+
weatherCodes?: string[];
|
|
18
|
+
weathers?: string[];
|
|
19
|
+
winds?: string[];
|
|
20
|
+
waves?: string[];
|
|
21
|
+
pops?: string[];
|
|
22
|
+
temps?: string[];
|
|
23
|
+
tempsMin?: string[];
|
|
24
|
+
tempsMinUpper?: string[];
|
|
25
|
+
tempsMinLower?: string[];
|
|
26
|
+
tempsMax?: string[];
|
|
27
|
+
tempsMaxUpper?: string[];
|
|
28
|
+
tempsMaxLower?: string[];
|
|
29
|
+
}>;
|
|
30
|
+
}>;
|
|
31
|
+
tempAverage?: {
|
|
32
|
+
areas: Array<{
|
|
33
|
+
area: {
|
|
34
|
+
name: string;
|
|
35
|
+
code?: string;
|
|
36
|
+
};
|
|
37
|
+
min?: string;
|
|
38
|
+
max?: string;
|
|
39
|
+
}>;
|
|
40
|
+
};
|
|
41
|
+
precipAverage?: {
|
|
42
|
+
areas: Array<{
|
|
43
|
+
area: {
|
|
44
|
+
name: string;
|
|
45
|
+
code?: string;
|
|
46
|
+
};
|
|
47
|
+
min?: string;
|
|
48
|
+
max?: string;
|
|
49
|
+
}>;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
export interface WeatherArgs {
|
|
53
|
+
areaCode: string;
|
|
54
|
+
}
|
|
55
|
+
export type { ToolResult } from "gui-chat-protocol/vue";
|
package/dist/core.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s="fetchWeather",m={type:"function",name:s,description:"Fetch weather forecast information from Japan Meteorological Agency (JMA) for any region in Japan. Supports all 47 prefectures plus regional subdivisions (59 areas total).",parameters:{type:"object",properties:{areaCode:{type:"string",description:"The JMA area code for the location. Examples: Tokyo (130000), Osaka (270000), Hokkaido regions (011000-017000), Kyoto (260000), Fukuoka (400000), Okinawa (471000). All Japanese prefectures and regions are supported."}},required:["areaCode"]}},i=[{code:"011000",name:"宗谷地方"},{code:"012000",name:"上川・留萌地方"},{code:"013000",name:"網走・北見・紋別地方"},{code:"014030",name:"十勝地方"},{code:"014100",name:"釧路・根室地方"},{code:"015000",name:"胆振・日高地方"},{code:"016000",name:"石狩・空知・後志地方"},{code:"017000",name:"渡島・檜山地方"},{code:"020000",name:"青森県"},{code:"030000",name:"岩手県"},{code:"040000",name:"宮城県"},{code:"050000",name:"秋田県"},{code:"060000",name:"山形県"},{code:"070000",name:"福島県"},{code:"080000",name:"茨城県"},{code:"090000",name:"栃木県"},{code:"100000",name:"群馬県"},{code:"110000",name:"埼玉県"},{code:"120000",name:"千葉県"},{code:"130000",name:"東京都"},{code:"140000",name:"神奈川県"},{code:"150000",name:"新潟県"},{code:"160000",name:"富山県"},{code:"170000",name:"石川県"},{code:"180000",name:"福井県"},{code:"190000",name:"山梨県"},{code:"200000",name:"長野県"},{code:"210000",name:"岐阜県"},{code:"220000",name:"静岡県"},{code:"230000",name:"愛知県"},{code:"240000",name:"三重県"},{code:"250000",name:"滋賀県"},{code:"260000",name:"京都府"},{code:"270000",name:"大阪府"},{code:"280000",name:"兵庫県"},{code:"290000",name:"奈良県"},{code:"300000",name:"和歌山県"},{code:"310000",name:"鳥取県"},{code:"320000",name:"島根県"},{code:"330000",name:"岡山県"},{code:"340000",name:"広島県"},{code:"350000",name:"山口県"},{code:"360000",name:"徳島県"},{code:"370000",name:"香川県"},{code:"380000",name:"愛媛県"},{code:"390000",name:"高知県"},{code:"400000",name:"福岡県"},{code:"410000",name:"佐賀県"},{code:"420000",name:"長崎県"},{code:"430000",name:"熊本県"},{code:"440000",name:"大分県"},{code:"450000",name:"宮崎県"},{code:"460040",name:"奄美地方"},{code:"460100",name:"鹿児島県(奄美地方除く)"},{code:"471000",name:"沖縄本島地方"},{code:"472000",name:"大東島地方"},{code:"473000",name:"宮古島地方"},{code:"474000",name:"八重山地方"}],h=i.reduce((c,n)=>(c[n.code]=n.name,c),{}),l=async(c,n)=>{const{areaCode:a}=n,e=h[a]||"Unknown";try{const o=`https://www.jma.go.jp/bosai/forecast/data/forecast/${a}.json`,t=await fetch(o);if(!t.ok)throw new Error(`JMA API error: ${t.status} ${t.statusText}`);const d=await t.json(),r=Array.isArray(d)&&d.length>0?d[0]:null;return r?{message:`Successfully fetched weather forecast for ${e}`,title:`Weather - ${e}`,jsonData:r,instructions:"Provide a summary of the weather forecast. Include today's weather, temperature range, and any notable conditions. Keep it concise and conversational.",data:{areaCode:a,areaName:e,publishingOffice:r.publishingOffice,reportDatetime:r.reportDatetime}}:{message:`No weather data available for ${e}`,title:`Weather - ${e}`,instructions:"Acknowledge that no weather data is available for the requested area.",data:{areaCode:a,areaName:e}}}catch(o){return console.error("*** Weather fetch failed",o),{message:`Failed to fetch weather for ${e}: ${o instanceof Error?o.message:"Unknown error"}`,title:`Weather - ${e}`,instructions:"Acknowledge that the weather data fetch failed and suggest trying again.",data:{areaCode:a,areaName:e}}}},f=[{name:"Tokyo Weather",args:{areaCode:"130000"}},{name:"Osaka Weather",args:{areaCode:"270000"}},{name:"Hokkaido Weather",args:{areaCode:"016000"}},{name:"Okinawa Weather",args:{areaCode:"471000"}}];exports.TOOL_DEFINITION=m;exports.TOOL_NAME=s;exports.fetchWeather=l;exports.samples=f;
|
package/dist/core.js
ADDED
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
const s = "fetchWeather", h = {
|
|
2
|
+
type: "function",
|
|
3
|
+
name: s,
|
|
4
|
+
description: "Fetch weather forecast information from Japan Meteorological Agency (JMA) for any region in Japan. Supports all 47 prefectures plus regional subdivisions (59 areas total).",
|
|
5
|
+
parameters: {
|
|
6
|
+
type: "object",
|
|
7
|
+
properties: {
|
|
8
|
+
areaCode: {
|
|
9
|
+
type: "string",
|
|
10
|
+
description: "The JMA area code for the location. Examples: Tokyo (130000), Osaka (270000), Hokkaido regions (011000-017000), Kyoto (260000), Fukuoka (400000), Okinawa (471000). All Japanese prefectures and regions are supported."
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
required: ["areaCode"]
|
|
14
|
+
}
|
|
15
|
+
}, m = [
|
|
16
|
+
{
|
|
17
|
+
code: "011000",
|
|
18
|
+
name: "宗谷地方"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
code: "012000",
|
|
22
|
+
name: "上川・留萌地方"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
code: "013000",
|
|
26
|
+
name: "網走・北見・紋別地方"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
code: "014030",
|
|
30
|
+
name: "十勝地方"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
code: "014100",
|
|
34
|
+
name: "釧路・根室地方"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
code: "015000",
|
|
38
|
+
name: "胆振・日高地方"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
code: "016000",
|
|
42
|
+
name: "石狩・空知・後志地方"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
code: "017000",
|
|
46
|
+
name: "渡島・檜山地方"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
code: "020000",
|
|
50
|
+
name: "青森県"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
code: "030000",
|
|
54
|
+
name: "岩手県"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
code: "040000",
|
|
58
|
+
name: "宮城県"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
code: "050000",
|
|
62
|
+
name: "秋田県"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
code: "060000",
|
|
66
|
+
name: "山形県"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
code: "070000",
|
|
70
|
+
name: "福島県"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
code: "080000",
|
|
74
|
+
name: "茨城県"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
code: "090000",
|
|
78
|
+
name: "栃木県"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
code: "100000",
|
|
82
|
+
name: "群馬県"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
code: "110000",
|
|
86
|
+
name: "埼玉県"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
code: "120000",
|
|
90
|
+
name: "千葉県"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
code: "130000",
|
|
94
|
+
name: "東京都"
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
code: "140000",
|
|
98
|
+
name: "神奈川県"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
code: "150000",
|
|
102
|
+
name: "新潟県"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
code: "160000",
|
|
106
|
+
name: "富山県"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
code: "170000",
|
|
110
|
+
name: "石川県"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
code: "180000",
|
|
114
|
+
name: "福井県"
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
code: "190000",
|
|
118
|
+
name: "山梨県"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
code: "200000",
|
|
122
|
+
name: "長野県"
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
code: "210000",
|
|
126
|
+
name: "岐阜県"
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
code: "220000",
|
|
130
|
+
name: "静岡県"
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
code: "230000",
|
|
134
|
+
name: "愛知県"
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
code: "240000",
|
|
138
|
+
name: "三重県"
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
code: "250000",
|
|
142
|
+
name: "滋賀県"
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
code: "260000",
|
|
146
|
+
name: "京都府"
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
code: "270000",
|
|
150
|
+
name: "大阪府"
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
code: "280000",
|
|
154
|
+
name: "兵庫県"
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
code: "290000",
|
|
158
|
+
name: "奈良県"
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
code: "300000",
|
|
162
|
+
name: "和歌山県"
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
code: "310000",
|
|
166
|
+
name: "鳥取県"
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
code: "320000",
|
|
170
|
+
name: "島根県"
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
code: "330000",
|
|
174
|
+
name: "岡山県"
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
code: "340000",
|
|
178
|
+
name: "広島県"
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
code: "350000",
|
|
182
|
+
name: "山口県"
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
code: "360000",
|
|
186
|
+
name: "徳島県"
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
code: "370000",
|
|
190
|
+
name: "香川県"
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
code: "380000",
|
|
194
|
+
name: "愛媛県"
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
code: "390000",
|
|
198
|
+
name: "高知県"
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
code: "400000",
|
|
202
|
+
name: "福岡県"
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
code: "410000",
|
|
206
|
+
name: "佐賀県"
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
code: "420000",
|
|
210
|
+
name: "長崎県"
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
code: "430000",
|
|
214
|
+
name: "熊本県"
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
code: "440000",
|
|
218
|
+
name: "大分県"
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
code: "450000",
|
|
222
|
+
name: "宮崎県"
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
code: "460040",
|
|
226
|
+
name: "奄美地方"
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
code: "460100",
|
|
230
|
+
name: "鹿児島県(奄美地方除く)"
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
code: "471000",
|
|
234
|
+
name: "沖縄本島地方"
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
code: "472000",
|
|
238
|
+
name: "大東島地方"
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
code: "473000",
|
|
242
|
+
name: "宮古島地方"
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
code: "474000",
|
|
246
|
+
name: "八重山地方"
|
|
247
|
+
}
|
|
248
|
+
], i = m.reduce(
|
|
249
|
+
(c, n) => (c[n.code] = n.name, c),
|
|
250
|
+
{}
|
|
251
|
+
), l = async (c, n) => {
|
|
252
|
+
const { areaCode: a } = n, e = i[a] || "Unknown";
|
|
253
|
+
try {
|
|
254
|
+
const o = `https://www.jma.go.jp/bosai/forecast/data/forecast/${a}.json`, t = await fetch(o);
|
|
255
|
+
if (!t.ok)
|
|
256
|
+
throw new Error(
|
|
257
|
+
`JMA API error: ${t.status} ${t.statusText}`
|
|
258
|
+
);
|
|
259
|
+
const d = await t.json(), r = Array.isArray(d) && d.length > 0 ? d[0] : null;
|
|
260
|
+
return r ? {
|
|
261
|
+
message: `Successfully fetched weather forecast for ${e}`,
|
|
262
|
+
title: `Weather - ${e}`,
|
|
263
|
+
jsonData: r,
|
|
264
|
+
instructions: "Provide a summary of the weather forecast. Include today's weather, temperature range, and any notable conditions. Keep it concise and conversational.",
|
|
265
|
+
data: {
|
|
266
|
+
areaCode: a,
|
|
267
|
+
areaName: e,
|
|
268
|
+
publishingOffice: r.publishingOffice,
|
|
269
|
+
reportDatetime: r.reportDatetime
|
|
270
|
+
}
|
|
271
|
+
} : {
|
|
272
|
+
message: `No weather data available for ${e}`,
|
|
273
|
+
title: `Weather - ${e}`,
|
|
274
|
+
instructions: "Acknowledge that no weather data is available for the requested area.",
|
|
275
|
+
data: {
|
|
276
|
+
areaCode: a,
|
|
277
|
+
areaName: e
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
} catch (o) {
|
|
281
|
+
return console.error("*** Weather fetch failed", o), {
|
|
282
|
+
message: `Failed to fetch weather for ${e}: ${o instanceof Error ? o.message : "Unknown error"}`,
|
|
283
|
+
title: `Weather - ${e}`,
|
|
284
|
+
instructions: "Acknowledge that the weather data fetch failed and suggest trying again.",
|
|
285
|
+
data: {
|
|
286
|
+
areaCode: a,
|
|
287
|
+
areaName: e
|
|
288
|
+
}
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
}, f = [
|
|
292
|
+
{
|
|
293
|
+
name: "Tokyo Weather",
|
|
294
|
+
args: {
|
|
295
|
+
areaCode: "130000"
|
|
296
|
+
}
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
name: "Osaka Weather",
|
|
300
|
+
args: {
|
|
301
|
+
areaCode: "270000"
|
|
302
|
+
}
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
name: "Hokkaido Weather",
|
|
306
|
+
args: {
|
|
307
|
+
areaCode: "016000"
|
|
308
|
+
}
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
name: "Okinawa Weather",
|
|
312
|
+
args: {
|
|
313
|
+
areaCode: "471000"
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
];
|
|
317
|
+
export {
|
|
318
|
+
h as TOOL_DEFINITION,
|
|
319
|
+
s as TOOL_NAME,
|
|
320
|
+
l as fetchWeather,
|
|
321
|
+
f as samples
|
|
322
|
+
};
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./core.cjs");exports.TOOL_DEFINITION=e.TOOL_DEFINITION;exports.TOOL_NAME=e.TOOL_NAME;exports.fetchWeather=e.fetchWeather;exports.samples=e.samples;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./core";
|
package/dist/index.js
ADDED
package/dist/style.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-border-style:solid;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-duration:initial;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1}}}@layer theme{:root,:host{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-50:oklch(97.1% .013 17.38);--color-red-500:oklch(63.7% .237 25.331);--color-red-600:oklch(57.7% .245 27.325);--color-red-700:oklch(50.5% .213 27.518);--color-orange-50:oklch(98% .016 73.684);--color-orange-200:oklch(90.1% .076 70.697);--color-orange-500:oklch(70.5% .213 47.604);--color-orange-600:oklch(64.6% .222 41.116);--color-orange-700:oklch(55.3% .195 38.402);--color-green-50:oklch(98.2% .018 155.826);--color-teal-50:oklch(98.4% .014 180.72);--color-teal-300:oklch(85.5% .138 181.071);--color-teal-500:oklch(70.4% .14 182.503);--color-teal-800:oklch(43.7% .078 188.216);--color-cyan-50:oklch(98.4% .019 200.873);--color-cyan-300:oklch(86.5% .127 207.078);--color-cyan-400:oklch(78.9% .154 211.53);--color-cyan-500:oklch(71.5% .143 215.221);--color-cyan-600:oklch(60.9% .126 221.723);--color-cyan-700:oklch(52% .105 223.128);--color-sky-100:oklch(95.1% .026 236.824);--color-blue-50:oklch(97% .014 254.604);--color-blue-100:oklch(93.2% .032 255.585);--color-blue-200:oklch(88.2% .059 254.128);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-500:oklch(62.3% .214 259.815);--color-blue-600:oklch(54.6% .245 262.881);--color-blue-700:oklch(48.8% .243 264.376);--color-blue-800:oklch(42.4% .199 265.638);--color-indigo-100:oklch(93% .034 272.788);--color-indigo-200:oklch(87% .065 274.039);--color-indigo-600:oklch(51.1% .262 276.966);--color-indigo-700:oklch(45.7% .24 277.023);--color-purple-50:oklch(97.7% .014 308.299);--color-purple-300:oklch(82.7% .119 306.383);--color-purple-500:oklch(62.7% .265 303.9);--color-purple-800:oklch(43.8% .218 303.724);--color-pink-50:oklch(97.1% .014 343.198);--color-pink-500:oklch(65.6% .241 354.308);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-800:oklch(27.8% .033 256.848);--color-white:#fff;--spacing:.25rem;--container-3xl:48rem;--container-6xl:72rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-lg:1.125rem;--text-lg--line-height:calc(1.75/1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75/1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2/1.5);--text-3xl:1.875rem;--text-3xl--line-height: 1.2 ;--text-4xl:2.25rem;--text-4xl--line-height:calc(2.5/2.25);--text-5xl:3rem;--text-5xl--line-height:1;--text-6xl:3.75rem;--text-6xl--line-height:1;--text-8xl:6rem;--text-8xl--line-height:1;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--drop-shadow-lg:0 4px 4px #00000026;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.absolute{position:absolute}.relative{position:relative}.-top-3{top:calc(var(--spacing)*-3)}.left-1\/2{left:50%}.mx-auto{margin-inline:auto}.mt-3{margin-top:calc(var(--spacing)*3)}.mt-4{margin-top:calc(var(--spacing)*4)}.mr-1{margin-right:calc(var(--spacing)*1)}.mb-1{margin-bottom:calc(var(--spacing)*1)}.mb-2{margin-bottom:calc(var(--spacing)*2)}.mb-3{margin-bottom:calc(var(--spacing)*3)}.mb-4{margin-bottom:calc(var(--spacing)*4)}.mb-5{margin-bottom:calc(var(--spacing)*5)}.mb-6{margin-bottom:calc(var(--spacing)*6)}.mb-8{margin-bottom:calc(var(--spacing)*8)}.ml-2{margin-left:calc(var(--spacing)*2)}.contents{display:contents}.flex{display:flex}.grid{display:grid}.h-2{height:calc(var(--spacing)*2)}.h-4{height:calc(var(--spacing)*4)}.h-\[600px\]{height:600px}.h-auto{height:auto}.h-full{height:100%}.w-4{width:calc(var(--spacing)*4)}.w-full{width:100%}.max-w-3xl{max-width:var(--container-3xl)}.max-w-6xl{max-width:var(--container-6xl)}.max-w-\[200px\]{max-width:200px}.-translate-x-1\/2{--tw-translate-x: -50% ;translate:var(--tw-translate-x)var(--tw-translate-y)}.transform{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.cursor-pointer{cursor:pointer}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.gap-1{gap:calc(var(--spacing)*1)}.gap-2{gap:calc(var(--spacing)*2)}.gap-3{gap:calc(var(--spacing)*3)}.gap-4{gap:calc(var(--spacing)*4)}.gap-6{gap:calc(var(--spacing)*6)}:where(.space-y-8>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*8)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*8)*calc(1 - var(--tw-space-y-reverse)))}.overflow-auto{overflow:auto}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-xl{border-radius:var(--radius-xl)}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-blue-100{border-color:var(--color-blue-100)}.border-blue-200{border-color:var(--color-blue-200)}.border-gray-600{border-color:var(--color-gray-600)}.border-indigo-200{border-color:var(--color-indigo-200)}.border-orange-200{border-color:var(--color-orange-200)}.border-transparent{border-color:#0000}.bg-blue-500{background-color:var(--color-blue-500)}.bg-gray-100{background-color:var(--color-gray-100)}.bg-gray-200{background-color:var(--color-gray-200)}.bg-gray-800{background-color:var(--color-gray-800)}.bg-indigo-100{background-color:var(--color-indigo-100)}.bg-orange-500{background-color:var(--color-orange-500)}.bg-red-500{background-color:var(--color-red-500)}.bg-white{background-color:var(--color-white)}.bg-gradient-to-br{--tw-gradient-position:to bottom right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-r{--tw-gradient-position:to right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-blue-50{--tw-gradient-from:var(--color-blue-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-blue-400{--tw-gradient-from:var(--color-blue-400);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-blue-500{--tw-gradient-from:var(--color-blue-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-cyan-300{--tw-gradient-from:var(--color-cyan-300);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-cyan-400{--tw-gradient-from:var(--color-cyan-400);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-gray-300{--tw-gradient-from:var(--color-gray-300);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-green-50{--tw-gradient-from:var(--color-green-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-orange-50{--tw-gradient-from:var(--color-orange-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-purple-500{--tw-gradient-from:var(--color-purple-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-sky-100{--tw-gradient-from:var(--color-sky-100);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-teal-500{--tw-gradient-from:var(--color-teal-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.via-blue-50{--tw-gradient-via:var(--color-blue-50);--tw-gradient-via-stops:var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-via)var(--tw-gradient-via-position),var(--tw-gradient-to)var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.via-blue-100{--tw-gradient-via:var(--color-blue-100);--tw-gradient-via-stops:var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-via)var(--tw-gradient-via-position),var(--tw-gradient-to)var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.via-pink-50{--tw-gradient-via:var(--color-pink-50);--tw-gradient-via-stops:var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-via)var(--tw-gradient-via-position),var(--tw-gradient-to)var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.via-teal-50{--tw-gradient-via:var(--color-teal-50);--tw-gradient-via-stops:var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-via)var(--tw-gradient-via-position),var(--tw-gradient-to)var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.to-blue-400{--tw-gradient-to:var(--color-blue-400);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-blue-500{--tw-gradient-to:var(--color-blue-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-blue-600{--tw-gradient-to:var(--color-blue-600);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-cyan-50{--tw-gradient-to:var(--color-cyan-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-cyan-400{--tw-gradient-to:var(--color-cyan-400);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-cyan-500{--tw-gradient-to:var(--color-cyan-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-gray-400{--tw-gradient-to:var(--color-gray-400);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-indigo-100{--tw-gradient-to:var(--color-indigo-100);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-indigo-600{--tw-gradient-to:var(--color-indigo-600);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-pink-500{--tw-gradient-to:var(--color-pink-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-purple-50{--tw-gradient-to:var(--color-purple-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-red-50{--tw-gradient-to:var(--color-red-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.fill-blue-600{fill:var(--color-blue-600)}.fill-gray-600{fill:var(--color-gray-600)}.fill-gray-700{fill:var(--color-gray-700)}.fill-red-600{fill:var(--color-red-600)}.p-4{padding:calc(var(--spacing)*4)}.p-5{padding:calc(var(--spacing)*5)}.p-6{padding:calc(var(--spacing)*6)}.p-8{padding:calc(var(--spacing)*8)}.px-4{padding-inline:calc(var(--spacing)*4)}.py-1{padding-block:calc(var(--spacing)*1)}.py-2{padding-block:calc(var(--spacing)*2)}.text-center{text-align:center}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-4xl{font-size:var(--text-4xl);line-height:var(--tw-leading,var(--text-4xl--line-height))}.text-5xl{font-size:var(--text-5xl);line-height:var(--tw-leading,var(--text-5xl--line-height))}.text-6xl{font-size:var(--text-6xl);line-height:var(--tw-leading,var(--text-6xl--line-height))}.text-8xl{font-size:var(--text-8xl);line-height:var(--tw-leading,var(--text-8xl--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.text-blue-500{color:var(--color-blue-500)}.text-blue-600{color:var(--color-blue-600)}.text-blue-700{color:var(--color-blue-700)}.text-blue-800{color:var(--color-blue-800)}.text-cyan-600{color:var(--color-cyan-600)}.text-cyan-700{color:var(--color-cyan-700)}.text-gray-200{color:var(--color-gray-200)}.text-gray-600{color:var(--color-gray-600)}.text-gray-700{color:var(--color-gray-700)}.text-gray-800{color:var(--color-gray-800)}.text-indigo-700{color:var(--color-indigo-700)}.text-orange-500{color:var(--color-orange-500)}.text-orange-600{color:var(--color-orange-600)}.text-orange-700{color:var(--color-orange-700)}.text-purple-800{color:var(--color-purple-800)}.text-red-500{color:var(--color-red-500)}.text-red-600{color:var(--color-red-600)}.text-red-700{color:var(--color-red-700)}.text-teal-800{color:var(--color-teal-800)}.text-white{color:var(--color-white)}.opacity-90{opacity:.9}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a),0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a),0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.drop-shadow{--tw-drop-shadow-size:drop-shadow(0 1px 2px var(--tw-drop-shadow-color,#0000001a))drop-shadow(0 1px 1px var(--tw-drop-shadow-color,#0000000f));--tw-drop-shadow:drop-shadow(0 1px 2px #0000001a)drop-shadow(0 1px 1px #0000000f);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.drop-shadow-lg{--tw-drop-shadow-size:drop-shadow(0 4px 4px var(--tw-drop-shadow-color,#00000026));--tw-drop-shadow:drop-shadow(var(--drop-shadow-lg));filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-300{--tw-duration:.3s;transition-duration:.3s}.last\:mb-0:last-child{margin-bottom:calc(var(--spacing)*0)}@media(hover:hover){.hover\:scale-105:hover{--tw-scale-x:105%;--tw-scale-y:105%;--tw-scale-z:105%;scale:var(--tw-scale-x)var(--tw-scale-y)}.hover\:border-purple-300:hover{border-color:var(--color-purple-300)}.hover\:border-teal-300:hover{border-color:var(--color-teal-300)}.hover\:bg-indigo-200:hover{background-color:var(--color-indigo-200)}.hover\:shadow-2xl:hover{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hover\:shadow-xl:hover{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a),0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}}@media(min-width:40rem){.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}@media(min-width:48rem){.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}@media(min-width:64rem){.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}@media(min-width:80rem){.xl\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.xl\:grid-cols-7{grid-template-columns:repeat(7,minmax(0,1fr))}}}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"<length-percentage>";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"<length-percentage>";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"<length-percentage>";inherits:false;initial-value:100%}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ToolResult } from "gui-chat-protocol/vue";
|
|
2
|
+
import type { WeatherToolData } from "../core/types";
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
result: ToolResult<WeatherToolData>;
|
|
5
|
+
};
|
|
6
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
|
+
declare const _default: typeof __VLS_export;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ToolResult } from "gui-chat-protocol/vue";
|
|
2
|
+
import type { WeatherToolData, WeatherJsonData } from "../core/types";
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
selectedResult: ToolResult<WeatherToolData, WeatherJsonData> | null;
|
|
5
|
+
sendTextMessage: (text?: string) => void;
|
|
6
|
+
};
|
|
7
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
8
|
+
declare const _default: typeof __VLS_export;
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
times: string[];
|
|
3
|
+
tempsMax?: string[];
|
|
4
|
+
tempsMin?: string[];
|
|
5
|
+
temps?: string[];
|
|
6
|
+
};
|
|
7
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
8
|
+
declare const _default: typeof __VLS_export;
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import "../style.css";
|
|
2
|
+
import type { ToolPlugin } from "gui-chat-protocol/vue";
|
|
3
|
+
import type { WeatherToolData, WeatherJsonData, WeatherArgs } from "../core/types";
|
|
4
|
+
export declare const plugin: ToolPlugin<WeatherToolData, WeatherJsonData, WeatherArgs>;
|
|
5
|
+
export { fetchWeather as executeWeather } from "../core/plugin";
|
|
6
|
+
export * from "../core/types";
|
|
7
|
+
export { TOOL_DEFINITION } from "../core/definition";
|
|
8
|
+
declare const _default: {
|
|
9
|
+
plugin: ToolPlugin<WeatherToolData, WeatherJsonData, WeatherArgs, import("gui-chat-protocol/vue").InputHandler, Record<string, unknown>>;
|
|
10
|
+
};
|
|
11
|
+
export default _default;
|
package/dist/vue.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const v=require("./core.cjs"),e=require("vue"),D={class:"w-full"},S=["viewBox"],C={class:"grid-lines"},$=["x1","y1","x2","y2"],M={class:"y-axis-labels"},T=["x","y"],L=["points"],F={key:1},j=["cx","cy"],P=["x","y"],O=["points"],A={key:3},W=["cx","cy"],z=["x","y"],R=["points"],J={key:5},q=["cx","cy"],H={class:"x-axis-labels"},U=["x","y"],X={class:"flex justify-center gap-6 mt-4"},Y={key:0,class:"flex items-center gap-2"},G={key:1,class:"flex items-center gap-2"},K={key:2,class:"flex items-center gap-2"},B=800,V=300,Q=e.defineComponent({__name:"TemperatureChart",props:{times:{},tempsMax:{},tempsMin:{},temps:{}},setup(p){const a=p,i={top:40,right:40,bottom:60,left:50},g=e.computed(()=>B-i.left-i.right),u=e.computed(()=>V-i.top-i.bottom),m=e.computed(()=>{const n=[];return a.tempsMax&&n.push(...a.tempsMax.map(Number).filter(t=>!isNaN(t))),a.tempsMin&&n.push(...a.tempsMin.map(Number).filter(t=>!isNaN(t))),a.temps&&n.push(...a.temps.map(Number).filter(t=>!isNaN(t))),n}),_=e.computed(()=>{if(m.value.length===0)return{min:0,max:30};const n=Math.floor(Math.min(...m.value)/5)*5,t=Math.ceil(Math.max(...m.value)/5)*5;return{min:n,max:t}}),E=e.computed(()=>{const{min:n,max:t}=_.value,s=(t-n)/4;return[t,t-s,t-s*2,t-s*3,n]});function k(n){const t=typeof n=="string"?parseFloat(n):n;if(isNaN(t))return 0;const{min:s,max:d}=_.value,l=(t-s)/(d-s);return i.top+u.value*(1-l)}function f(n,t){return t<=1?i.left+g.value/2:i.left+g.value/(t-1)*n}const y=e.computed(()=>a.tempsMax?a.tempsMax.map((n,t)=>n?{x:f(t,a.times.length),y:k(n),value:n}:null).filter(n=>n!==null):[]),x=e.computed(()=>y.value.map(n=>`${n.x},${n.y}`).join(" ")),h=e.computed(()=>a.tempsMin?a.tempsMin.map((n,t)=>n?{x:f(t,a.times.length),y:k(n),value:n}:null).filter(n=>n!==null):[]),b=e.computed(()=>h.value.map(n=>`${n.x},${n.y}`).join(" ")),r=e.computed(()=>a.temps?a.temps.map((n,t)=>n?{x:f(t,a.times.length),y:k(n),value:n}:null).filter(n=>n!==null):[]),o=e.computed(()=>r.value.map(n=>`${n.x},${n.y}`).join(" ")),c=e.computed(()=>a.times.map(n=>{const t=new Date(n),s=new Date,d=new Date(s);d.setDate(d.getDate()+1);const l=t.toLocaleDateString("ja-JP",{month:"short",day:"numeric"}),N=t.toLocaleTimeString("ja-JP",{hour:"2-digit",minute:"2-digit"});return t.toDateString()===s.toDateString()?`Today ${N}`:t.toDateString()===d.toDateString()?`Tomorrow ${N}`:`${l} ${N}`}));return(n,t)=>(e.openBlock(),e.createElementBlock("div",D,[(e.openBlock(),e.createElementBlock("svg",{viewBox:`0 0 ${B} ${V}`,class:"w-full h-auto"},[e.createElementVNode("g",C,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(5,s=>e.createElementVNode("line",{key:`grid-${s}`,x1:i.left,y1:i.top+u.value/4*(s-1),x2:B-i.right,y2:i.top+u.value/4*(s-1),stroke:"#e5e7eb","stroke-width":"1"},null,8,$)),64))]),e.createElementVNode("g",M,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(E.value,(s,d)=>(e.openBlock(),e.createElementBlock("text",{key:`y-label-${d}`,x:i.left-10,y:i.top+u.value/4*d+5,"text-anchor":"end",class:"text-xs fill-gray-600"},e.toDisplayString(s)+"° ",9,T))),128))]),x.value.length>0?(e.openBlock(),e.createElementBlock("polyline",{key:0,points:x.value,fill:"none",stroke:"#ef4444","stroke-width":"3","stroke-linecap":"round","stroke-linejoin":"round"},null,8,L)):e.createCommentVNode("",!0),x.value.length>0?(e.openBlock(),e.createElementBlock("g",F,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(y.value,(s,d)=>(e.openBlock(),e.createElementBlock("g",{key:`max-point-${d}`},[e.createElementVNode("circle",{cx:s.x,cy:s.y,r:"5",fill:"#ef4444"},null,8,j),e.createElementVNode("text",{x:s.x,y:s.y-12,"text-anchor":"middle",class:"text-sm font-bold fill-red-600"},e.toDisplayString(s.value)+"° ",9,P)]))),128))])):e.createCommentVNode("",!0),b.value.length>0?(e.openBlock(),e.createElementBlock("polyline",{key:2,points:b.value,fill:"none",stroke:"#3b82f6","stroke-width":"3","stroke-linecap":"round","stroke-linejoin":"round"},null,8,O)):e.createCommentVNode("",!0),b.value.length>0?(e.openBlock(),e.createElementBlock("g",A,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.value,(s,d)=>(e.openBlock(),e.createElementBlock("g",{key:`min-point-${d}`},[e.createElementVNode("circle",{cx:s.x,cy:s.y,r:"5",fill:"#3b82f6"},null,8,W),e.createElementVNode("text",{x:s.x,y:s.y+20,"text-anchor":"middle",class:"text-sm font-bold fill-blue-600"},e.toDisplayString(s.value)+"° ",9,z)]))),128))])):e.createCommentVNode("",!0),o.value.length>0?(e.openBlock(),e.createElementBlock("polyline",{key:4,points:o.value,fill:"none",stroke:"#f97316","stroke-width":"3","stroke-linecap":"round","stroke-linejoin":"round","stroke-dasharray":"5,5"},null,8,R)):e.createCommentVNode("",!0),o.value.length>0?(e.openBlock(),e.createElementBlock("g",J,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,(s,d)=>(e.openBlock(),e.createElementBlock("g",{key:`current-point-${d}`},[e.createElementVNode("circle",{cx:s.x,cy:s.y,r:"5",fill:"#f97316"},null,8,q)]))),128))])):e.createCommentVNode("",!0),e.createElementVNode("g",H,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,(s,d)=>(e.openBlock(),e.createElementBlock("text",{key:`x-label-${d}`,x:i.left+g.value/(c.value.length-1)*d,y:V-i.bottom+20,"text-anchor":"middle",class:"text-xs fill-gray-700 font-medium"},e.toDisplayString(s),9,U))),128))])],8,S)),e.createElementVNode("div",X,[y.value.length>0?(e.openBlock(),e.createElementBlock("div",Y,[...t[0]||(t[0]=[e.createElementVNode("div",{class:"w-4 h-4 rounded-full bg-red-500"},null,-1),e.createElementVNode("span",{class:"text-sm text-gray-700 font-medium"},"最高気温",-1)])])):e.createCommentVNode("",!0),h.value.length>0?(e.openBlock(),e.createElementBlock("div",G,[...t[1]||(t[1]=[e.createElementVNode("div",{class:"w-4 h-4 rounded-full bg-blue-500"},null,-1),e.createElementVNode("span",{class:"text-sm text-gray-700 font-medium"},"最低気温",-1)])])):e.createCommentVNode("",!0),r.value.length>0?(e.openBlock(),e.createElementBlock("div",K,[...t[2]||(t[2]=[e.createElementVNode("div",{class:"w-4 h-4 rounded-full bg-orange-500"},null,-1),e.createElementVNode("span",{class:"text-sm text-gray-700 font-medium"},"現在気温",-1)])])):e.createCommentVNode("",!0)])]))}}),Z={class:"w-full h-full overflow-auto bg-gradient-to-br from-sky-100 via-blue-50 to-indigo-100"},I={class:"max-w-6xl mx-auto p-6"},ee={class:"bg-gradient-to-r from-blue-500 to-indigo-600 rounded-2xl shadow-xl p-8 mb-8 text-white"},te={class:"flex items-center justify-between"},oe={class:"text-4xl font-bold mb-2"},ne={class:"text-sm opacity-90"},le={key:0},se={key:1},re={key:0,class:"bg-white rounded-2xl shadow-lg p-8 text-center text-gray-600"},ce={key:1,class:"space-y-8"},ae={key:0,class:"text-3xl"},ie={key:1,class:"text-3xl"},de={key:2,class:"text-3xl"},me={key:3,class:"text-3xl"},ue={key:0,class:"text-lg font-semibold text-gray-700 mb-4"},pe={key:1},ge={class:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 xl:grid-cols-7 gap-4 mb-8"},xe={class:"text-center mt-3 mb-3"},ke={class:"text-sm font-medium text-gray-600"},fe={key:0,class:"text-center mb-3"},ye={class:"text-6xl mb-2 drop-shadow-lg"},he={class:"text-xs text-gray-700 font-medium"},be={key:1,class:"text-center mb-3"},ve={class:"flex items-center justify-center gap-2 mb-1"},_e={class:"text-3xl"},Ee={class:"text-2xl font-bold text-blue-600"},Ne={class:"text-center mb-3"},Be={key:0,class:"text-3xl font-bold text-red-500 mb-1"},Ve={key:1,class:"text-xl font-semibold text-blue-500"},we={key:2,class:"text-2xl font-bold text-orange-500"},De={key:2,class:"text-xs text-gray-600 mb-1 text-center"},Se={key:3,class:"text-xs text-gray-600 text-center"},Ce={key:0,class:"bg-white rounded-xl p-6 shadow-lg"},$e={key:2,class:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4"},Me={class:"text-sm font-bold text-blue-700 mb-3"},Te={key:0,class:"mb-3 flex items-center gap-2"},Le={class:"text-4xl drop-shadow"},Fe={class:"text-gray-800 font-medium text-sm"},je={key:1,class:"text-gray-700 mb-2"},Pe={class:"text-2xl font-bold ml-2"},Oe={class:"flex gap-3 mb-2"},Ae={key:0,class:"flex items-center gap-1"},We={class:"text-xl font-bold text-red-600"},ze={key:1,class:"flex items-center gap-1"},Re={class:"text-xl font-bold text-blue-600"},Je={key:2,class:"mb-2"},qe={class:"flex items-center justify-between text-sm mb-1"},He={class:"font-bold"},Ue={class:"w-full bg-gray-200 rounded-full h-2"},Xe={key:3,class:"text-gray-700 text-sm mb-1"},Ye={key:4,class:"text-gray-700 text-sm"},Ge={key:0,class:"bg-white rounded-2xl shadow-xl p-6"},Ke={class:"grid grid-cols-1 md:grid-cols-2 gap-6"},Qe={key:0,class:"bg-gradient-to-br from-orange-50 to-red-50 rounded-xl p-5 shadow-md border border-orange-200"},Ze={class:"font-semibold text-gray-800 mb-1"},Ie={class:"flex gap-3"},et={key:0,class:"flex items-center gap-1"},tt={class:"text-xl font-bold text-blue-700"},ot={key:1,class:"flex items-center gap-1"},nt={class:"text-xl font-bold text-red-700"},lt={key:1,class:"bg-gradient-to-br from-blue-50 to-cyan-50 rounded-xl p-5 shadow-md border border-blue-200"},st={class:"font-semibold text-gray-800 mb-1"},rt={class:"flex gap-3"},ct={key:0,class:"flex items-center gap-1"},at={class:"text-xl font-bold text-cyan-700"},it={key:1,class:"flex items-center gap-1"},dt={class:"text-xl font-bold text-blue-700"},mt=e.defineComponent({__name:"View",props:{selectedResult:{},sendTextMessage:{type:Function}},setup(p){const a=p,i=e.computed(()=>a.selectedResult?.data?.areaName||"Unknown Area"),g=e.computed(()=>a.selectedResult?.data?.publishingOffice||""),u=e.computed(()=>a.selectedResult?.data?.reportDatetime||""),m=e.computed(()=>a.selectedResult?.jsonData||null),_=e.computed(()=>u.value?new Date(u.value).toLocaleString("ja-JP",{year:"numeric",month:"long",day:"numeric",hour:"2-digit",minute:"2-digit"}):"");function E(r){const o=new Date(r),c=new Date,n=new Date(c);n.setDate(n.getDate()+1);const t=o.toLocaleDateString("ja-JP",{month:"short",day:"numeric"}),s=o.toLocaleTimeString("ja-JP",{hour:"2-digit",minute:"2-digit"});return o.toDateString()===c.toDateString()?`Today ${s}`:o.toDateString()===n.toDateString()?`Tomorrow ${s}`:`${t} ${s}`}function k(r){const o=new Date(r);return["日","月","火","水","木","金","土"][o.getDay()]??""}function f(r){const o=typeof r=="string"?parseInt(r):r;return o>=70?"bg-gradient-to-r from-blue-500 to-blue-600":o>=50?"bg-gradient-to-r from-blue-400 to-blue-500":o>=30?"bg-gradient-to-r from-cyan-400 to-blue-400":o>=10?"bg-gradient-to-r from-cyan-300 to-cyan-400":"bg-gradient-to-r from-gray-300 to-gray-400"}function y(r){return["Current Forecast","Extended Forecast","Weekly Forecast"][r]||`Forecast ${r+1}`}function x(r){if(!r)return"🌤️";const o=r.toLowerCase();return o.includes("晴")||o.includes("sunny")||o.includes("clear")?"☀️":o.includes("曇")||o.includes("cloudy")?"☁️":o.includes("雨")||o.includes("rain")?"🌧️":o.includes("雪")||o.includes("snow")?"❄️":o.includes("雷")||o.includes("thunder")?"⛈️":o.includes("霧")||o.includes("fog")?"🌫️":"🌤️"}function h(r){const o=typeof r=="string"?parseInt(r):r;return o>=50?"☔":o>=30?"🌂":o>=10?"☁️":"☀️"}function b(r){return!!(r.tempsMax||r.tempsMin||r.temps)}return(r,o)=>(e.openBlock(),e.createElementBlock("div",Z,[e.createElementVNode("div",I,[e.createElementVNode("div",ee,[e.createElementVNode("div",te,[e.createElementVNode("div",null,[e.createElementVNode("h1",oe,e.toDisplayString(i.value),1),e.createElementVNode("div",ne,[g.value?(e.openBlock(),e.createElementBlock("div",le,e.toDisplayString(g.value),1)):e.createCommentVNode("",!0),u.value?(e.openBlock(),e.createElementBlock("div",se,e.toDisplayString(_.value),1)):e.createCommentVNode("",!0)])]),o[0]||(o[0]=e.createElementVNode("div",{class:"text-8xl drop-shadow-lg"},"⛅",-1))])]),m.value?(e.openBlock(),e.createElementBlock("div",ce,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.value.timeSeries,(c,n)=>(e.openBlock(),e.createElementBlock("div",{key:n,class:e.normalizeClass(["rounded-2xl shadow-xl p-6",n===1?"bg-gradient-to-br from-orange-50 via-pink-50 to-purple-50":n===2?"bg-gradient-to-br from-green-50 via-teal-50 to-cyan-50":"bg-white"])},[e.createElementVNode("h2",{class:e.normalizeClass(["text-2xl font-bold mb-6 flex items-center gap-2",n===1?"text-purple-800":n===2?"text-teal-800":"text-gray-800"])},[n===1?(e.openBlock(),e.createElementBlock("span",ae,"📅")):n===2?(e.openBlock(),e.createElementBlock("span",ie,"📊")):n===0?(e.openBlock(),e.createElementBlock("span",de,"🌤️")):(e.openBlock(),e.createElementBlock("span",me,"📋")),e.createTextVNode(" "+e.toDisplayString(y(n)),1)],2),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.areas,(t,s)=>(e.openBlock(),e.createElementBlock("div",{key:s,class:"mb-6 last:mb-0"},[c.areas.length>1?(e.openBlock(),e.createElementBlock("h3",ue,e.toDisplayString(t.area.name),1)):e.createCommentVNode("",!0),n===1||n===2?(e.openBlock(),e.createElementBlock("div",pe,[e.createElementVNode("div",ge,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.timeDefines,(d,l)=>(e.openBlock(),e.createElementBlock("div",{key:l,class:e.normalizeClass(["relative bg-white rounded-xl p-5 shadow-lg hover:shadow-2xl transition-all duration-300 hover:scale-105 border-2 border-transparent",n===1?"hover:border-purple-300":"hover:border-teal-300"])},[e.createElementVNode("div",{class:e.normalizeClass(["absolute -top-3 left-1/2 transform -translate-x-1/2 text-white px-4 py-1 rounded-full text-xs font-bold shadow-md",n===1?"bg-gradient-to-r from-purple-500 to-pink-500":"bg-gradient-to-r from-teal-500 to-cyan-500"])},e.toDisplayString(k(d)),3),e.createElementVNode("div",xe,[e.createElementVNode("div",ke,e.toDisplayString(E(d)),1)]),t.weathers&&t.weathers[l]?(e.openBlock(),e.createElementBlock("div",fe,[e.createElementVNode("div",ye,e.toDisplayString(x(t.weathers[l])),1),e.createElementVNode("div",he,e.toDisplayString(t.weathers[l]),1)])):e.createCommentVNode("",!0),t.pops&&t.pops[l]?(e.openBlock(),e.createElementBlock("div",be,[e.createElementVNode("div",ve,[e.createElementVNode("span",_e,e.toDisplayString(h(t.pops[l])),1),e.createElementVNode("span",Ee,e.toDisplayString(t.pops[l])+"%",1)])])):e.createCommentVNode("",!0),e.createElementVNode("div",Ne,[t.tempsMax&&t.tempsMax[l]?(e.openBlock(),e.createElementBlock("div",Be,e.toDisplayString(t.tempsMax[l])+"° ",1)):e.createCommentVNode("",!0),t.tempsMin&&t.tempsMin[l]?(e.openBlock(),e.createElementBlock("div",Ve,e.toDisplayString(t.tempsMin[l])+"° ",1)):e.createCommentVNode("",!0),t.temps&&t.temps[l]?(e.openBlock(),e.createElementBlock("div",we,e.toDisplayString(t.temps[l])+"° ",1)):e.createCommentVNode("",!0)]),t.winds&&t.winds[l]?(e.openBlock(),e.createElementBlock("div",De,[o[1]||(o[1]=e.createElementVNode("span",{class:"mr-1"},"🌬️",-1)),e.createTextVNode(" "+e.toDisplayString(t.winds[l]),1)])):e.createCommentVNode("",!0),t.waves&&t.waves[l]?(e.openBlock(),e.createElementBlock("div",Se,[o[2]||(o[2]=e.createElementVNode("span",{class:"mr-1"},"🌊",-1)),e.createTextVNode(" "+e.toDisplayString(t.waves[l]),1)])):e.createCommentVNode("",!0)],2))),128))]),b(t)?(e.openBlock(),e.createElementBlock("div",Ce,[o[3]||(o[3]=e.createElementVNode("h3",{class:"text-lg font-bold text-gray-800 mb-4 flex items-center gap-2"},[e.createElementVNode("span",{class:"text-2xl"},"📈"),e.createTextVNode(" 気温の推移 ")],-1)),e.createVNode(Q,{times:c.timeDefines,tempsMax:t.tempsMax,tempsMin:t.tempsMin,temps:t.temps},null,8,["times","tempsMax","tempsMin","temps"])])):e.createCommentVNode("",!0)])):(e.openBlock(),e.createElementBlock("div",$e,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.timeDefines,(d,l)=>(e.openBlock(),e.createElementBlock("div",{key:l,class:"bg-gradient-to-br from-blue-50 to-cyan-50 rounded-xl p-5 shadow-md hover:shadow-xl transition-all duration-300 border border-blue-100"},[e.createElementVNode("div",Me,e.toDisplayString(E(d)),1),t.weathers&&t.weathers[l]?(e.openBlock(),e.createElementBlock("div",Te,[e.createElementVNode("span",Le,e.toDisplayString(x(t.weathers[l])),1),e.createElementVNode("span",Fe,e.toDisplayString(t.weathers[l]),1)])):e.createCommentVNode("",!0),t.temps&&t.temps[l]?(e.openBlock(),e.createElementBlock("div",je,[o[4]||(o[4]=e.createElementVNode("span",{class:"font-semibold text-orange-600"},"気温:",-1)),e.createElementVNode("span",Pe,e.toDisplayString(t.temps[l])+"°C",1)])):e.createCommentVNode("",!0),e.createElementVNode("div",Oe,[t.tempsMax&&t.tempsMax[l]?(e.openBlock(),e.createElementBlock("div",Ae,[o[5]||(o[5]=e.createElementVNode("span",{class:"text-red-500 font-bold text-sm"},"最高:",-1)),e.createElementVNode("span",We,e.toDisplayString(t.tempsMax[l])+"°",1)])):e.createCommentVNode("",!0),t.tempsMin&&t.tempsMin[l]?(e.openBlock(),e.createElementBlock("div",ze,[o[6]||(o[6]=e.createElementVNode("span",{class:"text-blue-500 font-bold text-sm"},"最低:",-1)),e.createElementVNode("span",Re,e.toDisplayString(t.tempsMin[l])+"°",1)])):e.createCommentVNode("",!0)]),t.pops&&t.pops[l]?(e.openBlock(),e.createElementBlock("div",Je,[e.createElementVNode("div",qe,[o[7]||(o[7]=e.createElementVNode("span",{class:"font-semibold text-blue-600"},"💧 降水確率",-1)),e.createElementVNode("span",He,e.toDisplayString(t.pops[l])+"%",1)]),e.createElementVNode("div",Ue,[e.createElementVNode("div",{class:e.normalizeClass(["h-full rounded-full transition-all",f(t.pops[l])]),style:e.normalizeStyle({width:t.pops[l]+"%"})},null,6)])])):e.createCommentVNode("",!0),t.winds&&t.winds[l]?(e.openBlock(),e.createElementBlock("div",Xe,[o[8]||(o[8]=e.createElementVNode("span",{class:"font-semibold"},"🌬️ 風:",-1)),e.createTextVNode(" "+e.toDisplayString(t.winds[l]),1)])):e.createCommentVNode("",!0),t.waves&&t.waves[l]?(e.openBlock(),e.createElementBlock("div",Ye,[o[9]||(o[9]=e.createElementVNode("span",{class:"font-semibold"},"🌊 波:",-1)),e.createTextVNode(" "+e.toDisplayString(t.waves[l]),1)])):e.createCommentVNode("",!0)]))),128))]))]))),128))],2))),128)),m.value.tempAverage||m.value.precipAverage?(e.openBlock(),e.createElementBlock("div",Ge,[o[16]||(o[16]=e.createElementVNode("h2",{class:"text-2xl font-bold text-gray-800 mb-6 flex items-center gap-2"},[e.createElementVNode("span",{class:"text-3xl"},"📊"),e.createTextVNode(" Historical Averages ")],-1)),e.createElementVNode("div",Ke,[m.value.tempAverage?(e.openBlock(),e.createElementBlock("div",Qe,[o[12]||(o[12]=e.createElementVNode("h3",{class:"font-bold text-orange-700 mb-3 text-lg flex items-center gap-2"},[e.createElementVNode("span",{class:"text-2xl"},"🌡️"),e.createTextVNode(" Temperature ")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.value.tempAverage.areas,(c,n)=>(e.openBlock(),e.createElementBlock("div",{key:n,class:"text-gray-700 mb-3 last:mb-0"},[e.createElementVNode("div",Ze,e.toDisplayString(c.area.name),1),e.createElementVNode("div",Ie,[c.min?(e.openBlock(),e.createElementBlock("div",et,[o[10]||(o[10]=e.createElementVNode("span",{class:"text-blue-600 font-semibold"},"最低:",-1)),e.createElementVNode("span",tt,e.toDisplayString(c.min)+"°C",1)])):e.createCommentVNode("",!0),c.max?(e.openBlock(),e.createElementBlock("div",ot,[o[11]||(o[11]=e.createElementVNode("span",{class:"text-red-600 font-semibold"},"最高:",-1)),e.createElementVNode("span",nt,e.toDisplayString(c.max)+"°C",1)])):e.createCommentVNode("",!0)])]))),128))])):e.createCommentVNode("",!0),m.value.precipAverage?(e.openBlock(),e.createElementBlock("div",lt,[o[15]||(o[15]=e.createElementVNode("h3",{class:"font-bold text-blue-700 mb-3 text-lg flex items-center gap-2"},[e.createElementVNode("span",{class:"text-2xl"},"💧"),e.createTextVNode(" Precipitation ")],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.value.precipAverage.areas,(c,n)=>(e.openBlock(),e.createElementBlock("div",{key:n,class:"text-gray-700 mb-3 last:mb-0"},[e.createElementVNode("div",st,e.toDisplayString(c.area.name),1),e.createElementVNode("div",rt,[c.min?(e.openBlock(),e.createElementBlock("div",ct,[o[13]||(o[13]=e.createElementVNode("span",{class:"text-cyan-600 font-semibold"},"最低:",-1)),e.createElementVNode("span",at,e.toDisplayString(c.min)+"mm",1)])):e.createCommentVNode("",!0),c.max?(e.openBlock(),e.createElementBlock("div",it,[o[14]||(o[14]=e.createElementVNode("span",{class:"text-blue-600 font-semibold"},"最高:",-1)),e.createElementVNode("span",dt,e.toDisplayString(c.max)+"mm",1)])):e.createCommentVNode("",!0)])]))),128))])):e.createCommentVNode("",!0)])])):e.createCommentVNode("",!0)])):(e.openBlock(),e.createElementBlock("div",re," No weather data available "))])]))}}),ut={class:"text-center p-4 bg-gradient-to-br from-sky-100 via-blue-100 to-indigo-100 rounded-xl shadow-md hover:shadow-xl transition-all duration-300 hover:scale-105 border-2 border-blue-200"},pt={class:"text-xs text-gray-700 font-medium"},gt=e.defineComponent({__name:"Preview",props:{result:{}},setup(p){return(a,i)=>(e.openBlock(),e.createElementBlock("div",ut,[i[0]||(i[0]=e.createElementVNode("div",{class:"text-5xl mb-2 drop-shadow-lg"},"⛅",-1)),i[1]||(i[1]=e.createElementVNode("div",{class:"text-blue-800 font-bold text-sm mb-1"},"天気予報",-1)),e.createElementVNode("div",pt,e.toDisplayString(p.result.data?.areaName||p.result.title),1)]))}}),w={toolDefinition:v.TOOL_DEFINITION,execute:v.fetchWeather,generatingMessage:"Fetching weather forecast...",isEnabled:()=>!0,delayAfterExecution:2e3,viewComponent:mt,previewComponent:gt,systemPrompt:"When fetching weather, you can provide forecasts for Tokyo (130000) and Osaka (270000). Summarize the weather in a natural, conversational way.",samples:v.samples},xt={plugin:w};exports.TOOL_DEFINITION=v.TOOL_DEFINITION;exports.executeWeather=v.fetchWeather;exports.default=xt;exports.plugin=w;
|
package/dist/vue.js
ADDED
|
@@ -0,0 +1,554 @@
|
|
|
1
|
+
import { samples as E, fetchWeather as O, TOOL_DEFINITION as R } from "./core.js";
|
|
2
|
+
import { defineComponent as F, computed as g, createElementBlock as o, openBlock as n, createElementVNode as e, createCommentVNode as d, Fragment as h, renderList as b, toDisplayString as a, normalizeClass as T, createTextVNode as y, createVNode as W, normalizeStyle as J } from "vue";
|
|
3
|
+
const V = { class: "w-full" }, B = ["viewBox"], z = { class: "grid-lines" }, H = ["x1", "y1", "x2", "y2"], U = { class: "y-axis-labels" }, X = ["x", "y"], Y = ["points"], q = { key: 1 }, G = ["cx", "cy"], K = ["x", "y"], Q = ["points"], Z = { key: 3 }, I = ["cx", "cy"], tt = ["x", "y"], et = ["points"], st = { key: 5 }, ot = ["cx", "cy"], nt = { class: "x-axis-labels" }, lt = ["x", "y"], rt = { class: "flex justify-center gap-6 mt-4" }, it = {
|
|
4
|
+
key: 0,
|
|
5
|
+
class: "flex items-center gap-2"
|
|
6
|
+
}, at = {
|
|
7
|
+
key: 1,
|
|
8
|
+
class: "flex items-center gap-2"
|
|
9
|
+
}, dt = {
|
|
10
|
+
key: 2,
|
|
11
|
+
class: "flex items-center gap-2"
|
|
12
|
+
}, C = 800, L = 300, ut = /* @__PURE__ */ F({
|
|
13
|
+
__name: "TemperatureChart",
|
|
14
|
+
props: {
|
|
15
|
+
times: {},
|
|
16
|
+
tempsMax: {},
|
|
17
|
+
tempsMin: {},
|
|
18
|
+
temps: {}
|
|
19
|
+
},
|
|
20
|
+
setup(_) {
|
|
21
|
+
const m = _, x = { top: 40, right: 40, bottom: 60, left: 50 }, w = g(() => C - x.left - x.right), v = g(() => L - x.top - x.bottom), f = g(() => {
|
|
22
|
+
const l = [];
|
|
23
|
+
return m.tempsMax && l.push(...m.tempsMax.map(Number).filter((t) => !isNaN(t))), m.tempsMin && l.push(...m.tempsMin.map(Number).filter((t) => !isNaN(t))), m.temps && l.push(...m.temps.map(Number).filter((t) => !isNaN(t))), l;
|
|
24
|
+
}), j = g(() => {
|
|
25
|
+
if (f.value.length === 0) return { min: 0, max: 30 };
|
|
26
|
+
const l = Math.floor(Math.min(...f.value) / 5) * 5, t = Math.ceil(Math.max(...f.value) / 5) * 5;
|
|
27
|
+
return { min: l, max: t };
|
|
28
|
+
}), P = g(() => {
|
|
29
|
+
const { min: l, max: t } = j.value, i = (t - l) / 4;
|
|
30
|
+
return [t, t - i, t - i * 2, t - i * 3, l];
|
|
31
|
+
});
|
|
32
|
+
function $(l) {
|
|
33
|
+
const t = typeof l == "string" ? parseFloat(l) : l;
|
|
34
|
+
if (isNaN(t)) return 0;
|
|
35
|
+
const { min: i, max: p } = j.value, r = (t - i) / (p - i);
|
|
36
|
+
return x.top + v.value * (1 - r);
|
|
37
|
+
}
|
|
38
|
+
function D(l, t) {
|
|
39
|
+
return t <= 1 ? x.left + w.value / 2 : x.left + w.value / (t - 1) * l;
|
|
40
|
+
}
|
|
41
|
+
const M = g(() => m.tempsMax ? m.tempsMax.map((l, t) => l ? {
|
|
42
|
+
x: D(t, m.times.length),
|
|
43
|
+
y: $(l),
|
|
44
|
+
value: l
|
|
45
|
+
} : null).filter((l) => l !== null) : []), k = g(() => M.value.map((l) => `${l.x},${l.y}`).join(" ")), S = g(() => m.tempsMin ? m.tempsMin.map((l, t) => l ? {
|
|
46
|
+
x: D(t, m.times.length),
|
|
47
|
+
y: $(l),
|
|
48
|
+
value: l
|
|
49
|
+
} : null).filter((l) => l !== null) : []), N = g(() => S.value.map((l) => `${l.x},${l.y}`).join(" ")), u = g(() => m.temps ? m.temps.map((l, t) => l ? {
|
|
50
|
+
x: D(t, m.times.length),
|
|
51
|
+
y: $(l),
|
|
52
|
+
value: l
|
|
53
|
+
} : null).filter((l) => l !== null) : []), s = g(() => u.value.map((l) => `${l.x},${l.y}`).join(" ")), c = g(() => m.times.map((l) => {
|
|
54
|
+
const t = new Date(l), i = /* @__PURE__ */ new Date(), p = new Date(i);
|
|
55
|
+
p.setDate(p.getDate() + 1);
|
|
56
|
+
const r = t.toLocaleDateString("ja-JP", {
|
|
57
|
+
month: "short",
|
|
58
|
+
day: "numeric"
|
|
59
|
+
}), A = t.toLocaleTimeString("ja-JP", {
|
|
60
|
+
hour: "2-digit",
|
|
61
|
+
minute: "2-digit"
|
|
62
|
+
});
|
|
63
|
+
return t.toDateString() === i.toDateString() ? `Today ${A}` : t.toDateString() === p.toDateString() ? `Tomorrow ${A}` : `${r} ${A}`;
|
|
64
|
+
}));
|
|
65
|
+
return (l, t) => (n(), o("div", V, [
|
|
66
|
+
(n(), o("svg", {
|
|
67
|
+
viewBox: `0 0 ${C} ${L}`,
|
|
68
|
+
class: "w-full h-auto"
|
|
69
|
+
}, [
|
|
70
|
+
e("g", z, [
|
|
71
|
+
(n(), o(h, null, b(5, (i) => e("line", {
|
|
72
|
+
key: `grid-${i}`,
|
|
73
|
+
x1: x.left,
|
|
74
|
+
y1: x.top + v.value / 4 * (i - 1),
|
|
75
|
+
x2: C - x.right,
|
|
76
|
+
y2: x.top + v.value / 4 * (i - 1),
|
|
77
|
+
stroke: "#e5e7eb",
|
|
78
|
+
"stroke-width": "1"
|
|
79
|
+
}, null, 8, H)), 64))
|
|
80
|
+
]),
|
|
81
|
+
e("g", U, [
|
|
82
|
+
(n(!0), o(h, null, b(P.value, (i, p) => (n(), o("text", {
|
|
83
|
+
key: `y-label-${p}`,
|
|
84
|
+
x: x.left - 10,
|
|
85
|
+
y: x.top + v.value / 4 * p + 5,
|
|
86
|
+
"text-anchor": "end",
|
|
87
|
+
class: "text-xs fill-gray-600"
|
|
88
|
+
}, a(i) + "° ", 9, X))), 128))
|
|
89
|
+
]),
|
|
90
|
+
k.value.length > 0 ? (n(), o("polyline", {
|
|
91
|
+
key: 0,
|
|
92
|
+
points: k.value,
|
|
93
|
+
fill: "none",
|
|
94
|
+
stroke: "#ef4444",
|
|
95
|
+
"stroke-width": "3",
|
|
96
|
+
"stroke-linecap": "round",
|
|
97
|
+
"stroke-linejoin": "round"
|
|
98
|
+
}, null, 8, Y)) : d("", !0),
|
|
99
|
+
k.value.length > 0 ? (n(), o("g", q, [
|
|
100
|
+
(n(!0), o(h, null, b(M.value, (i, p) => (n(), o("g", {
|
|
101
|
+
key: `max-point-${p}`
|
|
102
|
+
}, [
|
|
103
|
+
e("circle", {
|
|
104
|
+
cx: i.x,
|
|
105
|
+
cy: i.y,
|
|
106
|
+
r: "5",
|
|
107
|
+
fill: "#ef4444"
|
|
108
|
+
}, null, 8, G),
|
|
109
|
+
e("text", {
|
|
110
|
+
x: i.x,
|
|
111
|
+
y: i.y - 12,
|
|
112
|
+
"text-anchor": "middle",
|
|
113
|
+
class: "text-sm font-bold fill-red-600"
|
|
114
|
+
}, a(i.value) + "° ", 9, K)
|
|
115
|
+
]))), 128))
|
|
116
|
+
])) : d("", !0),
|
|
117
|
+
N.value.length > 0 ? (n(), o("polyline", {
|
|
118
|
+
key: 2,
|
|
119
|
+
points: N.value,
|
|
120
|
+
fill: "none",
|
|
121
|
+
stroke: "#3b82f6",
|
|
122
|
+
"stroke-width": "3",
|
|
123
|
+
"stroke-linecap": "round",
|
|
124
|
+
"stroke-linejoin": "round"
|
|
125
|
+
}, null, 8, Q)) : d("", !0),
|
|
126
|
+
N.value.length > 0 ? (n(), o("g", Z, [
|
|
127
|
+
(n(!0), o(h, null, b(S.value, (i, p) => (n(), o("g", {
|
|
128
|
+
key: `min-point-${p}`
|
|
129
|
+
}, [
|
|
130
|
+
e("circle", {
|
|
131
|
+
cx: i.x,
|
|
132
|
+
cy: i.y,
|
|
133
|
+
r: "5",
|
|
134
|
+
fill: "#3b82f6"
|
|
135
|
+
}, null, 8, I),
|
|
136
|
+
e("text", {
|
|
137
|
+
x: i.x,
|
|
138
|
+
y: i.y + 20,
|
|
139
|
+
"text-anchor": "middle",
|
|
140
|
+
class: "text-sm font-bold fill-blue-600"
|
|
141
|
+
}, a(i.value) + "° ", 9, tt)
|
|
142
|
+
]))), 128))
|
|
143
|
+
])) : d("", !0),
|
|
144
|
+
s.value.length > 0 ? (n(), o("polyline", {
|
|
145
|
+
key: 4,
|
|
146
|
+
points: s.value,
|
|
147
|
+
fill: "none",
|
|
148
|
+
stroke: "#f97316",
|
|
149
|
+
"stroke-width": "3",
|
|
150
|
+
"stroke-linecap": "round",
|
|
151
|
+
"stroke-linejoin": "round",
|
|
152
|
+
"stroke-dasharray": "5,5"
|
|
153
|
+
}, null, 8, et)) : d("", !0),
|
|
154
|
+
s.value.length > 0 ? (n(), o("g", st, [
|
|
155
|
+
(n(!0), o(h, null, b(u.value, (i, p) => (n(), o("g", {
|
|
156
|
+
key: `current-point-${p}`
|
|
157
|
+
}, [
|
|
158
|
+
e("circle", {
|
|
159
|
+
cx: i.x,
|
|
160
|
+
cy: i.y,
|
|
161
|
+
r: "5",
|
|
162
|
+
fill: "#f97316"
|
|
163
|
+
}, null, 8, ot)
|
|
164
|
+
]))), 128))
|
|
165
|
+
])) : d("", !0),
|
|
166
|
+
e("g", nt, [
|
|
167
|
+
(n(!0), o(h, null, b(c.value, (i, p) => (n(), o("text", {
|
|
168
|
+
key: `x-label-${p}`,
|
|
169
|
+
x: x.left + w.value / (c.value.length - 1) * p,
|
|
170
|
+
y: L - x.bottom + 20,
|
|
171
|
+
"text-anchor": "middle",
|
|
172
|
+
class: "text-xs fill-gray-700 font-medium"
|
|
173
|
+
}, a(i), 9, lt))), 128))
|
|
174
|
+
])
|
|
175
|
+
], 8, B)),
|
|
176
|
+
e("div", rt, [
|
|
177
|
+
M.value.length > 0 ? (n(), o("div", it, [...t[0] || (t[0] = [
|
|
178
|
+
e("div", { class: "w-4 h-4 rounded-full bg-red-500" }, null, -1),
|
|
179
|
+
e("span", { class: "text-sm text-gray-700 font-medium" }, "最高気温", -1)
|
|
180
|
+
])])) : d("", !0),
|
|
181
|
+
S.value.length > 0 ? (n(), o("div", at, [...t[1] || (t[1] = [
|
|
182
|
+
e("div", { class: "w-4 h-4 rounded-full bg-blue-500" }, null, -1),
|
|
183
|
+
e("span", { class: "text-sm text-gray-700 font-medium" }, "最低気温", -1)
|
|
184
|
+
])])) : d("", !0),
|
|
185
|
+
u.value.length > 0 ? (n(), o("div", dt, [...t[2] || (t[2] = [
|
|
186
|
+
e("div", { class: "w-4 h-4 rounded-full bg-orange-500" }, null, -1),
|
|
187
|
+
e("span", { class: "text-sm text-gray-700 font-medium" }, "現在気温", -1)
|
|
188
|
+
])])) : d("", !0)
|
|
189
|
+
])
|
|
190
|
+
]));
|
|
191
|
+
}
|
|
192
|
+
}), ct = { class: "w-full h-full overflow-auto bg-gradient-to-br from-sky-100 via-blue-50 to-indigo-100" }, mt = { class: "max-w-6xl mx-auto p-6" }, xt = { class: "bg-gradient-to-r from-blue-500 to-indigo-600 rounded-2xl shadow-xl p-8 mb-8 text-white" }, pt = { class: "flex items-center justify-between" }, gt = { class: "text-4xl font-bold mb-2" }, ft = { class: "text-sm opacity-90" }, ht = { key: 0 }, bt = { key: 1 }, yt = {
|
|
193
|
+
key: 0,
|
|
194
|
+
class: "bg-white rounded-2xl shadow-lg p-8 text-center text-gray-600"
|
|
195
|
+
}, vt = {
|
|
196
|
+
key: 1,
|
|
197
|
+
class: "space-y-8"
|
|
198
|
+
}, _t = {
|
|
199
|
+
key: 0,
|
|
200
|
+
class: "text-3xl"
|
|
201
|
+
}, wt = {
|
|
202
|
+
key: 1,
|
|
203
|
+
class: "text-3xl"
|
|
204
|
+
}, kt = {
|
|
205
|
+
key: 2,
|
|
206
|
+
class: "text-3xl"
|
|
207
|
+
}, $t = {
|
|
208
|
+
key: 3,
|
|
209
|
+
class: "text-3xl"
|
|
210
|
+
}, Dt = {
|
|
211
|
+
key: 0,
|
|
212
|
+
class: "text-lg font-semibold text-gray-700 mb-4"
|
|
213
|
+
}, Mt = { key: 1 }, St = { class: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 xl:grid-cols-7 gap-4 mb-8" }, Nt = { class: "text-center mt-3 mb-3" }, Tt = { class: "text-sm font-medium text-gray-600" }, jt = {
|
|
214
|
+
key: 0,
|
|
215
|
+
class: "text-center mb-3"
|
|
216
|
+
}, Pt = { class: "text-6xl mb-2 drop-shadow-lg" }, At = { class: "text-xs text-gray-700 font-medium" }, Ct = {
|
|
217
|
+
key: 1,
|
|
218
|
+
class: "text-center mb-3"
|
|
219
|
+
}, Lt = { class: "flex items-center justify-center gap-2 mb-1" }, Ft = { class: "text-3xl" }, Et = { class: "text-2xl font-bold text-blue-600" }, Ot = { class: "text-center mb-3" }, Rt = {
|
|
220
|
+
key: 0,
|
|
221
|
+
class: "text-3xl font-bold text-red-500 mb-1"
|
|
222
|
+
}, Wt = {
|
|
223
|
+
key: 1,
|
|
224
|
+
class: "text-xl font-semibold text-blue-500"
|
|
225
|
+
}, Jt = {
|
|
226
|
+
key: 2,
|
|
227
|
+
class: "text-2xl font-bold text-orange-500"
|
|
228
|
+
}, Vt = {
|
|
229
|
+
key: 2,
|
|
230
|
+
class: "text-xs text-gray-600 mb-1 text-center"
|
|
231
|
+
}, Bt = {
|
|
232
|
+
key: 3,
|
|
233
|
+
class: "text-xs text-gray-600 text-center"
|
|
234
|
+
}, zt = {
|
|
235
|
+
key: 0,
|
|
236
|
+
class: "bg-white rounded-xl p-6 shadow-lg"
|
|
237
|
+
}, Ht = {
|
|
238
|
+
key: 2,
|
|
239
|
+
class: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4"
|
|
240
|
+
}, Ut = { class: "text-sm font-bold text-blue-700 mb-3" }, Xt = {
|
|
241
|
+
key: 0,
|
|
242
|
+
class: "mb-3 flex items-center gap-2"
|
|
243
|
+
}, Yt = { class: "text-4xl drop-shadow" }, qt = { class: "text-gray-800 font-medium text-sm" }, Gt = {
|
|
244
|
+
key: 1,
|
|
245
|
+
class: "text-gray-700 mb-2"
|
|
246
|
+
}, Kt = { class: "text-2xl font-bold ml-2" }, Qt = { class: "flex gap-3 mb-2" }, Zt = {
|
|
247
|
+
key: 0,
|
|
248
|
+
class: "flex items-center gap-1"
|
|
249
|
+
}, It = { class: "text-xl font-bold text-red-600" }, te = {
|
|
250
|
+
key: 1,
|
|
251
|
+
class: "flex items-center gap-1"
|
|
252
|
+
}, ee = { class: "text-xl font-bold text-blue-600" }, se = {
|
|
253
|
+
key: 2,
|
|
254
|
+
class: "mb-2"
|
|
255
|
+
}, oe = { class: "flex items-center justify-between text-sm mb-1" }, ne = { class: "font-bold" }, le = { class: "w-full bg-gray-200 rounded-full h-2" }, re = {
|
|
256
|
+
key: 3,
|
|
257
|
+
class: "text-gray-700 text-sm mb-1"
|
|
258
|
+
}, ie = {
|
|
259
|
+
key: 4,
|
|
260
|
+
class: "text-gray-700 text-sm"
|
|
261
|
+
}, ae = {
|
|
262
|
+
key: 0,
|
|
263
|
+
class: "bg-white rounded-2xl shadow-xl p-6"
|
|
264
|
+
}, de = { class: "grid grid-cols-1 md:grid-cols-2 gap-6" }, ue = {
|
|
265
|
+
key: 0,
|
|
266
|
+
class: "bg-gradient-to-br from-orange-50 to-red-50 rounded-xl p-5 shadow-md border border-orange-200"
|
|
267
|
+
}, ce = { class: "font-semibold text-gray-800 mb-1" }, me = { class: "flex gap-3" }, xe = {
|
|
268
|
+
key: 0,
|
|
269
|
+
class: "flex items-center gap-1"
|
|
270
|
+
}, pe = { class: "text-xl font-bold text-blue-700" }, ge = {
|
|
271
|
+
key: 1,
|
|
272
|
+
class: "flex items-center gap-1"
|
|
273
|
+
}, fe = { class: "text-xl font-bold text-red-700" }, he = {
|
|
274
|
+
key: 1,
|
|
275
|
+
class: "bg-gradient-to-br from-blue-50 to-cyan-50 rounded-xl p-5 shadow-md border border-blue-200"
|
|
276
|
+
}, be = { class: "font-semibold text-gray-800 mb-1" }, ye = { class: "flex gap-3" }, ve = {
|
|
277
|
+
key: 0,
|
|
278
|
+
class: "flex items-center gap-1"
|
|
279
|
+
}, _e = { class: "text-xl font-bold text-cyan-700" }, we = {
|
|
280
|
+
key: 1,
|
|
281
|
+
class: "flex items-center gap-1"
|
|
282
|
+
}, ke = { class: "text-xl font-bold text-blue-700" }, $e = /* @__PURE__ */ F({
|
|
283
|
+
__name: "View",
|
|
284
|
+
props: {
|
|
285
|
+
selectedResult: {},
|
|
286
|
+
sendTextMessage: { type: Function }
|
|
287
|
+
},
|
|
288
|
+
setup(_) {
|
|
289
|
+
const m = _, x = g(() => m.selectedResult?.data?.areaName || "Unknown Area"), w = g(() => m.selectedResult?.data?.publishingOffice || ""), v = g(() => m.selectedResult?.data?.reportDatetime || ""), f = g(() => m.selectedResult?.jsonData || null), j = g(() => v.value ? new Date(v.value).toLocaleString("ja-JP", {
|
|
290
|
+
year: "numeric",
|
|
291
|
+
month: "long",
|
|
292
|
+
day: "numeric",
|
|
293
|
+
hour: "2-digit",
|
|
294
|
+
minute: "2-digit"
|
|
295
|
+
}) : "");
|
|
296
|
+
function P(u) {
|
|
297
|
+
const s = new Date(u), c = /* @__PURE__ */ new Date(), l = new Date(c);
|
|
298
|
+
l.setDate(l.getDate() + 1);
|
|
299
|
+
const t = s.toLocaleDateString("ja-JP", {
|
|
300
|
+
month: "short",
|
|
301
|
+
day: "numeric"
|
|
302
|
+
}), i = s.toLocaleTimeString("ja-JP", {
|
|
303
|
+
hour: "2-digit",
|
|
304
|
+
minute: "2-digit"
|
|
305
|
+
});
|
|
306
|
+
return s.toDateString() === c.toDateString() ? `Today ${i}` : s.toDateString() === l.toDateString() ? `Tomorrow ${i}` : `${t} ${i}`;
|
|
307
|
+
}
|
|
308
|
+
function $(u) {
|
|
309
|
+
const s = new Date(u);
|
|
310
|
+
return ["日", "月", "火", "水", "木", "金", "土"][s.getDay()] ?? "";
|
|
311
|
+
}
|
|
312
|
+
function D(u) {
|
|
313
|
+
const s = typeof u == "string" ? parseInt(u) : u;
|
|
314
|
+
return s >= 70 ? "bg-gradient-to-r from-blue-500 to-blue-600" : s >= 50 ? "bg-gradient-to-r from-blue-400 to-blue-500" : s >= 30 ? "bg-gradient-to-r from-cyan-400 to-blue-400" : s >= 10 ? "bg-gradient-to-r from-cyan-300 to-cyan-400" : "bg-gradient-to-r from-gray-300 to-gray-400";
|
|
315
|
+
}
|
|
316
|
+
function M(u) {
|
|
317
|
+
return ["Current Forecast", "Extended Forecast", "Weekly Forecast"][u] || `Forecast ${u + 1}`;
|
|
318
|
+
}
|
|
319
|
+
function k(u) {
|
|
320
|
+
if (!u) return "🌤️";
|
|
321
|
+
const s = u.toLowerCase();
|
|
322
|
+
return s.includes("晴") || s.includes("sunny") || s.includes("clear") ? "☀️" : s.includes("曇") || s.includes("cloudy") ? "☁️" : s.includes("雨") || s.includes("rain") ? "🌧️" : s.includes("雪") || s.includes("snow") ? "❄️" : s.includes("雷") || s.includes("thunder") ? "⛈️" : s.includes("霧") || s.includes("fog") ? "🌫️" : "🌤️";
|
|
323
|
+
}
|
|
324
|
+
function S(u) {
|
|
325
|
+
const s = typeof u == "string" ? parseInt(u) : u;
|
|
326
|
+
return s >= 50 ? "☔" : s >= 30 ? "🌂" : s >= 10 ? "☁️" : "☀️";
|
|
327
|
+
}
|
|
328
|
+
function N(u) {
|
|
329
|
+
return !!(u.tempsMax || u.tempsMin || u.temps);
|
|
330
|
+
}
|
|
331
|
+
return (u, s) => (n(), o("div", ct, [
|
|
332
|
+
e("div", mt, [
|
|
333
|
+
e("div", xt, [
|
|
334
|
+
e("div", pt, [
|
|
335
|
+
e("div", null, [
|
|
336
|
+
e("h1", gt, a(x.value), 1),
|
|
337
|
+
e("div", ft, [
|
|
338
|
+
w.value ? (n(), o("div", ht, a(w.value), 1)) : d("", !0),
|
|
339
|
+
v.value ? (n(), o("div", bt, a(j.value), 1)) : d("", !0)
|
|
340
|
+
])
|
|
341
|
+
]),
|
|
342
|
+
s[0] || (s[0] = e("div", { class: "text-8xl drop-shadow-lg" }, "⛅", -1))
|
|
343
|
+
])
|
|
344
|
+
]),
|
|
345
|
+
f.value ? (n(), o("div", vt, [
|
|
346
|
+
(n(!0), o(h, null, b(f.value.timeSeries, (c, l) => (n(), o("div", {
|
|
347
|
+
key: l,
|
|
348
|
+
class: T([
|
|
349
|
+
"rounded-2xl shadow-xl p-6",
|
|
350
|
+
l === 1 ? "bg-gradient-to-br from-orange-50 via-pink-50 to-purple-50" : l === 2 ? "bg-gradient-to-br from-green-50 via-teal-50 to-cyan-50" : "bg-white"
|
|
351
|
+
])
|
|
352
|
+
}, [
|
|
353
|
+
e("h2", {
|
|
354
|
+
class: T([
|
|
355
|
+
"text-2xl font-bold mb-6 flex items-center gap-2",
|
|
356
|
+
l === 1 ? "text-purple-800" : l === 2 ? "text-teal-800" : "text-gray-800"
|
|
357
|
+
])
|
|
358
|
+
}, [
|
|
359
|
+
l === 1 ? (n(), o("span", _t, "📅")) : l === 2 ? (n(), o("span", wt, "📊")) : l === 0 ? (n(), o("span", kt, "🌤️")) : (n(), o("span", $t, "📋")),
|
|
360
|
+
y(" " + a(M(l)), 1)
|
|
361
|
+
], 2),
|
|
362
|
+
(n(!0), o(h, null, b(c.areas, (t, i) => (n(), o("div", {
|
|
363
|
+
key: i,
|
|
364
|
+
class: "mb-6 last:mb-0"
|
|
365
|
+
}, [
|
|
366
|
+
c.areas.length > 1 ? (n(), o("h3", Dt, a(t.area.name), 1)) : d("", !0),
|
|
367
|
+
l === 1 || l === 2 ? (n(), o("div", Mt, [
|
|
368
|
+
e("div", St, [
|
|
369
|
+
(n(!0), o(h, null, b(c.timeDefines, (p, r) => (n(), o("div", {
|
|
370
|
+
key: r,
|
|
371
|
+
class: T([
|
|
372
|
+
"relative bg-white rounded-xl p-5 shadow-lg hover:shadow-2xl transition-all duration-300 hover:scale-105 border-2 border-transparent",
|
|
373
|
+
l === 1 ? "hover:border-purple-300" : "hover:border-teal-300"
|
|
374
|
+
])
|
|
375
|
+
}, [
|
|
376
|
+
e("div", {
|
|
377
|
+
class: T([
|
|
378
|
+
"absolute -top-3 left-1/2 transform -translate-x-1/2 text-white px-4 py-1 rounded-full text-xs font-bold shadow-md",
|
|
379
|
+
l === 1 ? "bg-gradient-to-r from-purple-500 to-pink-500" : "bg-gradient-to-r from-teal-500 to-cyan-500"
|
|
380
|
+
])
|
|
381
|
+
}, a($(p)), 3),
|
|
382
|
+
e("div", Nt, [
|
|
383
|
+
e("div", Tt, a(P(p)), 1)
|
|
384
|
+
]),
|
|
385
|
+
t.weathers && t.weathers[r] ? (n(), o("div", jt, [
|
|
386
|
+
e("div", Pt, a(k(t.weathers[r])), 1),
|
|
387
|
+
e("div", At, a(t.weathers[r]), 1)
|
|
388
|
+
])) : d("", !0),
|
|
389
|
+
t.pops && t.pops[r] ? (n(), o("div", Ct, [
|
|
390
|
+
e("div", Lt, [
|
|
391
|
+
e("span", Ft, a(S(t.pops[r])), 1),
|
|
392
|
+
e("span", Et, a(t.pops[r]) + "%", 1)
|
|
393
|
+
])
|
|
394
|
+
])) : d("", !0),
|
|
395
|
+
e("div", Ot, [
|
|
396
|
+
t.tempsMax && t.tempsMax[r] ? (n(), o("div", Rt, a(t.tempsMax[r]) + "° ", 1)) : d("", !0),
|
|
397
|
+
t.tempsMin && t.tempsMin[r] ? (n(), o("div", Wt, a(t.tempsMin[r]) + "° ", 1)) : d("", !0),
|
|
398
|
+
t.temps && t.temps[r] ? (n(), o("div", Jt, a(t.temps[r]) + "° ", 1)) : d("", !0)
|
|
399
|
+
]),
|
|
400
|
+
t.winds && t.winds[r] ? (n(), o("div", Vt, [
|
|
401
|
+
s[1] || (s[1] = e("span", { class: "mr-1" }, "🌬️", -1)),
|
|
402
|
+
y(" " + a(t.winds[r]), 1)
|
|
403
|
+
])) : d("", !0),
|
|
404
|
+
t.waves && t.waves[r] ? (n(), o("div", Bt, [
|
|
405
|
+
s[2] || (s[2] = e("span", { class: "mr-1" }, "🌊", -1)),
|
|
406
|
+
y(" " + a(t.waves[r]), 1)
|
|
407
|
+
])) : d("", !0)
|
|
408
|
+
], 2))), 128))
|
|
409
|
+
]),
|
|
410
|
+
N(t) ? (n(), o("div", zt, [
|
|
411
|
+
s[3] || (s[3] = e("h3", { class: "text-lg font-bold text-gray-800 mb-4 flex items-center gap-2" }, [
|
|
412
|
+
e("span", { class: "text-2xl" }, "📈"),
|
|
413
|
+
y(" 気温の推移 ")
|
|
414
|
+
], -1)),
|
|
415
|
+
W(ut, {
|
|
416
|
+
times: c.timeDefines,
|
|
417
|
+
tempsMax: t.tempsMax,
|
|
418
|
+
tempsMin: t.tempsMin,
|
|
419
|
+
temps: t.temps
|
|
420
|
+
}, null, 8, ["times", "tempsMax", "tempsMin", "temps"])
|
|
421
|
+
])) : d("", !0)
|
|
422
|
+
])) : (n(), o("div", Ht, [
|
|
423
|
+
(n(!0), o(h, null, b(c.timeDefines, (p, r) => (n(), o("div", {
|
|
424
|
+
key: r,
|
|
425
|
+
class: "bg-gradient-to-br from-blue-50 to-cyan-50 rounded-xl p-5 shadow-md hover:shadow-xl transition-all duration-300 border border-blue-100"
|
|
426
|
+
}, [
|
|
427
|
+
e("div", Ut, a(P(p)), 1),
|
|
428
|
+
t.weathers && t.weathers[r] ? (n(), o("div", Xt, [
|
|
429
|
+
e("span", Yt, a(k(t.weathers[r])), 1),
|
|
430
|
+
e("span", qt, a(t.weathers[r]), 1)
|
|
431
|
+
])) : d("", !0),
|
|
432
|
+
t.temps && t.temps[r] ? (n(), o("div", Gt, [
|
|
433
|
+
s[4] || (s[4] = e("span", { class: "font-semibold text-orange-600" }, "気温:", -1)),
|
|
434
|
+
e("span", Kt, a(t.temps[r]) + "°C", 1)
|
|
435
|
+
])) : d("", !0),
|
|
436
|
+
e("div", Qt, [
|
|
437
|
+
t.tempsMax && t.tempsMax[r] ? (n(), o("div", Zt, [
|
|
438
|
+
s[5] || (s[5] = e("span", { class: "text-red-500 font-bold text-sm" }, "最高:", -1)),
|
|
439
|
+
e("span", It, a(t.tempsMax[r]) + "°", 1)
|
|
440
|
+
])) : d("", !0),
|
|
441
|
+
t.tempsMin && t.tempsMin[r] ? (n(), o("div", te, [
|
|
442
|
+
s[6] || (s[6] = e("span", { class: "text-blue-500 font-bold text-sm" }, "最低:", -1)),
|
|
443
|
+
e("span", ee, a(t.tempsMin[r]) + "°", 1)
|
|
444
|
+
])) : d("", !0)
|
|
445
|
+
]),
|
|
446
|
+
t.pops && t.pops[r] ? (n(), o("div", se, [
|
|
447
|
+
e("div", oe, [
|
|
448
|
+
s[7] || (s[7] = e("span", { class: "font-semibold text-blue-600" }, "💧 降水確率", -1)),
|
|
449
|
+
e("span", ne, a(t.pops[r]) + "%", 1)
|
|
450
|
+
]),
|
|
451
|
+
e("div", le, [
|
|
452
|
+
e("div", {
|
|
453
|
+
class: T(["h-full rounded-full transition-all", D(t.pops[r])]),
|
|
454
|
+
style: J({ width: t.pops[r] + "%" })
|
|
455
|
+
}, null, 6)
|
|
456
|
+
])
|
|
457
|
+
])) : d("", !0),
|
|
458
|
+
t.winds && t.winds[r] ? (n(), o("div", re, [
|
|
459
|
+
s[8] || (s[8] = e("span", { class: "font-semibold" }, "🌬️ 風:", -1)),
|
|
460
|
+
y(" " + a(t.winds[r]), 1)
|
|
461
|
+
])) : d("", !0),
|
|
462
|
+
t.waves && t.waves[r] ? (n(), o("div", ie, [
|
|
463
|
+
s[9] || (s[9] = e("span", { class: "font-semibold" }, "🌊 波:", -1)),
|
|
464
|
+
y(" " + a(t.waves[r]), 1)
|
|
465
|
+
])) : d("", !0)
|
|
466
|
+
]))), 128))
|
|
467
|
+
]))
|
|
468
|
+
]))), 128))
|
|
469
|
+
], 2))), 128)),
|
|
470
|
+
f.value.tempAverage || f.value.precipAverage ? (n(), o("div", ae, [
|
|
471
|
+
s[16] || (s[16] = e("h2", { class: "text-2xl font-bold text-gray-800 mb-6 flex items-center gap-2" }, [
|
|
472
|
+
e("span", { class: "text-3xl" }, "📊"),
|
|
473
|
+
y(" Historical Averages ")
|
|
474
|
+
], -1)),
|
|
475
|
+
e("div", de, [
|
|
476
|
+
f.value.tempAverage ? (n(), o("div", ue, [
|
|
477
|
+
s[12] || (s[12] = e("h3", { class: "font-bold text-orange-700 mb-3 text-lg flex items-center gap-2" }, [
|
|
478
|
+
e("span", { class: "text-2xl" }, "🌡️"),
|
|
479
|
+
y(" Temperature ")
|
|
480
|
+
], -1)),
|
|
481
|
+
(n(!0), o(h, null, b(f.value.tempAverage.areas, (c, l) => (n(), o("div", {
|
|
482
|
+
key: l,
|
|
483
|
+
class: "text-gray-700 mb-3 last:mb-0"
|
|
484
|
+
}, [
|
|
485
|
+
e("div", ce, a(c.area.name), 1),
|
|
486
|
+
e("div", me, [
|
|
487
|
+
c.min ? (n(), o("div", xe, [
|
|
488
|
+
s[10] || (s[10] = e("span", { class: "text-blue-600 font-semibold" }, "最低:", -1)),
|
|
489
|
+
e("span", pe, a(c.min) + "°C", 1)
|
|
490
|
+
])) : d("", !0),
|
|
491
|
+
c.max ? (n(), o("div", ge, [
|
|
492
|
+
s[11] || (s[11] = e("span", { class: "text-red-600 font-semibold" }, "最高:", -1)),
|
|
493
|
+
e("span", fe, a(c.max) + "°C", 1)
|
|
494
|
+
])) : d("", !0)
|
|
495
|
+
])
|
|
496
|
+
]))), 128))
|
|
497
|
+
])) : d("", !0),
|
|
498
|
+
f.value.precipAverage ? (n(), o("div", he, [
|
|
499
|
+
s[15] || (s[15] = e("h3", { class: "font-bold text-blue-700 mb-3 text-lg flex items-center gap-2" }, [
|
|
500
|
+
e("span", { class: "text-2xl" }, "💧"),
|
|
501
|
+
y(" Precipitation ")
|
|
502
|
+
], -1)),
|
|
503
|
+
(n(!0), o(h, null, b(f.value.precipAverage.areas, (c, l) => (n(), o("div", {
|
|
504
|
+
key: l,
|
|
505
|
+
class: "text-gray-700 mb-3 last:mb-0"
|
|
506
|
+
}, [
|
|
507
|
+
e("div", be, a(c.area.name), 1),
|
|
508
|
+
e("div", ye, [
|
|
509
|
+
c.min ? (n(), o("div", ve, [
|
|
510
|
+
s[13] || (s[13] = e("span", { class: "text-cyan-600 font-semibold" }, "最低:", -1)),
|
|
511
|
+
e("span", _e, a(c.min) + "mm", 1)
|
|
512
|
+
])) : d("", !0),
|
|
513
|
+
c.max ? (n(), o("div", we, [
|
|
514
|
+
s[14] || (s[14] = e("span", { class: "text-blue-600 font-semibold" }, "最高:", -1)),
|
|
515
|
+
e("span", ke, a(c.max) + "mm", 1)
|
|
516
|
+
])) : d("", !0)
|
|
517
|
+
])
|
|
518
|
+
]))), 128))
|
|
519
|
+
])) : d("", !0)
|
|
520
|
+
])
|
|
521
|
+
])) : d("", !0)
|
|
522
|
+
])) : (n(), o("div", yt, " No weather data available "))
|
|
523
|
+
])
|
|
524
|
+
]));
|
|
525
|
+
}
|
|
526
|
+
}), De = { class: "text-center p-4 bg-gradient-to-br from-sky-100 via-blue-100 to-indigo-100 rounded-xl shadow-md hover:shadow-xl transition-all duration-300 hover:scale-105 border-2 border-blue-200" }, Me = { class: "text-xs text-gray-700 font-medium" }, Se = /* @__PURE__ */ F({
|
|
527
|
+
__name: "Preview",
|
|
528
|
+
props: {
|
|
529
|
+
result: {}
|
|
530
|
+
},
|
|
531
|
+
setup(_) {
|
|
532
|
+
return (m, x) => (n(), o("div", De, [
|
|
533
|
+
x[0] || (x[0] = e("div", { class: "text-5xl mb-2 drop-shadow-lg" }, "⛅", -1)),
|
|
534
|
+
x[1] || (x[1] = e("div", { class: "text-blue-800 font-bold text-sm mb-1" }, "天気予報", -1)),
|
|
535
|
+
e("div", Me, a(_.result.data?.areaName || _.result.title), 1)
|
|
536
|
+
]));
|
|
537
|
+
}
|
|
538
|
+
}), Ne = {
|
|
539
|
+
toolDefinition: R,
|
|
540
|
+
execute: O,
|
|
541
|
+
generatingMessage: "Fetching weather forecast...",
|
|
542
|
+
isEnabled: () => !0,
|
|
543
|
+
delayAfterExecution: 2e3,
|
|
544
|
+
viewComponent: $e,
|
|
545
|
+
previewComponent: Se,
|
|
546
|
+
systemPrompt: "When fetching weather, you can provide forecasts for Tokyo (130000) and Osaka (270000). Summarize the weather in a natural, conversational way.",
|
|
547
|
+
samples: E
|
|
548
|
+
}, Pe = { plugin: Ne };
|
|
549
|
+
export {
|
|
550
|
+
R as TOOL_DEFINITION,
|
|
551
|
+
Pe as default,
|
|
552
|
+
O as executeWeather,
|
|
553
|
+
Ne as plugin
|
|
554
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@gui-chat-plugin/weather",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Weather forecast plugin for GUI Chat - Japan Meteorological Agency",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js",
|
|
13
|
+
"require": "./dist/index.cjs"
|
|
14
|
+
},
|
|
15
|
+
"./core": {
|
|
16
|
+
"types": "./dist/core/index.d.ts",
|
|
17
|
+
"import": "./dist/core.js",
|
|
18
|
+
"require": "./dist/core.cjs"
|
|
19
|
+
},
|
|
20
|
+
"./vue": {
|
|
21
|
+
"types": "./dist/vue/index.d.ts",
|
|
22
|
+
"import": "./dist/vue.js",
|
|
23
|
+
"require": "./dist/vue.cjs"
|
|
24
|
+
},
|
|
25
|
+
"./style.css": "./dist/style.css"
|
|
26
|
+
},
|
|
27
|
+
"files": ["dist"],
|
|
28
|
+
"scripts": {
|
|
29
|
+
"dev": "vite",
|
|
30
|
+
"build": "vite build && vue-tsc -p tsconfig.build.json --emitDeclarationOnly",
|
|
31
|
+
"typecheck": "vue-tsc --noEmit",
|
|
32
|
+
"lint": "eslint src demo"
|
|
33
|
+
},
|
|
34
|
+
"peerDependencies": {
|
|
35
|
+
"vue": "^3.5.0"
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"gui-chat-protocol": "^0.0.1"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@tailwindcss/vite": "^4.1.18",
|
|
42
|
+
"@typescript-eslint/eslint-plugin": "^8.53.0",
|
|
43
|
+
"@typescript-eslint/parser": "^8.53.0",
|
|
44
|
+
"@vitejs/plugin-vue": "^6.0.3",
|
|
45
|
+
"eslint": "^9.39.2",
|
|
46
|
+
"eslint-plugin-vue": "^10.6.2",
|
|
47
|
+
"globals": "^17.0.0",
|
|
48
|
+
"tailwindcss": "^4.1.18",
|
|
49
|
+
"typescript": "~5.9.3",
|
|
50
|
+
"vite": "^7.3.1",
|
|
51
|
+
"vue": "^3.5.26",
|
|
52
|
+
"vue-eslint-parser": "^10.2.0",
|
|
53
|
+
"vue-tsc": "^3.2.2"
|
|
54
|
+
},
|
|
55
|
+
"keywords": ["guichat", "plugin", "weather", "jma", "forecast"],
|
|
56
|
+
"license": "MIT"
|
|
57
|
+
}
|