@mundogamernetwork/shared-ui 1.17.17 → 1.18.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/README.md +23 -0
- package/assets/kit/kit-base.css +47 -0
- package/assets/whats-new/tokens.css +43 -0
- package/components/ui/MgBanners.vue +13 -0
- package/components/whats-new/MgWhatsNewDialog.vue +552 -0
- package/components/whats-new/MgWhatsNewMedia.vue +242 -0
- package/components/whats-new/MgWhatsNewModal.vue +285 -0
- package/components/whats-new/MgWhatsNewRichText.vue +90 -0
- package/nuxt.config.ts +11 -0
- package/package.json +3 -2
- package/pages/contact.vue +8 -1
- package/pages/presskit/game/[slug].vue +29 -1
- package/pages/whats-new-preview.vue +96 -0
- package/services/creatorNetworkProgramService.ts +47 -0
- package/services/documentService.ts +16 -4
- package/stores/whatsNew.ts +170 -0
- package/utils/whatsNew.ts +300 -0
- package/utils/whatsNewMessages.ts +133 -0
- package/utils/whatsNewText.ts +10 -0
package/README.md
CHANGED
|
@@ -175,6 +175,29 @@ mgSharedUi: {
|
|
|
175
175
|
|
|
176
176
|
---
|
|
177
177
|
|
|
178
|
+
### Novidades da Rede (`MgWhatsNewModal`)
|
|
179
|
+
|
|
180
|
+
Modal "What's New" gerenciado pelo admin da rede (contrato: `GET /whats-new/pending` e `POST /whats-new/receipts` da api-main). O `<MgBanners />` já o monta, então os fronts não editam layout. Configure no `nuxt.config.ts` do front:
|
|
181
|
+
|
|
182
|
+
```ts
|
|
183
|
+
runtimeConfig: { public: { mgSharedUi: { whatsNew: {
|
|
184
|
+
enabled: true, // false desliga neste front
|
|
185
|
+
allowedRoutes: ["/feed", "/dashboard"], // vazio = qualquer rota logada não bloqueada
|
|
186
|
+
blockedRoutes: ["/wallet"], // soma-se às embutidas
|
|
187
|
+
} } } }
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
Também pode ser usado direto: `<MgWhatsNewModal :suppress="meuModalAberto" :blocked-routes="['/wallet']" />` (props abaixo; `suppress` só existe no uso direto).
|
|
191
|
+
|
|
192
|
+
- O backend decide *o que* mostrar (0 ou 1 comunicado por chamada); o componente decide *quando*: logado, 2,5 s de ociosidade na rota, nenhum outro modal aberto, 1 por sessão e 24 h entre exibições. Sem comunicado na API, nada é renderizado, então o backend é a flag de liberação.
|
|
193
|
+
- Props: `suppress` (o front tem um modal/tour próprio aberto: o comunicado espera na fila; modais com `role=dialog aria-modal` e tours driver.js já são detectados sozinhos), `blocked-routes` (rotas extras onde nunca interrompe, somadas às embutidas: login, cadastro, checkout, pagamento, criar/publicar/upload), `allowed-routes` (lista branca opcional; use em layouts compartilhados com páginas públicas), `logged-in` (sobrescreve a detecção via `useAuthStore().signedIn`), `has-route` (checa se uma rota interna existe; por padrão consulta o router. Atenção: `pages/[slug]` do shared-ui faz qualquer caminho de um segmento "existir").
|
|
194
|
+
- Plataforma: `runtimeConfig.public.mgSharedUi.systemId`; base da API: `networkBaseUrl`; idioma: vue-i18n (`ar-AE` é enviado como `ar`). O cache do comunicado é só em memória; só `device_id` (UUID aleatório) e a hora da última exibição ficam no `localStorage`.
|
|
195
|
+
- Textos fixos (Novidades, Fechar, Ver todas…) vivem em `utils/whatsNewMessages.ts` (en, pt-BR, de, es, ro, ar) e não dependem dos locales do app (vários fronts não mesclam os do shared-ui). Não mova para JSON em `locales/`: o `@nuxtjs/i18n` compila esses arquivos em AST.
|
|
196
|
+
- Cores: só tokens `--mg-wn-*` de `assets/whats-new/tokens.css` (claro padrão, escuro sob `.dark-mode`). Um front pode redefini-los no próprio tema.
|
|
197
|
+
- Texto do comunicado: `**negrito**` e `[texto](url)` (só `https://` ou `/caminho`), renderizados como nós Vue, sem `v-html`.
|
|
198
|
+
- Preview do admin: rota `/whats-new-preview` (noindex). O pai (iframe) envia `postMessage({ type: "mg-whats-new-preview", payload, theme?, lang? })` e recebe `{ type: "mg-whats-new-preview-ready" }`. Para QA: `/whats-new-preview?demo=image|video|embed|text&lang=pt-BR&theme=dark`.
|
|
199
|
+
- Testes: `yarn test` (vitest via npx) cobre markup seguro, rotas bloqueadas, elegibilidade, embeds e idiomas.
|
|
200
|
+
|
|
178
201
|
## Sobrescrita (Override)
|
|
179
202
|
|
|
180
203
|
Por ser um Nuxt Layer, qualquer arquivo pode ser sobrescrito no app consumidor. Basta criar o arquivo com o mesmo caminho:
|
package/assets/kit/kit-base.css
CHANGED
|
@@ -177,6 +177,53 @@ body:has(.kit-press) {
|
|
|
177
177
|
color: var(--kit-text, #f4f6fa);
|
|
178
178
|
border: 1px solid rgba(255,255,255,0.18);
|
|
179
179
|
}
|
|
180
|
+
.kit-btn-outline-accent {
|
|
181
|
+
background: transparent;
|
|
182
|
+
color: var(--kit-accent);
|
|
183
|
+
border: 1px solid var(--kit-accent);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/* ── Creator Network program (offered while it has a seat to give) ── */
|
|
187
|
+
.kit-program-pill {
|
|
188
|
+
display: inline-flex;
|
|
189
|
+
align-items: center;
|
|
190
|
+
gap: 8px;
|
|
191
|
+
width: fit-content;
|
|
192
|
+
padding: 4px 10px;
|
|
193
|
+
font-size: 0.72rem;
|
|
194
|
+
font-weight: 700;
|
|
195
|
+
letter-spacing: 1.5px;
|
|
196
|
+
text-transform: uppercase;
|
|
197
|
+
text-decoration: none;
|
|
198
|
+
color: var(--kit-accent);
|
|
199
|
+
border: 1px solid var(--kit-accent);
|
|
200
|
+
background: color-mix(in srgb, var(--kit-accent) 12%, transparent);
|
|
201
|
+
}
|
|
202
|
+
.kit-program-pill:hover { background: color-mix(in srgb, var(--kit-accent) 22%, transparent); }
|
|
203
|
+
.kit-program-dot {
|
|
204
|
+
width: 8px;
|
|
205
|
+
height: 8px;
|
|
206
|
+
background: var(--kit-accent);
|
|
207
|
+
animation: kit-program-pulse 2s ease-in-out infinite;
|
|
208
|
+
}
|
|
209
|
+
@keyframes kit-program-pulse { 50% { opacity: 0.35; } }
|
|
210
|
+
@media (prefers-reduced-motion: reduce) { .kit-program-dot { animation: none; } }
|
|
211
|
+
.kit-program-card {
|
|
212
|
+
display: flex;
|
|
213
|
+
align-items: center;
|
|
214
|
+
justify-content: space-between;
|
|
215
|
+
gap: 24px;
|
|
216
|
+
padding: 24px;
|
|
217
|
+
background: var(--kit-surface);
|
|
218
|
+
border: 1px solid var(--kit-line);
|
|
219
|
+
border-left: 3px solid var(--kit-accent);
|
|
220
|
+
}
|
|
221
|
+
.kit-program-card p { margin: 0; max-width: 60ch; line-height: 1.6; color: var(--kit-text); }
|
|
222
|
+
.kit-program-card .kit-btn { flex: none; }
|
|
223
|
+
@media (max-width: 720px) {
|
|
224
|
+
.kit-program-card { flex-direction: column; align-items: stretch; }
|
|
225
|
+
.kit-program-card .kit-btn { text-align: center; }
|
|
226
|
+
}
|
|
180
227
|
|
|
181
228
|
/* ── Content wrapper ────────────────────────────────────────────────*/
|
|
182
229
|
.kit-wrap {
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Theme tokens of the What's New modal. Colours live ONLY here; the component
|
|
3
|
+
* reads them through var(--mg-wn-*) with no literal fallback. A front can
|
|
4
|
+
* restyle the modal by redefining any of these in its own theme.
|
|
5
|
+
* Light is the default; the dark values apply under @nuxtjs/color-mode's
|
|
6
|
+
* `.dark-mode` class (every front sets colorMode.preference).
|
|
7
|
+
*/
|
|
8
|
+
:root,
|
|
9
|
+
.light-mode {
|
|
10
|
+
--mg-wn-overlay: rgba(11, 11, 20, 0.55);
|
|
11
|
+
--mg-wn-surface: #ffffff;
|
|
12
|
+
--mg-wn-surface-2: #f2f3f7;
|
|
13
|
+
--mg-wn-text: #1d2030;
|
|
14
|
+
--mg-wn-text-muted: #4f566b;
|
|
15
|
+
--mg-wn-border: #dcdfe8;
|
|
16
|
+
--mg-wn-accent: #3b38c4;
|
|
17
|
+
--mg-wn-on-accent: #ffffff;
|
|
18
|
+
--mg-wn-success: #146c43;
|
|
19
|
+
--mg-wn-warning: #8a4f00;
|
|
20
|
+
--mg-wn-neutral: #4f566b;
|
|
21
|
+
--mg-wn-media-bg: #1d2030;
|
|
22
|
+
--mg-wn-media-control-bg: rgba(0, 0, 0, 0.66);
|
|
23
|
+
--mg-wn-media-control-fg: #ffffff;
|
|
24
|
+
--mg-wn-shadow: rgba(0, 0, 0, 0.28);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.dark-mode {
|
|
28
|
+
--mg-wn-overlay: rgba(0, 0, 0, 0.66);
|
|
29
|
+
--mg-wn-surface: #1c1d2b;
|
|
30
|
+
--mg-wn-surface-2: #262838;
|
|
31
|
+
--mg-wn-text: #eceef8;
|
|
32
|
+
--mg-wn-text-muted: #a9aec6;
|
|
33
|
+
--mg-wn-border: #383b52;
|
|
34
|
+
--mg-wn-accent: #a3a1ff;
|
|
35
|
+
--mg-wn-on-accent: #12121c;
|
|
36
|
+
--mg-wn-success: #5fd199;
|
|
37
|
+
--mg-wn-warning: #f0b45a;
|
|
38
|
+
--mg-wn-neutral: #a9aec6;
|
|
39
|
+
--mg-wn-media-bg: #0c0c14;
|
|
40
|
+
--mg-wn-media-control-bg: rgba(0, 0, 0, 0.72);
|
|
41
|
+
--mg-wn-media-control-fg: #ffffff;
|
|
42
|
+
--mg-wn-shadow: rgba(0, 0, 0, 0.6);
|
|
43
|
+
}
|
|
@@ -12,6 +12,14 @@ onMounted(async () => {
|
|
|
12
12
|
});
|
|
13
13
|
|
|
14
14
|
const { isVisible: announcementVisible } = storeToRefs(announcementStore);
|
|
15
|
+
|
|
16
|
+
// "Novidades da Rede" rides along with the banners: every front already mounts
|
|
17
|
+
// <MgBanners /> in its logged-in layouts, so the modal needs no layout edit.
|
|
18
|
+
// Per-front rules live in nuxt.config → runtimeConfig.public.mgSharedUi.whatsNew.
|
|
19
|
+
const whatsNewConfig: any = (useRuntimeConfig().public.mgSharedUi as any)?.whatsNew ?? {};
|
|
20
|
+
const whatsNewEnabled = whatsNewConfig.enabled !== false;
|
|
21
|
+
const whatsNewAllowed: string[] = whatsNewConfig.allowedRoutes ?? [];
|
|
22
|
+
const whatsNewBlocked: string[] = whatsNewConfig.blockedRoutes ?? [];
|
|
15
23
|
</script>
|
|
16
24
|
|
|
17
25
|
<template>
|
|
@@ -20,4 +28,9 @@ const { isVisible: announcementVisible } = storeToRefs(announcementStore);
|
|
|
20
28
|
active/visible announcement. -->
|
|
21
29
|
<MgAnnouncementBanner />
|
|
22
30
|
<MgPromotionBanner v-if="!announcementVisible" />
|
|
31
|
+
<MgWhatsNewModal
|
|
32
|
+
v-if="whatsNewEnabled"
|
|
33
|
+
:allowed-routes="whatsNewAllowed"
|
|
34
|
+
:blocked-routes="whatsNewBlocked"
|
|
35
|
+
/>
|
|
23
36
|
</template>
|
|
@@ -0,0 +1,552 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, nextTick, onBeforeUnmount, onMounted, ref } from "vue";
|
|
3
|
+
import { classifyHref, isRtl, toApiLang, type WnPost } from "../../utils/whatsNew";
|
|
4
|
+
import { wnText, type WnTextKey } from "../../utils/whatsNewText";
|
|
5
|
+
|
|
6
|
+
const props = defineProps<{
|
|
7
|
+
post: WnPost;
|
|
8
|
+
locale: string;
|
|
9
|
+
// Maps an in-app path to the final route, or null when this front has no such route.
|
|
10
|
+
resolveInternal: (path: string) => string | null;
|
|
11
|
+
}>();
|
|
12
|
+
|
|
13
|
+
const emit = defineEmits<{
|
|
14
|
+
(e: "close", reason: "button" | "later" | "esc" | "backdrop"): void;
|
|
15
|
+
(e: "cta"): void;
|
|
16
|
+
(e: "navigate", path: string): void;
|
|
17
|
+
(e: "link", target: string): void;
|
|
18
|
+
(e: "video-play"): void;
|
|
19
|
+
}>();
|
|
20
|
+
|
|
21
|
+
const uid = Math.random().toString(36).slice(2, 8);
|
|
22
|
+
const titleId = `mg-wn-title-${uid}`;
|
|
23
|
+
const summaryId = `mg-wn-summary-${uid}`;
|
|
24
|
+
|
|
25
|
+
const panel = ref<HTMLElement | null>(null);
|
|
26
|
+
const titleEl = ref<HTMLElement | null>(null);
|
|
27
|
+
let returnFocusTo: HTMLElement | null = null;
|
|
28
|
+
let previousOverflow = "";
|
|
29
|
+
|
|
30
|
+
const t = (key: WnTextKey) => wnText(props.locale, key);
|
|
31
|
+
const dir = computed(() => (isRtl(props.locale) ? "rtl" : "ltr"));
|
|
32
|
+
|
|
33
|
+
const dateLabel = computed(() => {
|
|
34
|
+
if (!props.post.published_at) return "";
|
|
35
|
+
try {
|
|
36
|
+
return new Intl.DateTimeFormat(toApiLang(props.locale), { dateStyle: "long" }).format(
|
|
37
|
+
new Date(props.post.published_at),
|
|
38
|
+
);
|
|
39
|
+
} catch {
|
|
40
|
+
return "";
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
const kindLabel = computed(() => t(`kind_${props.post.kind}` as WnTextKey));
|
|
45
|
+
const subtitle = computed(() => [dateLabel.value, kindLabel.value].filter(Boolean).join(" · "));
|
|
46
|
+
|
|
47
|
+
// The CTA only renders when its target resolves to something this front can open.
|
|
48
|
+
const cta = computed(() => {
|
|
49
|
+
const c = props.post.cta;
|
|
50
|
+
if (!c || !c.label) return null;
|
|
51
|
+
const kind = classifyHref(c.target);
|
|
52
|
+
if (kind === "external") return { label: c.label, href: c.target, external: true };
|
|
53
|
+
if (kind === "internal") {
|
|
54
|
+
const resolved = props.resolveInternal(c.target);
|
|
55
|
+
return resolved ? { label: c.label, href: resolved, external: false } : null;
|
|
56
|
+
}
|
|
57
|
+
return null;
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
const historyLink = computed(() => {
|
|
61
|
+
const url = props.post.history_url;
|
|
62
|
+
const kind = classifyHref(url);
|
|
63
|
+
if (!url || !kind) return null;
|
|
64
|
+
if (kind === "external") return { href: url, external: true };
|
|
65
|
+
const resolved = props.resolveInternal(url);
|
|
66
|
+
return resolved ? { href: resolved, external: false } : null;
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
const footerLinks = computed(() =>
|
|
70
|
+
(props.post.links || []).filter((l) => classifyHref(l.url) === "external" && l.label),
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
function sectionLabel(section: WnPost["sections"][number]) {
|
|
74
|
+
return section.title || t(section.type as WnTextKey);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function onCta(event: MouseEvent) {
|
|
78
|
+
emit("cta");
|
|
79
|
+
if (cta.value && !cta.value.external) {
|
|
80
|
+
if (event.metaKey || event.ctrlKey || event.shiftKey || event.button !== 0) return;
|
|
81
|
+
event.preventDefault();
|
|
82
|
+
emit("navigate", cta.value.href);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function onHistory(event: MouseEvent) {
|
|
87
|
+
if (!historyLink.value) return;
|
|
88
|
+
emit("link", props.post.history_url as string);
|
|
89
|
+
if (!historyLink.value.external && !(event.metaKey || event.ctrlKey || event.shiftKey)) {
|
|
90
|
+
event.preventDefault();
|
|
91
|
+
emit("navigate", historyLink.value.href);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function onFooterLink(url: string) {
|
|
96
|
+
emit("link", url);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function onBackdrop(event: MouseEvent) {
|
|
100
|
+
if (event.target === event.currentTarget) emit("close", "backdrop");
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// ── focus management ──────────────────────────────────────────────────────
|
|
104
|
+
const FOCUSABLE =
|
|
105
|
+
'a[href], button:not([disabled]), iframe, video[controls], [tabindex]:not([tabindex="-1"])';
|
|
106
|
+
|
|
107
|
+
function focusables(): HTMLElement[] {
|
|
108
|
+
if (!panel.value) return [];
|
|
109
|
+
return Array.from(panel.value.querySelectorAll<HTMLElement>(FOCUSABLE)).filter(
|
|
110
|
+
(el) => !el.hasAttribute("inert") && el.getClientRects().length > 0,
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function onKeydown(event: KeyboardEvent) {
|
|
115
|
+
if (event.key === "Escape") {
|
|
116
|
+
event.stopPropagation();
|
|
117
|
+
emit("close", "esc");
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
if (event.key !== "Tab") return;
|
|
121
|
+
const items = focusables();
|
|
122
|
+
if (!items.length) {
|
|
123
|
+
event.preventDefault();
|
|
124
|
+
titleEl.value?.focus();
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
const first = items[0];
|
|
128
|
+
const last = items[items.length - 1];
|
|
129
|
+
const active = document.activeElement as HTMLElement | null;
|
|
130
|
+
const inside = !!active && !!panel.value?.contains(active);
|
|
131
|
+
if (event.shiftKey && (active === first || active === titleEl.value || !inside)) {
|
|
132
|
+
event.preventDefault();
|
|
133
|
+
last.focus();
|
|
134
|
+
} else if (!event.shiftKey && (active === last || !inside)) {
|
|
135
|
+
event.preventDefault();
|
|
136
|
+
first.focus();
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
onMounted(async () => {
|
|
141
|
+
returnFocusTo = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
142
|
+
previousOverflow = document.documentElement.style.overflow;
|
|
143
|
+
document.documentElement.style.overflow = "hidden";
|
|
144
|
+
document.addEventListener("keydown", onKeydown, true);
|
|
145
|
+
await nextTick();
|
|
146
|
+
titleEl.value?.focus({ preventScroll: true });
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
onBeforeUnmount(() => {
|
|
150
|
+
document.removeEventListener("keydown", onKeydown, true);
|
|
151
|
+
document.documentElement.style.overflow = previousOverflow;
|
|
152
|
+
if (returnFocusTo && document.contains(returnFocusTo)) returnFocusTo.focus({ preventScroll: true });
|
|
153
|
+
});
|
|
154
|
+
</script>
|
|
155
|
+
|
|
156
|
+
<template>
|
|
157
|
+
<div class="mg-wn-overlay" data-mg-wn :dir="dir" @mousedown="onBackdrop">
|
|
158
|
+
<div
|
|
159
|
+
ref="panel"
|
|
160
|
+
class="mg-wn-panel"
|
|
161
|
+
role="dialog"
|
|
162
|
+
aria-modal="true"
|
|
163
|
+
:aria-labelledby="titleId"
|
|
164
|
+
:aria-describedby="post.summary ? summaryId : undefined"
|
|
165
|
+
>
|
|
166
|
+
<header class="mg-wn-head">
|
|
167
|
+
<div class="mg-wn-head__text">
|
|
168
|
+
<p class="mg-wn-eyebrow">{{ t("title") }}</p>
|
|
169
|
+
<h2 :id="titleId" ref="titleEl" class="mg-wn-title" tabindex="-1">{{ post.title }}</h2>
|
|
170
|
+
<p v-if="subtitle" class="mg-wn-sub">{{ subtitle }}</p>
|
|
171
|
+
</div>
|
|
172
|
+
<button type="button" class="mg-wn-x" :aria-label="t('close')" @click="emit('close', 'button')">
|
|
173
|
+
<span aria-hidden="true">✕</span>
|
|
174
|
+
</button>
|
|
175
|
+
</header>
|
|
176
|
+
|
|
177
|
+
<div class="mg-wn-body" tabindex="0" role="region" :aria-labelledby="titleId">
|
|
178
|
+
<MgWhatsNewMedia
|
|
179
|
+
v-if="post.media"
|
|
180
|
+
:media="post.media"
|
|
181
|
+
:locale="locale"
|
|
182
|
+
@video-play="emit('video-play')"
|
|
183
|
+
/>
|
|
184
|
+
|
|
185
|
+
<p v-if="post.summary" :id="summaryId" class="mg-wn-summary">
|
|
186
|
+
<MgWhatsNewRichText
|
|
187
|
+
:text="post.summary"
|
|
188
|
+
:locale="locale"
|
|
189
|
+
:resolve-internal="resolveInternal"
|
|
190
|
+
@link="(u: string) => emit('link', u)"
|
|
191
|
+
@navigate="(p: string) => emit('navigate', p)"
|
|
192
|
+
/>
|
|
193
|
+
</p>
|
|
194
|
+
|
|
195
|
+
<section
|
|
196
|
+
v-for="(section, si) in post.sections"
|
|
197
|
+
:key="si"
|
|
198
|
+
class="mg-wn-section"
|
|
199
|
+
:class="`mg-wn-section--${section.type}`"
|
|
200
|
+
>
|
|
201
|
+
<h3 class="mg-wn-section__title">{{ sectionLabel(section) }}</h3>
|
|
202
|
+
<ul class="mg-wn-section__list">
|
|
203
|
+
<li v-for="(item, ii) in section.items" :key="ii">
|
|
204
|
+
<a
|
|
205
|
+
v-if="item.link_url && classifyHref(item.link_url) === 'external'"
|
|
206
|
+
class="mg-wn-item-link"
|
|
207
|
+
:href="item.link_url"
|
|
208
|
+
target="_blank"
|
|
209
|
+
rel="noopener noreferrer"
|
|
210
|
+
@click="emit('link', item.link_url as string)"
|
|
211
|
+
>
|
|
212
|
+
<MgWhatsNewRichText :text="item.body" :allow-links="false" :locale="locale" />
|
|
213
|
+
</a>
|
|
214
|
+
<a
|
|
215
|
+
v-else-if="item.link_url && classifyHref(item.link_url) === 'internal' && resolveInternal(item.link_url)"
|
|
216
|
+
class="mg-wn-item-link"
|
|
217
|
+
:href="resolveInternal(item.link_url) as string"
|
|
218
|
+
@click.prevent="
|
|
219
|
+
emit('link', item.link_url as string);
|
|
220
|
+
emit('navigate', resolveInternal(item.link_url as string) as string);
|
|
221
|
+
"
|
|
222
|
+
>
|
|
223
|
+
<MgWhatsNewRichText :text="item.body" :allow-links="false" :locale="locale" />
|
|
224
|
+
</a>
|
|
225
|
+
<MgWhatsNewRichText
|
|
226
|
+
v-else
|
|
227
|
+
:text="item.body"
|
|
228
|
+
:locale="locale"
|
|
229
|
+
:resolve-internal="resolveInternal"
|
|
230
|
+
@link="(u: string) => emit('link', u)"
|
|
231
|
+
@navigate="(p: string) => emit('navigate', p)"
|
|
232
|
+
/>
|
|
233
|
+
</li>
|
|
234
|
+
</ul>
|
|
235
|
+
</section>
|
|
236
|
+
</div>
|
|
237
|
+
|
|
238
|
+
<div v-if="cta" class="mg-wn-actions">
|
|
239
|
+
<a
|
|
240
|
+
class="mg-wn-btn mg-wn-btn--primary"
|
|
241
|
+
:href="cta.href"
|
|
242
|
+
:target="cta.external ? '_blank' : undefined"
|
|
243
|
+
:rel="cta.external ? 'noopener noreferrer' : undefined"
|
|
244
|
+
@click="onCta"
|
|
245
|
+
>
|
|
246
|
+
{{ cta.label }}
|
|
247
|
+
</a>
|
|
248
|
+
<button type="button" class="mg-wn-btn" @click="emit('close', 'later')">{{ t("later") }}</button>
|
|
249
|
+
</div>
|
|
250
|
+
|
|
251
|
+
<footer v-if="footerLinks.length || historyLink" class="mg-wn-foot">
|
|
252
|
+
<nav v-if="footerLinks.length" class="mg-wn-social" :aria-label="t('follow')">
|
|
253
|
+
<a
|
|
254
|
+
v-for="link in footerLinks"
|
|
255
|
+
:key="link.url"
|
|
256
|
+
class="mg-wn-social__link"
|
|
257
|
+
:href="link.url"
|
|
258
|
+
target="_blank"
|
|
259
|
+
rel="noopener noreferrer"
|
|
260
|
+
@click="onFooterLink(link.url)"
|
|
261
|
+
>
|
|
262
|
+
{{ link.label }}
|
|
263
|
+
</a>
|
|
264
|
+
</nav>
|
|
265
|
+
<a
|
|
266
|
+
v-if="historyLink"
|
|
267
|
+
class="mg-wn-history"
|
|
268
|
+
:href="historyLink.href"
|
|
269
|
+
:target="historyLink.external ? '_blank' : undefined"
|
|
270
|
+
:rel="historyLink.external ? 'noopener noreferrer' : undefined"
|
|
271
|
+
@click="onHistory"
|
|
272
|
+
>
|
|
273
|
+
{{ t("view_all") }} <span aria-hidden="true" class="mg-wn-history__arrow">→</span>
|
|
274
|
+
</a>
|
|
275
|
+
</footer>
|
|
276
|
+
</div>
|
|
277
|
+
</div>
|
|
278
|
+
</template>
|
|
279
|
+
|
|
280
|
+
<style lang="scss" scoped>
|
|
281
|
+
.mg-wn-overlay {
|
|
282
|
+
position: fixed;
|
|
283
|
+
inset: 0;
|
|
284
|
+
z-index: 10050;
|
|
285
|
+
display: flex;
|
|
286
|
+
align-items: center;
|
|
287
|
+
justify-content: center;
|
|
288
|
+
padding: 16px;
|
|
289
|
+
background: var(--mg-wn-overlay);
|
|
290
|
+
font-family: inherit;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
.mg-wn-panel {
|
|
294
|
+
display: flex;
|
|
295
|
+
flex-direction: column;
|
|
296
|
+
width: 100%;
|
|
297
|
+
max-width: 440px;
|
|
298
|
+
max-height: min(88dvh, 760px);
|
|
299
|
+
color: var(--mg-wn-text);
|
|
300
|
+
background: var(--mg-wn-surface);
|
|
301
|
+
border: 1px solid var(--mg-wn-border);
|
|
302
|
+
border-radius: 0;
|
|
303
|
+
box-shadow: 0 18px 50px var(--mg-wn-shadow);
|
|
304
|
+
overflow: hidden;
|
|
305
|
+
|
|
306
|
+
&:focus-visible,
|
|
307
|
+
& :focus-visible {
|
|
308
|
+
outline: 2px solid var(--mg-wn-accent);
|
|
309
|
+
outline-offset: 2px;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
.mg-wn-head {
|
|
314
|
+
display: flex;
|
|
315
|
+
align-items: flex-start;
|
|
316
|
+
justify-content: space-between;
|
|
317
|
+
gap: 12px;
|
|
318
|
+
padding: 16px 18px 10px;
|
|
319
|
+
|
|
320
|
+
&__text {
|
|
321
|
+
min-width: 0;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
.mg-wn-eyebrow {
|
|
326
|
+
margin: 0 0 2px;
|
|
327
|
+
font-size: 0.6875rem;
|
|
328
|
+
font-weight: 700;
|
|
329
|
+
letter-spacing: 0.09em;
|
|
330
|
+
text-transform: uppercase;
|
|
331
|
+
color: var(--mg-wn-accent);
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
.mg-wn-title {
|
|
335
|
+
margin: 0;
|
|
336
|
+
font-size: 1.25rem;
|
|
337
|
+
line-height: 1.25;
|
|
338
|
+
font-weight: 700;
|
|
339
|
+
color: var(--mg-wn-text);
|
|
340
|
+
overflow-wrap: anywhere;
|
|
341
|
+
|
|
342
|
+
&:focus {
|
|
343
|
+
outline: none;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
.mg-wn-sub {
|
|
348
|
+
margin: 4px 0 0;
|
|
349
|
+
font-size: 0.75rem;
|
|
350
|
+
color: var(--mg-wn-text-muted);
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
.mg-wn-x {
|
|
354
|
+
flex: none;
|
|
355
|
+
display: grid;
|
|
356
|
+
place-items: center;
|
|
357
|
+
width: 32px;
|
|
358
|
+
height: 32px;
|
|
359
|
+
padding: 0;
|
|
360
|
+
font-size: 0.875rem;
|
|
361
|
+
color: var(--mg-wn-text-muted);
|
|
362
|
+
background: transparent;
|
|
363
|
+
border: 1px solid var(--mg-wn-border);
|
|
364
|
+
border-radius: 0;
|
|
365
|
+
cursor: pointer;
|
|
366
|
+
|
|
367
|
+
&:hover {
|
|
368
|
+
color: var(--mg-wn-text);
|
|
369
|
+
background: var(--mg-wn-surface-2);
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
.mg-wn-body {
|
|
374
|
+
display: flex;
|
|
375
|
+
flex-direction: column;
|
|
376
|
+
gap: 12px;
|
|
377
|
+
padding: 4px 18px 8px;
|
|
378
|
+
overflow-y: auto;
|
|
379
|
+
overscroll-behavior: contain;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
.mg-wn-summary {
|
|
383
|
+
margin: 0;
|
|
384
|
+
font-size: 0.9rem;
|
|
385
|
+
line-height: 1.5;
|
|
386
|
+
color: var(--mg-wn-text);
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
.mg-wn-section {
|
|
390
|
+
&__title {
|
|
391
|
+
display: flex;
|
|
392
|
+
align-items: center;
|
|
393
|
+
gap: 8px;
|
|
394
|
+
margin: 0 0 6px;
|
|
395
|
+
font-size: 0.6875rem;
|
|
396
|
+
font-weight: 700;
|
|
397
|
+
letter-spacing: 0.09em;
|
|
398
|
+
text-transform: uppercase;
|
|
399
|
+
color: var(--mg-wn-section-color);
|
|
400
|
+
|
|
401
|
+
&::after {
|
|
402
|
+
content: "";
|
|
403
|
+
flex: 1;
|
|
404
|
+
height: 1px;
|
|
405
|
+
background: var(--mg-wn-border);
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
&__list {
|
|
410
|
+
margin: 0;
|
|
411
|
+
padding-inline-start: 18px;
|
|
412
|
+
font-size: 0.84rem;
|
|
413
|
+
line-height: 1.5;
|
|
414
|
+
|
|
415
|
+
li {
|
|
416
|
+
margin-bottom: 4px;
|
|
417
|
+
padding-inline-start: 2px;
|
|
418
|
+
color: var(--mg-wn-text);
|
|
419
|
+
|
|
420
|
+
&::marker {
|
|
421
|
+
color: var(--mg-wn-section-color);
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
// Section colour per type — success / accent / warning / neutral from the theme.
|
|
427
|
+
&--feature {
|
|
428
|
+
--mg-wn-section-color: var(--mg-wn-success);
|
|
429
|
+
}
|
|
430
|
+
&--improvement {
|
|
431
|
+
--mg-wn-section-color: var(--mg-wn-accent);
|
|
432
|
+
}
|
|
433
|
+
&--fix {
|
|
434
|
+
--mg-wn-section-color: var(--mg-wn-warning);
|
|
435
|
+
}
|
|
436
|
+
&--note {
|
|
437
|
+
--mg-wn-section-color: var(--mg-wn-neutral);
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
.mg-wn-item-link {
|
|
442
|
+
color: inherit;
|
|
443
|
+
text-decoration: underline;
|
|
444
|
+
text-decoration-color: var(--mg-wn-section-color);
|
|
445
|
+
text-underline-offset: 2px;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
.mg-wn-actions {
|
|
449
|
+
display: flex;
|
|
450
|
+
flex-wrap: wrap;
|
|
451
|
+
gap: 8px;
|
|
452
|
+
padding: 8px 18px 4px;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
.mg-wn-btn {
|
|
456
|
+
display: inline-flex;
|
|
457
|
+
align-items: center;
|
|
458
|
+
justify-content: center;
|
|
459
|
+
padding: 9px 16px;
|
|
460
|
+
font: inherit;
|
|
461
|
+
font-size: 0.8125rem;
|
|
462
|
+
font-weight: 600;
|
|
463
|
+
color: var(--mg-wn-text);
|
|
464
|
+
text-decoration: none;
|
|
465
|
+
background: transparent;
|
|
466
|
+
border: 1px solid var(--mg-wn-border);
|
|
467
|
+
border-radius: 0;
|
|
468
|
+
cursor: pointer;
|
|
469
|
+
|
|
470
|
+
&:hover {
|
|
471
|
+
background: var(--mg-wn-surface-2);
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
&--primary {
|
|
475
|
+
color: var(--mg-wn-on-accent);
|
|
476
|
+
background: var(--mg-wn-accent);
|
|
477
|
+
border-color: transparent;
|
|
478
|
+
|
|
479
|
+
&:hover {
|
|
480
|
+
background: var(--mg-wn-accent);
|
|
481
|
+
filter: brightness(1.08);
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
.mg-wn-foot {
|
|
487
|
+
display: flex;
|
|
488
|
+
flex-wrap: wrap;
|
|
489
|
+
align-items: center;
|
|
490
|
+
justify-content: space-between;
|
|
491
|
+
gap: 8px 16px;
|
|
492
|
+
margin-top: 10px;
|
|
493
|
+
padding: 10px 18px;
|
|
494
|
+
font-size: 0.75rem;
|
|
495
|
+
color: var(--mg-wn-text-muted);
|
|
496
|
+
background: var(--mg-wn-surface-2);
|
|
497
|
+
border-top: 1px solid var(--mg-wn-border);
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
.mg-wn-social {
|
|
501
|
+
display: flex;
|
|
502
|
+
flex-wrap: wrap;
|
|
503
|
+
gap: 6px;
|
|
504
|
+
|
|
505
|
+
&__link {
|
|
506
|
+
padding: 2px 10px;
|
|
507
|
+
color: var(--mg-wn-text);
|
|
508
|
+
text-decoration: none;
|
|
509
|
+
background: var(--mg-wn-surface);
|
|
510
|
+
border: 1px solid var(--mg-wn-border);
|
|
511
|
+
border-radius: 0;
|
|
512
|
+
|
|
513
|
+
&:hover {
|
|
514
|
+
border-color: var(--mg-wn-accent);
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
.mg-wn-history {
|
|
520
|
+
margin-inline-start: auto;
|
|
521
|
+
color: var(--mg-wn-accent);
|
|
522
|
+
font-weight: 600;
|
|
523
|
+
text-decoration: none;
|
|
524
|
+
|
|
525
|
+
&:hover {
|
|
526
|
+
text-decoration: underline;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
&__arrow {
|
|
530
|
+
display: inline-block;
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
[dir="rtl"] .mg-wn-history__arrow {
|
|
535
|
+
transform: scaleX(-1);
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
// Phones: bottom sheet.
|
|
539
|
+
@media (max-width: 560px) {
|
|
540
|
+
.mg-wn-overlay {
|
|
541
|
+
align-items: flex-end;
|
|
542
|
+
padding: 0;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
.mg-wn-panel {
|
|
546
|
+
max-width: none;
|
|
547
|
+
max-height: 92dvh;
|
|
548
|
+
border-radius: 0;
|
|
549
|
+
border-bottom: 0;
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
</style>
|