mirror of
https://git.j0bot.ch/admin_j0bot/ploxion-tree.git
synced 2026-11-29 07:25:04 +00:00
synchro du labo (0bf0da65) : app.blade.php, README.md
This commit is contained in:
commit
52662ad2b0
21
README.md
Normal file
21
README.md
Normal file
@ -0,0 +1,21 @@
|
||||
# 🌳 Arbre
|
||||
|
||||
La map navigable du lexique ionique — centre un terme, clique une porte (xref), le centre se redéploie.
|
||||
|
||||
| | |
|
||||
| --- | --- |
|
||||
| id | `tree` |
|
||||
| fournit | `lexicon-graph` `navigate` |
|
||||
| bions qu'il nomme | `jOSApps` `jOSPorts` |
|
||||
| fichiers | `app.blade.php` |
|
||||
| dans le labo | `resources/views/ploxions/tree/` (dépôt `my_website2`) |
|
||||
|
||||
## Contribuer
|
||||
|
||||
- **Dans le xer** : https://labo.j0bot.ch/px/atelier?ploxion=tree — prends-le, modifie-le, vois-le tourner, « ⧗ envoyer le tsoin ».
|
||||
- **Dans VS Code** : `xb prendre tree` (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.
|
||||
|
||||
© 2026 chill-tekk · ne pas nuire
|
||||
165
app.blade.php
Normal file
165
app.blade.php
Normal file
@ -0,0 +1,165 @@
|
||||
{{-- PL0XI0N tree — la MAP NAVIGABLE du lexique ionique (CLAUDE.md : égocentrique,
|
||||
on est toujours dans un koin, on clique une porte, le centre se redéploie).
|
||||
Lit /wiki/lexicon.json, parse les [[xref]] des définitions, et navigue le
|
||||
GRAPHE des termes : centre = terme focalisé, branches = ce qu'il cite +
|
||||
ce qui le cite. Clic = recentre. 100% client-side.
|
||||
window.jOSApps['tree']. mount(c, ctx) -> { unmount }. --}}
|
||||
<style>
|
||||
.tre { display:flex; flex-direction:column; height:100%; background:
|
||||
radial-gradient(circle at 50% 42%, rgba(24,36,58,.6), #06090d 72%);
|
||||
color:rgba(220,232,240,.92); font-family:ui-sans-serif,system-ui,sans-serif; font-size:.84rem; }
|
||||
.tre__bar { flex:0 0 auto; display:flex; align-items:center; gap:8px; padding:8px 11px; border-bottom:1px solid rgba(120,160,230,.18); }
|
||||
.tre__t { font-weight:700; letter-spacing:.04em; color:rgba(160,195,255,.95); white-space:nowrap; }
|
||||
.tre__f { flex:1; border-radius:8px; padding:6px 11px; border:1px solid rgba(120,160,230,.25);
|
||||
background:rgba(18,26,42,.55); color:#fff; font-family:inherit; font-size:.82rem; outline:none; }
|
||||
.tre__crumb { flex:0 0 auto; display:flex; gap:4px; flex-wrap:wrap; padding:5px 11px; font-size:.66rem;
|
||||
color:rgba(150,180,220,.55); border-bottom:1px solid rgba(120,160,230,.08); min-height:14px; }
|
||||
.tre__cr { cursor:pointer; } .tre__cr:hover { color:#fff; }
|
||||
.tre__body { flex:1; min-height:0; overflow-y:auto; padding:14px; display:flex; flex-direction:column; align-items:center; gap:12px; }
|
||||
.tre__up { font-size:.66rem; text-transform:uppercase; letter-spacing:.05em; color:rgba(150,180,220,.5); align-self:flex-start; }
|
||||
.tre__ring { display:flex; flex-wrap:wrap; gap:7px; justify-content:center; max-width:640px; }
|
||||
.tre__node { cursor:pointer; padding:4px 11px; border-radius:20px; border:1px solid rgba(120,160,230,.3);
|
||||
background:rgba(18,26,42,.55); color:rgba(195,215,240,.9); font-size:.78rem; }
|
||||
.tre__node:hover { border-color:rgba(160,195,255,.85); color:#fff; transform:translateY(-1px); }
|
||||
.tre__node.in { border-style:dashed; border-color:rgba(120,200,160,.4); color:rgba(170,220,195,.9); }
|
||||
.tre__center { text-align:center; max-width:560px; padding:14px 18px; border-radius:16px;
|
||||
border:1px solid rgba(120,170,255,.4); background:rgba(20,30,50,.6); box-shadow:0 0 28px rgba(70,120,220,.18); }
|
||||
.tre__g { font-size:2rem; color:rgba(150,200,255,.95); font-family:'Share Tech Mono',monospace; line-height:1; }
|
||||
.tre__n { font-size:1.1rem; font-weight:800; color:#fff; margin-top:4px; }
|
||||
.tre__deco { font-size:.72rem; color:rgba(160,200,255,.7); font-family:ui-monospace,monospace; margin-top:3px; }
|
||||
.tre__def { font-size:.8rem; color:rgba(200,218,234,.85); line-height:1.45; margin-top:7px; }
|
||||
.tre__lnk { display:inline-block; margin-top:8px; font-size:.7rem; color:rgba(160,195,255,.8); text-decoration:none; }
|
||||
.tre__lnk:hover { color:#fff; }
|
||||
.tre__msg { margin:auto; color:rgba(190,212,228,.5); }
|
||||
</style>
|
||||
<script>
|
||||
(function () {
|
||||
function esc(s) { return window.jOSb.esc(s); }
|
||||
|
||||
var LIVE = null; // posé au mount : {cur:function()}
|
||||
function describe() {
|
||||
var c = LIVE ? LIVE.cur() : null;
|
||||
return { v: 1, id: 'tree', title: 'Arbre', icon: '🌳', items: [
|
||||
{ p: 1, kind: 'stat', label: 'terme centré', value: c || '—' }
|
||||
] };
|
||||
}
|
||||
|
||||
function mount(container, ctx) {
|
||||
var alive = true, ac = ('AbortController' in window) ? new AbortController() : null;
|
||||
var url = (ctx && ctx.config && ctx.config.url) ? ctx.config.url : '/wiki/lexicon.json';
|
||||
var byId = {}, outAdj = {}, inAdj = {}, cur = null, hist = [];
|
||||
LIVE = { cur: function () { return cur; } };
|
||||
var offCenter = null, pendingCenter = null, loaded = false, seen = {};
|
||||
|
||||
container.innerHTML =
|
||||
'<div class="tre">'
|
||||
+ ' <div class="tre__bar"><span class="tre__t">🌳 Arbre du lexique</span>'
|
||||
+ ' <input class="tre__f" placeholder="aller à un terme…" list="tre-dl"><datalist id="tre-dl"></datalist></div>'
|
||||
+ ' <div class="tre__crumb"></div>'
|
||||
+ ' <div class="tre__body"><div class="tre__msg">tissage du graphe ionique…</div></div>'
|
||||
+ '</div>';
|
||||
var elF = container.querySelector('.tre__f'), elCrumb = container.querySelector('.tre__crumb');
|
||||
var elBody = container.querySelector('.tre__body'), elDl = container.querySelector('#tre-dl');
|
||||
|
||||
function xrefs(def) {
|
||||
var out = [], re = /\[\[([a-z0-9\-]+)(?:\|[^\]]*)?\]\]/gi, m;
|
||||
while ((m = re.exec(def || '')) !== null) if (out.indexOf(m[1].toLowerCase()) === -1) out.push(m[1].toLowerCase());
|
||||
return out;
|
||||
}
|
||||
function build(terms) {
|
||||
terms.forEach(function (t) { byId[t.slug] = t; });
|
||||
terms.forEach(function (t) {
|
||||
var outs = xrefs(t.definition).filter(function (s) { return byId[s] && s !== t.slug; });
|
||||
outAdj[t.slug] = outs;
|
||||
outs.forEach(function (s) { (inAdj[s] = inAdj[s] || []).push(t.slug); });
|
||||
});
|
||||
}
|
||||
function emitTerm(slug, first) {
|
||||
// OUT term : le koin focalisé part sur le bus (→ wiki.goto / knowledge.goto / xp.gain via les fils).
|
||||
var t = byId[slug] || {};
|
||||
try {
|
||||
if (window.jOSPorts && window.jOSPorts.emit)
|
||||
window.jOSPorts.emit('tree', 'term', { slug: slug, name: t.name || slug, glyph: t.glyph || '', discovered: !!first });
|
||||
} catch (e) {}
|
||||
}
|
||||
function go(slug, push) {
|
||||
if (!byId[slug]) return;
|
||||
if (push && cur && cur !== slug) hist.push(cur);
|
||||
cur = slug; render();
|
||||
var first = !seen[slug]; seen[slug] = true;
|
||||
emitTerm(slug, first);
|
||||
}
|
||||
function renderCrumb() {
|
||||
elCrumb.innerHTML = hist.slice(-8).map(function (s) {
|
||||
return '<span class="tre__cr" data-go="' + esc(s) + '">' + esc((byId[s] && byId[s].name) || s) + '</span> ›';
|
||||
}).join(' ');
|
||||
}
|
||||
function nodeHtml(slug, cls) {
|
||||
var t = byId[slug]; if (!t) return '';
|
||||
return '<span class="tre__node ' + (cls || '') + '" data-go="' + esc(slug) + '">'
|
||||
+ (t.glyph ? esc(t.glyph) + ' ' : '') + esc(t.name) + '</span>';
|
||||
}
|
||||
function render() {
|
||||
var t = byId[cur]; if (!t) { elBody.innerHTML = '<div class="tre__msg">terme introuvable</div>'; return; }
|
||||
renderCrumb();
|
||||
var outs = outAdj[cur] || [], ins = (inAdj[cur] || []).filter(function (s) { return outs.indexOf(s) === -1; });
|
||||
elBody.innerHTML =
|
||||
(outs.length ? '<div class="tre__up">↑ ce terme mène à</div><div class="tre__ring">' + outs.map(function (s) { return nodeHtml(s); }).join('') + '</div>' : '')
|
||||
+ '<div class="tre__center"><div class="tre__g">' + (t.glyph ? esc(t.glyph) : '◌') + '</div>'
|
||||
+ '<div class="tre__n">' + esc(t.name) + '</div>'
|
||||
+ (t.decomposition ? '<div class="tre__deco">' + esc(t.decomposition) + '</div>' : '')
|
||||
+ (t.definition ? '<div class="tre__def">' + esc(t.definition.replace(/\[\[([a-z0-9\-]+)(?:\|([^\]]*))?\]\]/gi, function (_, s, l) { return l || s; })) + '</div>' : '')
|
||||
+ '<a class="tre__lnk" href="/wiki/' + esc(cur) + '" target="_blank" rel="noopener">→ page wiki</a></div>'
|
||||
+ (ins.length ? '<div class="tre__up">↓ mènent à ce terme</div><div class="tre__ring">' + ins.map(function (s) { return nodeHtml(s, 'in'); }).join('') + '</div>' : '');
|
||||
}
|
||||
|
||||
elBody.addEventListener('click', function (e) { var n = e.target.closest('[data-go]'); if (n) go(n.getAttribute('data-go'), true); });
|
||||
elCrumb.addEventListener('click', function (e) { var n = e.target.closest('[data-go]'); if (n) { var s = n.getAttribute('data-go'); hist = hist.slice(0, hist.indexOf(s)); go(s, false); } });
|
||||
elF.addEventListener('change', function () {
|
||||
var v = elF.value.trim().toLowerCase().replace(/\s+/g, '-');
|
||||
if (byId[v]) { go(v, true); elF.value = ''; return; }
|
||||
var hit = Object.keys(byId).find(function (s) { return (byId[s].name || '').toLowerCase() === elF.value.trim().toLowerCase(); });
|
||||
if (hit) { go(hit, true); elF.value = ''; }
|
||||
});
|
||||
|
||||
// IN center : recentrer la carte égocentrique sur un terme (fil dictionnaire.term → tree.center).
|
||||
function centerOn(p) {
|
||||
if (!p || typeof p !== 'object') return;
|
||||
var s = String(p.slug || p.term || '').trim().toLowerCase().replace(/\s+/g, '-');
|
||||
if (s && byId[s]) { go(s, true); return; }
|
||||
var nm = String(p.name || p.term || p.slug || '').trim().toLowerCase();
|
||||
if (!nm) return;
|
||||
var hit = Object.keys(byId).find(function (k) { return (byId[k].name || '').toLowerCase() === nm; });
|
||||
if (hit) go(hit, true);
|
||||
}
|
||||
try {
|
||||
if (window.jOSPorts && window.jOSPorts.on)
|
||||
offCenter = window.jOSPorts.on('ploxion.tree.center', function (p) {
|
||||
if (!alive) return;
|
||||
if (!loaded) { pendingCenter = p; return; }
|
||||
centerOn(p);
|
||||
});
|
||||
} catch (e) {}
|
||||
|
||||
fetch(url, { headers: { Accept: 'application/json' }, signal: ac && ac.signal })
|
||||
.then(function (r) { if (!r.ok) throw new Error('http ' + r.status); return r.json(); })
|
||||
.then(function (d) {
|
||||
if (!alive) return;
|
||||
var terms = (d && d.terms) || []; build(terms);
|
||||
elDl.innerHTML = terms.map(function (t) { return '<option value="' + esc(t.name) + '">'; }).join('');
|
||||
// centre de départ : un terme cœur s'il existe, sinon le + connecté.
|
||||
var seed = ['ion', 'bion', 'tsoin', 'xerboxion', 'ploxion'].find(function (s) { return byId[s]; });
|
||||
if (!seed) seed = Object.keys(byId).sort(function (a, b) { return (outAdj[b].length + (inAdj[b] || []).length) - (outAdj[a].length + (inAdj[a] || []).length); })[0];
|
||||
loaded = true;
|
||||
if (pendingCenter) { var pc = pendingCenter; pendingCenter = null; centerOn(pc); }
|
||||
if (!cur) { if (seed) go(seed, false); else elBody.innerHTML = '<div class="tre__msg">lexique vide</div>'; }
|
||||
})
|
||||
.catch(function () { if (alive) elBody.innerHTML = '<div class="tre__msg">lexique hors ligne</div>'; });
|
||||
|
||||
return { unmount: function () { alive = false; LIVE = null; if (offCenter) try { offCenter(); } catch (e) {} if (ac) try { ac.abort(); } catch (e) {} container.innerHTML = ''; } };
|
||||
}
|
||||
|
||||
window.jOSApps = window.jOSApps || {};
|
||||
window.jOSApps['tree'] = { manifest: { id: 'tree', name: 'Arbre', icon: '🌳' }, mount: mount, describe: describe };
|
||||
})();
|
||||
</script>
|
||||
Loading…
Reference in New Issue
Block a user