feat(connaissances): B19 M3 — page /connaissances sur VueFiches (Graphe / Mixte / Fiches, fiche typée, bandeau de la dette de forme)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0179wsewuntMrKBA2s9y7ZeX
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
623584587d
commit
b799c292c8
@@ -0,0 +1,357 @@
|
||||
<!--
|
||||
/connaissances — B19-M3. La couche de connaissances partagées, premier jeu : des concepts
|
||||
reliés à leurs sources (CONCEPTION - couche connaissances partagees (12-10) §6), rendus par
|
||||
la vue fiches (états Graphe / Mixte / Fiches, libellés de B6), le graphe dans #carte, la
|
||||
fiche de l'objet dans #detail. URL partageable : ?vue=mixte&fiche=cpt:holoptisme.
|
||||
|
||||
Données : la fixture de B18, importée au build (aucune route serveur : /api/connaissances
|
||||
est B20). Seuls les objets publiés sont rendus. Rien n'est lu du vault, rien n'est copié de
|
||||
Holosapiens au-delà des titres, URL et dates ; la dette de forme se dit dans le bandeau.
|
||||
-->
|
||||
<template>
|
||||
<main class="cn">
|
||||
<header class="cn-tete">
|
||||
<h1 class="cn-tete__titre">Connaissances partagées</h1>
|
||||
<p class="cn-bandeau">
|
||||
Premier jeu : {{ nombreEnLettres(nbConcepts) }} concepts et leurs sources.
|
||||
La couche se nourrit des ressources proposées par les membres, triées à la main.
|
||||
Navigation inspirée de
|
||||
<a href="https://holosapiens.earth" target="_blank" rel="noopener noreferrer">l’explorateur Holosapiens<span class="cn-sr"> (nouvel onglet)</span></a>
|
||||
(CC BY-SA 4.0).
|
||||
</p>
|
||||
</header>
|
||||
|
||||
<div class="cn-vue">
|
||||
<VueFiches
|
||||
:vf="vf"
|
||||
intention="Des idées nommées, chacune reliée aux textes qui la portent : ouvrez un concept, ses sources s’allument."
|
||||
libelle-recherche="Rechercher un concept, une source…"
|
||||
:libelles-vue="{ carte: 'Graphe' }"
|
||||
:lien-page="() => null"
|
||||
>
|
||||
<template #carte>
|
||||
<GrapheConnaissances
|
||||
:noeuds="graphe.noeuds"
|
||||
:liens="graphe.liens"
|
||||
:selection="vf.ficheId"
|
||||
:survol="vf.survolId != null ? String(vf.survolId) : null"
|
||||
:retenus="vf.idsResultat"
|
||||
:libelle-kind="(k: string) => LIBELLES_NATURE[k as Nature]?.toLowerCase() ?? k"
|
||||
titre="Graphe des concepts et de leurs sources"
|
||||
@select="(id: string) => vf.ouvrirFiche(id)"
|
||||
@survol="(id: string | null) => (vf.survolId = id)"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<template #detail="{ fiche, filtrer }">
|
||||
<article v-if="objetDe(fiche.id)" class="cf">
|
||||
<p class="cf__nature">{{ LIBELLES_NATURE[objetDe(fiche.id)!.nature] }}</p>
|
||||
<h2 class="cf__titre">{{ objetDe(fiche.id)!.nom_canonique }}</h2>
|
||||
|
||||
<ChipGroup v-if="fiche.etiquettes?.echelle?.length" :aria-label="`Échelles de ${fiche.nom}`" class="cf__chips">
|
||||
<Chip
|
||||
v-for="e in fiche.etiquettes.echelle"
|
||||
:key="e"
|
||||
:label="e"
|
||||
variant="echelle"
|
||||
:active="(vf.etat.filtres.echelle ?? []).includes(e)"
|
||||
:aria-label="`Filtrer par échelle : ${e}`"
|
||||
@toggle="filtrer('echelle', e)"
|
||||
/>
|
||||
</ChipGroup>
|
||||
|
||||
<!-- Concept : la définition, dans nos mots -->
|
||||
<template v-if="objetDe(fiche.id)!.nature === 'concept'">
|
||||
<p class="cf__definition">{{ objetDe(fiche.id)!.definition_courte }}</p>
|
||||
<p class="cf__mention">Définition écrite par AEP, dans ses mots.</p>
|
||||
</template>
|
||||
|
||||
<!-- Objet : date de l'original, lien sortant -->
|
||||
<dl v-else class="cf__faits">
|
||||
<template v-if="objetDe(fiche.id)!.date_original">
|
||||
<dt>{{ objetDe(fiche.id)!.date_original_nature === 'vue' ? 'En ligne au' : 'Date de l’original' }}</dt>
|
||||
<dd>
|
||||
{{ dateFr(objetDe(fiche.id)!.date_original) }}
|
||||
<span v-if="objetDe(fiche.id)!.date_original_nature === 'vue'" class="cf__discret">(aucune date affichée)</span>
|
||||
</dd>
|
||||
</template>
|
||||
<template v-if="objetDe(fiche.id)!.statut">
|
||||
<dt>Statut</dt>
|
||||
<dd>{{ objetDe(fiche.id)!.statut }}</dd>
|
||||
</template>
|
||||
<template v-if="objetDe(fiche.id)!.url_canonique">
|
||||
<dt>Adresse</dt>
|
||||
<dd>
|
||||
<a :href="String(objetDe(fiche.id)!.url_canonique)" target="_blank" rel="noopener noreferrer" class="cf__lien">{{ urlCourte(String(objetDe(fiche.id)!.url_canonique)) }}<span aria-hidden="true"> ↗</span><span class="cn-sr"> (nouvel onglet)</span></a>
|
||||
</dd>
|
||||
</template>
|
||||
</dl>
|
||||
|
||||
<!-- Sources d'un concept -->
|
||||
<section v-if="sourcesDe(fiche.id).length" class="cf__bloc" :aria-labelledby="`cf-sources-${idDom(fiche.id)}`">
|
||||
<h3 :id="`cf-sources-${idDom(fiche.id)}`" class="cf__soustitre">Sources</h3>
|
||||
<ul class="cf__liste">
|
||||
<li v-for="s in sourcesDe(fiche.id)" :key="s.id" class="cf__source">
|
||||
<button v-if="estRendu(s)" type="button" class="cf__vers" @click="vf.ouvrirFiche(s.id)">{{ s.nom_canonique }}</button>
|
||||
<span v-else>{{ s.nom_canonique }}</span>
|
||||
<span class="cf__discret">
|
||||
· {{ s.date_original ? (s.date_original_nature === 'vue' ? `en ligne au ${dateFr(s.date_original)}` : dateFr(s.date_original)) : 'date à relever' }}
|
||||
<template v-if="!estRendu(s)"> · à creuser</template>
|
||||
</span>
|
||||
<a v-if="s.url_canonique" :href="String(s.url_canonique)" target="_blank" rel="noopener noreferrer" class="cf__lien cf__lien--ext">
|
||||
lien<span aria-hidden="true"> ↗</span><span class="cn-sr"> vers {{ s.nom_canonique }} (nouvel onglet)</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<!-- Relations typées, avec leur provenance -->
|
||||
<section v-if="relationsDe(fiche.id).length" class="cf__bloc" :aria-labelledby="`cf-rel-${idDom(fiche.id)}`">
|
||||
<h3 :id="`cf-rel-${idDom(fiche.id)}`" class="cf__soustitre">Relations</h3>
|
||||
<ul class="cf__liste">
|
||||
<li v-for="r in relationsDe(fiche.id)" :key="r.cle" class="cf__relation">
|
||||
<span class="cf__type">{{ r.libelle }}</span>
|
||||
<button v-if="r.cible && estRendu(r.cible)" type="button" class="cf__vers" @click="vf.ouvrirFiche(r.cible.id)">{{ r.cible.nom_canonique }}</button>
|
||||
<span v-else-if="r.cible">{{ r.cible.nom_canonique }} <span class="cf__discret">(non publié)</span></span>
|
||||
<span class="cf__provenance" :class="`cf__provenance--${r.provenance}`">{{ r.provenance === 'source' ? 'énoncé par la source' : 'posé par AEP' }}</span>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<p v-if="objetDe(fiche.id)!.registre_id" class="cf__registre">
|
||||
Renvoie au registre des œuvres : <code>{{ objetDe(fiche.id)!.registre_id }}</code>
|
||||
</p>
|
||||
|
||||
<!-- Crédit, licence, dettes -->
|
||||
<section class="cf__bloc cf__credit" :aria-labelledby="`cf-credit-${idDom(fiche.id)}`">
|
||||
<h3 :id="`cf-credit-${idDom(fiche.id)}`" class="cf__soustitre">Crédit et licence</h3>
|
||||
<p v-if="objetDe(fiche.id)!.credit">Crédit : {{ objetDe(fiche.id)!.credit }}</p>
|
||||
<p v-if="objetDe(fiche.id)!.nature === 'concept'">Cette fiche : {{ jeu.licence_couche }}, couche de connaissances AEP.</p>
|
||||
<p v-else-if="objetDe(fiche.id)!.licence">Licence de l’original : {{ objetDe(fiche.id)!.licence }}.</p>
|
||||
<template v-if="dettesDe(fiche.id).length">
|
||||
<p class="cf__dettes-titre">Dettes non créditées par la source :</p>
|
||||
<ul class="cf__dettes">
|
||||
<li v-for="d in dettesDe(fiche.id)" :key="d">{{ d }}</li>
|
||||
</ul>
|
||||
</template>
|
||||
<template v-if="vacancesDe(fiche.id).length">
|
||||
<p class="cf__dettes-titre">Ce qu’on n’a pas trouvé :</p>
|
||||
<ul class="cf__dettes">
|
||||
<li v-for="v in vacancesDe(fiche.id)" :key="v.enonce">{{ v.enonce }} <span class="cf__discret">(constaté le {{ dateFr(v.date) }})</span></li>
|
||||
</ul>
|
||||
</template>
|
||||
</section>
|
||||
</article>
|
||||
</template>
|
||||
</VueFiches>
|
||||
</div>
|
||||
</main>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import jeuBrut from '~/data/connaissances/fixture-lot2.json'
|
||||
import type { ConfigVueFiches } from '~/utils/vueFiches'
|
||||
import {
|
||||
fichesConnaissances, grapheConnaissances, estRendu, valeurPorteur, LIBELLES_NATURE,
|
||||
type JeuCouche, type ObjetCouche,
|
||||
} from '~/composables/useFicheAdapter'
|
||||
|
||||
type Nature = ObjetCouche['nature']
|
||||
|
||||
// Données au build : import statique de la fixture B18 (B20 branchera /api/connaissances).
|
||||
const jeu = jeuBrut as unknown as JeuCouche & { licence_couche: string }
|
||||
const parId = new Map(jeu.objets.map((o) => [o.id, o]))
|
||||
const objetDe = (id: string | number) => parId.get(String(id)) as (ObjetCouche & Record<string, any>) | undefined
|
||||
|
||||
const fiches = fichesConnaissances(jeu)
|
||||
const graphe = grapheConnaissances(jeu)
|
||||
const nbConcepts = jeu.objets.filter((o) => o.nature === 'concept' && estRendu(o)).length
|
||||
|
||||
// ── Configuration de la vue fiches : nature, échelle, porteur, couche ──
|
||||
const NATURES: Nature[] = ['concept', 'texte', 'organisation', 'outil']
|
||||
const presentes = (dim: string) => new Set(fiches.flatMap((f) => f.etiquettes?.[dim] ?? []))
|
||||
const config: ConfigVueFiches = {
|
||||
dimensions: [
|
||||
{ cle: 'nature', libelle: 'Nature', variante: 'fonction', valeurs: NATURES.filter((n) => presentes('nature').has(n)).map((n) => ({ valeur: n, libelle: LIBELLES_NATURE[n] })) },
|
||||
{ cle: 'echelle', libelle: 'Échelle', variante: 'echelle', valeurs: ['S', 'M', 'XL'].filter((e) => presentes('echelle').has(e)).map((e) => ({ valeur: e, libelle: e })) },
|
||||
{
|
||||
cle: 'porteur',
|
||||
libelle: 'Porteur',
|
||||
variante: 'posture',
|
||||
valeurs: jeu.objets
|
||||
.filter((o) => o.nature === 'organisation' && estRendu(o) && presentes('porteur').has(valeurPorteur(o.id)))
|
||||
.map((o) => ({ valeur: valeurPorteur(o.id), libelle: o.nom_canonique })),
|
||||
},
|
||||
{ cle: 'couche', libelle: 'Couche', variante: 'echelle', valeurs: ['socle', 'actualite'].filter((c) => presentes('couche').has(c)).map((c) => ({ valeur: c, libelle: c === 'socle' ? 'Socle' : 'Actualité' })) },
|
||||
],
|
||||
tris: ['nom', 'recent', 'pertinence'],
|
||||
triDefaut: 'nom',
|
||||
groupes: [
|
||||
{ cle: 'nature', libelle: 'Nature', dimension: 'nature', sans: 'Sans nature' },
|
||||
],
|
||||
etats: ['carte', 'mixte', 'fiches'],
|
||||
}
|
||||
|
||||
const vf = useVueFiches(fiches, config)
|
||||
|
||||
// ── Détail ──
|
||||
const LIBELLES_RELATION: Record<string, [string, string]> = {
|
||||
extrait_de: ['extrait de', 'source de'],
|
||||
porte_par: ['porté par', 'porte'],
|
||||
republication_de: ['republication de', 'republié par'],
|
||||
meme_objet_que: ['même objet que', 'même objet que'],
|
||||
recoupe: ['recoupe', 'recoupe'],
|
||||
precise: ['précise', 'précisé par'],
|
||||
contredit: ['contredit', 'contredit par'],
|
||||
condition_de: ['condition de', 'a pour condition'],
|
||||
homonyme_de: ['homonyme de, fusion refusée :', 'homonyme de, fusion refusée :'],
|
||||
}
|
||||
|
||||
/** Sources d'un concept (extrait_de), publiées ou non : une source à creuser se dit, elle ne disparaît pas. */
|
||||
function sourcesDe(id: string | number) {
|
||||
return jeu.relations
|
||||
.filter((r) => r.type === 'extrait_de' && r.de === String(id))
|
||||
.map((r) => objetDe(r.vers))
|
||||
.filter((o): o is ObjetCouche & Record<string, any> => !!o && o.etat !== 'ecarte')
|
||||
}
|
||||
|
||||
/** Relations de l'objet, sauf ses sources (au-dessus) et le registre (une autre base, pas un nœud de la couche). */
|
||||
function relationsDe(id: string | number) {
|
||||
const i = String(id)
|
||||
const out: { cle: string; libelle: string; cible: (ObjetCouche & Record<string, any>) | undefined; provenance: string }[] = []
|
||||
jeu.relations.forEach((r, k) => {
|
||||
if (r.etat === 'ecarte' || r.type === 'renvoie_a' || !LIBELLES_RELATION[r.type]) return
|
||||
if (r.de === i && r.type === 'extrait_de') return
|
||||
const sens = r.de === i ? 0 : r.vers === i ? 1 : -1
|
||||
if (sens < 0) return
|
||||
const cible = objetDe(sens === 0 ? r.vers : r.de)
|
||||
if (!cible || cible.etat === 'ecarte') return
|
||||
out.push({ cle: `${k}`, libelle: LIBELLES_RELATION[r.type][sens], cible, provenance: r.provenance })
|
||||
})
|
||||
return out
|
||||
}
|
||||
|
||||
const dettesDe = (id: string | number) => (objetDe(id)?.dettes_non_creditees as string[] | undefined) ?? []
|
||||
const vacancesDe = (id: string | number) => (objetDe(id)?.vacances as { enonce: string; date: string }[] | undefined) ?? []
|
||||
|
||||
const MOIS = ['janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre', 'octobre', 'novembre', 'décembre']
|
||||
function dateFr(d: unknown): string {
|
||||
const [a, m, j] = String(d ?? '').split('-')
|
||||
if (!a) return ''
|
||||
if (!m) return a
|
||||
if (!j) return `${MOIS[Number(m) - 1]} ${a}`
|
||||
return `${Number(j)} ${MOIS[Number(m) - 1]} ${a}`
|
||||
}
|
||||
const urlCourte = (u: string) => u.replace(/^https?:\/\//, '').replace(/\/$/, '')
|
||||
const idDom = (id: string | number) => String(id).replace(/[^a-z0-9-]/gi, '-')
|
||||
|
||||
const NOMBRES = ['zéro', 'un', 'deux', 'trois', 'quatre', 'cinq', 'six', 'sept', 'huit', 'neuf', 'dix', 'onze', 'douze']
|
||||
const nombreEnLettres = (n: number) => NOMBRES[n] ?? String(n)
|
||||
|
||||
useSeoMeta({
|
||||
title: () => (vf.ficheOuverte ? `${vf.ficheOuverte.nom} — Connaissances partagées — AEP` : 'Connaissances partagées — AEP'),
|
||||
description: 'Des concepts reliés à leurs sources, triés à la main : le premier jeu de la couche de connaissances partagées d’AEP, en graphe et en fiches.',
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/* La vue fiches remplit la hauteur du conteneur de défilement (app.vue), comme /outils « Partir de soi ». */
|
||||
.cn {
|
||||
height: 100%;
|
||||
min-height: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
color: var(--text);
|
||||
}
|
||||
.cn-tete {
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: baseline;
|
||||
gap: var(--space-2xs, 0.25rem) var(--space-md);
|
||||
padding: var(--space-xs) var(--space-md);
|
||||
border-bottom: 1px solid var(--border);
|
||||
background: var(--surface);
|
||||
}
|
||||
.cn-tete__titre { margin: 0; font-size: 1.25rem; font-weight: var(--fw-bold); line-height: 1.25; }
|
||||
.cn-bandeau {
|
||||
flex: 1 1 32rem;
|
||||
min-width: 0;
|
||||
margin: 0;
|
||||
font-size: var(--fs-sm);
|
||||
line-height: 1.45;
|
||||
color: color-mix(in srgb, var(--text) 82%, transparent);
|
||||
}
|
||||
.cn-bandeau a { color: var(--text); text-underline-offset: 2px; }
|
||||
.cn-bandeau a:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; border-radius: var(--radius-sm); }
|
||||
.cn-vue { flex: 1 1 0; min-height: 0; min-width: 0; }
|
||||
|
||||
.cn-sr {
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
overflow: hidden;
|
||||
clip: rect(0, 0, 0, 0);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* ── Fiche d'un objet ── */
|
||||
.cf { min-width: 0; overflow-wrap: anywhere; }
|
||||
.cf p { margin: 0; }
|
||||
.cf__nature {
|
||||
font-size: var(--fs-xs, 0.75rem);
|
||||
font-weight: var(--fw-semibold);
|
||||
letter-spacing: 0.04em;
|
||||
text-transform: uppercase;
|
||||
color: color-mix(in srgb, var(--text) 78%, transparent);
|
||||
}
|
||||
.cf__titre { margin: 2px 0 var(--space-xs); font-size: 1.25rem; font-weight: var(--fw-bold); line-height: 1.25; }
|
||||
.cf__chips { margin-bottom: var(--space-sm); }
|
||||
.cf__definition { font-size: 1rem; line-height: 1.55; }
|
||||
.cf__mention { margin-top: 2px !important; font-size: var(--fs-xs, 0.75rem); color: color-mix(in srgb, var(--text) 78%, transparent); }
|
||||
.cf__faits { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px var(--space-sm); margin: 0; font-size: var(--fs-sm); }
|
||||
.cf__faits dt { font-weight: var(--fw-semibold); }
|
||||
.cf__faits dd { margin: 0; min-width: 0; }
|
||||
.cf__bloc { margin-top: var(--space-md); }
|
||||
.cf__soustitre { margin: 0 0 var(--space-2xs, 0.25rem); font-size: var(--fs-sm); font-weight: var(--fw-bold); }
|
||||
.cf__liste { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2xs, 0.25rem); font-size: var(--fs-sm); line-height: 1.45; }
|
||||
.cf__vers {
|
||||
padding: 0;
|
||||
border: none;
|
||||
background: none;
|
||||
color: var(--text);
|
||||
font: inherit;
|
||||
font-weight: var(--fw-semibold);
|
||||
text-align: left;
|
||||
text-decoration: underline;
|
||||
text-underline-offset: 2px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.cf__lien { color: var(--text); text-underline-offset: 2px; }
|
||||
.cf__lien--ext { margin-left: 4px; }
|
||||
.cf__vers:focus-visible,
|
||||
.cf__lien:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; border-radius: var(--radius-sm); }
|
||||
.cf__discret { color: color-mix(in srgb, var(--text) 78%, transparent); }
|
||||
.cf__type { margin-right: 4px; }
|
||||
.cf__provenance {
|
||||
display: inline-block;
|
||||
margin-left: 6px;
|
||||
padding: 0 6px;
|
||||
border-radius: 999px;
|
||||
border: 1px solid var(--border-strong, var(--border));
|
||||
font-size: var(--fs-xs, 0.75rem);
|
||||
color: color-mix(in srgb, var(--text) 82%, transparent);
|
||||
}
|
||||
.cf__provenance--curation { border-style: dashed; }
|
||||
.cf__registre { margin-top: var(--space-sm) !important; font-size: var(--fs-sm); }
|
||||
.cf__credit { font-size: var(--fs-sm); line-height: 1.5; }
|
||||
.cf__dettes-titre { margin-top: var(--space-xs) !important; font-weight: var(--fw-semibold); }
|
||||
.cf__dettes { margin: 2px 0 0; padding-left: 1.1rem; }
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.cn-tete { padding: var(--space-2xs, 0.25rem) var(--space-sm); }
|
||||
.cn-tete__titre { font-size: 1.1rem; }
|
||||
.cn-bandeau { font-size: var(--fs-xs, 0.75rem); }
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user