feat(bibliotheque): étape D, la page /bibliotheque (VueFiches en Mixte, GrapheConnaissances par un second adaptateur, axes thème, époque, auteur ; disposition radiale amorcée au cache du graphe), le module de build et la route de la fiche au clic ; /rag et le commutateur mènent à /bibliotheque, /media intact

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Jules
2026-11-19 08:30:03 +01:00
co-authored by Claude Opus 5.5
parent 370d23e8b9
commit 52384ded3c
8 changed files with 650 additions and 11 deletions
+17 -3
View File
@@ -127,6 +127,13 @@ const A = await charger('utils', 'bibliotheque', 'arbre.ts')
const G = await jiti.import(join(racine, 'utils', 'connaissances', 'graphe.ts'))
ok(!!A, 'utils/bibliotheque/arbre.ts existe')
ok(typeof G.amorcer === 'function', 'graphe.ts : amorcer (une disposition calculée entre au cache)')
if (typeof G.amorcer === 'function') {
const nd = [{ id: 'a', libelle: 'A', kind: 'axe' }, { id: 'b', libelle: 'B', kind: 'reference' }]
const ln = [{ de: 'b', vers: 'a', type: 't', provenance: 'source' }]
const p = new Map([['a', { x: 0.3, y: 0.1 }], ['b', { x: -0.2, y: 0.4 }]])
G.amorcer(nd, ln, new Set(['axe', 'fiche']), p)
ok(G.disposerEnCache(nd, ln, new Set(['axe', 'fiche'])) === p && G.disposerEnCache(nd, ln, new Set(['concept'])) !== p, 'graphe.ts : la disposition amorcée est rendue telle quelle, pour la même signature seulement')
}
if (A && ex) {
const arbre = A.arbreServi(ex, new Set(ex.oeuvres.filter((o) => o.fiche).slice(0, 3).map((o) => o.fiche)))
ok(arbre.oeuvres.filter((o) => o.fiche).length === 3, 'arbre servi : une fiche seulement si son socle est servi')
@@ -135,10 +142,17 @@ if (A && ex) {
for (const axe of ['theme', 'epoque', 'auteur']) {
const g = A.grapheAxe(arbre, axe, [])
ok(g.noeuds.every((x) => x.kind === 'axe') && g.noeuds.length >= 12, `graphe ${axe} : sans focus, les catégories seules (${g.noeuds.length})`)
const cat = g.noeuds[0].id
const g2 = A.grapheAxe(arbre, axe, [cat])
const cat = A.lireIdCategorie(g.noeuds[0].id)
const g2 = A.grapheAxe(arbre, axe, [cat.valeur])
const oe = g2.noeuds.filter((x) => x.kind !== 'axe')
ok(oe.length > 0 && g2.liens.every((l) => l.vers.startsWith('axe:')), `graphe ${axe} : une catégorie ouverte montre ses œuvres (${oe.length})`)
ok(oe.length > 0 && oe.length <= A.MAX_OEUVRES && g2.liens.every((l) => l.vers.startsWith('axe:')), `graphe ${axe} : une catégorie ouverte montre ses œuvres (${oe.length}, ${g2.masquees} dans la liste seulement)`)
const derniere = A.categories(arbre, axe).find((c) => c.valeur === cat.valeur).oeuvres.at(-1)
const g3 = A.grapheAxe(arbre, axe, [cat.valeur], null, derniere.id)
ok(g3.noeuds.some((x) => x.id === derniere.id), `graphe ${axe} : l'œuvre ouverte est toujours dans le graphe, même au-delà de ${A.MAX_OEUVRES}`)
const pos = A.disposerArbre(g2.noeuds, g2.liens)
const c0 = pos.get(g.noeuds[0].id)
const dist = oe.map((x) => Math.hypot(pos.get(x.id).x - c0.x, pos.get(x.id).y - c0.y))
ok(g2.noeuds.every((x) => Number.isFinite(pos.get(x.id)?.x)) && dist.every((d) => d > 0.1 && d < 0.25), `graphe ${axe} : les œuvres en anneaux autour de la catégorie ouverte (distance ${Math.min(...dist).toFixed(2)} à ${Math.max(...dist).toFixed(2)})`)
}
}