synchro du labo (0bf0da65) : app.blade.php, README.md

This commit is contained in:
cloudion 2026-11-03 22:40:57 +00:00
parent 42b0fa2298
commit d804fb3b6c
2 changed files with 70 additions and 2 deletions

View File

@ -1,3 +1,21 @@
# ploxion-tendance-meteo # 🌡️ Tendance météo
PLOXION · Prévi météo 7 j en graphe. FORGÉ SANS LLM par synth.mjs (recette weather→chart+persist) = la candidate « météo + graphes » trouvée par le moteur inversé. Prévi météo 7 j en graphe. FORGÉ SANS LLM par synth.mjs (recette weather→chart+persist) = la candidate « météo + graphes » trouvée par le moteur inversé.
| | |
| --- | --- |
| id | `tendance-meteo` |
| fournit | — |
| bions qu'il nomme | `jOSApps` `jOSBoxion` `jOSPorts` `jOSStore` `jOSWeather` |
| fichiers | `app.blade.php` |
| dans le labo | `resources/views/ploxions/tendance-meteo/` (dépôt `my_website2`) |
## Contribuer
- **Dans le xer** : https://labo.j0bot.ch/px/atelier?ploxion=tendance-meteo — prends-le, modifie-le, vois-le tourner, « ⧗ envoyer le tsoin ».
- **Dans VS Code** : `xb prendre tendance-meteo` (ou l'extension xerboxion › ⇩ Prendre), puis ⧗ Envoyer.
- Le chemin complet : https://labo.j0bot.ch/px/contribuer
Ce dépôt est un **miroir** du labo (synchronisé par `bin/ploxions-forge.mjs`, depuis le commit `0bf0da65`) : une modif se propose par un tsoin ou une branche du labo, pas directement ici.
© 2026 chill-tekk · ne pas nuire

50
app.blade.php Normal file
View File

@ -0,0 +1,50 @@
{{-- FORGÉ SANS LLM par synth.mjs — recette (tsoin) : {"id":"tendance-meteo","name":"Tendance météo","icon":"🌡️","source":"weather","view":"chart","persist":true} --}}
<style>.tendance-meteo__wrap{display:flex;flex-direction:column;gap:10px;padding:12px;color:var(--xr-text,#e7f0ff);font-family:var(--xr-font-ui,system-ui)}.tendance-meteo__ta{width:100%;min-height:90px;background:var(--xr-bg,#0b1220);color:var(--xr-text,#e7f0ff);border:1px solid var(--xr-border,#22324f);border-radius:8px;padding:8px;font:13px ui-monospace,monospace}.tendance-meteo__bus{font:13px ui-monospace,monospace;color:var(--xr-muted,#8aa0c0)}.tendance-meteo__wx{font:13px ui-monospace,monospace;color:var(--xr-accent,#3fe0d0)}.tendance-meteo__stat{font:14px ui-monospace,monospace;color:var(--xr-text,#e7f0ff)}.tendance-meteo__tbl{max-height:260px;overflow:auto;font:13px ui-monospace,monospace}.tendance-meteo__row{display:flex;justify-content:space-between;border-bottom:1px solid var(--xr-border,#22324f);padding:3px 4px}.tendance-meteo__cv{border:1px solid var(--xr-border,#22324f);border-radius:8px}</style>
<script>
(function () {
'use strict';
var ID = 'tendance-meteo';
window.jOSApps = window.jOSApps || {};
if (window.jOSApps[ID]) return; // idempotent
var LIVE = null; // posé au mount : { data, pos }
function describe() {
var d = LIVE ? LIVE.data() : [], pos = LIVE ? LIVE.pos() : null;
var last = d.length ? d[d.length - 1] : null;
return { v: 1, id: ID, title: 'Tendance météo', icon: '🌡️', items: [
{ p: 1, kind: 'stat', label: pos ? pos.label : 'météo', value: last != null ? (last + '°C') : '…' }
] };
}
window.jOSApps[ID] = {
manifest: { id: ID, name: "Tendance météo", icon: "🌡️" },
describe: describe,
mount: function (container, ctx) {
var _data = [];
var _offs = [];
// position par défaut Lausanne ; si ma-position a déjà rangé un {lat,lng} dans jOSStore('position'), on repart de là.
var _pos = { lat: 46.52, lng: 6.63, label: 'Lausanne' };
try{ if (window.jOSStore){ var _stp=jOSStore('position'); var _cp=(_stp&&_stp.find)?_stp.find(function(x){return x&&x.kind==='coord'&&isFinite(+x.lat)&&isFinite(+x.lng);}):null; if(_cp){ _pos={lat:+_cp.lat, lng:+_cp.lng, label:(+_cp.lat).toFixed(2)+', '+(+_cp.lng).toFixed(2)}; } } }catch(e){}
container.innerHTML = '<div class="' + ID + '__wrap">' + '<canvas class="'+ID+'__cv" style="width:100%;height:220px"></canvas>' + '<div class="'+ID+'__wx">météo…</div>' + '</div>';
function redraw() {
var _cv = container.querySelector('.'+ID+'__cv');
if (window.jOSChart && jOSChart.line) jOSChart.line(_cv, [{name:'série', data:_data}], {});
}
if (window.jOSBoxion && jOSBoxion.load){ try{ var _b=jOSBoxion.load('tendance-meteo','data'); if(_b&&_b.data&&_b.data.length){ _data=_b.data; } }catch(e){} }
function _persistSave(){ if(window.jOSBoxion&&jOSBoxion.saveSoon){ try{ jOSBoxion.saveSoon('tendance-meteo','data',_data,'Tendance météo'); }catch(e){} } }
var _wx = container.querySelector('.'+ID+'__wx');
// OUT series : la série 7 j (temp max) part sur le bus (ploxion.tendance-meteo.series) — stats en tire la pente. Best-effort.
function _emitSeries(label){ if(!(_data&&_data.length)) return; try{ if(window.jOSPorts&&jOSPorts.emit) jOSPorts.emit(ID,'series',{name:'temp max 7 j · '+label, unit:'°C', values:_data.slice()}); }catch(e){} }
function _fetch(lat,lng,label){ if(!(window.jOSWeather&&jOSWeather.forecast)){ if(_wx)_wx.textContent='jOSWeather absent'; return; } jOSWeather.forecast(lat,lng).then(function(j){ _data = (((j||{}).daily||{}).temperature_2m_max||[]).map(Number).filter(function(x){return !isNaN(x);}); if(_wx)_wx.textContent=label+' · max °C · 7 j'; redraw(); if(_persistSave)_persistSave(); _emitSeries(label); }).catch(function(){ if(_wx)_wx.textContent='météo indisponible'; }); }
_fetch(_pos.lat, _pos.lng, _pos.label);
// IN coord : ma-position pilote OÙ la météo est cherchée (fini le Lausanne codé en dur). Payload {lat,lng} — métadonnées __wired/__via ignorées.
try{ if(window.jOSPorts&&jOSPorts.on){ _offs.push(jOSPorts.on('ploxion.'+ID+'.coord', function(p){ if(!p||typeof p!=='object') return; var la=+p.lat, ln=+(p.lng!=null?p.lng:p.lon); if(!isFinite(la)||!isFinite(ln)) return; _pos={lat:la, lng:ln, label:la.toFixed(2)+', '+ln.toFixed(2)}; if(_wx)_wx.textContent='météo… ('+_pos.label+')'; _fetch(_pos.lat, _pos.lng, _pos.label); })); } }catch(e){}
redraw();
LIVE = { data: function () { return _data; }, pos: function () { return _pos; } };
return { unmount: function () {
LIVE = null;
for (var i=0;i<_offs.length;i++){ try{ _offs[i](); }catch(e){} }
container.innerHTML = '';
} };
}
};
})();
</script>