From d0c9ad9cb6ac2f6c5d48e79f64d63571319b6c37 Mon Sep 17 00:00:00 2001 From: cloudion Date: Wed, 11 Nov 2026 00:14:07 +0000 Subject: [PATCH] synchro du labo (e0e8bc8a) : app.blade.php, README.md --- README.md | 2 +- app.blade.php | 150 +++++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 131 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 4902129..dc94d0c 100644 --- a/README.md +++ b/README.md @@ -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 `9bfd7520`) : 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 `e0e8bc8a`) : 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 f2509ef..73bf491 100644 --- a/app.blade.php +++ b/app.blade.php @@ -96,35 +96,39 @@ .atl__tool:hover{border-color:var(--xr-accent,#3fe0d0)} .atl__tool:active{transform:scale(.96)} .atl__status{font-size:.68rem;opacity:.65;flex:1 1 130px;min-width:130px;text-align:right} - .atl__ed{display:flex;border:1px solid var(--xr-border,#22324f);border-radius:11px;background:#060a12;overflow:auto;max-height:52vh;margin:0 0 8px} + .atl__ed{display:flex;flex:1 1 auto;min-height:0;height:100%;border:1px solid var(--xr-border,#22324f);border-radius:11px;background:#060a12;overflow:auto;margin:0 0 8px} .atl__gut{flex:0 0 auto;padding:10px 6px 10px 10px;font:12.5px/1.55 ui-monospace,monospace;color:#3f5570;text-align:right;user-select:none;white-space:pre;border-right:1px solid var(--xr-border,#22324f);position:sticky;left:0;background:#060a12} .atl__code{position:relative;flex:1 1 auto;min-width:0} .atl__hl,.atl__ta{margin:0;padding:10px 14px 10px 10px;font:12.5px/1.55 ui-monospace,monospace;white-space:pre;min-height:180px;min-width:100%;width:max-content;display:block} .atl__hl{color:#dbe7f5;pointer-events:none} .atl__ta{position:absolute;inset:0;width:100%;height:100%;background:transparent;color:transparent;caret-color:var(--xr-accent,#3fe0d0);border:0;outline:none;resize:none;overflow:hidden;white-space:pre;word-break:normal} .atl__h-c{color:#6a7a95}.atl__h-s{color:#9df3c8}.atl__h-k{color:#c9aaff}.atl__h-n{color:#ffcf6a}.atl__h-j{color:#3fe0d0;font-weight:600} - @media (max-width:699px){ .atl__gut,.atl__hl,.atl__ta{font-size:16px;line-height:1.5} .atl__ed{max-height:44vh} } + @media (max-width:699px){ .atl__gut,.atl__hl,.atl__ta{font-size:16px;line-height:1.5} .atl__ed{min-height:320px} } .atl__find{display:none;gap:6px;margin:0 0 8px} .atl__find.on{display:flex} .atl__find input{flex:1} .atl__log{font:11.5px/1.5 ui-monospace,monospace;max-height:120px;overflow-y:auto;margin:0 0 8px} .atl__log div{padding:2px 0;border-bottom:1px dashed rgba(255,255,255,.06)} .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{width:100%;height:100%;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__b>.atl__workbench{width:100%;max-width:none;margin-left:0;margin-right:0} + .atl__workbench{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:10px;align-items:stretch;min-height:calc(100vh - 190px)} + .atl__pane{min-width:0;min-height:0;display:flex;flex-direction:column} .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{display:flex;justify-content:center;align-items:flex-start;flex:1 1 auto;min-height:420px;padding:10px;background:rgba(255,255,255,.025);border:1px solid var(--xr-border,#22324f);border-radius:11px;overflow:auto} + .atl__viewport .atl__fw{display:flex;flex:1 1 auto;min-width:0;min-height:0;width:100%;height:100%} + .atl__viewport .atl__frame{flex:1 1 auto;min-width:0;min-height:0;margin:0} + .atl__viewport[data-device="phone"] .atl__fw{flex:0 0 390px;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__viewport[data-device="tablet"] .atl__fw{flex:0 0 768px;width:768px;height:620px} + .atl__viewport[data-device="watch"] .atl__fw{flex:0 0 240px;width:240px;height:300px} + .atl__viewport[data-device="watch"] .atl__frame{border-radius:32px} + .atl__viewport[data-device="xer"] .atl__fw{flex:0 0 520px;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} @@ -136,7 +140,7 @@ .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}} + @media (max-width:999px){.atl__workbench{grid-template-columns:1fr;min-height:0}.atl__ed{min-height:420px}.atl__viewport{min-height:420px}.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} @@ -336,21 +340,96 @@ } var root = document.getElementById('root'); var handle = null; var threw = null; try { handle = app.mount(root, { id: id }); } catch (e) { threw = e; } + var uiMode = false, selected = null, selectionBox = null, editState = null; + function selectorFor(el) { + if (el.id) return '#' + el.id; + var c = (el.className || '').toString().split(/\s+/).filter(Boolean)[0]; + return c ? '.' + c : el.tagName.toLowerCase(); + } 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 || '', + selector: selectorFor(el), 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) } }); } + function drawSelection() { + if (!selectionBox || !selected) return; + var r = selected.getBoundingClientRect(), x = r.left + window.scrollX, y = r.top + window.scrollY; + selectionBox.style.left = Math.round(x) + 'px'; selectionBox.style.top = Math.round(y) + 'px'; + selectionBox.style.width = Math.max(1, Math.round(r.width)) + 'px'; selectionBox.style.height = Math.max(1, Math.round(r.height)) + 'px'; + } + function select(el) { + if (!el || el === root || !root.contains(el)) return; + selected = el; + if (!selectionBox) { + selectionBox = document.createElement('div'); + selectionBox.style.cssText = 'position:absolute;z-index:2147483646;border:1px solid #3fe0d0;box-shadow:0 0 0 1px rgba(0,0,0,.7);pointer-events:none;display:none'; + ['nw', 'ne', 'sw', 'se'].forEach(function (name) { + var h = document.createElement('i'); + h.dataset.handle = name; + h.style.cssText = 'position:absolute;width:9px;height:9px;background:#3fe0d0;border:1px solid #061016;border-radius:2px;pointer-events:auto'; + if (name.indexOf('n') >= 0) h.style.top = '-5px'; else h.style.bottom = '-5px'; + if (name.indexOf('w') >= 0) h.style.left = '-5px'; else h.style.right = '-5px'; + h.addEventListener('pointerdown', function (e) { e.preventDefault(); e.stopPropagation(); startEdit('resize', name, e); }); + selectionBox.appendChild(h); + }); + document.body.appendChild(selectionBox); + } + selectionBox.style.display = uiMode ? 'block' : 'none'; drawSelection(); inspect(el, 'sélection'); + } + function startEdit(kind, handle, ev) { + if (!uiMode || !selected) return; + var r = selected.getBoundingClientRect(), startX = ev.clientX, startY = ev.clientY; + editState = { kind: kind, handle: handle, x: startX, y: startY, width: r.width, height: r.height, transform: selected.style.transform || '', moved: false }; + function move(e) { + var dx = e.clientX - editState.x, dy = e.clientY - editState.y, w = editState.width, h = editState.height; + if (Math.abs(dx) > 2 || Math.abs(dy) > 2) editState.moved = true; + if (kind === 'resize') { + if (handle.indexOf('e') >= 0) w = Math.max(1, editState.width + dx); + if (handle.indexOf('w') >= 0) w = Math.max(1, editState.width - dx); + if (handle.indexOf('s') >= 0) h = Math.max(1, editState.height + dy); + if (handle.indexOf('n') >= 0) h = Math.max(1, editState.height - dy); + selected.style.width = Math.round(w) + 'px'; selected.style.minHeight = Math.round(h) + 'px'; + } else { + selected.style.transform = (editState.transform ? editState.transform + ' ' : '') + 'translate(' + Math.round(dx) + 'px,' + Math.round(dy) + 'px)'; + } + drawSelection(); + } + function up() { + document.removeEventListener('pointermove', move); document.removeEventListener('pointerup', up); + if (!editState.moved) { editState = null; return; } + var rr = selected.getBoundingClientRect(); + post({ xbAtl: 1, t: 'ui-change', selector: selectorFor(selected), width: Math.round(rr.width), height: Math.round(rr.height), + dx: kind === 'move' ? Math.round(ev.clientX - editState.x) : 0, dy: kind === 'move' ? Math.round(ev.clientY - editState.y) : 0 }); + editState = null; + } + document.addEventListener('pointermove', move); document.addEventListener('pointerup', up); + } + window.addEventListener('message', function (e) { + if (!e.data || e.data.xbAtl !== 1 || e.data.t !== 'uiMode') return; + uiMode = !!e.data.on; + if (selectionBox) selectionBox.style.display = uiMode && selected ? 'block' : 'none'; + }); 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'); + if (e.target && e.target.closest) { + var el = e.target.closest('*'); + if (uiMode) { e.preventDefault(); e.stopPropagation(); select(el); } + else inspect(el, 'sélection'); + } }, true); + root.addEventListener('pointerdown', function (e) { + if (!uiMode || !selected || !selected.contains(e.target)) return; + e.preventDefault(); e.stopPropagation(); startEdit('move', '', e); + }, true); + window.addEventListener('resize', drawSelection); + window.addEventListener('scroll', drawSelection, 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, @@ -765,6 +844,7 @@ function renderInspect(info) { var box = $('[data-inspect]'), tools = $('[data-inspecttools]'); if (!box || !info) return; + if (info.event === 'survol' && st.inspect) 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 + '>') + '' + @@ -778,25 +858,48 @@ } 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 (st.dead || !e.data || e.data.xbAtl !== 1) return; if (frame.contentWindow && e.source !== frame.contentWindow) return; - renderInspect(e.data); + var d = e.data; + if (d.t === 'inspect') { renderInspect(d); return; } + if (d.t === 'mounted') { + var ps = $('[data-preview-status]'); + if (ps) ps.textContent = d.ok ? '✓ monté · ' + (d.rendered || 0) + ' caractères rendus' : '✕ montage incomplet'; + if (d.ok) log('ok', 'preview montée' + (d.id ? ' · ' + d.id : '') + (d.unmount ? ' · unmount() présent' : '')); + else log('err', 'preview : ' + (d.msg || 'le ploxion ne se monte pas')); + return; + } + if (d.t === 'err') { log('err', 'preview : ' + (d.msg || 'erreur JavaScript')); return; } + if (d.t === 'bus') { + var payload = ''; try { payload = d.payload == null ? '' : ' · ' + JSON.stringify(d.payload); } catch (ignore) { payload = ' · payload non sérialisable'; } + log('bus', d.topic + payload); return; + } + if (d.t === 'toast') { toast(d.msg || ''); return; } + if (d.t === 'ui-change') { applyUiOverride(d.selector, d.width, d.height, d.dx, d.dy); return; } }; window.addEventListener('message', st.messageHandler); function selectorFor(info) { + if (info.selector) return info.selector; if (info.id) return '#' + info.id; var first = (info.classes || '').split(/\s+/).filter(Boolean)[0]; return first ? '.' + first : info.tag; } + function applyUiOverride(selector, width, height, dx, dy) { + width = Number(width); height = Number(height); dx = Number(dx) || 0; dy = Number(dy) || 0; + if (!selector || !Number.isInteger(width) || !Number.isInteger(height) || width < 1 || width > 2400 || height < 1 || height > 1600) { + log('err', 'taille UI invalide (1–2400 × 1–1600 px)'); return; + } + var move = dx || dy ? ' transform: translate(' + Math.round(dx) + 'px, ' + Math.round(dy) + 'px);' : ''; + var css = ''; + st.src = st.src.replace(/'; - st.src = st.src.replace(/