v2 : les 14 écrans — le tour complet de la démocratie d'exercice

- Aujourd'hui (Fil 13 sections + capture sticky) + Le chemin (tunnel 2 gestes,
  Q0 inline, 3 chips, dérogation asymétrique, alternatives réglage/consignation)
- Registre + fiche décision (timeline, périmètre premier/second lieu auditable,
  affluence non-ignorable, S'instruire condensé, éléments + cartographie de
  clôture, épreuve du réel, Remettre en question, PV A4, gravure)
- Salle de vote 5 modalités (consentement, nuancé+histogramme, binaire hérité
  avec jauge inertielle, Réglage collectif complet — faisceau, médiane basse,
  Pour moi, Explorer, cristallisation-geste —, élection à départage humain)
- Textes (Pacte en clair, document vivant, diff, vue projetée, Atelier des
  formules porté du v1 sur le moteur unique) + Mandats (faits comptés, feux
  de la rampe, wizard 3 étapes) + Observatoire (consigner→observer→protocoliser)
- Onboarding 7 gabarits + Données locales (export/import, attributs, atelier)
- voting→framing gardé (Reformuler d'un réglage figé non cristallisé)
- Pages v1 supprimées (login, documents, mandates, protocols, sanctuary,
  tools, decisions/new) — 342 tests verts, build zéro erreur

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Yvv
2026-08-11 13:47:20 +02:00
co-authored by Claude Fable 5
parent d886302b59
commit e164b5f6c1
96 changed files with 14097 additions and 11777 deletions
@@ -0,0 +1,254 @@
<script setup lang="ts">
/**
* /donnees §1 — les collectifs de cette machine : export JSON (<slug>-<date>.json),
* suppression de la copie locale (confirmation), collectif actif marqué, lignée.
*/
import { useCollectiveStore } from '~/stores/collective'
import type { CollectiveIndexEntry } from '~/stores/collective'
import { loadState, toBundle } from '~/data/persistence'
import { LINEAGE_PREFIX } from '~/lexicon'
const store = useCollectiveStore()
const confirmEntry = ref<CollectiveIndexEntry | null>(null)
const confirmOpen = computed({
get: () => confirmEntry.value !== null,
set: (open: boolean) => {
if (!open) confirmEntry.value = null
},
})
const activeLineage = computed(() => store.current?.collective.lineage ?? null)
async function exportEntry(entry: CollectiveIndexEntry) {
const now = new Date().toISOString()
let json: string | null = null
if (entry.id === store.activeId) {
json = store.exportJson()
} else {
const state = await loadState(entry.id)
if (state) json = JSON.stringify(toBundle(state, now), null, 2)
}
if (!json) return
const blob = new Blob([json], { type: 'application/json' })
const url = URL.createObjectURL(blob)
const a = document.createElement('a')
a.href = url
a.download = `${entry.slug}-${now.slice(0, 10)}.json`
a.click()
URL.revokeObjectURL(url)
}
async function removeConfirmed() {
if (!confirmEntry.value) return
await store.removeCollective(confirmEntry.value.id)
confirmEntry.value = null
}
</script>
<template>
<!-- ld-v2 -->
<section class="ld-card data-card">
<h2 class="data-card__title">
<UIcon name="i-lucide-database" /> Collectifs sur cette machine
</h2>
<div v-if="!store.index.length" class="data-card__empty">
<p>Aucun collectif ici pour l'instant.</p>
<NuxtLink to="/creer" class="ld-btn ld-btn--ghost">
<UIcon name="i-lucide-sparkles" /> Créer un collectif
</NuxtLink>
</div>
<ul v-else class="col-list">
<li v-for="entry in store.index" :key="entry.id" class="col-row">
<span class="col-row__dot" :style="{ background: entry.color }" />
<span class="col-row__main">
<span class="col-row__name">
{{ entry.name }}
<span v-if="entry.id === store.activeId" class="status-pill status-adopted">actif</span>
</span>
<span class="col-row__slug">{{ entry.slug }}</span>
<span
v-if="entry.id === store.activeId && activeLineage"
class="col-row__lineage"
>
<UIcon name="i-lucide-sprout" /> {{ LINEAGE_PREFIX }} {{ activeLineage.sourceSlug }}
</span>
</span>
<span class="col-row__actions">
<button type="button" class="ld-btn ld-btn--ghost" @click="exportEntry(entry)">
<UIcon name="i-lucide-download" /> Exporter
</button>
<button
type="button"
class="ld-btn ld-btn--quiet col-row__delete"
@click="confirmEntry = entry"
>
<UIcon name="i-lucide-trash-2" /> Supprimer
</button>
</span>
</li>
</ul>
<UModal v-model:open="confirmOpen">
<template #content>
<div class="confirm">
<h3 class="confirm__title">Supprimer « {{ confirmEntry?.name }} » ?</h3>
<p class="confirm__text">
Ce geste supprime uniquement la copie locale, sur cette machine.
Un fichier exporté ou une copie ailleurs n'est pas touché.
</p>
<div class="confirm__actions">
<button type="button" class="ld-btn ld-btn--ghost" @click="confirmEntry = null">
Garder
</button>
<button type="button" class="ld-btn confirm__danger" @click="removeConfirmed">
<UIcon name="i-lucide-trash-2" /> Supprimer la copie locale
</button>
</div>
</div>
</template>
</UModal>
</section>
</template>
<style scoped>
.data-card {
display: flex;
flex-direction: column;
gap: 1rem;
padding: clamp(1rem, 3vw, 1.5rem);
}
.data-card__title {
display: flex;
align-items: center;
gap: 0.5rem;
margin: 0;
font-size: 1.0625rem;
font-weight: 800;
color: var(--mood-text);
}
.data-card__empty {
display: flex;
flex-direction: column;
align-items: flex-start;
gap: 0.75rem;
color: var(--mood-text-muted);
font-size: 0.9375rem;
}
.data-card__empty p { margin: 0; }
.col-list {
display: flex;
flex-direction: column;
gap: 0.5rem;
margin: 0;
padding: 0;
list-style: none;
}
.col-row {
display: flex;
align-items: center;
gap: 0.75rem;
padding: 0.7rem 0.85rem;
border-radius: var(--r-input);
background: var(--mood-bg);
}
.col-row__dot {
width: 0.9rem;
height: 0.9rem;
flex-shrink: 0;
border-radius: 50%;
box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}
.col-row__main {
display: flex;
flex-direction: column;
gap: 0.15rem;
min-width: 0;
flex: 1;
}
.col-row__name {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 0.5rem;
font-weight: 700;
color: var(--mood-text);
}
.col-row__slug {
font-size: 0.8125rem;
color: var(--mood-text-muted);
overflow: hidden;
text-overflow: ellipsis;
}
.col-row__lineage {
display: inline-flex;
align-items: center;
gap: 0.3rem;
font-size: 0.8125rem;
font-style: italic;
color: var(--mood-tertiary);
}
.col-row__actions {
display: flex;
flex-wrap: wrap;
justify-content: flex-end;
gap: 0.4rem;
}
.col-row__delete:hover { color: var(--mood-error); }
.confirm {
display: flex;
flex-direction: column;
gap: 0.875rem;
padding: clamp(1.1rem, 3vw, 1.5rem);
}
.confirm__title {
margin: 0;
font-size: 1.0625rem;
font-weight: 800;
color: var(--mood-text);
}
.confirm__text {
margin: 0;
font-size: 0.9375rem;
line-height: 1.5;
color: var(--mood-text-muted);
}
.confirm__actions {
display: flex;
flex-wrap: wrap;
justify-content: flex-end;
gap: 0.5rem;
}
.confirm__danger {
background: var(--mood-error);
color: #ffffff;
}
@media (max-width: 480px) {
.col-row {
flex-wrap: wrap;
}
.col-row__actions {
width: 100%;
justify-content: flex-start;
}
}
</style>
@@ -0,0 +1,226 @@
<script setup lang="ts">
/**
* /donnees §4 — mon identité locale : prénom (stamp + persist) et mes
* attributs déclarés (clés/valeurs libres — nourrissent la carte « Pour moi »).
*/
import { useCollectiveStore } from '~/stores/collective'
import { ATTRIBUTES_HINT } from '~/lexicon'
const store = useCollectiveStore()
interface AttrRow {
key: string
value: number
}
const nameDraft = ref('')
const rows = ref<AttrRow[]>([])
// Re-seed the drafts only when the person changes (collective switch),
// never on our own commits — an in-progress empty row must survive.
watch(
() => store.me?.id,
() => {
const me = store.me
nameDraft.value = me?.displayName ?? ''
rows.value = Object.entries(me?.attributes ?? {}).map(([key, value]) => ({ key, value }))
},
{ immediate: true },
)
function commitName() {
const me = store.me
if (!me) return
const value = nameDraft.value.trim()
if (!value || value === me.displayName) {
nameDraft.value = me.displayName
return
}
me.displayName = value
store.stamp(me)
store.persist()
}
function commitAttributes() {
const me = store.me
if (!me) return
const attributes: Record<string, number> = {}
for (const row of rows.value) {
const key = row.key.trim()
if (!key) continue
attributes[key] = Number.isFinite(row.value) ? row.value : 0
}
me.attributes = attributes
store.stamp(me)
store.persist()
}
function addRow() {
rows.value.push({ key: '', value: 0 })
}
function removeRow(index: number) {
rows.value.splice(index, 1)
commitAttributes()
}
</script>
<template>
<!-- ld-v2 -->
<section class="ld-card data-card">
<h2 class="data-card__title">
<UIcon name="i-lucide-user-round" /> Mon identité
</h2>
<p v-if="!store.me" class="data-card__empty">
Aucun collectif actif crée ou importe un collectif pour poser ton identité.
</p>
<template v-else>
<label class="field">
<span class="field__label">Comment tu t'appelles ici</span>
<input
v-model="nameDraft"
class="field__input"
type="text"
autocomplete="off"
@change="commitName"
@keydown.enter.prevent="commitName"
>
</label>
<div class="field">
<span class="field__label">Mes attributs</span>
<p class="field__hint">{{ ATTRIBUTES_HINT }}</p>
<ul v-if="rows.length" class="attr-list">
<li v-for="(row, i) in rows" :key="i" class="attr-row">
<input
v-model="row.key"
class="field__input attr-row__key"
type="text"
placeholder="heures/mois"
autocomplete="off"
@change="commitAttributes"
>
<input
v-model.number="row.value"
class="field__input attr-row__value"
type="number"
step="any"
@change="commitAttributes"
>
<button
type="button"
class="attr-row__x"
:aria-label="`Retirer l'attribut ${row.key || i + 1}`"
@click="removeRow(i)"
>
<UIcon name="i-lucide-x" />
</button>
</li>
</ul>
<button type="button" class="ld-btn ld-btn--ghost attr-add" @click="addRow">
<UIcon name="i-lucide-plus" /> Ajouter un attribut
</button>
</div>
</template>
</section>
</template>
<style scoped>
.data-card {
display: flex;
flex-direction: column;
gap: 1rem;
padding: clamp(1rem, 3vw, 1.5rem);
}
.data-card__title {
display: flex;
align-items: center;
gap: 0.5rem;
margin: 0;
font-size: 1.0625rem;
font-weight: 800;
color: var(--mood-text);
}
.data-card__empty {
margin: 0;
font-size: 0.9375rem;
color: var(--mood-text-muted);
}
.field {
display: flex;
flex-direction: column;
gap: 0.5rem;
}
.field__label {
font-size: 0.8125rem;
font-weight: 700;
letter-spacing: 0.04em;
text-transform: uppercase;
color: var(--mood-text-muted);
}
.field__hint {
margin: 0;
font-size: 0.8125rem;
font-style: italic;
color: var(--mood-text-muted);
}
.field__input {
min-height: 2.25rem;
padding: 0.45rem 0.8rem;
font-size: 0.9375rem;
font-weight: 600;
box-shadow: inset 0 0 0 1.5px var(--mood-input-border);
border-radius: var(--r-input);
}
.field__input:focus-visible {
box-shadow: inset 0 0 0 1.5px var(--mood-input-focus), 0 0 0 2.5px var(--mood-accent-soft);
}
.attr-list {
display: flex;
flex-direction: column;
gap: 0.5rem;
margin: 0;
padding: 0;
list-style: none;
}
.attr-row {
display: flex;
align-items: center;
gap: 0.5rem;
}
.attr-row__key { flex: 1; min-width: 0; }
.attr-row__value { width: 6.5rem; flex-shrink: 0; }
.attr-row__x {
display: inline-flex;
align-items: center;
justify-content: center;
width: 2.25rem;
height: 2.25rem;
flex-shrink: 0;
border-radius: 50%;
cursor: pointer;
background: none;
color: var(--mood-text-muted);
transition: background 0.1s ease, color 0.1s ease;
}
.attr-row__x:hover {
background: var(--mood-accent-soft);
color: var(--mood-error);
}
.attr-add { align-self: flex-start; }
</style>
@@ -0,0 +1,221 @@
<script setup lang="ts">
/**
* /donnees §2 — importer un collectif : fichier ou glisser-déposer.
* Issues en français (bloquantes / avertissements), lignée « essaimé de … ».
*/
import { useCollectiveStore } from '~/stores/collective'
import type { ImportIssue } from '~/data/persistence'
import { LINEAGE_PREFIX } from '~/lexicon'
const store = useCollectiveStore()
const dragging = ref(false)
const busy = ref(false)
const issues = ref<ImportIssue[]>([])
const importedName = ref<string | null>(null)
const importedLineage = ref<string | null>(null)
const errors = computed(() => issues.value.filter(i => i.level === 'error'))
const warnings = computed(() => issues.value.filter(i => i.level === 'warning'))
async function importFile(file: File | null | undefined) {
if (!file || busy.value) return
busy.value = true
importedName.value = null
importedLineage.value = null
const text = await file.text()
const result = await store.importJson(text)
issues.value = result.issues
if (result.state && !result.collided) {
importedName.value = result.state.collective.name
importedLineage.value = result.state.collective.lineage?.sourceSlug ?? null
}
busy.value = false
}
function onDrop(ev: DragEvent) {
dragging.value = false
importFile(ev.dataTransfer?.files?.[0])
}
function onPick(ev: Event) {
const input = ev.target as HTMLInputElement
importFile(input.files?.[0])
input.value = ''
}
</script>
<template>
<!-- ld-v2 -->
<section class="ld-card data-card">
<h2 class="data-card__title">
<UIcon name="i-lucide-file-down" /> Importer un collectif
</h2>
<label
class="dropzone"
:class="{ 'dropzone--over': dragging, 'dropzone--busy': busy }"
@dragover.prevent="dragging = true"
@dragleave="dragging = false"
@drop.prevent="onDrop"
>
<UIcon name="i-lucide-upload" class="dropzone__icon" />
<span class="dropzone__text">
Dépose un fichier .json ici, ou <span class="dropzone__link">choisis-le</span>
</span>
<span class="dropzone__sub">Un export libreDecision, d'ici ou d'ailleurs.</span>
<input
type="file"
accept=".json,application/json"
class="dropzone__input"
:disabled="busy"
@change="onPick"
>
</label>
<ul v-if="errors.length" class="issues issues--error">
<li v-for="issue in errors" :key="issue.message">
<UIcon name="i-lucide-circle-alert" /> {{ issue.message }}
</li>
</ul>
<ul v-if="warnings.length" class="issues issues--warning">
<li v-for="issue in warnings" :key="issue.message">
<UIcon name="i-lucide-triangle-alert" /> {{ issue.message }}
</li>
</ul>
<div v-if="importedName" class="imported">
<p class="imported__line">
<UIcon name="i-lucide-circle-check" /> « {{ importedName }} » est arrivé sur cette machine c'est maintenant le collectif actif.
</p>
<p v-if="importedLineage" class="imported__lineage">
<UIcon name="i-lucide-sprout" /> {{ LINEAGE_PREFIX }} {{ importedLineage }}
</p>
</div>
</section>
</template>
<style scoped>
.data-card {
display: flex;
flex-direction: column;
gap: 1rem;
padding: clamp(1rem, 3vw, 1.5rem);
}
.data-card__title {
display: flex;
align-items: center;
gap: 0.5rem;
margin: 0;
font-size: 1.0625rem;
font-weight: 800;
color: var(--mood-text);
}
.dropzone {
display: flex;
flex-direction: column;
align-items: center;
gap: 0.35rem;
padding: clamp(1.25rem, 4vw, 2rem);
border-radius: var(--r-input);
background: var(--mood-bg);
box-shadow: inset 0 0 0 1.5px var(--mood-input-border);
cursor: pointer;
text-align: center;
transition: box-shadow 0.12s ease, background 0.12s ease;
}
.dropzone--over {
background: var(--mood-accent-soft);
box-shadow: inset 0 0 0 2px var(--mood-accent);
}
.dropzone--busy {
opacity: 0.6;
cursor: progress;
}
.dropzone__icon {
font-size: 1.5rem;
color: var(--mood-accent);
}
.dropzone__text {
font-size: 0.9375rem;
font-weight: 600;
color: var(--mood-text);
}
.dropzone__link {
color: var(--mood-accent);
text-decoration: underline;
text-underline-offset: 3px;
}
.dropzone__sub {
font-size: 0.8125rem;
color: var(--mood-text-muted);
}
.dropzone__input {
position: absolute;
width: 1px;
height: 1px;
opacity: 0;
pointer-events: none;
}
.issues {
display: flex;
flex-direction: column;
gap: 0.4rem;
margin: 0;
padding: 0.75rem 1rem;
list-style: none;
border-radius: var(--r-input);
font-size: 0.875rem;
font-weight: 600;
}
.issues li {
display: flex;
align-items: flex-start;
gap: 0.45rem;
}
.issues--error {
background: color-mix(in srgb, var(--mood-error) 10%, transparent);
color: var(--mood-error);
}
.issues--warning {
background: var(--mood-status-fenetre-bg);
color: var(--mood-status-fenetre);
}
.imported {
display: flex;
flex-direction: column;
gap: 0.3rem;
padding: 0.75rem 1rem;
border-radius: var(--r-input);
background: var(--mood-status-vigueur-bg);
}
.imported__line {
display: flex;
align-items: flex-start;
gap: 0.45rem;
margin: 0;
font-size: 0.9rem;
font-weight: 600;
color: var(--mood-status-vigueur);
}
.imported__lineage {
display: flex;
align-items: center;
gap: 0.35rem;
margin: 0;
font-size: 0.8125rem;
font-style: italic;
color: var(--mood-tertiary);
}
</style>
@@ -0,0 +1,187 @@
<script lang="ts">
/** The six accent swatches offered at creation — well-water field, shared with /creer. */
export interface ColorChoice {
hex: string
label: string
}
export const COLOR_CHOICES: ColorChoice[] = [
{ hex: '#0f7fa8', label: 'Eau vive' },
{ hex: '#2e8a72', label: 'Eau végétale' },
{ hex: '#4f7a3c', label: 'Mousse' },
{ hex: '#96682a', label: 'Bronze' },
{ hex: '#b0563c', label: 'Terre cuite' },
{ hex: '#5c68b8', label: 'Iris' },
]
</script>
<script setup lang="ts">
/** Étape 1 — nom du collectif, couleur, ambiance. Entrée valide l'étape. */
const name = defineModel<string>('name', { required: true })
const color = defineModel<string>('color', { required: true })
const emit = defineEmits<{ next: [] }>()
const { moods, currentMood, setMood } = useLibreMood()
const nameInput = ref<HTMLInputElement | null>(null)
onMounted(() => nameInput.value?.focus())
</script>
<template>
<!-- ld-v2 -->
<section class="idstep">
<label class="field">
<span class="field__label">Le nom de votre collectif</span>
<input
ref="nameInput"
v-model="name"
class="field__input"
type="text"
placeholder="Les Jardins du Canal…"
autocomplete="off"
enterkeyhint="next"
@keydown.enter.prevent="emit('next')"
>
</label>
<div class="field">
<span class="field__label">Sa couleur</span>
<div class="swatches" role="group" aria-label="Couleur du collectif">
<button
v-for="c in COLOR_CHOICES"
:key="c.hex"
type="button"
class="swatch"
:class="{ 'swatch--active': color === c.hex }"
:style="{ background: c.hex }"
:aria-label="c.label"
:aria-pressed="color === c.hex"
:title="c.label"
@click="color = c.hex"
/>
</div>
</div>
<div class="field">
<span class="field__label">L'ambiance de tes écrans</span>
<div class="moods" role="group" aria-label="Ambiance">
<button
v-for="m in moods"
:key="m.id"
type="button"
class="mood-pill"
:class="{ 'mood-pill--active': currentMood === m.id }"
:aria-pressed="currentMood === m.id"
@click="setMood(m.id)"
>
<span class="mood-pill__dot" :style="{ background: m.color }" />
{{ m.label }}
</button>
</div>
<p class="field__hint">L'ambiance ne vaut que pour toi, sur cette machine.</p>
</div>
</section>
</template>
<style scoped>
.idstep {
display: flex;
flex-direction: column;
gap: clamp(1.25rem, 3vw, 1.75rem);
width: min(100%, 26rem);
margin-inline: auto;
}
.field {
display: flex;
flex-direction: column;
gap: 0.5rem;
}
.field__label {
font-size: 0.8125rem;
font-weight: 700;
letter-spacing: 0.04em;
text-transform: uppercase;
color: var(--mood-text-muted);
}
.field__input {
min-height: 2.75rem;
padding: 0.6rem 0.9rem;
font-size: 1.0625rem;
font-weight: 600;
box-shadow: inset 0 0 0 1.5px var(--mood-input-border);
border-radius: var(--r-input);
}
.field__input:focus-visible {
box-shadow: inset 0 0 0 1.5px var(--mood-input-focus), 0 0 0 2.5px var(--mood-accent-soft);
}
.field__hint {
margin: 0;
font-size: 0.8125rem;
color: var(--mood-text-muted);
}
.swatches {
display: flex;
flex-wrap: wrap;
gap: 0.75rem;
}
.swatch {
width: 2.25rem;
height: 2.25rem;
border-radius: 50%;
cursor: pointer;
padding: 0;
box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.35), 0 1px 3px var(--mood-shadow);
transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.swatch:hover { transform: translateY(-1px) scale(1.08); }
.swatch:active { transform: translateY(0); }
.swatch--active {
box-shadow:
inset 0 0 0 1.5px rgba(255, 255, 255, 0.35),
0 0 0 2.5px var(--mood-bg),
0 0 0 5px var(--mood-accent);
}
.moods {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
}
.mood-pill {
display: inline-flex;
align-items: center;
gap: 0.45rem;
min-height: 2.25rem;
padding: 0.35rem 0.9rem;
border-radius: var(--r-pill);
font-size: 0.9375rem;
font-weight: 600;
cursor: pointer;
background: var(--mood-surface);
color: var(--mood-text);
box-shadow: var(--shadow-card);
transition: transform 0.1s ease, box-shadow 0.12s ease;
}
.mood-pill:hover { transform: translateY(-1px); }
.mood-pill:active { transform: translateY(0); }
.mood-pill--active {
box-shadow: var(--shadow-card), 0 0 0 2px var(--mood-accent);
color: var(--mood-accent);
}
.mood-pill__dot {
width: 0.8rem;
height: 0.8rem;
border-radius: 50%;
flex-shrink: 0;
box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}
</style>
@@ -0,0 +1,167 @@
<script setup lang="ts">
/** Étape 3 — toi (Person isMe) + les premiers membres, ajout rapide au clavier. */
const meName = defineModel<string>('meName', { required: true })
const members = defineModel<string[]>('members', { required: true })
const newMember = ref('')
const meInput = ref<HTMLInputElement | null>(null)
const memberInput = ref<HTMLInputElement | null>(null)
onMounted(() => meInput.value?.focus())
function addMember() {
const value = newMember.value.trim()
if (!value) return
if (!members.value.includes(value)) members.value = [...members.value, value]
newMember.value = ''
}
function removeMember(index: number) {
members.value = members.value.filter((_, i) => i !== index)
}
</script>
<template>
<!-- ld-v2 -->
<section class="memstep">
<label class="field">
<span class="field__label">Toi ton prénom</span>
<input
ref="meInput"
v-model="meName"
class="field__input"
type="text"
placeholder="Camille"
autocomplete="given-name"
enterkeyhint="next"
@keydown.enter.prevent="memberInput?.focus()"
>
</label>
<div class="field">
<span class="field__label">Les premières personnes autour de la table</span>
<div class="member-add">
<input
ref="memberInput"
v-model="newMember"
class="field__input member-add__input"
type="text"
placeholder="Un prénom, puis Entrée"
autocomplete="off"
enterkeyhint="enter"
@keydown.enter.prevent="addMember"
>
<button
type="button"
class="ld-btn ld-btn--ghost"
:disabled="!newMember.trim()"
@click="addMember"
>
<UIcon name="i-lucide-plus" /> Ajouter
</button>
</div>
<ul v-if="members.length" class="member-chips">
<li v-for="(m, i) in members" :key="m" class="member-chip">
{{ m }}
<button
type="button"
class="member-chip__x"
:aria-label="`Retirer ${m}`"
@click="removeMember(i)"
>
<UIcon name="i-lucide-x" />
</button>
</li>
</ul>
<p class="field__hint">Tu pourras en ajouter à tout moment les cercles se dessinent à l'usage.</p>
</div>
</section>
</template>
<style scoped>
.memstep {
display: flex;
flex-direction: column;
gap: clamp(1.25rem, 3vw, 1.75rem);
width: min(100%, 26rem);
margin-inline: auto;
}
.field {
display: flex;
flex-direction: column;
gap: 0.5rem;
}
.field__label {
font-size: 0.8125rem;
font-weight: 700;
letter-spacing: 0.04em;
text-transform: uppercase;
color: var(--mood-text-muted);
}
.field__input {
min-height: 2.75rem;
padding: 0.6rem 0.9rem;
font-size: 1.0625rem;
font-weight: 600;
box-shadow: inset 0 0 0 1.5px var(--mood-input-border);
border-radius: var(--r-input);
}
.field__input:focus-visible {
box-shadow: inset 0 0 0 1.5px var(--mood-input-focus), 0 0 0 2.5px var(--mood-accent-soft);
}
.field__hint {
margin: 0;
font-size: 0.8125rem;
color: var(--mood-text-muted);
}
.member-add {
display: flex;
gap: 0.5rem;
}
.member-add__input { flex: 1; min-width: 0; }
.member-chips {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
margin: 0.25rem 0 0;
padding: 0;
list-style: none;
}
.member-chip {
display: inline-flex;
align-items: center;
gap: 0.35rem;
min-height: 2.25rem;
padding: 0.3rem 0.4rem 0.3rem 0.85rem;
border-radius: var(--r-pill);
font-size: 0.9375rem;
font-weight: 600;
background: var(--mood-accent-soft);
color: var(--mood-text);
}
.member-chip__x {
display: inline-flex;
align-items: center;
justify-content: center;
width: 1.6rem;
height: 1.6rem;
border-radius: 50%;
cursor: pointer;
background: none;
color: var(--mood-text-muted);
transition: background 0.1s ease, color 0.1s ease;
}
.member-chip__x:hover {
background: var(--mood-surface);
color: var(--mood-error);
}
</style>
@@ -0,0 +1,191 @@
<script lang="ts">
import type { TemplateId } from '~/data/templates'
/** Per-template icon — also becomes Collective.icon at creation (/creer). */
export const TEMPLATE_ICONS: Record<TemplateId, string> = {
'blank': 'i-lucide-notebook-pen',
'informal': 'i-lucide-coffee',
'association': 'i-lucide-heart-handshake',
'cooperative': 'i-lucide-wheat',
'commune': 'i-lucide-map-pinned',
'free-currency': 'i-lucide-coins',
'symmetric': 'i-lucide-scale',
}
/** « Qui doit être d'accord ? » — the concrete line of each card. */
const TEMPLATE_AGREEMENT: Record<TemplateId, string> = {
'blank': "celles et ceux que ça touche — sans objection maintenue, c'est adopté.",
'informal': "le groupe, par consentement ; rien d'exigé avant de décider.",
'association': 'les membres concernés ; nombreux, vous décidez en nuances — jamais deux camps.',
'cooperative': 'celles et ceux que ça engage ; les nuances décident des grandes questions.',
'commune': 'chaque périmètre à sa juste échelle ; les nuances au-delà du cercle proche.',
'free-currency': "la toile entière sur les grands sujets — le pour/contre inertiel hérité de Ğ1.",
'symmetric': 'tout le collectif, en pleine lumière — la transparence est la règle.',
}
</script>
<script setup lang="ts">
/** Étape 2 — les sept gabarits (blank en premier) + les deux collectifs à explorer. */
import { TEMPLATE_CARDS } from '~/data/templates'
import type { SeedName } from '~/stores/collective'
const selected = defineModel<TemplateId | null>({ required: true })
const emit = defineEmits<{ next: []; seed: [name: SeedName] }>()
</script>
<template>
<!-- ld-v2 -->
<section class="tplstep">
<div class="tpl-grid">
<button
v-for="card in TEMPLATE_CARDS"
:key="card.id"
type="button"
class="ld-card ld-card--hover tpl-card"
:class="{ 'tpl-card--active': selected === card.id, 'tpl-card--blank': card.id === 'blank' }"
:aria-pressed="selected === card.id"
@click="selected = card.id"
@dblclick="emit('next')"
>
<span class="tpl-card__top">
<span class="tpl-card__icon"><UIcon :name="TEMPLATE_ICONS[card.id]" /></span>
<span class="tpl-card__head">
<span class="tpl-card__title">{{ card.title }}</span>
<span class="tpl-card__subtitle">{{ card.subtitle }}</span>
</span>
</span>
<span class="tpl-card__desc">{{ card.description }}</span>
<span class="tpl-card__agree">
<strong>Qui doit être d'accord ?</strong>
{{ TEMPLATE_AGREEMENT[card.id] }}
</span>
</button>
</div>
<div class="tpl-seeds">
<p class="tpl-seeds__label">Ou entre d'abord dans un collectif déjà vivant :</p>
<div class="tpl-seeds__row">
<button type="button" class="ld-btn ld-btn--ghost" @click="emit('seed', 'duniter-g1')">
<UIcon name="i-lucide-coins" /> Explorer Duniter Ğ1
</button>
<button type="button" class="ld-btn ld-btn--ghost" @click="emit('seed', 'atelier-du-canal')">
<UIcon name="i-lucide-hammer" /> Explorer l'Atelier du Canal
</button>
</div>
</div>
</section>
</template>
<style scoped>
.tplstep {
display: flex;
flex-direction: column;
gap: clamp(1.25rem, 3vw, 1.75rem);
width: 100%;
}
.tpl-grid {
display: grid;
grid-template-columns: 1fr;
gap: 0.875rem;
}
@media (min-width: 768px) {
.tpl-grid { grid-template-columns: 1fr 1fr; }
.tpl-card--blank { grid-column: 1 / -1; }
}
.tpl-card {
display: flex;
flex-direction: column;
align-items: stretch;
gap: 0.55rem;
padding: clamp(0.875rem, 2.5vw, 1.15rem);
text-align: left;
cursor: pointer;
color: var(--mood-text);
background: var(--mood-surface);
}
.tpl-card--active {
box-shadow: var(--shadow-card), 0 0 0 2.5px var(--mood-accent);
}
.tpl-card--blank {
background: var(--mood-accent-soft);
}
.tpl-card__top {
display: flex;
align-items: center;
gap: 0.7rem;
}
.tpl-card__icon {
display: inline-flex;
align-items: center;
justify-content: center;
width: 2.5rem;
height: 2.5rem;
flex-shrink: 0;
border-radius: var(--r-icon);
font-size: 1.25rem;
background: var(--mood-accent-soft);
color: var(--mood-accent);
}
.tpl-card__head {
display: flex;
flex-direction: column;
gap: 0.1rem;
min-width: 0;
}
.tpl-card__title {
font-size: 1.0625rem;
font-weight: 800;
line-height: 1.2;
}
.tpl-card__subtitle {
font-size: 0.8125rem;
font-weight: 600;
font-style: italic;
color: var(--mood-text-muted);
}
.tpl-card__desc {
font-size: 0.9rem;
line-height: 1.45;
color: var(--mood-text);
}
.tpl-card__agree {
font-size: 0.85rem;
line-height: 1.45;
color: var(--mood-text-muted);
}
.tpl-card__agree strong {
font-weight: 700;
color: var(--mood-accent);
}
.tpl-seeds {
display: flex;
flex-direction: column;
gap: 0.6rem;
align-items: center;
text-align: center;
}
.tpl-seeds__label {
margin: 0;
font-size: 0.875rem;
color: var(--mood-text-muted);
}
.tpl-seeds__row {
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 0.6rem;
}
</style>