synchro du labo (0bf0da65) : app.blade.php, README.md
This commit is contained in:
475
app.blade.php
Normal file
475
app.blade.php
Normal file
@@ -0,0 +1,475 @@
|
||||
{{-- PL0XION wormion — le WORMION = des RONDS dans des RONDS (RS-7 : « le wormion il
|
||||
lui faut un ploxion », pendant du `portion`). Superposition & observation, n^π.
|
||||
Zoom infini à la molette + 4 MODES : concentrique · spirale (le mandala du cahier
|
||||
rs-flay p.33) · sphère (ronds-dans-ronds en 3D = spherion) · tunnel (wormhole).
|
||||
100% canvas. window.jOSApps['wormion']. mount(c, ctx) -> { unmount }.
|
||||
LOT BUREAU v2 (25.09.2026, docs/dev/33-bureau-v2-et-zones.md) : le wormion devient le NAVIGATEUR des flux — « percevoir, utiliser »
|
||||
(papiers 26/27 : wormion = continu, anti-gravité, la perception, « plonger sans fin »). Un vrai flux en ANNEAUX qu'on traverse en
|
||||
zoomant (molette en avant = on avance ; l'anneau qu'on traverse = le présent, en ambre) :
|
||||
bureau:<wormion> ce que la zone a vu passer (les moments) bureau:<fichier> le fichier en immersion
|
||||
bureau:<portion> ce qu'elle contient bureau tout ce que les wormions ont vu
|
||||
fichier:<chemin> un fichier de jOSFiles en immersion vu:<wormion>:<i> un moment vu, en immersion
|
||||
tsoin:<id> les événements d'un tsoin
|
||||
Immersion : une image = des anneaux d'elle-même (zoom infini, Droste) ; une vidéo / un son = ses tranches de temps ; un texte =
|
||||
ses paragraphes ; le reste s'ouvre dans le bon ploxion. Sans scope : les 4 modes d'avant, à l'identique (+ un bouton « ◎ flux »).
|
||||
Kill-switch : localStorage xb:wormion.nav = off (ou xb:bureau-v2 = off, tout le bureau v2) → seulement les modes d'avant. 0 rAF permanent : transform + transitions CSS. --}}
|
||||
<style>
|
||||
.wm { position:relative; height:100%; background:#04060c; overflow:hidden; cursor:zoom-in; font-family:ui-sans-serif,system-ui,sans-serif; }
|
||||
.wm canvas { display:block; width:100%; height:100%; touch-action:none; }
|
||||
.wm__bar { position:absolute; left:10px; top:9px; display:flex; gap:5px; flex-wrap:wrap; }
|
||||
.wm__m { cursor:pointer; font-size:.66rem; padding:3px 9px; border-radius:7px; border:1px solid rgba(150,140,255,.35);
|
||||
background:rgba(16,14,32,.7); color:rgba(200,190,255,.9); font-family:inherit; }
|
||||
.wm__m.on { background:rgba(95,70,190,.55); color:#fff; border-color:rgba(185,165,255,.8); }
|
||||
.wm__hud { position:absolute; right:10px; top:9px; font-size:.7rem; color:rgba(195,185,255,.85); font-family:ui-monospace,monospace; background:rgba(10,8,22,.6); padding:3px 8px; border-radius:7px; pointer-events:none; }
|
||||
.wm__hint { position:absolute; right:10px; bottom:9px; font-size:.62rem; color:rgba(180,170,220,.6); background:rgba(10,8,22,.6); padding:3px 8px; border-radius:7px; pointer-events:none; }
|
||||
|
||||
/* ── le navigateur des flux (bureau v2) : le vide, des anneaux, le présent en ambre, le passé bleu, le futur violet ── */
|
||||
.wf { position:absolute; inset:0; display:flex; flex-direction:column; background:radial-gradient(ellipse 70% 60% at 42% 50%, rgba(126,96,214,.06), transparent 70%), #010306; color:rgba(225,247,255,.92); font:400 .8rem/1.35 system-ui,-apple-system,"Segoe UI",sans-serif; overflow:hidden; }
|
||||
.wf *, .wf *::before { box-sizing:border-box; }
|
||||
.wf__attente { margin:auto; font:italic .9rem Georgia,serif; color:rgba(193,227,240,.5); }
|
||||
.wf__h { flex:0 0 auto; display:flex; flex-wrap:wrap; align-items:center; gap:8px 12px; padding:9px 12px 8px; border-bottom:1px solid rgba(158,223,245,.12); }
|
||||
.wf__fil { flex:1 1 200px; min-width:0; display:flex; flex-wrap:wrap; align-items:center; gap:2px 6px; font:600 .56rem/1.4 system-ui,sans-serif; letter-spacing:.2em; text-transform:uppercase; color:rgba(193,227,240,.45); }
|
||||
.wf__fil b { font:italic 500 .92rem/1.2 Georgia,"Times New Roman",serif; letter-spacing:0; text-transform:none; color:rgba(225,247,255,.95); }
|
||||
.wf__fil i { font-style:normal; opacity:.5; }
|
||||
.wf__outils { display:flex; gap:6px; flex-wrap:wrap; }
|
||||
.wf__outils button, .wf__actions button { border:1px solid rgba(158,223,245,.26); background:none; color:rgba(193,227,240,.85); border-radius:2px; font:600 .54rem/1 system-ui,sans-serif; letter-spacing:.18em; text-transform:uppercase; padding:6px 8px; cursor:pointer; white-space:nowrap; }
|
||||
.wf__outils button:hover, .wf__outils button:focus-visible, .wf__actions button:hover, .wf__actions button:focus-visible { border-color:#ffc46b; color:#ffc46b; outline:none; }
|
||||
.wf__corps { flex:1 1 auto; min-height:0; display:flex; }
|
||||
.wf__tunnel { position:relative; flex:1 1 auto; min-width:0; overflow:hidden; outline:none; cursor:zoom-in; touch-action:none; }
|
||||
.wf__tunnel:focus-visible { box-shadow:inset 0 0 0 1px rgba(255,196,107,.5); }
|
||||
.wf__tunnel svg { position:absolute; inset:0; width:100%; height:100%; overflow:visible; }
|
||||
.wf__g { transform-origin:0 0; transform-box:view-box; }
|
||||
.wf__g circle.anneau { fill:none; }
|
||||
.wf__g circle.anneau.passe { stroke:rgba(167,139,250,.35); }
|
||||
.wf__g circle.anneau.futur { stroke:rgba(111,159,216,.45); }
|
||||
.wf__g circle.anneau.present { stroke:#ffc46b; }
|
||||
.wf__g circle.cible { fill:transparent; stroke:transparent; cursor:pointer; pointer-events:stroke; }
|
||||
.wf__g text { fill:rgba(225,247,255,.75); font-family:system-ui,sans-serif; dominant-baseline:central; pointer-events:none; }
|
||||
.wf__g text.present { fill:#ffc46b; font-weight:600; }
|
||||
.wf__g text.t { fill:rgba(193,227,240,.45); font-family:ui-monospace,Menlo,monospace; }
|
||||
.wf__coeur { fill:rgba(255,196,107,.9); }
|
||||
.wf__panneau { flex:0 0 300px; max-width:46%; display:flex; flex-direction:column; gap:8px; padding:12px 14px; border-left:1px solid rgba(158,223,245,.1); overflow:auto; }
|
||||
.wf__apercu { position:relative; width:100%; aspect-ratio:4/3; display:flex; align-items:center; justify-content:center; border:1px solid rgba(158,223,245,.18); border-radius:2px; overflow:hidden; background:rgba(158,223,245,.03); color:rgba(158,223,245,.75); }
|
||||
.wf__apercu img, .wf__apercu video { max-width:100%; max-height:100%; display:block; }
|
||||
.wf__apercu audio { width:92%; }
|
||||
.wf__apercu svg { width:34%; height:auto; fill:none; stroke:currentColor; stroke-width:1; }
|
||||
.wf__apercu .glyphe { font-size:2.6rem; }
|
||||
.wf__apercu pre { margin:0; padding:10px; width:100%; height:100%; overflow:auto; white-space:pre-wrap; font:400 .74rem/1.5 Georgia,serif; color:rgba(225,247,255,.9); text-align:left; }
|
||||
.wf__nom { font:italic 500 1rem/1.25 Georgia,"Times New Roman",serif; color:#fff; overflow-wrap:anywhere; }
|
||||
.wf__dl { margin:0; display:grid; grid-template-columns:auto 1fr; gap:3px 10px; }
|
||||
.wf__dl dt { font:600 .5rem/1.7 system-ui,sans-serif; letter-spacing:.22em; text-transform:uppercase; color:rgba(193,227,240,.45); }
|
||||
.wf__dl dd { margin:0; font:500 .66rem/1.5 ui-monospace,Menlo,monospace; color:rgba(225,247,255,.88); overflow-wrap:anywhere; }
|
||||
.wf__dl dd.present { color:#ffc46b; }
|
||||
.wf__actions { display:flex; flex-wrap:wrap; gap:6px; }
|
||||
.wf__pied { flex:0 0 auto; display:flex; flex-wrap:wrap; gap:4px 14px; padding:6px 12px 7px; border-top:1px solid rgba(158,223,245,.1); font:500 .6rem/1.3 ui-monospace,Menlo,monospace; color:rgba(193,227,240,.55); }
|
||||
.wf__pied b { font:600 .5rem/1 system-ui,sans-serif; letter-spacing:.24em; text-transform:uppercase; color:rgba(193,227,240,.4); margin-right:4px; }
|
||||
.wf__pied .present { color:#ffc46b; }
|
||||
.wf__vide { margin:auto; max-width:360px; text-align:center; font:italic .88rem Georgia,serif; color:rgba(193,227,240,.5); padding:20px; }
|
||||
/* l'image en anneaux d'elle-même (Droste) : cinq calques ronds, la même image, une échelle (transform) */
|
||||
.wf__droste { position:absolute; left:50%; top:50%; width:0; height:0; transform-origin:0 0; will-change:transform; }
|
||||
.wf__droste .couche { position:absolute; border-radius:50%; overflow:hidden; box-shadow:0 0 0 1px rgba(255,196,107,.5), 0 0 30px rgba(0,0,0,.6); background:#000; }
|
||||
.wf__droste .couche img { width:100%; height:100%; object-fit:cover; display:block; }
|
||||
@media (max-width:560px) { .wf__corps { flex-direction:column; } .wf__panneau { flex:0 0 auto; max-width:none; max-height:44%; border-left:0; border-top:1px solid rgba(158,223,245,.1); } }
|
||||
@media (prefers-reduced-motion:reduce) { .wf__g, .wf__droste { transition:none !important; } }
|
||||
</style>
|
||||
<script>
|
||||
(function () {
|
||||
// ═══════════════ les modes d'avant (visualiseur, zoom infini) — inchangés ; + « ◎ flux » quand le bureau v2 est là ═══════════════
|
||||
function motifs(container, ctx, api) {
|
||||
var MODES = [['concentrique','◎'], ['spirale','🌀'], ['sphère','●'], ['tunnel','◯']];
|
||||
container.innerHTML = '<div class="wm"><canvas></canvas>'
|
||||
+ '<div class="wm__bar">' + MODES.map(function (m, i) { return '<button class="wm__m' + (i === 0 ? ' on' : '') + '" data-m="' + m[0] + '">' + m[1] + ' ' + m[0] + '</button>'; }).join('')
|
||||
+ (api && api.flux ? '<button class="wm__m" data-flux title="le vrai flux : ce que tes wormions ont vu passer">◎ flux</button>' : '') + '</div>'
|
||||
+ '<div class="wm__hud">🌀 wormion · <b data-z>×1.0</b></div>'
|
||||
+ '<div class="wm__hint">molette / pinch = zoom infini · double-clic = recentrer</div></div>';
|
||||
var root = container.querySelector('.wm'), cv = container.querySelector('canvas'), cx = cv.getContext('2d');
|
||||
var hud = container.querySelector('[data-z]');
|
||||
var RATIO = 1.6, LOGR = Math.log(RATIO), zoom = 0, raf = 0, mode = 'concentrique';
|
||||
|
||||
function size() { var r = root.getBoundingClientRect(), dpr = Math.min(2, devicePixelRatio || 1);
|
||||
cv.width = Math.max(1, r.width * dpr); cv.height = Math.max(1, r.height * dpr); cx.setTransform(dpr, 0, 0, dpr, 0, 0); }
|
||||
|
||||
function circle(x, y, r, stroke, lw) { cx.beginPath(); cx.arc(x, y, r, 0, Math.PI * 2); cx.strokeStyle = stroke; cx.lineWidth = lw; cx.stroke(); }
|
||||
function ellipse(x, y, rx, ry, rot, stroke, lw) { cx.beginPath(); cx.ellipse(x, y, rx, ry, rot, 0, Math.PI * 2); cx.strokeStyle = stroke; cx.lineWidth = lw; cx.stroke(); }
|
||||
function koin(x, y, r, a, col) { var t = r * 0.14; cx.beginPath();
|
||||
cx.moveTo(x + Math.cos(a) * r, y + Math.sin(a) * r);
|
||||
cx.lineTo(x + Math.cos(a + 0.16) * (r - t), y + Math.sin(a + 0.16) * (r - t));
|
||||
cx.lineTo(x + Math.cos(a - 0.16) * (r - t), y + Math.sin(a - 0.16) * (r - t));
|
||||
cx.closePath(); cx.fillStyle = col; cx.fill(); }
|
||||
|
||||
function draw() {
|
||||
var r = root.getBoundingClientRect(), w = r.width, h = r.height, X = w / 2, Y = h / 2;
|
||||
cx.clearRect(0, 0, w, h);
|
||||
var maxR = Math.hypot(w, h), phase = zoom / LOGR;
|
||||
if (mode === 'spirale') {
|
||||
// spirale log auto-similaire : r = r0·exp(k·a), décalée par le zoom
|
||||
cx.beginPath();
|
||||
var k = Math.log(RATIO) / (Math.PI * 2), first = true;
|
||||
for (var a = -8; a < 40; a += 0.12) {
|
||||
var rr = 6 * Math.exp(k * (a + (phase % 1) * Math.PI * 2));
|
||||
if (rr > maxR) break;
|
||||
var px = X + Math.cos(a) * rr, py = Y + Math.sin(a) * rr;
|
||||
if (first) { cx.moveTo(px, py); first = false; } else cx.lineTo(px, py);
|
||||
}
|
||||
cx.strokeStyle = 'hsla(265,70%,72%,.85)'; cx.lineWidth = 1.6; cx.stroke();
|
||||
hud.textContent = '×' + Math.exp(zoom).toFixed(2); return;
|
||||
}
|
||||
for (var i = -2; i < 42; i++) {
|
||||
var s = 6 * Math.pow(RATIO, i + (phase % 1));
|
||||
if (s < 2) continue; if (s > maxR) break;
|
||||
var depth = i + phase, hue = 255 + 30 * Math.sin(depth * 0.5);
|
||||
var op = 0.18 + 0.5 * (1 - Math.min(1, s / maxR));
|
||||
var col = 'hsla(' + hue + ',70%,70%,' + op + ')', lw = Math.max(0.6, s * 0.011);
|
||||
if (mode === 'concentrique') { circle(X, Y, s, col, lw); if (s > 26) koin(X, Y, s, depth * 0.7, 'hsla(' + (hue + 50) + ',75%,74%,' + (op * 0.8) + ')'); }
|
||||
else if (mode === 'sphère') { circle(X, Y, s, col, lw); ellipse(X, Y, s, s * 0.42, 0, col, lw); ellipse(X, Y, s * 0.42, s, 0, col, lw); }
|
||||
else { // tunnel : centre décalé selon la profondeur (wormhole)
|
||||
var off = (depth % 6) * 6; circle(X + off, Y - off * 0.6, s, col, lw);
|
||||
}
|
||||
}
|
||||
hud.textContent = '×' + Math.exp(zoom).toFixed(2);
|
||||
}
|
||||
function schedule() { if (!raf) raf = requestAnimationFrame(function () { raf = 0; draw(); }); }
|
||||
|
||||
cv.addEventListener('wheel', function (e) { e.preventDefault(); zoom += (e.deltaY < 0 ? 1 : -1) * 0.12; schedule(); }, { passive: false });
|
||||
var pinch = null;
|
||||
cv.addEventListener('touchmove', function (e) {
|
||||
if (e.touches.length === 2) { e.preventDefault();
|
||||
var d = Math.hypot(e.touches[0].clientX - e.touches[1].clientX, e.touches[0].clientY - e.touches[1].clientY);
|
||||
if (pinch != null) { zoom += Math.log(d / pinch); schedule(); } pinch = d;
|
||||
}
|
||||
}, { passive: false });
|
||||
cv.addEventListener('touchend', function () { pinch = null; });
|
||||
root.addEventListener('dblclick', function () { zoom = 0; schedule(); });
|
||||
container.querySelector('.wm__bar').addEventListener('click', function (e) {
|
||||
if (e.target.closest('[data-flux]')) { api.flux('bureau'); return; }
|
||||
var b = e.target.closest('[data-m]'); if (!b) return; mode = b.getAttribute('data-m');
|
||||
container.querySelectorAll('.wm__m').forEach(function (x) { x.classList.toggle('on', x === b); }); schedule();
|
||||
});
|
||||
|
||||
var ro = new ResizeObserver(function () { size(); draw(); }); ro.observe(root);
|
||||
size(); draw();
|
||||
return { unmount: function () { try { ro.disconnect(); } catch (e) {} if (raf) cancelAnimationFrame(raf); container.innerHTML = ''; } };
|
||||
}
|
||||
|
||||
// ═══════════════ le navigateur des flux (bureau v2) ═══════════════
|
||||
var RATIO = 1.45, R0 = 58; // l'anneau du présent (unités du viewBox -100…100) ; un anneau = ×1,45
|
||||
function parse(s) {
|
||||
s = String(s || 'bureau'); var m;
|
||||
if (s === 'bureau') return { k: 'bureau', id: null };
|
||||
if ((m = /^bureau:([a-z0-9][a-z0-9_-]{0,47})$/i.exec(s))) return { k: 'bureau', id: m[1] };
|
||||
if ((m = /^vu:([a-z0-9][a-z0-9_-]{0,47}):(\d{1,3})$/i.exec(s))) return { k: 'vu', id: m[1], i: +m[2] };
|
||||
if ((m = /^fichier:(.{1,700})$/.exec(s))) return { k: 'fichier', chemin: m[1] };
|
||||
if ((m = /^tsoin:([a-z0-9][a-z0-9_.:-]{0,80})$/i.exec(s))) return { k: 'tsoin', id: m[1] };
|
||||
return { k: 'bureau', id: null };
|
||||
}
|
||||
function scopeDe(o) { return o.k === 'vu' ? 'vu:' + o.id + ':' + o.i : o.k === 'fichier' ? 'fichier:' + o.chemin : o.k === 'tsoin' ? 'tsoin:' + o.id : (o.id ? 'bureau:' + o.id : 'bureau'); }
|
||||
function deux(n) { return (n < 10 ? '0' : '') + n; }
|
||||
function temps(s) { s = Math.max(0, +s || 0); var m = Math.floor(s / 60), r = s - m * 60; return deux(m) + ':' + (r < 10 ? '0' : '') + r.toFixed(1); }
|
||||
|
||||
function flux(container, ctx, scope, api) {
|
||||
var W = window, D = document, E = W.jOSEntrees, alive = true, S = parse(scope), pile = [], desabo = [], rt = null, snapT = null;
|
||||
var M = [], z = 0, z0 = -99, mode = 'anneaux', media = null, urlCourante = null, droste = { z: 0 };
|
||||
container.innerHTML = '<div class="wf" data-bv2-nav><div class="wf__attente">○ le wormion s\'ouvre…</div></div>'; // data-bv2-nav (25.09) : toute la fenêtre reçoit un dépôt
|
||||
var root = container.firstChild;
|
||||
var esc = function (s) { return String(s == null ? '' : s).replace(/[&<>"']/g, function (c) { return { '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]; }); };
|
||||
function clamp(v, a, b) { return Math.max(a, Math.min(b, v)); }
|
||||
function reduit() { try { var h = D.documentElement; return h.getAttribute('data-puissance') === 'faible' || h.classList.contains('xb-no-anim') || !!(W.matchMedia && W.matchMedia('(prefers-reduced-motion: reduce)').matches); } catch (e) { return false; } }
|
||||
function persister(nom) {
|
||||
try { if (ctx && ctx.tab) { ctx.tab.scope = scopeDe(S); ctx.tab.title = 'Wormion · ' + nom; } } catch (e) {}
|
||||
try { if (ctx && ctx.win && ctx.win.tabs && ctx.win.tabs.length === 1) { ctx.win.title = '🌀 Wormion · ' + nom; var n = W.jOS && W.jOS._wm && W.jOS._wm.node(ctx.win.id), t = n && n.querySelector('.jos-win__title'); if (t) t.textContent = ctx.win.title; } } catch (e2) {}
|
||||
try { if (W.jOS && W.jOS._wm && W.jOS._wm.save) W.jOS._wm.save(); } catch (e3) {}
|
||||
}
|
||||
function aller(o, empiler) { if (empiler) pile.push(scopeDe(S)); S = o; z = 0; z0 = -99; droste.z = 0; charger(); }
|
||||
var inst = { vivant: function () { return alive; }, winId: function () { return ctx && ctx.win && ctx.win.id; }, naviguer: function (sc) { pile = []; aller(parse(sc)); } };
|
||||
|
||||
// ── les moments d'un scope ──
|
||||
// (27.09) envoye 'rs1' : PRIS par la coord (son accusé) par le portail vers RS-1 — parti à RS-1 à son ➤ (bureau-v2.js § 5 bis ; docs/dev/33 « Le portail vers RS-1 »)
|
||||
function vuMoment(v, wId, i) { return { nom: v.nom, type: v.type, quand: v.quand, ref: v, wId: wId, i: i, sous: (v.envoye ? (v.envoye === 'moi' ? '→ mes appareils · ' : v.envoye === 'rs1' ? '→ RS-1 · ' : '→ amis · ') : '') + E.ilya(v.quand) }; }
|
||||
function itemMoment(it) { return { nom: E.nomDe(it), type: it.t === 'fichier' ? it.type : it.t, quand: it.cree, item: it, sous: it.t === 'fichier' ? E.taille(it.taille) : E.genreDe(it) }; }
|
||||
function metaDe(m) { // ce qu'il faut pour ouvrir / lire le moment
|
||||
if (m.item && m.item.t === 'fichier') return m.item;
|
||||
if (m.ref && m.ref.chemin) return { chemin: m.ref.chemin, nom: m.ref.nom, mime: m.ref.mime, taille: m.ref.taille, ou: m.ref.ou, type: E.typeDe(m.ref.nom, m.ref.mime) };
|
||||
return null;
|
||||
}
|
||||
function charger() {
|
||||
M = []; mode = 'anneaux'; arreterMedia();
|
||||
if (S.k === 'bureau' && !S.id) {
|
||||
Object.keys(E.etat().items).forEach(function (k) { var w = E.etat().items[k]; if (w.t === 'wormion') w.vus.forEach(function (v, i) { M.push(vuMoment(v, w.id, i)); }); });
|
||||
M.sort(function (a, b) { return (b.quand || 0) - (a.quand || 0); });
|
||||
return peindre('tout ce que tes wormions ont vu');
|
||||
}
|
||||
if (S.k === 'bureau') {
|
||||
var it = E.item(S.id);
|
||||
if (!it) { S = { k: 'bureau', id: null }; return charger(); }
|
||||
if (it.t === 'wormion') { M = it.vus.map(function (v, i) { return vuMoment(v, it.id, i); }); return peindre(E.nomDe(it)); }
|
||||
if (it.t === 'portion') { M = E.enfants(it.id).map(itemMoment); return peindre(E.nomDe(it)); }
|
||||
if (it.t === 'fichier') return immersion(it, E.nomDe(it));
|
||||
if (it.t === 'trou') { M = it.avales.map(function (a) { var m = itemMoment(a.item); m.sous = 'avalé ' + E.ilya(a.quand); return m; }); return peindre(E.nomDe(it)); }
|
||||
M = [itemMoment(it)]; return peindre(E.nomDe(it));
|
||||
}
|
||||
if (S.k === 'vu') { var w2 = E.item(S.id), v = w2 && w2.vus && w2.vus[S.i]; if (!v) { S = { k: 'bureau', id: w2 ? w2.id : null }; return charger(); } var mm = vuMoment(v, w2.id, S.i), meta = metaDe(mm); if (meta) return immersion(meta, v.nom); M = [mm]; return peindre(v.nom); }
|
||||
if (S.k === 'fichier') { var nom = S.chemin.split('/').pop() || S.chemin; return immersion({ chemin: S.chemin, nom: nom, type: E.typeDe(nom), ou: (/^([a-z]+):/.exec(S.chemin) || [0, 'fs'])[1] }, nom); }
|
||||
if (S.k === 'tsoin') {
|
||||
var ts = []; try { if (W.jOSTsoin && W.jOSTsoin.list) ts = W.jOSTsoin.list() || []; } catch (e) {} try { (JSON.parse(localStorage.getItem('tsoinion:tsoins') || '[]') || []).forEach(function (t) { ts.push(t); }); } catch (e2) {}
|
||||
var t = ts.filter(function (x) { return x && (x.id === S.id || x.name === S.id); })[0], evs = t ? (t.events || t.actions || []) : [];
|
||||
M = evs.slice(0, 200).map(function (ev, i) { return { nom: String((ev && (ev.type || ev.topic || ev.k || ev.port)) || 'événement ' + (i + 1)).slice(0, 60), type: 'tsoin', quand: ev && ev.t, sous: ev && ev.t != null ? (+ev.t / 1000).toFixed(2) + ' s' : '#' + (i + 1), ev: ev }; });
|
||||
return peindre(t ? (t.name || t.label || S.id) : S.id);
|
||||
}
|
||||
}
|
||||
|
||||
// ── l'immersion d'un fichier ──
|
||||
function immersion(meta, nom) {
|
||||
var ty = meta.type || E.typeDe(meta.nom, meta.mime);
|
||||
peindre(nom, { immersion: meta });
|
||||
if (ty === 'image') { mode = 'droste'; E.urlDe(meta).then(function (u) { if (!alive) return; urlCourante = u; poserDroste(u); panneau(); }); return; }
|
||||
if (ty === 'video' || ty === 'son') {
|
||||
mode = 'temps';
|
||||
E.urlDe(meta).then(function (u) {
|
||||
if (!alive || !u) { if (alive) panneau(); return; }
|
||||
urlCourante = u;
|
||||
var el = D.createElement(ty === 'video' ? 'video' : 'audio'); el.preload = 'metadata'; el.controls = true; el.playsInline = true; el.src = u;
|
||||
media = { el: el, n: 0, dur: 0 };
|
||||
el.addEventListener('loadedmetadata', function () { if (!alive) return; var d = isFinite(el.duration) ? el.duration : 0; media.dur = d; var n = d ? clamp(Math.round(d / 6), 6, 40) : 1; media.n = n;
|
||||
M = []; for (var i = 0; i < n; i++) M.push({ nom: temps(d * i / n), type: 'temps', t0: d * i / n, t1: d * (i + 1) / n, sous: '→ ' + temps(d * (i + 1) / n) });
|
||||
z = 0; z0 = -99; anneaux(); panneau(); });
|
||||
el.addEventListener('timeupdate', function () { if (!media || !media.n || !media.dur) return; var i = clamp(Math.floor(el.currentTime / media.dur * media.n), 0, media.n - 1); if (i !== Math.round(z) && !snapT) { z = i; anneaux(true); } majPied(); });
|
||||
panneau();
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (ty === 'texte') {
|
||||
E.blobDe(meta).then(function (b) { if (!b) return ''; if (b.size > 600000) b = b.slice(0, 600000); return b.text ? b.text() : new Response(b).text(); }).then(function (t) {
|
||||
if (!alive) return;
|
||||
var ps = String(t || '').split(/\n\s*\n/).map(function (p) { return p.trim(); }).filter(Boolean);
|
||||
if (ps.length < 3) ps = String(t || '').split(/\n/).map(function (p) { return p.trim(); }).filter(Boolean);
|
||||
M = ps.slice(0, 160).map(function (p, i) { return { nom: p.slice(0, 48), type: 'para', texte: p.slice(0, 6000), sous: '§ ' + (i + 1) }; });
|
||||
if (!M.length) M = [{ nom: '(vide)', type: 'para', texte: '', sous: '' }];
|
||||
z = 0; z0 = -99; anneaux(); panneau();
|
||||
}).catch(function () { if (alive) panneau(); });
|
||||
return;
|
||||
}
|
||||
M = [{ nom: meta.nom || nom, type: ty, meta: meta, sous: E.taille(meta.taille) }];
|
||||
anneaux(); panneau();
|
||||
}
|
||||
|
||||
// ── le dessin ──
|
||||
var IMM = null, NOM = '';
|
||||
function peindre(nom, o) {
|
||||
var focus = !!(D.activeElement && root.contains(D.activeElement) && D.activeElement.hasAttribute && D.activeElement.hasAttribute('data-tunnel'));
|
||||
NOM = nom; IMM = (o && o.immersion) || null; persister(nom);
|
||||
// (25.09, docs/dev/33 § Créer des fichiers / le dépôt fluide) le wormion montré : « + nouveau » y fait naître un fichier, et sa fenêtre
|
||||
// reçoit ce qu'on y lâche comme sa zone (elle perçoit) ; sur autre chose, elle tient le glisser (pas de voile, rien ne se pose)
|
||||
var wz = (S.k === 'bureau' && S.id && E.item(S.id) && E.item(S.id).t === 'wormion') ? S.id : null;
|
||||
var neuf = !!(wz && !IMM && typeof E.menuNouveau === 'function' && !E.coupe('fichiers.nouveau') && !E.coupe('bureau.fichiers'));
|
||||
var h = '<div class="wf__h"><nav class="wf__fil" aria-label="où je suis">' + (pile.length ? '<button type="button" data-retour title="revenir" style="border:0;background:none;color:#ffc46b;font:inherit;cursor:pointer">↩</button>' : '')
|
||||
+ '<span>○ wormion</span><i>›</i><b>' + esc(nom) + '</b></nav><div class="wf__outils">'
|
||||
+ (IMM ? '<button type="button" data-ouvrir-imm>↗ ouvrir</button>' : '')
|
||||
+ (neuf ? '<button type="button" data-nouveau aria-haspopup="menu" title="créer un fichier dans ce wormion (il y reste : rien ne passe le portail sans geste)">+ nouveau</button>' : '')
|
||||
+ (api && api.motifs ? '<button type="button" data-motifs title="les motifs du wormion (les modes d\'avant)">◎ motifs</button>' : '') + '</div></div>'
|
||||
+ '<div class="wf__corps" data-bv2-wormion="' + esc(wz || 'aucun') + '"><div class="wf__tunnel" tabindex="0" aria-label="le flux : molette en avant pour avancer, flèches pour passer d\'un anneau à l\'autre" data-tunnel></div><aside class="wf__panneau" data-panneau aria-live="polite"></aside></div>'
|
||||
+ '<div class="wf__pied" data-pied></div>';
|
||||
root.innerHTML = h;
|
||||
brancher();
|
||||
if (!IMM) { anneaux(); panneau(); }
|
||||
if (focus && tunnel()) try { tunnel().focus({ preventScroll: true }); } catch (e) {}
|
||||
}
|
||||
function tunnel() { return root.querySelector('[data-tunnel]'); }
|
||||
function anneaux(anim) {
|
||||
var tu = tunnel(); if (!tu || mode === 'droste') return;
|
||||
if (!M.length) { tu.innerHTML = '<div class="wf__vide">' + (S.k === 'bureau' ? 'rien n\'est encore passé par ici · glisse un fichier ou une icône sur un wormion du bureau' : 'rien à traverser') + '</div>'; majPied(); return; }
|
||||
z = clamp(z, 0, M.length - 1);
|
||||
var k0 = Math.floor(z), present = Math.round(z);
|
||||
if (k0 !== z0) {
|
||||
z0 = k0;
|
||||
var h = '<svg viewBox="-100 -100 200 200" preserveAspectRatio="xMidYMid meet" aria-hidden="true"><g class="wf__g">';
|
||||
for (var j = Math.min(M.length - 1, k0 + 7); j >= Math.max(0, k0 - 2); j--) {
|
||||
var r = R0 * Math.pow(RATIO, k0 - j), cls = j === present ? 'present' : j < present ? 'passe' : 'futur', m = M[j];
|
||||
if (r < 2.2 || r > 260) continue;
|
||||
var lw = Math.max(0.25, r * 0.012), a = (-58 + j * 41) * Math.PI / 180, fx = Math.cos(a) * r, fy = Math.sin(a) * r, fs = clamp(r * 0.075, 1.4, 7.5);
|
||||
h += '<circle class="anneau ' + cls + '" data-j="' + j + '" r="' + r.toFixed(2) + '" stroke-width="' + lw.toFixed(2) + '"/>';
|
||||
h += '<circle class="cible" data-j="' + j + '" r="' + r.toFixed(2) + '" stroke-width="' + Math.max(3, r * 0.08).toFixed(2) + '"/>';
|
||||
h += '<circle class="wf__coeur" cx="' + fx.toFixed(2) + '" cy="' + fy.toFixed(2) + '" r="' + (fs * 0.28).toFixed(2) + '"' + (j === present ? '' : ' style="fill:' + (j < present ? 'rgba(167,139,250,.7)' : 'rgba(111,159,216,.8)') + '"') + '/>';
|
||||
h += '<text class="' + (j === present ? 'present' : '') + '" x="' + (fx + fs * 0.6).toFixed(2) + '" y="' + fy.toFixed(2) + '" font-size="' + fs.toFixed(2) + '">' + esc(String(m.nom).slice(0, 34)) + '</text>';
|
||||
if (m.sous) h += '<text class="t" x="' + (fx + fs * 0.6).toFixed(2) + '" y="' + (fy + fs * 1.05).toFixed(2) + '" font-size="' + (fs * 0.62).toFixed(2) + '">' + esc(String(m.sous).slice(0, 40)) + '</text>';
|
||||
}
|
||||
tu.innerHTML = h + '</g></svg>';
|
||||
} else {
|
||||
[].forEach.call(tu.querySelectorAll('circle.anneau'), function (c) { var j = +c.getAttribute('data-j'); c.setAttribute('class', 'anneau ' + (j === present ? 'present' : j < present ? 'passe' : 'futur')); });
|
||||
}
|
||||
var g = tu.querySelector('.wf__g'); if (g) { g.style.transition = anim && !reduit() ? 'transform .2s cubic-bezier(.2,.9,.1,1)' : 'none'; g.style.transform = 'scale(' + Math.pow(RATIO, z - k0).toFixed(4) + ')'; }
|
||||
majPied();
|
||||
}
|
||||
function poserDroste(u) {
|
||||
var tu = tunnel(); if (!tu) return;
|
||||
if (!u) { tu.innerHTML = '<div class="wf__vide">image introuvable</div>'; return; }
|
||||
var r = tu.getBoundingClientRect(), d0 = Math.max(80, Math.min(r.width || 400, r.height || 300) * 0.92), h = '<div class="wf__droste" data-droste>';
|
||||
for (var k = 0; k < 6; k++) { var d = d0 * Math.pow(RATIO, -k * 1.6); h += '<div class="couche" style="width:' + d.toFixed(1) + 'px;height:' + d.toFixed(1) + 'px;left:' + (-d / 2).toFixed(1) + 'px;top:' + (-d / 2).toFixed(1) + 'px"><img src="' + esc(u) + '" alt="" draggable="false"></div>'; }
|
||||
tu.innerHTML = h + '</div>';
|
||||
appliquerDroste(false);
|
||||
}
|
||||
function appliquerDroste(anim) {
|
||||
var el = root.querySelector('[data-droste]'); if (!el) return;
|
||||
var pas = Math.pow(RATIO, 1.6), k = Math.floor(droste.z), s = Math.pow(pas, droste.z - k); // auto-similaire : à chaque anneau traversé, on recommence
|
||||
el.style.transition = anim && !reduit() ? 'transform .18s ease-out' : 'none';
|
||||
el.style.transform = 'scale(' + s.toFixed(4) + ')';
|
||||
majPied();
|
||||
}
|
||||
function arreterMedia() { if (media && media.el) { try { media.el.pause(); media.el.removeAttribute('src'); media.el.load(); } catch (e) {} } media = null; }
|
||||
|
||||
// ── le panneau du présent : l'aperçu, les valeurs exactes, les gestes ──
|
||||
function lignes(l) { return '<dl class="wf__dl">' + l.filter(Boolean).map(function (x) { return '<dt>' + esc(x[0]) + '</dt><dd' + (x[2] ? ' class="present"' : '') + '>' + esc(x[1]) + '</dd>'; }).join('') + '</dl>'; }
|
||||
function valeursImm(ty) { return lignes([['genre', ty + (IMM.mime ? ' · ' + IMM.mime : '')], IMM.taille != null ? ['taille', E.exact(IMM.taille) + ' · ' + E.taille(IMM.taille)] : null, ['chemin', IMM.chemin || ''], mode === 'temps' && media ? ['durée', temps(media.dur)] : null, mode === 'temps' && media ? ['maintenant', temps(media.el.currentTime), true] : null, mode === 'droste' ? ['anneau', String(Math.floor(droste.z)), true] : null, M.length > 1 ? ['anneau', (Math.round(z) + 1) + ' / ' + M.length, true] : null]); }
|
||||
function panneau() {
|
||||
var p = root.querySelector('[data-panneau]'); if (!p) return;
|
||||
var h = '';
|
||||
// une vidéo / un son qui joue ne se redessine jamais (le sortir du document le mettrait en pause) : seules les valeurs bougent
|
||||
if (IMM && mode === 'temps' && media && media.el && p.contains(media.el)) { var dl0 = p.querySelector('[data-dl]'); if (dl0) dl0.innerHTML = valeursImm(IMM.type || E.typeDe(IMM.nom, IMM.mime)); return; }
|
||||
if (IMM) {
|
||||
var ty = IMM.type || E.typeDe(IMM.nom, IMM.mime);
|
||||
if (mode === 'temps') h += '<div class="wf__apercu" data-media></div>';
|
||||
else if (mode === 'droste') h += '<div class="wf__apercu">' + (urlCourante ? '<img src="' + esc(urlCourante) + '" alt="" draggable="false">' : '') + '</div>';
|
||||
else if (ty === 'texte' && M.length) { var m0 = M[clamp(Math.round(z), 0, M.length - 1)]; h += '<div class="wf__apercu" style="aspect-ratio:auto;min-height:40%"><pre>' + esc(m0.texte || '') + '</pre></div>'; }
|
||||
else h += '<div class="wf__apercu">' + ((E.glyphes && E.glyphes[ty]) || '') + '</div>';
|
||||
h += '<div class="wf__nom">' + esc(IMM.nom || NOM) + '</div>';
|
||||
h += '<div data-dl>' + valeursImm(ty) + '</div>';
|
||||
h += '<div class="wf__actions"><button type="button" data-ouvrir-imm>↗ ouvrir dans ' + esc(appNom(IMM, ty)) + '</button>' + (partout() ? '<button type="button" data-avec-imm aria-haspopup="menu">ouvrir avec ›</button>' : '') + (IMM.id && E.item(IMM.id) ? '<button type="button" data-machine>⧗ la machine</button>' : '') + '</div>';
|
||||
} else if (!M.length) {
|
||||
// (27.09) un portail vers RS-1 le dit (bureau-v2.js § 5 bis) : ce qu'on y lâche part à la coord, pas en immersion
|
||||
var rs1v = S.k === 'bureau' && S.id && typeof E.actionDe === 'function' && E.actionDe(S.id) === 'portail-rs1';
|
||||
h += '<div class="wf__nom">' + esc(NOM) + '</div><p style="font:italic .8rem Georgia,serif;color:rgba(193,227,240,.5);margin:0">' + (rs1v ? 'glisse un fichier, une icône ou un dossier sur ce portail : il part à RS-1 (la coord s\'ouvre, ➤ pour le lui envoyer) et reste noté ici.' : 'glisse un fichier, une icône ou un dossier sur ce wormion : il s\'ouvre ici, en immersion, et reste dans ses anneaux.') + '</p>';
|
||||
} else {
|
||||
var m = M[clamp(Math.round(z), 0, M.length - 1)], meta = metaDe(m), vig = m.item ? E.vignetteSync(m.item.id) : (m.ref && m.ref.item ? E.vignetteSync(m.ref.item) : null);
|
||||
h += '<div class="wf__apercu">' + (vig ? '<img src="' + vig + '" alt="" draggable="false">' : (m.type === 'tsoin' ? '<span class="glyphe">⧗</span>' : ((E.glyphes && (E.glyphes[m.type] || E.glyphes.autre)) || ''))) + '</div>';
|
||||
h += '<div class="wf__nom">' + esc(m.nom) + '</div>';
|
||||
h += lignes([['moment', (Math.round(z) + 1) + ' / ' + M.length, true], m.quand ? ['quand', E.quand(m.quand)] : null, m.quand ? ['il y a', E.ilya(m.quand).replace('il y a ', '')] : null, meta && meta.taille != null ? ['taille', E.taille(meta.taille)] : null, meta ? ['chemin', meta.chemin] : null, m.ref && m.ref.envoye ? ['passé', m.ref.envoye === 'moi' ? 'vers mes appareils' : m.ref.envoye === 'rs1' ? 'dans la coord, pour RS-1' : 'vers des amis'] : null, m.ev ? ['données', JSON.stringify(m.ev).slice(0, 160)] : null]);
|
||||
var a = '';
|
||||
if (m.item || meta || (m.ref && m.ref.px)) a += '<button type="button" data-ouvrir-moment>↗ ouvrir</button>';
|
||||
if (meta && partout()) a += '<button type="button" data-avec-moment aria-haspopup="menu">ouvrir avec ›</button>';
|
||||
if (meta && /^(image|video|son|texte)$/.test(meta.type || E.typeDe(meta.nom, meta.mime))) a += '<button type="button" data-plonger>◎ plonger</button>';
|
||||
if (m.ref && !m.ref.item && (m.ref.chemin || m.ref.px)) a += '<button type="button" data-poser>▢ poser sur le bureau</button>';
|
||||
if (m.ev && W.jOSTransport && W.jOSTransport.play) a += '<button type="button" data-rejouer>▶ rejouer</button>';
|
||||
h += '<div class="wf__actions">' + a + '</div>';
|
||||
}
|
||||
p.innerHTML = h;
|
||||
if (mode === 'temps' && media && media.el) { var host = p.querySelector('[data-media]'); if (host) host.appendChild(media.el); }
|
||||
}
|
||||
function majPied() {
|
||||
var p = root.querySelector('[data-pied]'); if (!p) return;
|
||||
var h = '<span><b>z</b>' + (mode === 'droste' ? droste.z.toFixed(2) : z.toFixed(2)) + '</span>';
|
||||
if (mode === 'droste') h += '<span><b>×</b>' + Math.pow(RATIO, droste.z * 1.6).toFixed(2) + '</span><span><b>anneau</b>' + Math.floor(droste.z) + '</span>';
|
||||
else if (M.length) h += '<span><b>anneau</b>' + (Math.round(z) + 1) + ' / ' + M.length + '</span>';
|
||||
if (mode === 'temps' && media && media.el) h += '<span class="present"><b>t</b>' + temps(media.el.currentTime) + ' / ' + temps(media.dur) + '</span>';
|
||||
else h += '<span class="present"><b>maintenant</b>' + esc((E.quand(Date.now()).split(' · ')[1] || '')) + '</span>';
|
||||
p.innerHTML = h;
|
||||
}
|
||||
// ── avancer / reculer : la molette, le clavier, un clic sur un anneau ──
|
||||
function viser(nz, anim) {
|
||||
if (mode === 'droste') { droste.z = Math.max(0, nz); appliquerDroste(anim); return; }
|
||||
if (!M.length) return;
|
||||
var avant = Math.round(z); z = clamp(nz, 0, M.length - 1); anneaux(anim);
|
||||
if (Math.round(z) !== avant) { panneau(); if (mode === 'temps' && media && media.el && M[Math.round(z)] && !anim) { try { media.el.currentTime = M[Math.round(z)].t0; } catch (e) {} } }
|
||||
}
|
||||
function poser() { clearTimeout(snapT); snapT = null; if (mode === 'droste') return; var cible = Math.round(z); viser(cible, true); if (mode === 'temps' && media && media.el && M[cible]) { try { media.el.currentTime = M[cible].t0; } catch (e) {} } }
|
||||
function molette(e) {
|
||||
e.preventDefault();
|
||||
var d = e.deltaMode === 1 ? e.deltaY * 16 : e.deltaY, pas = -d * 0.0035;
|
||||
if (mode === 'droste') { viser(droste.z + pas * 1.2, false); return; }
|
||||
viser(z + pas, false);
|
||||
clearTimeout(snapT); snapT = setTimeout(poser, 170);
|
||||
}
|
||||
function clavier(e) {
|
||||
var k = e.key, j = Math.round(mode === 'droste' ? droste.z : z);
|
||||
if (k === 'ArrowDown' || k === 'ArrowRight' || k === 'PageDown' || k === '+') { e.preventDefault(); e.stopPropagation(); viser(j + 1, true); if (mode === 'temps') poser(); }
|
||||
else if (k === 'ArrowUp' || k === 'ArrowLeft' || k === 'PageUp' || k === '-') { e.preventDefault(); e.stopPropagation(); viser(j - 1, true); if (mode === 'temps') poser(); }
|
||||
else if (k === 'Home') { e.preventDefault(); viser(0, true); }
|
||||
else if (k === 'End' && M.length) { e.preventDefault(); viser(M.length - 1, true); }
|
||||
else if (k === 'Enter') { e.preventDefault(); ouvrirMoment(); }
|
||||
}
|
||||
function ouvrirMoment() {
|
||||
if (IMM) { E.ouvrirFichier(IMM, { depuis: 'wormion' }); return; }
|
||||
var m = M[clamp(Math.round(z), 0, M.length - 1)]; if (!m) return;
|
||||
if (m.item && E.item(m.item.id)) { E.ouvrir(m.item.id, { depuis: 'wormion' }); return; }
|
||||
if (m.ref && m.ref.item && E.item(m.ref.item)) { E.ouvrir(m.ref.item, { depuis: 'wormion' }); return; }
|
||||
if (m.ref && m.ref.px) { E.ouvrirPx(m.ref.px); return; }
|
||||
var meta = metaDe(m); if (meta) E.ouvrirFichier(meta, { depuis: 'wormion' });
|
||||
}
|
||||
// (26.09) « ouvrir dans son app » (jOSFiles décide, docs/dev/33) et « ouvrir avec › » : le menu de jOSFiles, le bureau l'ouvre (il sait
|
||||
// lire ce qu'il garde sur l'appareil) ; xb:fichiers.ouvrir-partout=off : comme avant (↗ ouvrir, rien de plus)
|
||||
function partout() { var F = W.jOSFiles; try { return !!(F && F.menuAvec && (!F.partout || F.partout())); } catch (e) { return false; } }
|
||||
// (relecture adverse) le bouton dit CE QU'IL OUVRE : le ploxion que jOSFiles choisit pour ce fichier (« toujours ouvrir avec » compris —
|
||||
// avant, il disait « OneNote » et ouvrait le Viewer choisi par le compte) ; « ouvrir avec › » pour un autre
|
||||
function appDuFichier(F, meta) { var p = F.ploxionDe(meta); if (p !== 'viewer' && p !== 'vue-3d' && F.ouvrable && !F.ouvrable(p)) p = (meta.type === '3d' || (F.genreDe && F.genreDe(meta.nom, meta.mime) === '3d')) ? 'vue-3d' : 'viewer'; return p; }
|
||||
function appNom(meta, ty) { var F = W.jOSFiles; try { if (partout() && F.ploxionDe && F.typesSync && F.typesSync()) return F.nomPx(appDuFichier(F, meta)); if (partout() && F.types && !F.typesSync()) F.types().then(function () { var bt = alive && IMM && root.querySelector('.wf__actions [data-ouvrir-imm]'); if (bt) bt.textContent = '↗ ouvrir dans ' + F.nomPx(appDuFichier(F, IMM)); }, function () {}); } catch (e) {} return ty === '3d' ? 'la vue 3D' : 'le viewer'; }
|
||||
function menuAvec(btn, meta) { var F = W.jOSFiles; if (!meta || !F || !F.menuAvec) return; F.menuAvec(btn, meta, { depuis: 'wormion', ouvrir: function (pid) { E.ouvrirFichier(meta, { avec: pid, depuis: 'wormion' }); } }); }
|
||||
function plongerMoment() {
|
||||
var m = M[clamp(Math.round(z), 0, M.length - 1)]; if (!m) return;
|
||||
if (m.item) { aller({ k: 'bureau', id: m.item.id }, true); return; }
|
||||
if (m.ref && m.ref.item && E.item(m.ref.item)) { aller({ k: 'bureau', id: m.ref.item }, true); return; }
|
||||
if (m.wId != null) { aller({ k: 'vu', id: m.wId, i: m.i }, true); return; }
|
||||
var meta = metaDe(m); if (meta && meta.chemin) aller({ k: 'fichier', chemin: meta.chemin }, true);
|
||||
}
|
||||
function brancher() {
|
||||
var tu = tunnel(); if (!tu) return;
|
||||
tu.addEventListener('wheel', molette, { passive: false });
|
||||
tu.addEventListener('keydown', clavier);
|
||||
// glisser vers le haut = avancer (comme la molette), au doigt comme à la souris ; lâcher = l'anneau le plus proche
|
||||
var gl = null;
|
||||
tu.addEventListener('pointerdown', function (e) { if (e.button > 0 || (e.target.closest && e.target.closest('circle.cible'))) return; gl = { y: e.clientY, z: mode === 'droste' ? droste.z : z, id: e.pointerId, bouge: false }; });
|
||||
tu.addEventListener('pointermove', function (e) { if (!gl || e.pointerId !== gl.id) return; var dy = gl.y - e.clientY; if (!gl.bouge && Math.abs(dy) < 6) return; gl.bouge = true; try { tu.setPointerCapture(e.pointerId); } catch (x) {} viser(gl.z + dy * 0.012, false); });
|
||||
var fin = function (e) { if (!gl || e.pointerId !== gl.id) return; var b = gl.bouge; gl = null; if (b) poser(); };
|
||||
tu.addEventListener('pointerup', fin); tu.addEventListener('pointercancel', fin);
|
||||
tu.addEventListener('dblclick', function (e) { e.preventDefault(); if (mode === 'droste') { droste.z = 0; appliquerDroste(true); } else ouvrirMoment(); });
|
||||
}
|
||||
root.addEventListener('click', function (e) {
|
||||
var t = e.target;
|
||||
if (t.closest('[data-motifs]') && api && api.motifs) { api.motifs(); return; }
|
||||
if (t.closest('[data-retour]')) { var sc = pile.pop(); if (sc) aller(parse(sc), false); return; }
|
||||
if (t.closest('[data-ouvrir-imm]')) { if (IMM) E.ouvrirFichier(IMM, { depuis: 'wormion' }); return; }
|
||||
var av = t.closest('[data-avec-imm],[data-avec-moment]'); if (av) { menuAvec(av, av.hasAttribute('data-avec-imm') ? IMM : metaDe(M[clamp(Math.round(z), 0, M.length - 1)] || {})); return; }
|
||||
var nv = t.closest('[data-nouveau]'); if (nv && E.menuNouveau && S.k === 'bureau' && S.id) { var rb = nv.getBoundingClientRect(); E.menuNouveau(rb.left, rb.bottom + 4, { k: 'wormion', id: S.id }, nv); return; }
|
||||
if (t.closest('[data-ouvrir-moment]')) { ouvrirMoment(); return; }
|
||||
if (t.closest('[data-plonger]')) { plongerMoment(); return; }
|
||||
if (t.closest('[data-machine]')) { E.machine(IMM && IMM.id); return; }
|
||||
if (t.closest('[data-rejouer]')) { var m = M[Math.round(z)]; try { W.jOSTransport.play({ dur: 1000, events: [{ t: 0, data: m.ev }], title: '⧗ ' + m.nom }, function () {}); } catch (er) {} return; }
|
||||
if (t.closest('[data-poser]')) {
|
||||
var mm = M[Math.round(z)]; if (!mm || !mm.ref) return;
|
||||
var n = E.enfants(null).length, it = mm.ref.px ? E.creer('px', { px: mm.ref.px, x: 80 + (n % 6) * 90, y: 100 + Math.floor(n / 6) * 100 }) : E.creer('fichier', { nom: mm.ref.nom, chemin: mm.ref.chemin, mime: mm.ref.mime, taille: mm.ref.taille, ou: mm.ref.ou, x: 80 + (n % 6) * 90, y: 100 + Math.floor(n / 6) * 100 });
|
||||
if (it) E.murmure('▢ ' + E.nomDe(it) + ' posé sur le bureau'); return;
|
||||
}
|
||||
var c = t.closest && t.closest('circle.cible'); if (c) { viser(+c.getAttribute('data-j'), true); if (mode === 'temps') poser(); try { tunnel().focus({ preventScroll: true }); } catch (x) {} }
|
||||
});
|
||||
|
||||
E.charger().then(function () {
|
||||
if (!alive) return;
|
||||
desabo.push(E.vivant('wormion', inst));
|
||||
var on = function (e) { var r = e && e.detail && e.detail.raison; if (r === 'menu' || r === 'vignette' || IMM) return; if (rt) return; rt = setTimeout(function () { rt = null; if (!alive || IMM) return; var zz = z; charger(); z = clamp(zz, 0, Math.max(0, M.length - 1)); z0 = -99; anneaux(); panneau(); }, 60); };
|
||||
W.addEventListener('xb:bureau', on); desabo.push(function () { W.removeEventListener('xb:bureau', on); });
|
||||
var ro = null; try { ro = new ResizeObserver(function () { if (mode === 'droste' && urlCourante) poserDroste(urlCourante); }); ro.observe(root); desabo.push(function () { ro.disconnect(); }); } catch (e) {}
|
||||
charger();
|
||||
}, function () { if (alive) root.innerHTML = '<div class="wf__attente">le bureau n\'a pas pu se charger' + (api && api.motifs ? ' · <button type="button" data-motifs style="font:inherit;color:#ffc46b;background:none;border:0;cursor:pointer">◎ les motifs</button>' : '') + '</div>'; });
|
||||
return { unmount: function () { alive = false; clearTimeout(rt); clearTimeout(snapT); arreterMedia(); desabo.forEach(function (f) { try { f(); } catch (e) {} }); container.innerHTML = ''; } };
|
||||
}
|
||||
|
||||
// ═══════════════ le montage : le scope décide (demande du bureau > onglet restauré > rien = les motifs) ═══════════════
|
||||
function mount(container, ctx) {
|
||||
ctx = ctx || {};
|
||||
var W = window, E = W.jOSEntrees, coupe = false, d = null, cur = null, fini = false;
|
||||
try { coupe = !!(E && E.coupe && (E.coupe('wormion.nav') || E.coupe('bureau-v2'))); } catch (e) {} // xb:bureau-v2 = off coupe aussi le navigateur
|
||||
try { d = (!coupe && E && E.demande) ? E.demande('wormion') : null; } catch (e2) {}
|
||||
var nav = !!(E && E.charger && !coupe);
|
||||
var api = nav ? {
|
||||
flux: function (sc) { montrer(sc || 'bureau'); },
|
||||
motifs: function () { try { if (ctx.tab) ctx.tab.scope = null; if (W.jOS && W.jOS._wm) W.jOS._wm.save(); } catch (e) {} montrer(null); }
|
||||
} : null;
|
||||
function montrer(sc) {
|
||||
if (fini) return;
|
||||
if (cur) { try { cur.unmount(); } catch (e) {} cur = null; }
|
||||
cur = (sc && nav) ? flux(container, ctx, sc, api) : motifs(container, ctx, api);
|
||||
}
|
||||
montrer(d || ctx.scope || null);
|
||||
return { unmount: function () { fini = true; if (cur) { try { cur.unmount(); } catch (e) {} } cur = null; } };
|
||||
}
|
||||
window.jOSApps = window.jOSApps || {};
|
||||
window.jOSApps['wormion'] = { manifest: { id: 'wormion', name: 'Wormion', icon: '🌀' }, mount: mount };
|
||||
})();
|
||||
</script>
|
||||
Reference in New Issue
Block a user