ploxion-phone-test/app.blade.php

54 lines
4.5 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{{-- PL0XION phone-test 📱 — tester le UI sur chaque type de téléphone (RS-7 : « un ploxion test iphone selon
chaque type de téléphone serait cool »). Affiche le labo (same-origin) dans le cadre exact de chaque appareil,
avec rotation + zoom-fit. Utile pour vérifier le xer + tout UI mobile. window.jOSApps['phone-test']. --}}
<style>
.pht{display:flex;flex-direction:column;height:100%;background:#06080e;color:#dfeef0;font-family:var(--xr-font-ui,system-ui)}
.pht__bar{flex:0 0 auto;display:flex;align-items:center;gap:6px;flex-wrap:wrap;padding:8px 12px;border-bottom:1px solid #1a2740}
.pht__d{cursor:pointer;font:inherit;font-size:.7rem;padding:5px 10px;border-radius:8px;border:1px solid #22344f;background:#0b1526;color:#bcd}
.pht__d.on{background:rgba(63,224,208,.16);border-color:#3fe0d0;color:#3fe0d0}
.pht__sp{flex:1}
.pht__b{cursor:pointer;font:inherit;font-size:.72rem;padding:5px 10px;border-radius:8px;border:1px solid #22344f;background:#0b1526;color:#bcd}
.pht__url{flex:0 0 auto;min-width:120px;background:#0b1526;border:1px solid #22344f;border-radius:8px;color:#cfe;padding:5px 8px;font:inherit;font-size:.7rem}
.pht__stage{flex:1;min-height:0;overflow:auto;display:flex;align-items:center;justify-content:center;padding:18px;background:radial-gradient(120% 100% at 50% 30%,#0a0f1c,#05070d)}
.pht__phone{position:relative;flex:0 0 auto;border-radius:34px;background:#0b0d14;border:2px solid #2a3550;box-shadow:0 20px 60px rgba(0,0,0,.6),inset 0 0 0 8px #05070a;padding:12px}
.pht__notch{position:absolute;top:14px;left:50%;transform:translateX(-50%);width:34%;height:22px;background:#05070a;border-radius:0 0 14px 14px;z-index:2}
.pht__screen{border-radius:22px;overflow:hidden;background:#000;position:relative}
.pht__screen iframe{border:0;display:block;background:#000}
.pht__cap{flex:0 0 auto;text-align:center;font-size:.66rem;color:#6a86ad;padding:5px}
</style>
<script>
(function(){
var DEV=[
{n:'iPhone SE',w:375,h:667,dpr:2},{n:'iPhone 13/14',w:390,h:844,dpr:3},{n:'iPhone 15 Pro',w:393,h:852,dpr:3},
{n:'iPhone 15 Pro Max',w:430,h:932,dpr:3},{n:'Pixel 7',w:412,h:915,dpr:2.6},{n:'Galaxy S',w:360,h:800,dpr:3},
{n:'iPhone mini',w:360,h:780,dpr:3},{n:'iPad mini',w:768,h:1024,dpr:2}
];
function mount(container){
container.innerHTML='<div class="pht"><div class="pht__bar" data-bar></div>'
+'<div class="pht__stage"><div class="pht__phone" data-phone><div class="pht__notch"></div><div class="pht__screen" data-screen><iframe data-frame title="preview"></iframe></div></div></div>'
+'<div class="pht__cap" data-cap></div></div>';
var bar=container.querySelector('[data-bar]'), phone=container.querySelector('[data-phone]'),
screen=container.querySelector('[data-screen]'), frame=container.querySelector('[data-frame]'),
cap=container.querySelector('[data-cap]'), stage=container.querySelector('.pht__stage');
var idx=1, rot=false, url='/home';
bar.innerHTML=DEV.map(function(d,i){ return '<button class="pht__d'+(i===idx?' on':'')+'" data-i="'+i+'">'+d.n+'</button>'; }).join('')
+'<span class="pht__sp"></span><input class="pht__url" data-u value="/home" title="url à tester"><button class="pht__b" data-rot>⟳ rotation</button>';
function fit(){ var d=DEV[idx], w=rot?d.h:d.w, h=rot?d.w:d.h;
// zoom pour tenir dans le stage
var sr=stage.getBoundingClientRect(), scale=Math.min(1,(sr.width-56)/w,(sr.height-56)/h);
screen.style.width=w+'px'; screen.style.height=h+'px'; frame.style.width=w+'px'; frame.style.height=h+'px';
phone.style.transform='scale('+scale.toFixed(3)+')'; phone.style.transformOrigin='center center';
cap.textContent=d.n+' · '+w+'×'+h+' · dpr '+d.dpr+' · zoom '+(scale*100|0)+'%'; }
function load(){ try{ frame.src=url; }catch(e){} }
bar.addEventListener('click',function(e){ var b=e.target.closest('[data-i]'); if(b){ idx=+b.getAttribute('data-i');
bar.querySelectorAll('[data-i]').forEach(function(x){x.classList.toggle('on',x===b);}); fit(); return; }
if(e.target.closest('[data-rot]')){ rot=!rot; fit(); } });
bar.querySelector('[data-u]').addEventListener('change',function(e){ url=e.target.value||'/home'; load(); });
var ro; try{ ro=new ResizeObserver(fit); ro.observe(stage); }catch(e){}
load(); fit(); setTimeout(fit,80);
return { unmount:function(){ try{ro.disconnect();}catch(e){} container.innerHTML=''; } };
}
window.jOSApps=window.jOSApps||{}; window.jOSApps['phone-test']={manifest:{id:'phone-test',name:'Test téléphone',icon:'📱'},mount:mount};
})();
</script>