111 lines
8.0 KiB
PHP
111 lines
8.0 KiB
PHP
{{-- PL0XION periodic ⚛ — LA TABLE PÉRIODIQUE (RS-7 : « des données genre la table périodique … apprendre
|
||
avec le xerboxion »). 118 éléments réels (/periodic.json), vraie disposition (18 groupes × 7 périodes +
|
||
les 2 bandes f lanthanides/actinides). Conçu selon la recherche 2025 sur l'apprentissage des cerveaux
|
||
NEURODIVERGENTS : couleur par famille (patterns visuels > par-cœur), tap-pour-le-détail (chunking, charge
|
||
mémoire basse), palette calme (faible charge sensorielle), tap une famille = surligne le motif, recherche
|
||
tolérante, zéro pression/score. Chaque élément = un bion de la matière. window.jOSApps['periodic']. --}}
|
||
<style>
|
||
.pe{position:absolute;inset:0;display:flex;flex-direction:column;overflow:hidden;background:var(--xr-bg,#080b12);color:var(--xr-text,#dbe7f7);font-family:var(--xr-font-ui,ui-sans-serif,system-ui)}
|
||
.pe *{box-sizing:border-box;-webkit-tap-highlight-color:transparent;min-width:0}
|
||
.pe__h{flex:0 0 auto;padding:calc(env(safe-area-inset-top,0px) + 9px) 12px 4px}
|
||
.pe__t{font-weight:800;color:var(--xr-accent,#7fe0c8);font-size:.98rem}
|
||
.pe__bar{display:flex;gap:7px;align-items:center;margin-top:5px}
|
||
.pe__f{flex:1;min-width:0;border:1px solid var(--xr-border,#22344f);background:rgba(11,20,34,.6);color:#cfe;border-radius:16px;padding:6px 12px;font:inherit;font-size:.78rem;outline:none}
|
||
.pe__leg{flex:0 0 auto;display:flex;flex-wrap:wrap;gap:4px;padding:6px 12px}
|
||
.pe__lg{cursor:pointer;font-size:.58rem;padding:2px 7px;border-radius:10px;border:1px solid transparent;opacity:.9}
|
||
.pe__lg.off{opacity:.3}
|
||
.pe__scroll{flex:1;min-height:0;overflow:auto;-webkit-overflow-scrolling:touch;padding:6px 12px calc(env(safe-area-inset-bottom,0px) + 12px)}
|
||
.pe__grid{display:grid;grid-template-columns:repeat(18,minmax(34px,1fr));gap:3px;min-width:640px}
|
||
.pe__fb{margin-top:6px}
|
||
.pe__c{aspect-ratio:1;border-radius:5px;display:flex;flex-direction:column;align-items:center;justify-content:center;cursor:pointer;color:#0a0f16;position:relative;padding:1px}
|
||
.pe__c.dim{opacity:.16}
|
||
.pe__z{position:absolute;top:1px;left:3px;font-size:.5rem;opacity:.7}
|
||
.pe__sy{font-weight:800;font-size:.9rem;line-height:1}
|
||
.pe__nm{font-size:.4rem;line-height:1;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
||
.pe__gap{grid-column:3;font-size:.5rem;color:var(--xr-muted,#8aa6c8);display:flex;align-items:center;justify-content:center}
|
||
.pe__det{flex:0 0 auto;border-top:1px solid var(--xr-border,#15233c);padding:10px 13px calc(env(safe-area-inset-bottom,0px) + 12px);min-height:64px}
|
||
.pe__dh{display:flex;align-items:baseline;gap:9px;flex-wrap:wrap}
|
||
.pe__dsy{font-weight:800;font-size:1.3rem;color:#fff}
|
||
.pe__dn{font-weight:700;color:#dbe7f7}
|
||
.pe__dz{font-family:ui-monospace,monospace;font-size:.72rem;color:var(--xr-muted,#8aa6c8)}
|
||
.pe__dmeta{font-size:.74rem;color:#bcd0e6;margin-top:4px;line-height:1.5}
|
||
.pe__dmeta b{color:#7fe0c8}
|
||
.pe__empty{color:var(--xr-muted,#8aa6c8);font-size:.76rem}
|
||
</style>
|
||
<script>
|
||
(function () {
|
||
'use strict';
|
||
function esc(s) { return window.jOSb.esc(s); }
|
||
var COL = { al:'#ff9e7d', ae:'#ffd27d', tm:'#ffe08a', pt:'#b9e08a', me:'#8ae0c8', nm:'#7fe0e0', hg:'#7fc8ff', ng:'#b8a9ff', ln:'#ff9ecb', an:'#e79eff' };
|
||
|
||
var LIVE=null; // posé au mount : {sel:function()}
|
||
function describe(){
|
||
var s = LIVE ? LIVE.sel() : null;
|
||
return { v:1, id:'periodic', title:'Table périodique', icon:'⚛', items:[
|
||
{ p:1, kind:'stat', label:'élément sélectionné', value: s ? (s.sym+' — '+(s.name||'')) : 'aucun' }
|
||
]};
|
||
}
|
||
|
||
function mount(container, ctx) {
|
||
var alive=true, data=null, q='', only='', sel=null;
|
||
LIVE = { sel: function () { return sel; } };
|
||
container.innerHTML =
|
||
'<div class="pe">'
|
||
+ ' <div class="pe__h"><div class="pe__t">⚛ Table périodique — 118 éléments</div>'
|
||
+ ' <div class="pe__bar"><input class="pe__f" data-q placeholder="cherche : nom, symbole, numéro…"></div></div>'
|
||
+ ' <div class="pe__leg" data-leg></div>'
|
||
+ ' <div class="pe__scroll"><div class="pe__grid" data-grid></div><div class="pe__grid pe__fb" data-fb></div></div>'
|
||
+ ' <div class="pe__det" data-det><div class="pe__empty">touche un élément — sa fiche s\'ouvre ici. les couleurs = les familles (les motifs de la matière).</div></div>'
|
||
+ '</div>';
|
||
var root=container.querySelector('.pe'), elQ=root.querySelector('[data-q]'), elLeg=root.querySelector('[data-leg]');
|
||
var elGrid=root.querySelector('[data-grid]'), elFb=root.querySelector('[data-fb]'), elDet=root.querySelector('[data-det]');
|
||
|
||
function match(e){ if(only && e.cat!==only) return false; if(!q) return true; var s=q.toLowerCase();
|
||
return e.name.toLowerCase().indexOf(s)!==-1 || e.sym.toLowerCase()===s || (''+e.z)===s || e.sym.toLowerCase().indexOf(s)===0; }
|
||
function cell(e){ var hit=match(e);
|
||
return '<div class="pe__c'+(hit?'':' dim')+'" style="background:'+(COL[e.cat]||'#889')+'" data-z="'+e.z+'" title="'+esc(e.name)+'">'
|
||
+'<span class="pe__z">'+e.z+'</span><span class="pe__sy">'+esc(e.sym)+'</span><span class="pe__nm">'+esc(e.name)+'</span></div>';
|
||
}
|
||
function renderGrid(){
|
||
var els=data.elements, main={}, f9={}, f10={}, i;
|
||
els.forEach(function(e){ if(e.p===9) f9[e.g]=e; else if(e.p===10) f10[e.g]=e; else main[e.p+'-'+e.g]=e; });
|
||
var html='';
|
||
for(var p=1;p<=7;p++){ for(var g=1;g<=18;g++){ var e=main[p+'-'+g];
|
||
if(e) html+=cell(e);
|
||
else if((p===6&&g===3)) html+='<div class="pe__gap">57-71</div>';
|
||
else if((p===7&&g===3)) html+='<div class="pe__gap">89-103</div>';
|
||
else html+='<div></div>';
|
||
} }
|
||
elGrid.innerHTML=html;
|
||
// bandes f (lanthanides p9, actinides p10) : groupes 3..17 → colonnes 3..17
|
||
var fh='';
|
||
for(var g2=1;g2<=18;g2++){ fh += f9[g2]?cell(f9[g2]):'<div></div>'; }
|
||
for(var g3=1;g3<=18;g3++){ fh += f10[g3]?cell(f10[g3]):'<div></div>'; }
|
||
elFb.innerHTML=fh;
|
||
}
|
||
function renderLeg(){
|
||
var c=data.categories||{};
|
||
elLeg.innerHTML=Object.keys(c).map(function(k){ return '<span class="pe__lg'+(only&&only!==k?' off':'')+'" data-cat="'+k+'" style="background:'+(COL[k]||'#889')+';color:#0a0f16">'+esc(c[k])+'</span>'; }).join('');
|
||
}
|
||
function detail(e){
|
||
var c=data.categories||{};
|
||
elDet.innerHTML='<div class="pe__dh"><span class="pe__dsy" style="color:'+(COL[e.cat]||'#fff')+'">'+esc(e.sym)+'</span>'
|
||
+'<span class="pe__dn">'+esc(e.name)+'</span><span class="pe__dz">Z '+e.z+'</span></div>'
|
||
+'<div class="pe__dmeta"><b>'+esc(c[e.cat]||e.cat)+'</b> · masse '+esc(e.mass)+' u · '
|
||
+(e.p<=7?'période '+e.p:(e.p===9?'lanthanide':'actinide'))+' · groupe '+(e.g)+'<br>'
|
||
+'chaque élément = un <b>bion</b> de la matière ; sa place dans la table = sa formule (couche électronique). Z = nombre de protons.</div>';
|
||
}
|
||
|
||
elQ.addEventListener('input', function(){ q=elQ.value.trim(); renderGrid(); });
|
||
elLeg.addEventListener('click', function(e){ var b=e.target.closest('[data-cat]'); if(!b)return; var k=b.getAttribute('data-cat'); only=(only===k?'':k); renderLeg(); renderGrid(); });
|
||
root.querySelector('.pe__scroll').addEventListener('click', function(e){ var c=e.target.closest('[data-z]'); if(!c)return; var z=+c.getAttribute('data-z'); sel=data.elements[z-1]; if(sel){ detail(sel); try{ window.jOSPorts&&jOSPorts.emit&&jOSPorts.emit('periodic','element',{z:z,sym:sel.sym}); }catch(x){} } });
|
||
|
||
fetch('/periodic.json',{headers:{Accept:'application/json'}}).then(function(r){return r.ok?r.json():null;}).then(function(j){ if(!alive)return; data=j; if(!data){ elGrid.innerHTML='<div class="pe__empty">données indisponibles — node resources/forge → public/periodic.json</div>'; return; } renderLeg(); renderGrid(); }).catch(function(){});
|
||
|
||
return { unmount:function(){ alive=false; LIVE=null; container.innerHTML=''; } };
|
||
}
|
||
window.jOSApps = window.jOSApps || {};
|
||
window.jOSApps['periodic'] = { manifest:{ id:'periodic', name:'Table périodique', icon:'⚛' }, mount:mount, describe:describe };
|
||
})();
|
||
</script>
|