@seta-labs/nuxt-foundation 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -21,6 +21,24 @@ body {
21
21
  .sf-shell__marchio {
22
22
  display: flex;
23
23
  align-items: center;
24
+ gap: var(--s-3);
25
+ padding: 0 var(--s-2);
26
+ color: var(--fg);
27
+ text-decoration: none;
28
+ }
29
+
30
+ .sf-shell__simbolo {
31
+ height: 22px;
32
+ width: auto;
33
+ }
34
+
35
+ .sf-shell__nome {
36
+ font-family: var(--font-display);
37
+ font-variation-settings: 'wdth' 118;
38
+ font-size: 14px;
39
+ font-weight: 600;
40
+ letter-spacing: 0.22em;
41
+ text-transform: uppercase;
24
42
  }
25
43
 
26
44
  .sf-shell__corpo {
@@ -179,7 +197,7 @@ body {
179
197
  }
180
198
 
181
199
  @media (max-width: 640px) {
182
- .sf-shell__marchio,
200
+ .sf-shell__nome,
183
201
  .sf-shell__sep {
184
202
  display: none;
185
203
  }
@@ -0,0 +1,332 @@
1
+ <script setup lang="ts">
2
+ // Boot splash in the landing's "accensione" language: the two circles of the
3
+ // symbol fill, the lens lights up, the system checks roll in, then the veil
4
+ // lifts on the shell. Every check states a real fact of this session.
5
+ const emit = defineEmits<{ fine: [] }>();
6
+
7
+ const DURATA_MS = 3400;
8
+ const DURATA_RIDOTTA_MS = 900;
9
+ const USCITA_MS = 420;
10
+
11
+ const app = useFoundationApp();
12
+ const user = useCurrentUser();
13
+ const { theme } = useFoundationTheme();
14
+ const { foundationVersion } = useRuntimeConfig().public;
15
+
16
+ const spento = ref(false);
17
+ const salta = ref<HTMLButtonElement | null>(null);
18
+ let timer: ReturnType<typeof setTimeout> | undefined;
19
+
20
+ const verifiche = computed(() => [
21
+ { voce: 'Shell', valore: `v${foundationVersion}` },
22
+ { voce: 'App', valore: app.value?.name ?? '—' },
23
+ { voce: 'Tema', valore: theme.value },
24
+ {
25
+ voce: 'Accesso',
26
+ valore: import.meta.dev ? 'locale' : user.value ? 'Cloudflare Access' : 'in verifica',
27
+ },
28
+ ]);
29
+
30
+ function esci(): void {
31
+ if (spento.value) return;
32
+ spento.value = true;
33
+ clearTimeout(timer);
34
+ timer = setTimeout(() => emit('fine'), USCITA_MS);
35
+ }
36
+
37
+ function onKey(event: KeyboardEvent): void {
38
+ if (event.key === 'Escape') esci();
39
+ }
40
+
41
+ onMounted(() => {
42
+ const ridotto = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
43
+ timer = setTimeout(esci, ridotto ? DURATA_RIDOTTA_MS : DURATA_MS);
44
+ document.addEventListener('keydown', onKey);
45
+ salta.value?.focus({ preventScroll: true });
46
+ });
47
+ onBeforeUnmount(() => {
48
+ clearTimeout(timer);
49
+ document.removeEventListener('keydown', onKey);
50
+ });
51
+ </script>
52
+
53
+ <template>
54
+ <div
55
+ class="sf-avvio"
56
+ :data-spento="spento"
57
+ role="dialog"
58
+ aria-modal="true"
59
+ aria-label="Avvio di Seta Foundation"
60
+ >
61
+ <div class="sf-avvio__velo" aria-hidden="true" />
62
+ <svg class="sf-avvio__orb" viewBox="0 0 320 240" aria-hidden="true">
63
+ <circle class="sf-avvio__corona" cx="160" cy="120" r="112" />
64
+ <g class="sf-avvio__base">
65
+ <circle cx="134.5" cy="120" r="80" />
66
+ <circle cx="185.5" cy="120" r="80" />
67
+ </g>
68
+ <circle class="sf-avvio__arco sf-avvio__arco--blu" cx="134.5" cy="120" r="80" />
69
+ <circle class="sf-avvio__arco sf-avvio__arco--seta" cx="185.5" cy="120" r="80" />
70
+ <path
71
+ class="sf-avvio__lente"
72
+ d="M160 44.2A80 80 0 0 1 160 195.8A80 80 0 0 1 160 44.2Z"
73
+ />
74
+ <g class="sf-avvio__mirino">
75
+ <path d="M160 20v14M160 206v14M36 120h14M270 120h14" />
76
+ </g>
77
+ </svg>
78
+
79
+ <div class="sf-avvio__testi">
80
+ <p class="sf-avvio__marchio">Seta Foundation</p>
81
+ <ol class="sf-avvio__lista">
82
+ <li
83
+ v-for="(verifica, index) in verifiche"
84
+ :key="verifica.voce"
85
+ class="sf-avvio__riga"
86
+ :style="{ '--i': index }"
87
+ >
88
+ <span>{{ verifica.voce }}</span>
89
+ <i aria-hidden="true" />
90
+ <span class="sf-avvio__valore">{{ verifica.valore }}</span>
91
+ <b>OK</b>
92
+ </li>
93
+ </ol>
94
+ </div>
95
+
96
+ <button
97
+ ref="salta"
98
+ class="sf-btn sf-btn--testo sf-btn--compatto sf-avvio__salta"
99
+ type="button"
100
+ @click="esci"
101
+ >
102
+ Salta
103
+ </button>
104
+ </div>
105
+ </template>
106
+
107
+ <style scoped>
108
+ .sf-avvio {
109
+ position: fixed;
110
+ inset: 0;
111
+ z-index: 100;
112
+ display: grid;
113
+ place-content: center;
114
+ justify-items: center;
115
+ gap: var(--s-5);
116
+ padding: var(--s-5);
117
+ transition: opacity var(--d-ampio) var(--e-uscita);
118
+ }
119
+
120
+ .sf-avvio[data-spento='true'] {
121
+ opacity: 0;
122
+ pointer-events: none;
123
+ }
124
+
125
+ .sf-avvio__velo {
126
+ position: absolute;
127
+ inset: 0;
128
+ z-index: -1;
129
+ background: radial-gradient(
130
+ 120% 90% at 50% 40%,
131
+ color-mix(in oklab, var(--accent) 7%, var(--bg)) 0%,
132
+ var(--bg) 62%
133
+ );
134
+ }
135
+
136
+ .sf-avvio__orb {
137
+ width: min(72vw, 320px);
138
+ height: auto;
139
+ overflow: visible;
140
+ transition: transform var(--d-ampio) var(--e-uscita);
141
+ }
142
+
143
+ .sf-avvio[data-spento='true'] .sf-avvio__orb {
144
+ transform: scale(0.86);
145
+ }
146
+
147
+ .sf-avvio__corona {
148
+ fill: none;
149
+ stroke: var(--ornato);
150
+ stroke-opacity: 0.45;
151
+ stroke-width: 1;
152
+ stroke-dasharray: 2 7;
153
+ transform-origin: 160px 120px;
154
+ opacity: 0;
155
+ animation:
156
+ sf-avvio-corona 1.4s var(--e-entrata) 0.15s forwards,
157
+ sf-avvio-gira 60s linear 1.5s infinite;
158
+ }
159
+
160
+ .sf-avvio__base circle {
161
+ fill: none;
162
+ stroke: var(--hud-tenue);
163
+ stroke-width: 1.3;
164
+ }
165
+
166
+ .sf-avvio__arco {
167
+ fill: none;
168
+ stroke-width: 1.6;
169
+ stroke-linecap: round;
170
+ stroke-dasharray: 502.65;
171
+ stroke-dashoffset: 502.65;
172
+ transform-box: fill-box;
173
+ transform-origin: center;
174
+ animation: sf-avvio-riempi 1.25s var(--e-standard) 0.25s forwards;
175
+ }
176
+
177
+ .sf-avvio__arco--blu {
178
+ stroke: var(--seta-blu);
179
+ transform: rotate(-90deg);
180
+ filter: drop-shadow(0 0 6px color-mix(in oklab, var(--seta-blu) 60%, transparent));
181
+ }
182
+
183
+ .sf-avvio__arco--seta {
184
+ stroke: var(--fg);
185
+ transform: rotate(-90deg) scaleX(-1);
186
+ animation-delay: 0.4s;
187
+ filter: drop-shadow(0 0 6px color-mix(in oklab, var(--fg) 35%, transparent));
188
+ }
189
+
190
+ .sf-avvio__lente {
191
+ fill: var(--seta-blu);
192
+ opacity: 0;
193
+ animation: sf-avvio-lente 1s var(--e-standard) 1.55s forwards;
194
+ }
195
+
196
+ .sf-avvio__mirino path {
197
+ stroke: var(--ornato);
198
+ stroke-opacity: 0.7;
199
+ stroke-width: 1;
200
+ fill: none;
201
+ }
202
+
203
+ .sf-avvio__mirino {
204
+ transform-origin: 160px 120px;
205
+ opacity: 0;
206
+ animation: sf-avvio-mirino 0.8s var(--e-entrata) 1.2s forwards;
207
+ }
208
+
209
+ .sf-avvio__testi {
210
+ display: grid;
211
+ gap: var(--s-4);
212
+ justify-items: center;
213
+ }
214
+
215
+ .sf-avvio__marchio {
216
+ margin: 0;
217
+ font-family: var(--font-display);
218
+ font-variation-settings: 'wdth' 118;
219
+ font-size: clamp(20px, 5vw, 28px);
220
+ font-weight: 600;
221
+ letter-spacing: 0.08em;
222
+ text-transform: uppercase;
223
+ opacity: 0;
224
+ transform: translateY(10px);
225
+ animation: sf-avvio-sale 0.8s var(--e-entrata) 0.7s forwards;
226
+ }
227
+
228
+ .sf-avvio__lista {
229
+ display: grid;
230
+ gap: 7px;
231
+ width: min(84vw, 340px);
232
+ margin: 0;
233
+ padding: 0;
234
+ list-style: none;
235
+ }
236
+
237
+ .sf-avvio__riga {
238
+ display: flex;
239
+ align-items: baseline;
240
+ gap: var(--s-2);
241
+ font-size: 11px;
242
+ line-height: 1.6;
243
+ letter-spacing: 0.18em;
244
+ text-transform: uppercase;
245
+ color: var(--muted);
246
+ font-variant-numeric: tabular-nums;
247
+ opacity: 0;
248
+ transform: translateY(-6px);
249
+ animation: sf-avvio-sale 0.5s var(--e-entrata) forwards;
250
+ animation-delay: calc(1.1s + var(--i) * 0.22s);
251
+ }
252
+
253
+ .sf-avvio__riga i {
254
+ flex: 1;
255
+ border-bottom: 1px dotted var(--hud-tenue);
256
+ }
257
+
258
+ .sf-avvio__valore {
259
+ color: var(--fg);
260
+ letter-spacing: 0.12em;
261
+ }
262
+
263
+ .sf-avvio__riga b {
264
+ color: var(--ok);
265
+ font-weight: 500;
266
+ letter-spacing: 0.14em;
267
+ }
268
+
269
+ .sf-avvio__salta {
270
+ position: absolute;
271
+ right: var(--s-4);
272
+ bottom: var(--s-4);
273
+ color: var(--muted);
274
+ }
275
+
276
+ @keyframes sf-avvio-riempi {
277
+ to {
278
+ stroke-dashoffset: 0;
279
+ }
280
+ }
281
+
282
+ @keyframes sf-avvio-corona {
283
+ from {
284
+ opacity: 0;
285
+ rotate: -24deg;
286
+ scale: 0.92;
287
+ }
288
+ to {
289
+ opacity: 1;
290
+ rotate: 0deg;
291
+ scale: 1;
292
+ }
293
+ }
294
+
295
+ @keyframes sf-avvio-gira {
296
+ to {
297
+ transform: rotate(360deg);
298
+ }
299
+ }
300
+
301
+ @keyframes sf-avvio-mirino {
302
+ from {
303
+ opacity: 0;
304
+ transform: scale(0.6);
305
+ }
306
+ to {
307
+ opacity: 1;
308
+ transform: scale(1);
309
+ }
310
+ }
311
+
312
+ @keyframes sf-avvio-lente {
313
+ 0% {
314
+ opacity: 0;
315
+ }
316
+ 40% {
317
+ opacity: 0.9;
318
+ filter: drop-shadow(0 0 24px var(--seta-blu));
319
+ }
320
+ 100% {
321
+ opacity: 0.35;
322
+ filter: none;
323
+ }
324
+ }
325
+
326
+ @keyframes sf-avvio-sale {
327
+ to {
328
+ opacity: 1;
329
+ transform: none;
330
+ }
331
+ }
332
+ </style>
@@ -1,7 +1,4 @@
1
1
  <script setup lang="ts">
2
- import logoNotte from '../../design-system/assets/Marchio/logo-dark-stretto.png';
3
- import logoGiorno from '../../design-system/assets/Marchio/logo-light-stretto.png';
4
-
5
2
  defineProps<{ menuOpen: boolean }>();
6
3
  defineEmits<{ toggleMenu: [] }>();
7
4
 
@@ -13,13 +10,13 @@ const dev = import.meta.dev;
13
10
  <template>
14
11
  <header class="sf-barra sf-shell__barra">
15
12
  <FoundationLauncher />
16
- <NuxtLink to="/" class="sf-shell__marchio" aria-label="Seta Labs, torna all'inizio">
17
- <img class="sf-marchio sf-solo-notte" :src="logoNotte" alt="" />
18
- <img class="sf-marchio sf-solo-giorno" :src="logoGiorno" alt="" />
13
+ <NuxtLink to="/" class="sf-shell__marchio" aria-label="Seta Foundation, torna all'inizio">
14
+ <SfSimbolo class="sf-shell__simbolo" />
15
+ <span class="sf-shell__nome" aria-hidden="true">Foundation</span>
19
16
  </NuxtLink>
20
17
  <template v-if="app">
21
18
  <span class="sf-barra__sep sf-shell__sep" />
22
- <NuxtLink to="/" class="sf-barra__app">
19
+ <NuxtLink to="/" class="sf-barra__app" data-tour="app">
23
20
  <SfTessera :app="app.id" :size="32" />
24
21
  {{ app.name }}
25
22
  </NuxtLink>
@@ -30,6 +27,7 @@ const dev = import.meta.dev;
30
27
  <button
31
28
  v-if="hasNav"
32
29
  class="sf-btn sf-btn--icona sf-shell__apri-menu"
30
+ data-tour="menu-mobile"
33
31
  type="button"
34
32
  aria-controls="sf-menu"
35
33
  :aria-expanded="menuOpen"
@@ -16,6 +16,7 @@ const isTool = (app: FoundationApp): boolean => app.kind === 'tool';
16
16
  <button
17
17
  ref="trigger"
18
18
  class="sf-barra__launcher"
19
+ data-tour="launcher"
19
20
  type="button"
20
21
  aria-label="Apri le app"
21
22
  aria-haspopup="dialog"
@@ -2,6 +2,17 @@
2
2
  defineProps<{ open: boolean }>();
3
3
 
4
4
  const nav = useFoundationNav();
5
+ // Consecutive items sharing a `gruppo` render under one title, in the order
6
+ // the host declares them; items without a group get an untitled block.
7
+ const gruppi = computed(() => {
8
+ const blocchi: { titolo?: string; voci: typeof nav }[] = [];
9
+ for (const voce of nav) {
10
+ const ultimo = blocchi.at(-1);
11
+ if (ultimo && ultimo.titolo === voce.gruppo) ultimo.voci.push(voce);
12
+ else blocchi.push({ titolo: voce.gruppo, voci: [voce] });
13
+ }
14
+ return blocchi;
15
+ });
5
16
  const app = useFoundationApp();
6
17
  const active = useActiveNav();
7
18
  </script>
@@ -10,13 +21,15 @@ const active = useActiveNav();
10
21
  <nav
11
22
  v-if="nav.length"
12
23
  id="sf-menu"
24
+ data-tour="menu"
13
25
  class="sf-menu sf-shell__menu"
14
26
  :class="{ 'sf-shell__menu--aperto': open }"
15
27
  :aria-label="app?.name ?? 'Menu'"
16
28
  >
17
- <div class="sf-menu__gruppo">
29
+ <div v-for="(gruppo, n) in gruppi" :key="gruppo.titolo ?? n" class="sf-menu__gruppo">
30
+ <div v-if="gruppo.titolo" class="sf-menu__titolo">{{ gruppo.titolo }}</div>
18
31
  <NuxtLink
19
- v-for="item in nav"
32
+ v-for="item in gruppo.voci"
20
33
  :key="item.to"
21
34
  :to="item.to"
22
35
  class="sf-menu__voce"
@@ -4,7 +4,7 @@ const app = useFoundationApp();
4
4
  </script>
5
5
 
6
6
  <template>
7
- <footer class="sf-stato sf-shell__stato">
7
+ <footer class="sf-stato sf-shell__stato" data-tour="stato">
8
8
  <span>
9
9
  Seta Foundation <b>shell {{ foundationVersion }}</b>
10
10
  </span>
@@ -0,0 +1,322 @@
1
+ <script setup lang="ts">
2
+ // Guided tour of the shell: a dark veil with a spotlight on one element at a
3
+ // time and a card explaining it. Targets are `[data-tour]` hooks in the shell;
4
+ // a step whose target is not visible (the side menu on a phone, the menu
5
+ // button on a desktop) is dropped, so each layout gets its own steps.
6
+ const emit = defineEmits<{ fine: [] }>();
7
+
8
+ interface Passo {
9
+ bersagli: string[];
10
+ titolo: string;
11
+ testo: string;
12
+ }
13
+
14
+ interface Riquadro {
15
+ top: number;
16
+ left: number;
17
+ width: number;
18
+ height: number;
19
+ }
20
+
21
+ const MARGINE = 8;
22
+ const SCHEDA_LARGHEZZA = 340;
23
+
24
+ const app = useFoundationApp();
25
+ const nomeApp = computed(() => app.value?.name ?? "l'app");
26
+
27
+ const PASSI = computed<Passo[]>(() => [
28
+ {
29
+ bersagli: ['launcher'],
30
+ titolo: 'Le app della suite',
31
+ testo: "Da qui passi da un'app all'altra della suite e apri gli strumenti come Infra. L'app in cui sei è evidenziata.",
32
+ },
33
+ {
34
+ bersagli: ['app'],
35
+ titolo: 'Dove ti trovi',
36
+ testo: `Tessera e nome di ${nomeApp.value}: un clic ti riporta alla sua pagina iniziale.`,
37
+ },
38
+ {
39
+ bersagli: ['menu'],
40
+ titolo: 'Il menu dell’app',
41
+ testo: `Le sezioni di ${nomeApp.value}: la voce evidenziata è quella in cui ti trovi.`,
42
+ },
43
+ {
44
+ bersagli: ['menu-mobile'],
45
+ titolo: 'Il menu dell’app',
46
+ testo: `Le sezioni di ${nomeApp.value}: sugli schermi stretti si aprono da questo pulsante.`,
47
+ },
48
+ {
49
+ bersagli: ['contenuto'],
50
+ titolo: 'Lo spazio di lavoro',
51
+ testo: 'Qui l’app mostra le sue pagine. La riga in alto ti dice sempre in quale sezione sei.',
52
+ },
53
+ {
54
+ bersagli: ['utente'],
55
+ titolo: 'Il tuo profilo',
56
+ testo: 'L’accesso passa da Cloudflare Access. Da qui cambi tema tra notte e giorno, rivedi questa presentazione ed esci.',
57
+ },
58
+ {
59
+ bersagli: ['stato'],
60
+ titolo: 'La barra di stato',
61
+ testo: 'Versione della shell e app corrente: fatti di sistema, mai azioni.',
62
+ },
63
+ ]);
64
+
65
+ const indice = ref(0);
66
+ const faro = ref<Riquadro | null>(null);
67
+ const scheda = ref<HTMLElement | null>(null);
68
+ const avantiBtn = ref<HTMLButtonElement | null>(null);
69
+ const passi = ref<Passo[]>([]);
70
+
71
+ const passo = computed(() => passi.value[indice.value]);
72
+ const ultimo = computed(() => indice.value === passi.value.length - 1);
73
+ const numero = (n: number): string => String(n).padStart(2, '0');
74
+
75
+ function visibile(el: Element | null): el is HTMLElement {
76
+ if (!(el instanceof HTMLElement)) return false;
77
+ const rect = el.getBoundingClientRect();
78
+ const style = getComputedStyle(el);
79
+ return rect.width > 0 && rect.height > 0 && style.visibility !== 'hidden';
80
+ }
81
+
82
+ function bersaglio(p: Passo): HTMLElement | null {
83
+ for (const nome of p.bersagli) {
84
+ const el = document.querySelector(`[data-tour="${nome}"]`);
85
+ if (visibile(el)) return el;
86
+ }
87
+ return null;
88
+ }
89
+
90
+ function misura(): void {
91
+ const el = passo.value ? bersaglio(passo.value) : null;
92
+ if (!el) return;
93
+ const rect = el.getBoundingClientRect();
94
+ // Kept inside the viewport: a target on the edge must not lose its outline.
95
+ const top = Math.max(2, rect.top - MARGINE);
96
+ const left = Math.max(2, rect.left - MARGINE);
97
+ faro.value = {
98
+ top,
99
+ left,
100
+ width: Math.min(rect.right + MARGINE, window.innerWidth - 2) - left,
101
+ height: Math.min(rect.bottom + MARGINE, window.innerHeight - 2) - top,
102
+ };
103
+ }
104
+
105
+ // Beside a tall target (the side menu), otherwise below it when it fits,
106
+ // otherwise above; always clamped to the viewport.
107
+ const posizioneScheda = computed(() => {
108
+ const f = faro.value;
109
+ if (!f || !import.meta.client) return {};
110
+ const larghezza = Math.min(SCHEDA_LARGHEZZA, window.innerWidth - 32);
111
+ const altezza = scheda.value?.offsetHeight ?? 200;
112
+ const clampTop = (top: number): number =>
113
+ Math.max(16, Math.min(top, window.innerHeight - altezza - 16));
114
+ const clampLeft = (left: number): number =>
115
+ Math.min(Math.max(16, left), window.innerWidth - larghezza - 16);
116
+
117
+ const accanto = f.left + f.width + 12;
118
+ if (f.height > window.innerHeight / 2 && accanto + larghezza < window.innerWidth - 16) {
119
+ return { top: `${clampTop(f.top + 16)}px`, left: `${accanto}px`, width: `${larghezza}px` };
120
+ }
121
+ const sotto = f.top + f.height + 12;
122
+ const top = sotto + altezza < window.innerHeight - 16 ? sotto : clampTop(f.top - altezza - 12);
123
+ return { top: `${top}px`, left: `${clampLeft(f.left)}px`, width: `${larghezza}px` };
124
+ });
125
+
126
+ async function vai(n: number): Promise<void> {
127
+ indice.value = n;
128
+ await nextTick();
129
+ misura();
130
+ await nextTick();
131
+ avantiBtn.value?.focus({ preventScroll: true });
132
+ }
133
+
134
+ function avanti(): void {
135
+ if (ultimo.value) emit('fine');
136
+ else void vai(indice.value + 1);
137
+ }
138
+
139
+ function onKey(event: KeyboardEvent): void {
140
+ if (event.key === 'Escape') emit('fine');
141
+ if (event.key === 'ArrowRight') avanti();
142
+ if (event.key === 'ArrowLeft' && indice.value > 0) void vai(indice.value - 1);
143
+ }
144
+
145
+ onMounted(() => {
146
+ passi.value = PASSI.value.filter((p) => bersaglio(p));
147
+ if (!passi.value.length) return emit('fine');
148
+ void vai(0);
149
+ window.addEventListener('resize', misura);
150
+ window.addEventListener('scroll', misura, true);
151
+ document.addEventListener('keydown', onKey);
152
+ });
153
+ onBeforeUnmount(() => {
154
+ window.removeEventListener('resize', misura);
155
+ window.removeEventListener('scroll', misura, true);
156
+ document.removeEventListener('keydown', onKey);
157
+ });
158
+ </script>
159
+
160
+ <template>
161
+ <div class="sf-tour">
162
+ <div
163
+ v-if="faro"
164
+ class="sf-tour__faro"
165
+ aria-hidden="true"
166
+ :style="{
167
+ top: `${faro.top}px`,
168
+ left: `${faro.left}px`,
169
+ width: `${faro.width}px`,
170
+ height: `${faro.height}px`,
171
+ }"
172
+ />
173
+ <section
174
+ v-if="passo"
175
+ ref="scheda"
176
+ class="sf-tour__scheda"
177
+ role="dialog"
178
+ aria-modal="true"
179
+ aria-labelledby="sf-tour-titolo"
180
+ aria-describedby="sf-tour-testo"
181
+ :style="posizioneScheda"
182
+ >
183
+ <div class="sf-targa__riga">
184
+ <b>{{ numero(indice + 1) }} / {{ numero(passi.length) }}</b>
185
+ <span>Presentazione</span>
186
+ <span class="sf-targa__filetto" />
187
+ </div>
188
+ <h2 id="sf-tour-titolo" class="sf-tour__titolo">{{ passo.titolo }}</h2>
189
+ <p id="sf-tour-testo" class="sf-tour__testo">{{ passo.testo }}</p>
190
+ <div class="sf-tour__puntini" aria-hidden="true">
191
+ <span v-for="(p, n) in passi" :key="p.titolo" :data-attivo="n === indice" />
192
+ </div>
193
+ <div class="sf-tour__azioni">
194
+ <button
195
+ class="sf-btn sf-btn--testo sf-btn--compatto sf-tour__salta"
196
+ type="button"
197
+ @click="emit('fine')"
198
+ >
199
+ Salta il tour
200
+ </button>
201
+ <button
202
+ v-if="indice > 0"
203
+ class="sf-btn sf-btn--compatto"
204
+ type="button"
205
+ @click="vai(indice - 1)"
206
+ >
207
+ Indietro
208
+ </button>
209
+ <button
210
+ ref="avantiBtn"
211
+ class="sf-btn sf-btn--primario sf-btn--compatto"
212
+ type="button"
213
+ @click="avanti"
214
+ >
215
+ {{ ultimo ? 'Inizia' : 'Avanti' }}
216
+ </button>
217
+ </div>
218
+ </section>
219
+ </div>
220
+ </template>
221
+
222
+ <style scoped>
223
+ .sf-tour {
224
+ position: fixed;
225
+ inset: 0;
226
+ z-index: 90;
227
+ animation: sf-tour-entra var(--d-ampio) var(--e-entrata);
228
+ }
229
+
230
+ /* The spotlight: a transparent box whose huge shadow is the dark veil. */
231
+ .sf-tour__faro {
232
+ position: fixed;
233
+ border-radius: var(--r-md);
234
+ box-shadow:
235
+ 0 0 0 1px var(--accent),
236
+ 0 0 0 9999px color-mix(in oklab, var(--seta-notte) 74%, transparent);
237
+ transition:
238
+ top var(--d-ampio) var(--e-entrata),
239
+ left var(--d-ampio) var(--e-entrata),
240
+ width var(--d-ampio) var(--e-entrata),
241
+ height var(--d-ampio) var(--e-entrata);
242
+ pointer-events: none;
243
+ }
244
+
245
+ .sf-tour__faro::after {
246
+ content: '';
247
+ position: absolute;
248
+ inset: -1px;
249
+ border-radius: inherit;
250
+ box-shadow: 0 0 22px 2px color-mix(in oklab, var(--accent) 55%, transparent);
251
+ animation: sf-tour-respiro 2.4s var(--e-standard) infinite;
252
+ }
253
+
254
+ .sf-tour__scheda {
255
+ position: fixed;
256
+ display: flex;
257
+ flex-direction: column;
258
+ gap: var(--s-3);
259
+ padding: var(--s-5);
260
+ background: var(--surface);
261
+ border: 1px solid var(--border-forte);
262
+ border-radius: var(--r-lg);
263
+ box-shadow: var(--ombra-sovrapposto);
264
+ transition:
265
+ top var(--d-ampio) var(--e-entrata),
266
+ left var(--d-ampio) var(--e-entrata);
267
+ }
268
+
269
+ .sf-tour__titolo {
270
+ margin: 0;
271
+ font-size: 17px;
272
+ font-weight: 600;
273
+ }
274
+
275
+ .sf-tour__testo {
276
+ margin: 0;
277
+ color: var(--muted);
278
+ }
279
+
280
+ .sf-tour__puntini {
281
+ display: flex;
282
+ gap: 6px;
283
+ }
284
+
285
+ .sf-tour__puntini span {
286
+ width: 6px;
287
+ height: 6px;
288
+ background: var(--hud-tenue);
289
+ transition:
290
+ background var(--d-medio) var(--e-standard),
291
+ width var(--d-medio) var(--e-standard);
292
+ }
293
+
294
+ .sf-tour__puntini span[data-attivo='true'] {
295
+ width: 18px;
296
+ background: var(--accent);
297
+ }
298
+
299
+ .sf-tour__azioni {
300
+ display: flex;
301
+ flex-wrap: wrap;
302
+ align-items: center;
303
+ gap: var(--s-2);
304
+ }
305
+
306
+ .sf-tour__salta {
307
+ margin-right: auto;
308
+ color: var(--muted);
309
+ }
310
+
311
+ @keyframes sf-tour-entra {
312
+ from {
313
+ opacity: 0;
314
+ }
315
+ }
316
+
317
+ @keyframes sf-tour-respiro {
318
+ 50% {
319
+ opacity: 0.35;
320
+ }
321
+ }
322
+ </style>
@@ -1,6 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  const user = useCurrentUser();
3
3
  const { theme, toggle: toggleTheme } = useFoundationTheme();
4
+ const { rivedi } = useBenvenuto();
4
5
  const trigger = ref<HTMLElement | null>(null);
5
6
  const panel = ref<HTMLElement | null>(null);
6
7
  const { open, toggle } = usePopover(trigger, panel);
@@ -24,6 +25,7 @@ const nextTheme = computed(() => (theme.value === 'notte' ? 'giorno' : 'notte'))
24
25
  <button
25
26
  ref="trigger"
26
27
  class="sf-avatar sf-avatar--bottone"
28
+ data-tour="utente"
27
29
  type="button"
28
30
  :aria-label="`Menu utente: ${label}`"
29
31
  :aria-expanded="open"
@@ -42,6 +44,9 @@ const nextTheme = computed(() => (theme.value === 'notte' ? 'giorno' : 'notte'))
42
44
  <button class="sf-utente__voce" type="button" @click="toggleTheme">
43
45
  Passa al tema {{ nextTheme }}
44
46
  </button>
47
+ <button class="sf-utente__voce" type="button" @click="rivedi">
48
+ Rivedi la presentazione
49
+ </button>
45
50
  <a v-if="user" class="sf-utente__voce" href="/cdn-cgi/access/logout">Esci</a>
46
51
  </div>
47
52
  </div>
@@ -0,0 +1,40 @@
1
+ export type BenvenutoFase = 'avvio' | 'tour' | null;
2
+
3
+ const COOKIE = 'sf-benvenuto';
4
+ const SUITE_DOMAIN = 'setalabs.it';
5
+
6
+ /**
7
+ * First-visit welcome: the boot splash, then the guided tour. A cookie marks
8
+ * it as seen; on the suite domain it is shared by every app, so the welcome
9
+ * plays once for the whole suite, not once per panel.
10
+ */
11
+ export function useBenvenuto(): {
12
+ fase: Ref<BenvenutoFase>;
13
+ avanti: () => void;
14
+ chiudi: () => void;
15
+ rivedi: () => void;
16
+ } {
17
+ const { hostname } = useRequestURL();
18
+ const suite = hostname === SUITE_DOMAIN || hostname.endsWith(`.${SUITE_DOMAIN}`);
19
+ const visto = useCookie<string | null>(COOKIE, {
20
+ default: () => null,
21
+ domain: suite ? `.${SUITE_DOMAIN}` : undefined,
22
+ maxAge: 60 * 60 * 24 * 365 * 2,
23
+ sameSite: 'lax',
24
+ });
25
+ const fase = useState<BenvenutoFase>('sf-benvenuto', () => (visto.value ? null : 'avvio'));
26
+
27
+ const chiudi = (): void => {
28
+ visto.value = 'visto';
29
+ fase.value = null;
30
+ };
31
+ const avanti = (): void => {
32
+ if (fase.value === 'avvio') fase.value = 'tour';
33
+ else chiudi();
34
+ };
35
+ const rivedi = (): void => {
36
+ fase.value = 'avvio';
37
+ };
38
+
39
+ return { fase, avanti, chiudi, rivedi };
40
+ }
@@ -4,6 +4,7 @@ const app = useFoundationApp();
4
4
  const active = useActiveNav();
5
5
  const route = useRoute();
6
6
  const menuOpen = ref(false);
7
+ const { fase, avanti, chiudi } = useBenvenuto();
7
8
 
8
9
  useHead({ htmlAttrs: { 'data-theme': theme } });
9
10
  const closeMenu = (): void => {
@@ -29,7 +30,7 @@ onBeforeUnmount(() => document.removeEventListener('keydown', onKey));
29
30
  aria-hidden="true"
30
31
  @click="closeMenu"
31
32
  />
32
- <main class="sf-shell__slot">
33
+ <main class="sf-shell__slot" data-tour="contenuto">
33
34
  <div v-if="app && active" class="sf-targa__riga sf-shell__briciole">
34
35
  <b>{{ app.name }}</b
35
36
  ><span>{{ active.label }}</span
@@ -39,5 +40,9 @@ onBeforeUnmount(() => document.removeEventListener('keydown', onKey));
39
40
  </main>
40
41
  </div>
41
42
  <FoundationStato />
43
+ <FoundationAvvio v-if="fase === 'avvio'" @fine="avanti" />
44
+ <ClientOnly>
45
+ <FoundationTour v-if="fase === 'tour'" @fine="chiudi" />
46
+ </ClientOnly>
42
47
  </div>
43
48
  </template>
package/app.config.ts CHANGED
@@ -4,6 +4,8 @@ export interface FoundationNavItem {
4
4
  label: string;
5
5
  to: string;
6
6
  icon: IconName;
7
+ /** Title of the side-menu block the item belongs to; consecutive items share it. */
8
+ gruppo?: string;
7
9
  }
8
10
 
9
11
  // Types the host's `defineAppConfig` input: a wrong icon name fails its typecheck.
@@ -0,0 +1,31 @@
1
+ <script setup lang="ts">
2
+ // The two circles of the brand symbol (geometry of favicon.svg), drawn in
3
+ // vector so they follow the theme: blue plus the text color, no baked
4
+ // background like the PNG files of the Marchio group.
5
+ </script>
6
+
7
+ <template>
8
+ <svg class="sf-simbolo" viewBox="7 13 50 38" aria-hidden="true">
9
+ <circle class="sf-simbolo__blu" cx="26" cy="32" r="17" />
10
+ <circle class="sf-simbolo__seta" cx="38" cy="32" r="17" />
11
+ </svg>
12
+ </template>
13
+
14
+ <style scoped>
15
+ circle {
16
+ fill: none;
17
+ stroke-width: 3;
18
+ }
19
+
20
+ .sf-simbolo__blu {
21
+ stroke: var(--seta-blu);
22
+ }
23
+
24
+ .sf-simbolo__seta {
25
+ stroke: var(--fg);
26
+ }
27
+
28
+ :global([data-theme='giorno']) .sf-simbolo__blu {
29
+ stroke: var(--seta-blu-chiaro);
30
+ }
31
+ </style>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seta-labs/nuxt-foundation",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "description": "Seta Foundation: the Nuxt layer every internal Seta panel extends — design system mirror (tokens, sf- components, icons, brand) plus the shared shell (bar, app launcher, side menu, status bar)",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {