@vibes.diy/prompts 14.3.249 → 14.3.251

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. package/generation-variety.js +1 -1
  2. package/index.d.ts +1 -1
  3. package/index.js +1 -1
  4. package/index.js.map +1 -1
  5. package/llms/backend.js +1 -0
  6. package/llms/backend.js.map +1 -1
  7. package/llms/blockly.js +1 -0
  8. package/llms/blockly.js.map +1 -1
  9. package/llms/blockly.md +2 -3
  10. package/llms/bluesky.js +2 -0
  11. package/llms/bluesky.js.map +1 -1
  12. package/llms/board-games.js +9 -4
  13. package/llms/board-games.js.map +1 -1
  14. package/llms/board-games.md +3 -153
  15. package/llms/callai.js +1 -0
  16. package/llms/callai.js.map +1 -1
  17. package/llms/callai.md +1 -1
  18. package/llms/canvas-theme-colors.d.ts +2 -0
  19. package/llms/canvas-theme-colors.js +7 -0
  20. package/llms/canvas-theme-colors.js.map +1 -0
  21. package/llms/canvas-theme-colors.md +70 -0
  22. package/llms/image-gen.js +1 -0
  23. package/llms/image-gen.js.map +1 -1
  24. package/llms/image-gen.md +1 -1
  25. package/llms/index.d.ts +24 -2
  26. package/llms/index.js +64 -0
  27. package/llms/index.js.map +1 -1
  28. package/llms/keepsake.d.ts +2 -0
  29. package/llms/keepsake.js +9 -0
  30. package/llms/keepsake.js.map +1 -0
  31. package/llms/keepsake.md +74 -0
  32. package/llms/live-rooms.d.ts +2 -0
  33. package/llms/live-rooms.js +28 -0
  34. package/llms/live-rooms.js.map +1 -0
  35. package/llms/live-rooms.md +288 -0
  36. package/llms/media-capture.d.ts +2 -0
  37. package/llms/media-capture.js +27 -0
  38. package/llms/media-capture.js.map +1 -0
  39. package/llms/media-capture.md +190 -0
  40. package/llms/mic-capture.d.ts +2 -0
  41. package/llms/mic-capture.js +7 -0
  42. package/llms/mic-capture.js.map +1 -0
  43. package/llms/mic-capture.md +76 -0
  44. package/llms/needs.d.ts +12 -0
  45. package/llms/needs.js +71 -0
  46. package/llms/needs.js.map +1 -0
  47. package/llms/owner-secret.d.ts +2 -0
  48. package/llms/owner-secret.js +8 -0
  49. package/llms/owner-secret.js.map +1 -0
  50. package/llms/owner-secret.md +82 -0
  51. package/llms/p5.js +1 -0
  52. package/llms/p5.js.map +1 -1
  53. package/llms/p5.md +15 -69
  54. package/llms/photo-input.d.ts +2 -0
  55. package/llms/photo-input.js +7 -0
  56. package/llms/photo-input.js.map +1 -0
  57. package/llms/photo-input.md +141 -0
  58. package/llms/physics.js +1 -0
  59. package/llms/physics.js.map +1 -1
  60. package/llms/physics.md +7 -16
  61. package/llms/reskin.js +3 -8
  62. package/llms/reskin.js.map +1 -1
  63. package/llms/reskin.md +12 -78
  64. package/llms/richtext.md +2 -0
  65. package/llms/social-post.js +1 -0
  66. package/llms/social-post.js.map +1 -1
  67. package/llms/social-post.md +22 -4
  68. package/llms/sound-core.d.ts +2 -0
  69. package/llms/sound-core.js +7 -0
  70. package/llms/sound-core.js.map +1 -0
  71. package/llms/sound-core.md +131 -0
  72. package/llms/spotify.js +11 -1
  73. package/llms/spotify.js.map +1 -1
  74. package/llms/spotify.md +54 -50
  75. package/llms/strudel.js +2 -0
  76. package/llms/strudel.js.map +1 -1
  77. package/llms/strudel.md +24 -25
  78. package/llms/surface-board.d.ts +2 -0
  79. package/llms/surface-board.js +8 -0
  80. package/llms/surface-board.js.map +1 -0
  81. package/llms/surface-board.md +140 -0
  82. package/llms/surface-play-area.d.ts +2 -0
  83. package/llms/surface-play-area.js +8 -0
  84. package/llms/surface-play-area.js.map +1 -0
  85. package/llms/surface-play-area.md +51 -0
  86. package/llms/surface-presence.d.ts +2 -0
  87. package/llms/surface-presence.js +9 -0
  88. package/llms/surface-presence.js.map +1 -0
  89. package/llms/surface-presence.md +118 -0
  90. package/llms/third-party-embed.d.ts +2 -0
  91. package/llms/third-party-embed.js +8 -0
  92. package/llms/third-party-embed.js.map +1 -0
  93. package/llms/third-party-embed.md +110 -0
  94. package/llms/three-js.js +1 -1
  95. package/llms/three-js.js.map +1 -1
  96. package/llms/three-js.md +52 -18
  97. package/llms/touch-games.js +11 -11
  98. package/llms/touch-games.js.map +1 -1
  99. package/llms/touch-games.md +59 -354
  100. package/llms/types.d.ts +14 -0
  101. package/llms/ui-chat.js +2 -1
  102. package/llms/ui-chat.js.map +1 -1
  103. package/llms/ui-chat.md +25 -14
  104. package/llms/ui-weather.js +1 -1
  105. package/llms/ui-weather.js.map +1 -1
  106. package/llms/ui-weather.md +1 -2
  107. package/llms/use-vibe.js +1 -0
  108. package/llms/use-vibe.js.map +1 -1
  109. package/llms/use-viewer.js +1 -0
  110. package/llms/use-viewer.js.map +1 -1
  111. package/llms/voxel.js +1 -0
  112. package/llms/voxel.js.map +1 -1
  113. package/llms/voxel.md +33 -109
  114. package/llms/weather.d.ts +2 -0
  115. package/llms/weather.js +12 -0
  116. package/llms/weather.js.map +1 -0
  117. package/llms/weather.md +248 -0
  118. package/llms/web-audio.js +4 -21
  119. package/llms/web-audio.js.map +1 -1
  120. package/llms/web-audio.md +19 -951
  121. package/llms/web-music.d.ts +2 -0
  122. package/llms/web-music.js +8 -0
  123. package/llms/web-music.js.map +1 -0
  124. package/llms/web-music.md +895 -0
  125. package/llms/world-controls.d.ts +2 -0
  126. package/llms/world-controls.js +14 -0
  127. package/llms/world-controls.js.map +1 -0
  128. package/llms/world-controls.md +262 -0
  129. package/llms/worlds.js +2 -1
  130. package/llms/worlds.js.map +1 -1
  131. package/llms/worlds.md +5 -14
  132. package/llms/youtube.js +10 -1
  133. package/llms/youtube.js.map +1 -1
  134. package/llms/youtube.md +67 -53
  135. package/package.json +5 -5
  136. package/prompts.js +5 -19
  137. package/prompts.js.map +1 -1
@@ -0,0 +1,248 @@
1
+ # Weather — real forecasts from Open-Meteo, with no key
2
+
3
+ Current conditions, an hourly strip and a several-day forecast for any place on
4
+ Earth come from **Open-Meteo**: free, no account, no key, and open to any
5
+ origin, so the page calls it directly with a plain `fetch`. There is no setup
6
+ item, no secret and no backend in this recipe, and the app works the moment it
7
+ opens.
8
+
9
+ Open-Meteo's free tier is for non-commercial apps (no ads, no subscriptions)
10
+ and fewer than 10,000 calls a day. An app that sells something needs Open-Meteo's
11
+ commercial plan and a key; say that to the person in one sentence and build the
12
+ free version.
13
+
14
+ ## 1. A place name becomes coordinates
15
+
16
+ The forecast takes a latitude and longitude, so a typed place goes through
17
+ Open-Meteo's geocoder first:
18
+
19
+ ```
20
+ GET https://geocoding-api.open-meteo.com/v1/search?name=<typed>&count=5&language=en&format=json
21
+ ```
22
+
23
+ Each entry of `results` carries `name`, `latitude`, `longitude`, `timezone`,
24
+ `country`, `country_code` and `admin1` (the region), with empty fields left
25
+ out. **When nothing matches, the answer has no `results` key at all**, so read
26
+ `data.results ?? []` and say "No place called Springfeld" with the typed name
27
+ kept on screen. Several towns share a name: list the matches as
28
+ `name, admin1, country` and let the person pick one, never silently take the
29
+ first. Keep the pick as `{ name, latitude, longitude, timezone }`, which is all
30
+ the forecast needs.
31
+
32
+ "Use my location" reads `navigator.geolocation.getCurrentPosition` from the
33
+ press handler (the app's frame is allowed to ask), names the place
34
+ "My location", and falls back to the search with the person's answer kept when
35
+ they decline.
36
+
37
+ ## 2. One forecast call
38
+
39
+ ```
40
+ GET https://api.open-meteo.com/v1/forecast?latitude=38.72&longitude=-9.15
41
+ &current=temperature_2m,apparent_temperature,relative_humidity_2m,weather_code,wind_speed_10m,is_day
42
+ &hourly=temperature_2m,weather_code,precipitation_probability&forecast_hours=12
43
+ &daily=weather_code,temperature_2m_max,temperature_2m_min,precipitation_probability_max,uv_index_max,sunrise,sunset
44
+ &timezone=auto&forecast_days=5
45
+ ```
46
+
47
+ - **`timezone=auto` is required for `daily`**, and it makes every `time` the
48
+ place's own local time, so "Tuesday" and "14:00" mean the place's Tuesday.
49
+ - `hourly` and `daily` are **parallel arrays**: `daily.time[i]` is the date of
50
+ `daily.temperature_2m_max[i]`. Zip them by index into one object per day.
51
+ - `forecast_hours=12` starts the hourly arrays at the current hour, so the strip
52
+ needs no slicing. `forecast_days` runs from 1 to 16.
53
+ - **Units go in the request, and change together**: `temperature_unit=fahrenheit`
54
+ with `wind_speed_unit=mph` (and `precipitation_unit=inch`), or the defaults
55
+ °C, km/h and mm. Label each figure from the response's `current_units`,
56
+ `hourly_units` and `daily_units`, which echo what was asked, and refetch when
57
+ the person switches units rather than converting by hand. Keep each response
58
+ beside the units it was asked in and label from those, so figures still on
59
+ screen while the new ones load (or after that refetch fails) keep their own
60
+ units, and let only the newest request land.
61
+ - **Several places, one call**: comma-separated `latitude=38.72,59.91` and
62
+ `longitude=-9.15,10.75` answer with an array, one forecast per place in the
63
+ order asked. A single place answers with one object, so wrap it.
64
+
65
+ ## 3. Weather codes become words
66
+
67
+ `weather_code` is a WMO code. Map it to words in one table, pick any icon from
68
+ those words, and show the words: a code number means nothing to anyone.
69
+
70
+ ```js
71
+ const WEATHER_CODES = {
72
+ 0: "Clear", 1: "Mostly clear", 2: "Partly cloudy", 3: "Overcast", 45: "Fog", 48: "Freezing fog",
73
+ 51: "Light drizzle", 53: "Drizzle", 55: "Heavy drizzle", 56: "Freezing drizzle", 57: "Freezing drizzle",
74
+ 61: "Light rain", 63: "Rain", 65: "Heavy rain", 66: "Freezing rain", 67: "Freezing rain",
75
+ 71: "Light snow", 73: "Snow", 75: "Heavy snow", 77: "Snow grains",
76
+ 80: "Showers", 81: "Showers", 82: "Heavy showers", 85: "Snow showers", 86: "Heavy snow showers",
77
+ 95: "Thunderstorm", 96: "Thunderstorm with hail", 99: "Thunderstorm with hail",
78
+ };
79
+ function weatherWords(code) {
80
+ return WEATHER_CODES[code] ?? "Unsettled";
81
+ }
82
+ ```
83
+
84
+ `current.is_day` is `1` by day and `0` by night, so a clear night can show a
85
+ moon instead of a sun.
86
+
87
+ ## 4. When to call
88
+
89
+ Fetch when the person picks a place or units, and when the app opens with
90
+ places already chosen: an effect keyed on the place and the units, never a call
91
+ from render. Refresh when the page becomes visible again after 15 minutes or
92
+ more, and keep the figures
93
+ on screen with "Updated 10:40" from the time they arrived. Three places on one
94
+ screen are one call (section 2), not three.
95
+
96
+ ## 5. Errors keep their reason
97
+
98
+ A bad parameter answers HTTP 400 with `{ "error": true, "reason": "…" }`; show
99
+ that reason. A network failure (offline, the service down) keeps the last
100
+ forecast on screen with its time and a "Couldn't reach the forecast — Try again"
101
+ line, rather than blanking the page. "Try again" repeats the step that failed:
102
+ a failed place search searches again, a failed forecast fetches again. Never fill a failed day with zeros: a
103
+ forecast of 0° is a forecast, so a missing one says it is missing.
104
+
105
+ ## 6. Credit the data
106
+
107
+ Open-Meteo's data is CC BY 4.0, so the screen carries a small visible line,
108
+ "Weather data by Open-Meteo.com", linking `https://open-meteo.com/`.
109
+
110
+ ## 7. Alerts and digests
111
+
112
+ "Tell me when frost is coming" or "email me the weekend forecast" is a
113
+ scheduled job in backend.js (the `backend` skill), which can read the same
114
+ forecast URL with `ctx.fetch`. The page's own forecast never needs a backend.
115
+
116
+ ## App.jsx
117
+
118
+ ```jsx app=weather-forecast
119
+ import React, { useEffect, useRef, useState } from "react";
120
+ import { Button, Field, Input, Row, Stack } from "@vibes.diy/ui";
121
+
122
+ const UNITS = {
123
+ metric: { query: "", temp: "°C", wind: "km/h" },
124
+ imperial: { query: "&temperature_unit=fahrenheit&wind_speed_unit=mph&precipitation_unit=inch", temp: "°F", wind: "mph" },
125
+ };
126
+
127
+ async function searchPlaces(typed) {
128
+ const r = await fetch(`https://geocoding-api.open-meteo.com/v1/search?name=${encodeURIComponent(typed)}&count=5&language=en&format=json`);
129
+ const data = await r.json();
130
+ if (!r.ok) throw new Error(data.reason ?? `The place search answered ${r.status}`);
131
+ return (data.results ?? []).map((p) => ({ name: p.name, region: [p.admin1, p.country].filter(Boolean).join(", "), latitude: p.latitude, longitude: p.longitude }));
132
+ }
133
+
134
+ // Every place in one call; the answer is an array for several places and an object for one.
135
+ async function fetchForecast(places, units) {
136
+ const lat = places.map((p) => p.latitude).join(",");
137
+ const lon = places.map((p) => p.longitude).join(",");
138
+ const r = await fetch(
139
+ `https://api.open-meteo.com/v1/forecast?latitude=${lat}&longitude=${lon}` +
140
+ "&current=temperature_2m,apparent_temperature,weather_code,wind_speed_10m,is_day" +
141
+ "&daily=weather_code,temperature_2m_max,temperature_2m_min,precipitation_probability_max" +
142
+ `&timezone=auto&forecast_days=5${UNITS[units].query}`
143
+ );
144
+ const data = await r.json();
145
+ if (!r.ok || data.error) throw new Error(data.reason ?? `The forecast answered ${r.status}`);
146
+ const all = Array.isArray(data) ? data : [data];
147
+ return all.map((f, i) => ({
148
+ place: places[i],
149
+ now: { temp: f.current.temperature_2m, feels: f.current.apparent_temperature, code: f.current.weather_code, wind: f.current.wind_speed_10m },
150
+ days: f.daily.time.map((date, d) => ({
151
+ date,
152
+ hi: f.daily.temperature_2m_max[d],
153
+ lo: f.daily.temperature_2m_min[d],
154
+ code: f.daily.weather_code[d],
155
+ rain: f.daily.precipitation_probability_max[d],
156
+ })),
157
+ }));
158
+ }
159
+
160
+ const dayName = (date) => new Date(`${date}T12:00`).toLocaleDateString(undefined, { weekday: "short" });
161
+
162
+ export default function App() {
163
+ const [places, setPlaces] = useState([{ name: "Lisbon", region: "Portugal", latitude: 38.72, longitude: -9.15 }]);
164
+ const [units, setUnits] = useState("metric");
165
+ // The figures on screen and the units they were asked in, kept together: a toggle changes
166
+ // `units` at once, and the figures it labels arrive later or not at all.
167
+ const [shown, setShown] = useState({ forecasts: [], units: "metric" });
168
+ const latest = useRef(0);
169
+ const [updated, setUpdated] = useState(null);
170
+ // A failure and the step that retries it: search and forecast fail separately, so "Try again"
171
+ // repeats the one that failed. A search that found nothing has no retry, only a message.
172
+ const [problem, setProblem] = useState(null);
173
+ const [typed, setTyped] = useState("");
174
+ const [matches, setMatches] = useState([]);
175
+
176
+ const load = () => {
177
+ setProblem(null);
178
+ const n = ++latest.current; // only the newest request may land, or a slow old one restores old units
179
+ const asked = units;
180
+ fetchForecast(places, asked)
181
+ .then((f) => { if (n === latest.current) { setShown({ forecasts: f, units: asked }); setUpdated(new Date()); } })
182
+ .catch((e) => { if (n === latest.current) setProblem({ message: e.message, retry: load }); }); // the last forecast stays on screen, with its own units
183
+ };
184
+ useEffect(load, [places, units]);
185
+ useEffect(() => {
186
+ const onVisible = () => {
187
+ if (document.visibilityState === "visible" && updated && Date.now() - updated.getTime() > 15 * 60 * 1000) load();
188
+ };
189
+ document.addEventListener("visibilitychange", onVisible);
190
+ return () => document.removeEventListener("visibilitychange", onVisible);
191
+ }, [updated, places, units]);
192
+
193
+ const search = async () => {
194
+ setProblem(null);
195
+ try {
196
+ const found = await searchPlaces(typed);
197
+ setMatches(found);
198
+ if (found.length === 0) setProblem({ message: `No place called ${typed}.`, retry: null });
199
+ } catch (e) {
200
+ setProblem({ message: e.message, retry: search });
201
+ }
202
+ };
203
+
204
+ const u = UNITS[shown.units]; // label the figures in the units they came in
205
+ return (
206
+ <Stack gap={4}>
207
+ <Row gap={2} align="top">
208
+ <Field label="Add a place">{(id, describedBy) => <Input id={id} describedBy={describedBy} value={typed} onChange={setTyped} placeholder="Oslo" />}</Field>
209
+ <Button type="button" onClick={search}>Find</Button>
210
+ <Button type="button" variant="quiet" onClick={() => setUnits(units === "metric" ? "imperial" : "metric")}>
211
+ Show {units === "metric" ? "°F" : "°C"}
212
+ </Button>
213
+ </Row>
214
+ {matches.map((m) => (
215
+ <Button key={`${m.latitude},${m.longitude}`} type="button" variant="quiet" onClick={() => { setPlaces([...places, m]); setMatches([]); setTyped(""); }}>
216
+ {m.name}, {m.region}
217
+ </Button>
218
+ ))}
219
+ {problem && (
220
+ <p role="alert">
221
+ {problem.message} {problem.retry && <Button type="button" variant="quiet" onClick={problem.retry}>Try again</Button>}
222
+ </p>
223
+ )}
224
+
225
+ {shown.forecasts.map((f) => {
226
+ const words = weatherWords(f.now.code);
227
+ return (
228
+ <section key={f.place.name + f.place.latitude}>
229
+ <h2>{f.place.name}</h2>
230
+ <p>{Math.round(f.now.temp)}{u.temp} · {words} · feels like {Math.round(f.now.feels)}{u.temp} · wind {Math.round(f.now.wind)} {u.wind}</p>
231
+ <ol>
232
+ {f.days.map((d) => (
233
+ <li key={d.date}>
234
+ {dayName(d.date)}: {weatherWords(d.code)}, {Math.round(d.hi)}{u.temp} / {Math.round(d.lo)}{u.temp}, {d.rain}% rain
235
+ </li>
236
+ ))}
237
+ </ol>
238
+ </section>
239
+ );
240
+ })}
241
+ {updated && <small>Updated {updated.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" })}</small>}
242
+ <small>Weather data by <a href="https://open-meteo.com/" target="_blank" rel="noreferrer">Open-Meteo.com</a></small>
243
+ </Stack>
244
+ );
245
+ }
246
+ ```
247
+
248
+ `weatherWords` and its table are section 3's, in the same file.
package/llms/web-audio.js CHANGED
@@ -1,26 +1,9 @@
1
1
  export const webAudioConfig = {
2
2
  name: "web-audio",
3
+ needs: ["sound-core"],
3
4
  label: "Web Audio API",
4
- description: "Web Audio fundamentals; echo/delay with effects in the feedback path; mic monitoring with a metronome; audio‑clock scheduling; timing design for multi‑channel drum machines and MIDI synths with accurate voice overlap; a complete synthesized drum machine (kick, snare, hats, 16‑step sequencer, tempo, swing, saturation, volume).",
5
- cues: [
6
- "audio",
7
- "sound",
8
- "sounds",
9
- "music",
10
- "synth",
11
- "synthesizer",
12
- "oscillator",
13
- "metronome",
14
- "drum machine",
15
- "drum",
16
- "drums",
17
- "midi",
18
- "melody",
19
- "web audio",
20
- "samples",
21
- "sampled",
22
- "sampled sounds",
23
- "audio engine",
24
- ],
5
+ description: "Web Audio fundamentals: the AudioContext from the gesture unlock, oscillators, decoded-file playback, gain and filters, and heavyweight engines (Tone.js and the like) imported at runtime from a pinned URL in a memoized loader, with one Stop that silences every voice. A music toy (a drum machine, a synth, a sequencer, a metronome) names \"web-music\", which brings this with it.",
6
+ teaches: ["AudioContext", "WebAudio", "Web Audio"],
7
+ cues: ["audio", "sound", "sounds", "oscillator", "web audio", "samples", "sampled", "sampled sounds", "audio engine"],
25
8
  };
26
9
  //# sourceMappingURL=web-audio.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"web-audio.js","sourceRoot":"","sources":["../../jsr/llms/web-audio.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,cAAc,GAAc;IACvC,IAAI,EAAE,WAAW;IACjB,KAAK,EAAE,eAAe;IACtB,WAAW,EACT,yUAAyU;IAC3U,IAAI,EAAE;QACJ,OAAO;QACP,OAAO;QACP,QAAQ;QACR,OAAO;QACP,OAAO;QACP,aAAa;QACb,YAAY;QACZ,WAAW;QACX,cAAc;QACd,MAAM;QACN,OAAO;QACP,MAAM;QACN,QAAQ;QACR,WAAW;QACX,SAAS;QACT,SAAS;QACT,gBAAgB;QAChB,cAAc;KACf;CACF,CAAC"}
1
+ {"version":3,"file":"web-audio.js","sourceRoot":"","sources":["../../jsr/llms/web-audio.ts"],"names":[],"mappings":"AAQA,MAAM,CAAC,MAAM,cAAc,GAAc;IACvC,IAAI,EAAE,WAAW;IAEjB,KAAK,EAAE,CAAC,YAAY,CAAC;IACrB,KAAK,EAAE,eAAe;IACtB,WAAW,EACT,6XAA6X;IAE/X,OAAO,EAAE,CAAC,cAAc,EAAE,UAAU,EAAE,WAAW,CAAC;IAClD,IAAI,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,gBAAgB,EAAE,cAAc,CAAC;CACtH,CAAC"}