@seta-labs/nuxt-foundation 0.1.0 → 0.3.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.
- package/app/apps.ts +2 -0
- package/app/components/FoundationAvvio.vue +332 -0
- package/app/components/FoundationBarra.vue +2 -1
- package/app/components/FoundationLauncher.vue +1 -0
- package/app/components/FoundationMenu.vue +1 -0
- package/app/components/FoundationStato.vue +1 -1
- package/app/components/FoundationTour.vue +322 -0
- package/app/components/FoundationUtente.vue +5 -0
- package/app/composables/useBenvenuto.ts +40 -0
- package/app/layouts/default.vue +6 -1
- package/nuxt.config.ts +5 -6
- package/package.json +1 -1
package/app/apps.ts
CHANGED
|
@@ -8,6 +8,8 @@ import type { IconName } from '../design-system/vue/icons';
|
|
|
8
8
|
export const foundationApps = [
|
|
9
9
|
{ id: 'agency', name: 'Agency', kind: 'app', url: 'https://agency.setalabs.it' },
|
|
10
10
|
{ id: 'proxy', name: 'Proxy', kind: 'app', url: 'https://proxy.setalabs.it' },
|
|
11
|
+
{ id: 'geo', name: 'Geo', kind: 'app', url: 'https://geo.setalabs.it' },
|
|
12
|
+
{ id: 'immo', name: 'Immo', kind: 'app', url: 'https://immo.setalabs.it' },
|
|
11
13
|
{ id: 'infra', name: 'Infra', kind: 'tool', url: 'https://argocd.setalabs.it' },
|
|
12
14
|
] as const satisfies readonly FoundationAppEntry[];
|
|
13
15
|
|
|
@@ -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>
|
|
@@ -19,7 +19,7 @@ const dev = import.meta.dev;
|
|
|
19
19
|
</NuxtLink>
|
|
20
20
|
<template v-if="app">
|
|
21
21
|
<span class="sf-barra__sep sf-shell__sep" />
|
|
22
|
-
<NuxtLink to="/" class="sf-barra__app">
|
|
22
|
+
<NuxtLink to="/" class="sf-barra__app" data-tour="app">
|
|
23
23
|
<SfTessera :app="app.id" :size="32" />
|
|
24
24
|
{{ app.name }}
|
|
25
25
|
</NuxtLink>
|
|
@@ -30,6 +30,7 @@ const dev = import.meta.dev;
|
|
|
30
30
|
<button
|
|
31
31
|
v-if="hasNav"
|
|
32
32
|
class="sf-btn sf-btn--icona sf-shell__apri-menu"
|
|
33
|
+
data-tour="menu-mobile"
|
|
33
34
|
type="button"
|
|
34
35
|
aria-controls="sf-menu"
|
|
35
36
|
:aria-expanded="menuOpen"
|
|
@@ -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
|
+
}
|
package/app/layouts/default.vue
CHANGED
|
@@ -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/nuxt.config.ts
CHANGED
|
@@ -3,6 +3,10 @@ import { fileURLToPath } from 'node:url';
|
|
|
3
3
|
|
|
4
4
|
const here = (path: string): string => fileURLToPath(new URL(path, import.meta.url));
|
|
5
5
|
const { version } = JSON.parse(readFileSync(here('./package.json'), 'utf8')) as { version: string };
|
|
6
|
+
// Inlined at build time: the host serves no Foundation files of its own.
|
|
7
|
+
const favicon = `data:image/svg+xml,${encodeURIComponent(
|
|
8
|
+
readFileSync(here('./design-system/assets/Marchio/favicon.svg'), 'utf8'),
|
|
9
|
+
)}`;
|
|
6
10
|
|
|
7
11
|
// The layer: design system (tokens + sf- CSS + Vue primitives) and the shell.
|
|
8
12
|
// The host app sets `runtimeConfig.public.foundationApp` to its registry id;
|
|
@@ -10,7 +14,7 @@ const { version } = JSON.parse(readFileSync(here('./package.json'), 'utf8')) as
|
|
|
10
14
|
export default defineNuxtConfig({
|
|
11
15
|
app: {
|
|
12
16
|
head: {
|
|
13
|
-
link: [{ rel: 'icon', type: 'image/svg+xml', href:
|
|
17
|
+
link: [{ rel: 'icon', type: 'image/svg+xml', href: favicon }],
|
|
14
18
|
},
|
|
15
19
|
},
|
|
16
20
|
components: [
|
|
@@ -22,11 +26,6 @@ export default defineNuxtConfig({
|
|
|
22
26
|
here('./design-system/components/bundle.css'),
|
|
23
27
|
here('./app/assets/shell.css'),
|
|
24
28
|
],
|
|
25
|
-
nitro: {
|
|
26
|
-
publicAssets: [
|
|
27
|
-
{ baseURL: '/_foundation', dir: here('./design-system/assets/Marchio'), maxAge: 86400 },
|
|
28
|
-
],
|
|
29
|
-
},
|
|
30
29
|
runtimeConfig: {
|
|
31
30
|
public: {
|
|
32
31
|
foundationApp: '',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seta-labs/nuxt-foundation",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.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": {
|