From 1dff0123fb4bd141d046cabc24cf8e50eaaee27a Mon Sep 17 00:00:00 2001 From: cloudion Date: Wed, 11 Nov 2026 00:05:54 +0000 Subject: [PATCH] synchro du labo (9bfd7520) : app.blade.php, README.md --- README.md | 4 +- app.blade.php | 249 ++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 242 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index f6315b4..4902129 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ La porte de contribution : prends un ploxion, modifie-le dans le xer, vois-le to | --- | --- | | id | `atelier` | | fournit | `contribution` `atelier` `dev` | -| bions qu'il nomme | `jOSApi` `jOSApiDriver` `jOSAppareil` `jOSApps` `jOSBoxion` `jOSCarte` `jOSCommandes` `jOSForge` `jOSGame` `jOSKion` `jOSMobile` `jOSPlug` `jOSPorts` `jOSQR` `jOSRepoverse` `jOSStore` `jOSSwipe` `jOSTsoin` | +| bions qu'il nomme | `jOSApi` `jOSApiDriver` `jOSAppareil` `jOSApps` `jOSBoxion` `jOSCarte` `jOSCommandes` `jOSForge` `jOSGame` `jOSKion` `jOSMobile` `jOSPlug` `jOSPorts` `jOSQR` `jOSRepoverse` `jOSStore` `jOSSwipe` `jOSTsoin` `jOSXerVues` `jOSXui` | | fichiers | `app.blade.php` | | dans le labo | `resources/views/ploxions/atelier/` (dépôt `my_website2`) | @@ -16,6 +16,6 @@ La porte de contribution : prends un ploxion, modifie-le dans le xer, vois-le to - **Dans VS Code** : `xb prendre atelier` (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. +Ce dépôt est un **miroir** du labo (synchronisé par `bin/ploxions-forge.mjs`, depuis le commit `9bfd7520`) : une modif se propose par un tsoin ou une branche du labo, pas directement ici. © 2026 chill-tekk · ne pas nuire diff --git a/app.blade.php b/app.blade.php index 37397fc..f2509ef 100644 --- a/app.blade.php +++ b/app.blade.php @@ -112,6 +112,31 @@ .atl__log .err{color:#ff9d9d}.atl__log .bus{color:#9df3c8}.atl__log .inf{opacity:.6} .atl__frame{width:100%;height:280px;border:1px solid var(--xr-border,#22324f);border-radius:11px;background:#0a0f18;display:none} .atl__frame.on{display:block} + .atl__modebar{display:flex;align-items:center;gap:6px;flex-wrap:wrap;margin:0 0 8px} + .atl__mode{padding:7px 11px;border:1px solid var(--xr-border,#22324f);border-radius:9px;background:transparent;color:inherit;font-size:.72rem;font-weight:700;cursor:pointer} + .atl__mode.on{border-color:var(--xr-accent,#3fe0d0);color:var(--xr-accent,#3fe0d0);background:rgba(63,224,208,.08)} + .atl__device{margin-left:auto;padding:7px 9px;border:1px solid var(--xr-border,#22324f);border-radius:9px;background:var(--xr-bg,#070b12);color:inherit;font:inherit;font-size:.72rem} + .atl__workbench{display:grid;grid-template-columns:minmax(0,1fr) minmax(320px,1fr);gap:10px;align-items:start} + .atl__pane{min-width:0} + .atl__pane-title{display:flex;align-items:center;justify-content:space-between;gap:8px;margin:0 0 6px;font-size:.68rem;text-transform:uppercase;letter-spacing:.07em;color:var(--xr-accent,#3fe0d0)} + .atl__viewport{display:flex;justify-content:center;align-items:flex-start;min-height:300px;padding:10px;background:rgba(255,255,255,.025);border:1px solid var(--xr-border,#22324f);border-radius:11px;overflow:auto} + .atl__viewport .atl__frame{flex:0 0 auto;min-width:0;margin:0} + .atl__viewport[data-device="phone"] .atl__frame{width:390px;height:690px} + .atl__viewport[data-device="tablet"] .atl__frame{width:768px;height:620px} + .atl__viewport[data-device="watch"] .atl__frame{width:240px;height:300px;border-radius:32px} + .atl__viewport[data-device="xer"] .atl__frame{width:520px;height:420px} + .atl__inspect{margin-top:7px;padding:9px;border:1px solid var(--xr-border,#22324f);border-radius:10px;background:rgba(255,255,255,.025);font:.7rem/1.45 var(--xr-font-mono,ui-monospace,monospace);min-height:48px} + .atl__inspect b{color:var(--xr-accent,#3fe0d0)} + .atl__inspect small{display:block;color:var(--xr-muted,#7f93c8);margin-top:3px} + .atl__inspecttools{display:flex;gap:6px;align-items:center;flex-wrap:wrap;margin-top:8px} + .atl__inspecttools input{width:76px;padding:5px 6px;border:1px solid var(--xr-border,#22324f);border-radius:7px;background:var(--xr-bg,#070b12);color:inherit;font:inherit} + .atl__inspecttools button{padding:5px 8px;border:1px solid var(--xr-accent,#3fe0d0);border-radius:7px;background:transparent;color:var(--xr-accent,#3fe0d0);font:inherit;cursor:pointer} + .atl__mode-test .atl__codepane{display:none} + .atl__mode-test .atl__previewpane{grid-column:1/-1} + .atl__mode-test .atl__viewport{min-height:520px} + .atl__mode-ui .atl__inspect{display:block} + .atl__mode-code .atl__inspect{opacity:.55} + @media (max-width:999px){.atl__workbench{grid-template-columns:1fr}.atl__mode-test .atl__previewpane{grid-column:auto}} .atl__fw{position:relative} .atl__fw.full{position:fixed;inset:0;z-index:9999;background:#0a0f18;padding:0;max-width:none} .atl__fw.full .atl__frame{height:100%;border:0;border-radius:0} @@ -295,7 +320,8 @@ ['jOSChart', 'jOSSound', 'jOSPlayer', 'jOSKion', 'jOSMobile', 'jOSMap', 'jOSSwipe', 'jOSApi', 'jOSApiDriver', 'jOSRepoverse', 'jOSPlug', 'jOSForge', 'jOSTsoin', 'jOSQR', 'jOSui', 'jOSSensor', 'jOSCarte', 'jOSSDK'].forEach(function (n) { window[n] = perm(); }); window.fetch = function () { return Promise.resolve({ ok: true, status: 200, headers: { get: function () { return null; } }, json: function () { return Promise.resolve({}); }, text: function () { return Promise.resolve(''); }, blob: function () { return Promise.resolve(new Blob()); }, clone: function () { return this; } }); }; - window.requestAnimationFrame = function () { return 1; }; + // (07.11) l'animation réelle : un ploxion qui dessine image par image (une fractale, un jeu) doit se voir tourner dans l'aperçu ; + // l'iframe est isolée (sandbox sans même-origine) et rendue invisible = le navigateur la ralentit lui-même // --- exécute le code du brouillon (celui de l'utilisateur LUI-MÊME — self-XSS ok) --- var okRun = true; try { (0, eval)(window.__ATL_CODE__); } @@ -310,11 +336,29 @@ } var root = document.getElementById('root'); var handle = null; var threw = null; try { handle = app.mount(root, { id: id }); } catch (e) { threw = e; } + function inspect(el, eventName) { + if (!el || el === root || !root.contains(el)) return; + var r = el.getBoundingClientRect(), attrs = {}; + Array.prototype.forEach.call(el.attributes || [], function (a) { attrs[a.name] = a.value; }); + post({ xbAtl: 1, t: 'inspect', event: eventName, tag: el.tagName.toLowerCase(), id: el.id || '', + classes: el.className && typeof el.className === 'string' ? el.className : '', + attrs: attrs, text: (el.textContent || '').trim().slice(0, 120), + rect: { x: Math.round(r.x), y: Math.round(r.y), width: Math.round(r.width), height: Math.round(r.height) } }); + } + root.addEventListener('mouseover', function (e) { + if (e.target && e.target.closest) inspect(e.target.closest('*'), 'survol'); + }, true); + root.addEventListener('click', function (e) { + if (e.target && e.target.closest) inspect(e.target.closest('*'), 'sélection'); + }, true); setTimeout(function () { var rendered = (root.innerHTML || '').replace(/\s+/g, '').length; post({ xbAtl: 1, t: 'mounted', ok: !threw && rendered > 0 && !errors.length, id: id, rendered: rendered, unmount: !!(handle && typeof handle.unmount === 'function'), msg: threw ? ('mount() a levé : ' + threw.message) : (rendered ? '' : 'rien n\'est rendu') }); + // (07.11) la vue xerploxion : le describe() part au parent (puis toutes les 2 s : l'état vivant), dessiné sur tous les écrans des xers + var envoyerXui = function () { var x = null, er = ''; try { x = typeof app.describe === 'function' ? app.describe() : null; } catch (e) { er = e.message; } try { post({ xbAtl: 1, t: 'xui', xui: x ? JSON.parse(JSON.stringify(x)) : null, err: er }); } catch (e2) { post({ xbAtl: 1, t: 'xui', xui: null, err: 'describe() pas sérialisable : ' + e2.message }); } }; + envoyerXui(); setInterval(envoyerXui, 2000); }, 150); } @@ -356,7 +400,8 @@ ck('warn', /unmount\s*[:=]/.test(src), 'unmount présent (le droit au silence)', 'retourne { unmount } depuis mount()'); var inner = src.indexOf('innerHTML') >= 0; ck('warn', !inner || /\besc\s*\(|jOSb\.esc|textContent/.test(src), 'esc() sur le HTML (la muraille XSS)', 'innerHTML sans esc() repéré — toute donnée passe par jOSb.esc()'); - ck('warn', /describe\s*[:=]/.test(src), 'describe() XUI', 'décrit en p1–p5, le ploxion s\'affiche sur toutes les surfaces'); + // (07.11) RS-7 : « la vue xerploxion, il faut l'implémenter tout le temps » : sans describe(), le ploxion n'existe sur aucun xer + ck('ko', /describe\s*[:=]/.test(src), 'describe() XUI (la vue xerploxion)', 'obligatoire : décrit en p1–p5, le ploxion s\'affiche sur tous les xers (32×32 d\'un cubion, montre, HUD, bureau)'); return out; } function checksLight(list) { @@ -401,7 +446,8 @@ // ================= le ploxion ================= function mount(container, ctx) { var st = { view: 'pick', id: null, meta: null, src: '', orig: '', note: '', dirty: false, savedAt: '', - hist: [], q: '', queue: null, admin: false, detail: null, sent: null, dead: false, full: false }; + hist: [], q: '', queue: null, admin: false, detail: null, sent: null, dead: false, full: false, + mode: 'code', device: 'desktop', inspect: null }; var busLog; container.innerHTML = @@ -411,6 +457,7 @@ '' + '' + '' + + '' + '' + '
'; @@ -430,8 +477,37 @@ } // ---------- navigation ---------- + // ---- ⇄ LA BOÎTE : ce qu'on m'a partagé (07.11 ; RS-7 : « partager mon atelier sur epsylaeu » ; AtelierPartageController) ---- + function renderRecus() { + if (!st.recus) { jget('/atelier/recus').then(function (j) { st.recus = j.recus || []; if (!st.dead && st.view === 'recus') render(); }).catch(function () { st.recus = []; if (!st.dead && st.view === 'recus') render(); }); return '
chargement de ta boîte…
'; } + var h = '
⇄ reçus les brouillons qu\'on t\'a partagés : vois-les tourner, prends-les dans ton établi, renvoie ton tsoin
'; + if (!st.recus.length) return h + '
rien encore. Dans l\'établi, « ⇄ partager » envoie ton brouillon à un ami.
'; + st.recus.forEach(function (x) { + h += '
' + esc(x.ploxion) + ' ' + esc(x.nom_de) + ' ' + esc(String(x.lignes || '')) + ' lignes ' + esc((x.at || '').slice(0, 16).replace('T', ' ')) + '' + + (x.note ? '
« ' + esc(x.note) + ' »
' : '') + + '
' + + '
'; + }); + return h; + } + function wireRecus() { + container.querySelectorAll('[data-rapercu]').forEach(function (b) { b.addEventListener('click', function () { + var u = b.getAttribute('data-rapercu'), fr = container.querySelector('[data-rframe="' + u + '"]'); + jget('/atelier/recus/' + encodeURIComponent(u)).then(function (x) { fr.classList.add('on'); fr.srcdoc = frameHtml(x.source || '', { id: x.ploxion }); }); + }); }); + container.querySelectorAll('[data-rprendre]').forEach(function (b) { b.addEventListener('click', function () { + var u = b.getAttribute('data-rprendre'); b.disabled = true; b.textContent = '…'; + jget('/atelier/recus/' + encodeURIComponent(u)).then(function (x) { + return jpost('/atelier/draft/' + encodeURIComponent(x.ploxion), { source: x.source, note: 'partagé par ' + x.nom_de }).then(function () { take(x.ploxion); }); + }).catch(function (e) { b.disabled = false; b.textContent = '✕ ' + (e.message || e); }); + }); }); + container.querySelectorAll('[data-roublier]').forEach(function (b) { b.addEventListener('click', function () { + jpost('/atelier/recus/' + encodeURIComponent(b.getAttribute('data-roublier')) + '/oublier', {}).then(function () { st.recus = null; render(); }); + }); }); + } function setTab(v) { st.view = v; st.detail = null; + if (v === 'recus') st.recus = null; if (v === 'queue' && !st.queue) refreshQueue(); render(); } @@ -568,16 +644,29 @@ '' + '' + '' + + '' + '' + '' + (st.savedAt ? '💾 brouillon du ' + esc(st.savedAt.slice(0, 16).replace('T', ' ')) : 'pas encore de brouillon') + '' + ''; h += '
'; - h += '
' +
+      h += '
' + + '' + + '' + + '' + + '' + + '
'; + h += '
' + + '
code sourceédition directe
' + + '
' +
         '
' + - '
'; + '
' + + '
aperçu vivanten attente
' + + '
' + + '
InspectionSurvole ou clique un élément dans l’aperçu en mode UI pour retrouver son tag, ses attributs, sa taille et sa ligne probable.
' + + '
'; h += '
'; - h += '
' + - '
'; + // (07.11) RS-7 : « il faut pouvoir voir toutes les vues dans l'atelier, et surtout sur les xers qu'on va mettre dans les cubions » + h += '
◫ les vues le describe() sur les écrans des xers (jOSXerVues) ; ▶ voir tourner pour les remplir
▶ voir tourner : chaque écran montre ce que ton ploxion y dit
'; h += '
✅ les checks (verify-lite)
'; h += '
' + '⧗ envoyer le tsoin' + @@ -593,10 +682,51 @@ function wireEdit() { var ta = $('[data-ta]'), pre = $('[data-hl]'), gut = $('[data-gut]'), frame = $('[data-frame]'); + // ◫ les vues : le describe() que l'aperçu renvoie, dessiné sur chaque écran de xer + var vuesEl = $('[data-vues]'), vues = null; + if (st._onMsg) window.removeEventListener('message', st._onMsg); + st._onMsg = function (ev) { + if (!frame || ev.source !== frame.contentWindow) return; + var d = ev.data; if (!d || !d.xbAtl || d.t !== 'xui' || !vuesEl) return; + if (!d.xui) { vues = null; vuesEl.innerHTML = '✕ pas de vue xerploxion : ' + esc(d.err || 'ce ploxion n\'a pas de describe()') + '. Sans lui, il n\'existe sur aucun xer (le 32×32 d\'un cubion, la montre, le HUD). Ajoute describe: function () { return { v: 1, id, title, icon, items: [{ p: 1, kind: \'stat\', label, value }] }; }'; return; } + if (!window.jOSXerVues) { vuesEl.textContent = 'le bion jOSXerVues manque ici'; return; } + st._xui = d.xui; + if (!vues) { vuesEl.innerHTML = '
'; vues = window.jOSXerVues.galerie(vuesEl.querySelector('[data-vg]'), d.xui); vuesEl.querySelector('[data-montre]').onclick = surMontre; } + else vues.maj(d.xui); + }; + // ⌚ épingler ce ploxion sur la montre (XuiMontreController) : le XUI compact, que l'app Connect IQ lit avec la clé du compte + function compacter(x) { + try { if (window.jOSXui && window.jOSXui.compact) return window.jOSXui.compact(x); } catch (e) {} + return [x.id, x.title || x.id, (x.items || []).map(function (it) { return [it.p || 3, it.kind || 'stat', it.label || '', it.value == null ? '' : it.value, it.unit || '']; })]; + } + function surMontre() { + var et = vuesEl.querySelector('[data-montre-etat]'); if (!st._xui) return; + var csrf = (document.querySelector('meta[name=csrf-token]') || {}).content || ''; + fetch('/xui/montre', { method: 'POST', credentials: 'same-origin', headers: { 'Content-Type': 'application/json', Accept: 'application/json', 'X-CSRF-TOKEN': csrf }, body: JSON.stringify({ id: st.id, xuic: compacter(st._xui) }) }) + .then(function (r) { return r.json().catch(function () { return { ok: false, erreur: 'HTTP ' + r.status }; }); }) + .then(function (j) { if (et) et.innerHTML = j.ok ? '✓ sur ta montre (' + esc(j.epingles.join(', ')) + ') · clé de la montre : ' + esc(j.cle) + ' (à mettre dans Garmin Connect › l\'app xer › réglages)' : '✕ ' + esc(j.erreur || 'refusé'); }) + .catch(function (e) { if (et) et.textContent = '✕ ' + e.message; }); + } + window.addEventListener('message', st._onMsg); var logEl = $('[data-log]'), statusEl = $('[data-status]'); if (!ta) return; busLog = []; ta.value = st.src; + var viewport = $('[data-viewport]'), device = $('[data-device]'); + if (viewport) viewport.setAttribute('data-device', st.device || 'desktop'); + if (device) { + device.value = st.device || 'desktop'; + device.addEventListener('change', function () { + st.device = device.value; + if (viewport) viewport.setAttribute('data-device', st.device); + }); + } + container.querySelectorAll('[data-mode]').forEach(function (b) { + b.addEventListener('click', function () { + st.mode = b.getAttribute('data-mode') || 'code'; + render(); + }); + }); function paint() { pre.innerHTML = hl(ta.value) + '\n'; @@ -615,6 +745,59 @@ logEl.scrollTop = logEl.scrollHeight; } st._log = log; + function sourceLine(info) { + var lines = st.src.split('\n'), needles = []; + if (info.id) needles.push('id="' + info.id + '"', "id='" + info.id + "'"); + (info.classes || '').split(/\s+/).filter(Boolean).slice(0, 3).forEach(function (c) { + needles.push('.' + c, 'class="' + c, 'class=\'' + c); + }); + Object.keys(info.attrs || {}).forEach(function (k) { + if (k.indexOf('data-') === 0) needles.push(k); + }); + needles.push('<' + info.tag); + var best = { line: 0, score: -1 }; + lines.forEach(function (line, i) { + var score = needles.reduce(function (n, needle) { return n + (line.indexOf(needle) >= 0 ? 1 : 0); }, 0); + if (score > best.score) best = { line: i + 1, score: score }; + }); + return best.score > 0 ? best.line : null; + } + function renderInspect(info) { + var box = $('[data-inspect]'), tools = $('[data-inspecttools]'); + if (!box || !info) return; + var attrs = Object.keys(info.attrs || {}).map(function (k) { return k + (info.attrs[k] ? '="' + info.attrs[k] + '"' : ''); }).join(' '); + var line = sourceLine(info); + box.innerHTML = '' + esc((info.event === 'survol' ? 'Survol' : 'Sélection') + ' · <' + info.tag + '>') + '' + + '' + esc((info.classes ? '.' + info.classes : '') + (info.id ? ' #' + info.id : '') + ' · ' + (info.rect ? info.rect.width + ' × ' + info.rect.height + ' px' : 'taille inconnue')) + + (line ? ' · ligne probable ' + line : ' · ligne non déterminée') + '
' + esc(attrs || 'aucun attribut') + '
'; + if (tools) tools.style.display = 'flex'; + var wi = $('[data-ui-width]'), hi = $('[data-ui-height]'); + if (wi) wi.value = info.rect && info.rect.width || ''; + if (hi) hi.value = info.rect && info.rect.height || ''; + st.inspect = info; + } + if (st.messageHandler) window.removeEventListener('message', st.messageHandler); + st.messageHandler = function (e) { + if (st.dead || !e.data || e.data.xbAtl !== 1 || e.data.t !== 'inspect') return; + if (frame.contentWindow && e.source !== frame.contentWindow) return; + renderInspect(e.data); + }; + window.addEventListener('message', st.messageHandler); + function selectorFor(info) { + if (info.id) return '#' + info.id; + var first = (info.classes || '').split(/\s+/).filter(Boolean)[0]; + return first ? '.' + first : info.tag; + } + var applySize = $('[data-apply-size]'); + if (applySize) applySize.addEventListener('click', function () { + if (!st.inspect) return; + var w = parseInt(($('[data-ui-width]') || {}).value, 10), h = parseInt(($('[data-ui-height]') || {}).value, 10); + if (!w || !h || w > 2400 || h > 1600) { log('err', 'taille invalide (1–2400 × 1–1600 px)'); return; } + var css = ''; + st.src = st.src.replace(/