Retours de Jules du 27/10, n° 4 et 5.
- useVueFiches : troisième paramètre optionnel { etatDefaut } ; l'état rendu sort dans
vueRendue (pure, testée). Sans option, comportement inchangé ; l'URL (vue=) prime.
- VueFiches : prop navigationLineaire (vrai par défaut) qui masque Précédente / Suivante
et le rang ; les flèches ← → et le balayage restent.
- /connaissances : etatDefaut 'carte' (libellé « Graphe »), navigationLineaire false.
- test-vue-fiches : 80 → 89 cas.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PWGVn1RZVsSd6YYS1o7CHk
317 lines
16 KiB
Vue
317 lines
16 KiB
Vue
<!--
|
||
/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="sr-only"> (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"
|
||
:navigation-lineaire="false"
|
||
>
|
||
<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="objetOuvert" class="cf">
|
||
<p class="cf__nature">{{ LIBELLES_NATURE[objetOuvert.nature] }}</p>
|
||
<h2 class="cf__titre">{{ objetOuvert.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="objetOuvert.nature === 'concept'">
|
||
<p class="cf__definition">{{ objetOuvert.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="objetOuvert.date_original">
|
||
<dt>{{ objetOuvert.date_original_nature === 'vue' ? 'En ligne au' : 'Date de l’original' }}</dt>
|
||
<dd>
|
||
{{ dateFr(objetOuvert.date_original) }}
|
||
<span v-if="objetOuvert.date_original_nature === 'vue'" class="cf__discret">(aucune date affichée)</span>
|
||
</dd>
|
||
</template>
|
||
<template v-if="objetOuvert.statut">
|
||
<dt>Statut</dt>
|
||
<dd>{{ objetOuvert.statut }}</dd>
|
||
</template>
|
||
<template v-if="objetOuvert.url_canonique">
|
||
<dt>Adresse</dt>
|
||
<dd>
|
||
<a :href="String(objetOuvert.url_canonique)" target="_blank" rel="noopener noreferrer" class="cf__lien">{{ urlCourte(String(objetOuvert.url_canonique)) }}<span aria-hidden="true"> ↗</span><span class="sr-only"> (nouvel onglet)</span></a>
|
||
</dd>
|
||
</template>
|
||
</dl>
|
||
|
||
<!-- Sources d'un concept -->
|
||
<section v-if="sourcesOuvertes.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 sourcesOuvertes" :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="sr-only"> vers {{ s.nom_canonique }} (nouvel onglet)</span>
|
||
</a>
|
||
</li>
|
||
</ul>
|
||
</section>
|
||
|
||
<!-- Relations typées, avec leur provenance -->
|
||
<section v-if="relationsOuvertes.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 relationsOuvertes" :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="objetOuvert.registre_id" class="cf__registre">
|
||
Renvoie au registre des œuvres : <code>{{ objetOuvert.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="objetOuvert.credit">Crédit : {{ objetOuvert.credit }}</p>
|
||
<p v-if="objetOuvert.nature === 'concept'">Cette fiche : {{ jeu.licence_couche }}, couche de connaissances AEP.</p>
|
||
<p v-else-if="objetOuvert.licence">Licence de l’original : {{ objetOuvert.licence }}.</p>
|
||
<template v-if="dettesOuvertes.length">
|
||
<p class="cf__dettes-titre">Dettes non créditées par la source :</p>
|
||
<ul class="cf__dettes">
|
||
<li v-for="d in dettesOuvertes" :key="d">{{ d }}</li>
|
||
</ul>
|
||
</template>
|
||
<template v-if="vacancesOuvertes.length">
|
||
<p class="cf__dettes-titre">Ce qu’on n’a pas trouvé :</p>
|
||
<ul class="cf__dettes">
|
||
<li v-for="v in vacancesOuvertes" :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 type { JeuConnaissances, ObjetConnaissance } from '~/utils/connaissances/valider'
|
||
import { lecture, estRendu, sourcesDe, relationsDe, dettesDe, vacancesDe } from '~/utils/connaissances/lire'
|
||
import { NATURES, ECHELLES, COUCHES, LIBELLES_NATURE, LIBELLES_COUCHE, type Nature } from '~/utils/connaissances/vocabulaire'
|
||
import { fichesConnaissances, grapheConnaissances, valeurPorteur } from '~/composables/useFicheAdapter'
|
||
|
||
// Données au build : import statique de la fixture B18 (B20 branchera /api/connaissances).
|
||
const jeu = jeuBrut as unknown as JeuConnaissances
|
||
const lu = lecture(jeu)
|
||
|
||
const fiches = fichesConnaissances(jeu)
|
||
const graphe = grapheConnaissances(jeu)
|
||
const nbConcepts = [...lu.rendus.values()].filter((o) => o.nature === 'concept').length
|
||
|
||
// ── Configuration de la vue fiches : nature, échelle, porteur, couche ──
|
||
// Ordre d'affichage des natures : les concepts d'abord (le vocabulaire les tient dans l'ordre du schéma).
|
||
const ORDRE_NATURES: Nature[] = ['concept', ...NATURES.filter((n) => n !== 'concept')]
|
||
const presentes = (dim: string) => new Set(fiches.flatMap((f) => f.etiquettes?.[dim] ?? []))
|
||
const config: ConfigVueFiches = {
|
||
dimensions: [
|
||
{ cle: 'nature', libelle: 'Nature', variante: 'fonction', valeurs: ORDRE_NATURES.filter((n) => presentes('nature').has(n)).map((n) => ({ valeur: n, libelle: LIBELLES_NATURE[n] })) },
|
||
{ cle: 'echelle', libelle: 'Échelle', variante: 'echelle', valeurs: ECHELLES.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: COUCHES.filter((c) => presentes('couche').has(c)).map((c) => ({ valeur: c, libelle: LIBELLES_COUCHE[c] })) },
|
||
],
|
||
tris: ['nom', 'recent', 'pertinence'],
|
||
triDefaut: 'nom',
|
||
groupes: [
|
||
{ cle: 'nature', libelle: 'Nature', dimension: 'nature', sans: 'Sans nature' },
|
||
],
|
||
etats: ['carte', 'mixte', 'fiches'],
|
||
}
|
||
|
||
// Retour de Jules du 27/10 n° 4 : « je laisserais l’échelle du graphe par défaut ». L’URL (vue=) prime.
|
||
const vf = useVueFiches(fiches, config, { etatDefaut: 'carte' })
|
||
|
||
// ── Détail : l'objet de la fiche ouverte, typé, lu une fois par fiche (utils/connaissances/lire.ts) ──
|
||
const objetOuvert = computed<ObjetConnaissance | undefined>(() => (vf.ficheOuverte ? lu.rendus.get(String(vf.ficheOuverte.id)) : undefined))
|
||
const sourcesOuvertes = computed(() => (objetOuvert.value ? sourcesDe(lu, objetOuvert.value.id) : []))
|
||
const relationsOuvertes = computed(() => (objetOuvert.value ? relationsDe(lu, objetOuvert.value.id) : []))
|
||
const dettesOuvertes = computed(() => dettesDe(objetOuvert.value))
|
||
const vacancesOuvertes = computed(() => vacancesDe(objetOuvert.value))
|
||
|
||
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) 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: var(--fs-lg); 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-decoration: underline; 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; }
|
||
|
||
|
||
/* ── Fiche d'un objet ── */
|
||
.cf { min-width: 0; overflow-wrap: anywhere; }
|
||
.cf p { margin: 0; }
|
||
.cf__nature {
|
||
font-size: var(--fs-xs);
|
||
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: var(--fs-xl); font-weight: var(--fw-bold); line-height: 1.25; }
|
||
.cf__chips { margin-bottom: var(--space-sm); }
|
||
.cf__definition { font-size: var(--fs-base); line-height: 1.55; }
|
||
.cf__mention { margin-top: 2px !important; font-size: var(--fs-xs); 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); 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); font-size: var(--fs-sm); line-height: 1.45; }
|
||
.cf__vers {
|
||
padding: var(--space-2xs) 0;
|
||
min-height: 44px;
|
||
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-decoration: underline; 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: var(--radius-full);
|
||
border: 1px solid var(--border-strong, var(--border));
|
||
font-size: var(--fs-xs);
|
||
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) var(--space-sm); }
|
||
.cn-bandeau { font-size: var(--fs-xs); }
|
||
}
|
||
</style>
|