@brucesantos/design-space 0.5.1 → 0.8.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/dist/index.js CHANGED
@@ -1,549 +1,415 @@
1
- import { jsxs as u, jsx as o, Fragment as A } from "react/jsx-runtime";
2
- import { useState as $, useEffect as I, useMemo as C, useCallback as E, useContext as ue, createContext as he, useRef as Q, forwardRef as pe } from "react";
3
- import { S as se, v as me, P as g, N as ie, s as fe, c as be, g as ve } from "./contrast-BseNi5QD.js";
4
- import { C as At, a as Pt, b as Lt, d as $t, e as Et, f as Ft, h as Rt, i as Dt, j as Ot, k as It, p as Bt, r as Wt, l as jt, m as Ht, n as Kt } from "./contrast-BseNi5QD.js";
5
- function ge(e) {
6
- const t = new Map(e.scenarios.map((d) => [d.id, d])), n = new Map(
7
- (e.components ?? []).map((d) => [d.id, d])
8
- ), s = new Map(e.personas.map((d) => [d.id, d])), l = new Map(e.fixtures.map((d) => [d.id, d])), a = new Map((e.rules ?? []).map((d) => [d.id, d])), r = new Map(e.modules.map((d) => [d.id, d])), c = new Map(
9
- e.modules.flatMap((d) => (d.flows ?? []).map((f) => [f.id, f]))
10
- ), h = e.modules.map((d) => ({
11
- module: d,
12
- scenarios: e.scenarios.filter((f) => f.id.split(".")[0] === d.id)
13
- })), p = new Set(h.flatMap((d) => d.scenarios.map((f) => f.id))), m = e.scenarios.filter((d) => !p.has(d.id)), v = (d) => d ? t.get(d) : void 0, i = (d) => d ? s.get(d) : void 0, N = (d, f) => {
14
- if (!(!d || !f))
15
- return n.get(d)?.fixtures?.find((k) => k.id === f);
16
- }, x = (d = {}) => e.scenarios.filter(
17
- (f) => d.includePorted || (d.view === "ported" ? f.status === "ported" : f.status !== "ported") || d.view === void 0 && f.id === d.activeScenario
18
- ), S = (d) => d ? d.permissions ? d.permissions : i(d.persona)?.permissions ?? [] : [];
1
+ import { jsx as t, jsxs as g, Fragment as I } from "react/jsx-runtime";
2
+ import { useState as z, useRef as U, useEffect as K, useMemo as D, useCallback as W, useContext as Ze, createContext as Ye, useLayoutEffect as Pe } from "react";
3
+ import { r as me, h as Q, v as Qe, a as ce, b as $e, p as Xe, P as C, c as ge, d as ne, t as re, f as pe, N as Fe, e as ze, g as Je, s as Se, i as Ne, F as et, j as tt, k as nt, m as ot } from "./index-FIzKHaWE.js";
4
+ import { l as en, H as tn, n as nn, o as on, q as rn, u as an, w as sn, x as cn, y as ln, z as dn } from "./index-FIzKHaWE.js";
5
+ function rt(e) {
6
+ const n = e.scenarios ?? [], o = e.routes ?? [], a = e.components ?? [], r = new Map(n.map((i) => [i.id, i])), s = new Map(a.map((i) => [i.id, i])), u = new Map((e.personas ?? []).map((i) => [i.id, i])), c = new Map((e.fixtures ?? []).map((i) => [i.id, i])), p = new Map((e.rules ?? []).map((i) => [i.id, i])), l = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new Map();
7
+ for (const i of n) {
8
+ const m = me(o, i.route ?? "");
9
+ if (!m) continue;
10
+ const v = m.definition.path;
11
+ w.set(i.id, v);
12
+ const E = l.get(v) ?? [];
13
+ E.push(i), l.set(v, E);
14
+ }
15
+ const f = /* @__PURE__ */ new Set(), b = [];
16
+ for (const i of o) {
17
+ if (f.has(i.path)) continue;
18
+ f.add(i.path);
19
+ const m = l.get(i.path) ?? [];
20
+ b.push({
21
+ id: i.path,
22
+ name: i.name?.trim() || m[0]?.title || i.path,
23
+ description: i.description,
24
+ route: i,
25
+ href: at(i.path),
26
+ variations: m
27
+ });
28
+ }
29
+ const M = new Map(b.map((i) => [i.id, i])), y = (i) => i ? r.get(i) : void 0, d = (i) => i ? u.get(i) : void 0, h = (i, m) => {
30
+ if (!(!i || !m))
31
+ return s.get(i)?.fixtures?.find((v) => v.id === m);
32
+ }, S = (i = {}) => n.filter((m) => Q(i.handoff, m.id)), L = (i) => {
33
+ const m = me(o, i);
34
+ return m ? M.get(m.definition.path) : void 0;
35
+ }, T = (i = {}) => {
36
+ const { handoff: m } = i;
37
+ return m ? b.map((v) => ({
38
+ ...v,
39
+ variations: v.variations.filter((E) => Q(m, E.id))
40
+ })).filter(
41
+ (v) => v.variations.length > 0 || (m.routes ?? []).length > 0 && $e(m, v.href)
42
+ ) : b;
43
+ }, _ = (i) => i ? i.permissions ? i.permissions : d(i.persona)?.permissions ?? [] : [], $ = (i) => a.filter((m) => ce(i, m.id));
19
44
  return {
20
45
  product: e,
21
- tree: h,
22
- orphans: m,
23
- issues: me(e),
24
- scenario: v,
25
- component: (d) => d ? n.get(d) : void 0,
26
- componentFixture: N,
27
- resolveComponentFixture: (d, f) => {
28
- const k = d ? n.get(d) : void 0, M = N(d, f), _ = N(d, k?.defaultFixture) ?? k?.fixtures?.[0];
46
+ screens: b,
47
+ issues: Qe(e),
48
+ scenario: y,
49
+ component: (i) => i ? s.get(i) : void 0,
50
+ componentFixture: h,
51
+ resolveComponentFixture: (i, m) => {
52
+ const v = i ? s.get(i) : void 0, E = h(i, m), N = h(i, v?.defaultFixture) ?? v?.fixtures?.[0];
29
53
  return {
30
- fixture: M ?? _,
31
- requestedId: f,
32
- didFallback: !!(f && !M)
54
+ fixture: E ?? N,
55
+ requestedId: m,
56
+ didFallback: !!(m && !E)
33
57
  };
34
58
  },
35
- persona: i,
36
- fixture: (d) => d ? l.get(d) : void 0,
37
- rule: (d) => d ? a.get(d) : void 0,
38
- module: (d) => d ? r.get(d) : void 0,
39
- flow: (d) => d ? c.get(d) : void 0,
40
- rulesOf: (d) => (d?.rules ?? []).map((f) => a.get(f)).filter((f) => !!f),
41
- permissionsOf: S,
42
- scenariosForRoute: (d, f) => {
43
- const k = d.split("?")[0];
44
- return x(f).filter((M) => M.route.split("?")[0] === k);
59
+ persona: d,
60
+ fixture: (i) => i ? c.get(i) : void 0,
61
+ rule: (i) => i ? p.get(i) : void 0,
62
+ screen: (i) => i ? M.get(i) : void 0,
63
+ screenForPath: L,
64
+ screenOf: (i) => {
65
+ const m = i ? w.get(i.id) : void 0;
66
+ return m ? M.get(m) : void 0;
45
67
  },
46
- activeScenarios: x,
47
- treeFor: (d) => {
48
- const f = new Set(x(d).map((k) => k.id));
49
- return h.map((k) => ({
50
- ...k,
51
- scenarios: k.scenarios.filter((M) => f.has(M.id))
52
- }));
68
+ screensFor: T,
69
+ rulesOf: (i) => (i?.rules ?? []).map((m) => p.get(m)).filter((m) => !!m),
70
+ permissionsOf: _,
71
+ scenariosForRoute: (i, m) => {
72
+ const v = L(i);
73
+ return v ? v.variations.filter((E) => Q(m?.handoff, E.id)) : [];
53
74
  },
54
- orphansFor: (d) => {
55
- const f = new Set(x(d).map((k) => k.id));
56
- return m.filter((k) => f.has(k.id));
75
+ activeScenarios: S,
76
+ search: (i, m) => {
77
+ const v = G(i), E = S(m);
78
+ return v ? E.filter(
79
+ (N) => G(
80
+ [
81
+ N.title,
82
+ N.id,
83
+ N.intent ?? "",
84
+ N.route,
85
+ d(N.persona)?.name ?? "",
86
+ (N.tags ?? []).join(" "),
87
+ (N.expected ?? []).join(" ")
88
+ ].join(" ")
89
+ ).includes(v)
90
+ ) : E;
57
91
  },
58
- search: (d, f) => {
59
- const k = te(d), M = x(f);
60
- return k ? M.filter((_) => {
61
- const T = r.get(_.id.split(".")[0] ?? "")?.name ?? "";
62
- return te(
92
+ searchScreens: (i, m) => {
93
+ const v = G(i), E = T(m);
94
+ return v ? E.filter(
95
+ (N) => G(
63
96
  [
64
- _.title,
65
- _.id,
66
- _.intent ?? "",
67
- _.route,
68
- T,
69
- s.get(_.persona)?.name ?? "",
70
- (_.tags ?? []).join(" "),
71
- (_.expected ?? []).join(" ")
97
+ N.name,
98
+ N.description ?? "",
99
+ N.id,
100
+ ...N.variations.flatMap((O) => [
101
+ O.title,
102
+ O.id,
103
+ (O.tags ?? []).join(" ")
104
+ ])
72
105
  ].join(" ")
73
- ).includes(k);
74
- }) : M;
106
+ ).includes(v)
107
+ ) : E;
75
108
  },
76
- byStatus: (d) => e.scenarios.filter((f) => f.status === d),
77
- coverage: (d) => {
78
- const f = Object.fromEntries(
79
- se.map((k) => [k, 0])
80
- );
81
- for (const k of x(d)) f[k.status] += 1;
82
- return f;
83
- }
109
+ searchComponents: (i, m) => {
110
+ const v = G(i), E = $(m);
111
+ return v ? E.filter(
112
+ (N) => G(
113
+ [
114
+ N.name,
115
+ N.description ?? "",
116
+ N.group ?? "",
117
+ N.id,
118
+ N.source ?? ""
119
+ ].join(" ")
120
+ ).includes(v)
121
+ ) : E;
122
+ },
123
+ componentsFor: $,
124
+ componentsOfScreen: (i) => {
125
+ const m = /* @__PURE__ */ new Set();
126
+ for (const v of i?.variations ?? [])
127
+ for (const E of v.components ?? []) m.add(E);
128
+ return [...m].map((v) => s.get(v)).filter((v) => !!v);
129
+ },
130
+ usagesOf: (i, m) => i ? T(m).filter(
131
+ (v) => v.variations.some((E) => E.components?.includes(i))
132
+ ) : []
84
133
  };
85
134
  }
86
- function te(e) {
87
- return e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "").trim();
135
+ function G(e) {
136
+ return e.toLowerCase().normalize("NFD").replace(/[̀-ͯ]/g, "").trim();
88
137
  }
89
- const ce = [
138
+ function at(e) {
139
+ const n = e.split("/").filter(Boolean);
140
+ return n[n.length - 1] === "*" && n.pop(), `/${n.join("/")}`;
141
+ }
142
+ const it = [
143
+ { id: "mobile", label: "Celular", width: 375, height: 812 },
144
+ { id: "tablet", label: "Tablet", width: 768, height: 1024 },
145
+ { id: "desktop", label: "Desktop", width: 1280, height: 800 },
90
146
  { id: "fit", label: "Ajustar" },
91
- { id: "mobile", label: "Celular", width: 390, height: 844 },
92
- { id: "tablet", label: "Tablet", width: 834, height: 1112 },
93
- { id: "desktop", label: "Desktop", width: 1440, height: 900 },
94
147
  { id: "custom", label: "Personalizado" }
95
- ], we = [1, 1.25, 1.5, 2];
96
- function ke(e, t) {
97
- const n = new URLSearchParams(e), s = n.get(g.component) ?? void 0, l = t.component(s), a = n.get(g.scenario) ?? void 0, r = l ? void 0 : t.scenario(a), c = n.get(g.fixture) ?? void 0, h = l ? c ?? t.componentFixture(l.id, l.defaultFixture)?.id ?? l.fixtures?.[0]?.id : void 0, p = n.get(g.network), m = Number(n.get(g.textScale)), v = n.get(g.view), i = r?.status === "ported" || v === "ported" || n.get(g.showPorted) === "1" ? "ported" : "active";
148
+ ], be = 25, ve = 150, ie = 100;
149
+ function st(e, n) {
150
+ const o = new URLSearchParams(e), a = Xe(o), r = o.get(C.component) ?? void 0, s = ce(a, r) ? n.component(r) : void 0, u = o.get(C.scenario) ?? void 0, c = s || !Q(a, u) ? void 0 : n.scenario(u), p = o.get(C.fixture) ?? void 0, l = s ? p ?? n.componentFixture(s.id, s.defaultFixture)?.id ?? s.fixtures?.[0]?.id : void 0, w = o.get(C.network);
98
151
  return {
99
- scenario: r?.id,
100
- view: i,
101
- showPorted: i === "ported",
102
- component: l?.id,
103
- persona: n.get(g.persona) ?? r?.persona,
104
- fixture: l ? h : c ?? r?.fixture,
105
- network: ye(p) ? p : r?.network ?? "success",
106
- viewport: n.get(g.viewport) ?? "fit",
107
- customWidth: _e(n.get(g.customWidth)),
108
- themeMode: n.get(g.themeMode) ?? t.product.theme?.modes?.[0],
109
- locale: n.get(g.locale) ?? t.product.theme?.locales?.[0],
110
- dataSource: n.get(g.dataSource) ?? t.product.dataSources?.default ?? "fixtures",
111
- chromeTheme: Se(n.get(g.chromeTheme)) ? n.get(g.chromeTheme) : "dark",
152
+ scenario: c?.id,
153
+ handoff: a,
154
+ component: s?.id,
155
+ persona: o.get(C.persona) ?? c?.persona,
156
+ fixture: s ? l : p ?? c?.fixture,
157
+ network: lt(w) ? w : c?.network ?? "success",
158
+ viewport: o.get(C.viewport) ?? "fit",
159
+ customWidth: ht(o.get(C.customWidth)),
160
+ themeMode: o.get(C.themeMode) ?? n.product.theme?.modes?.[0],
161
+ locale: o.get(C.locale) ?? n.product.theme?.locales?.[0],
162
+ dataSource: o.get(C.dataSource) ?? n.product.dataSources?.default ?? "fixtures",
163
+ // Sem parâmetro, o tema do chrome fica em aberto: o shell resolve pela
164
+ // última escolha da pessoa e, na falta dela, pelo sistema.
165
+ chromeTheme: dt(o.get(C.chromeTheme)) ? o.get(C.chromeTheme) : void 0,
112
166
  // Chrome visível por padrão. `?chrome=0` é o modo de revisão limpa e captura
113
167
  // de tela, então precisa ser explícito para não sumir sem pedido.
114
- chrome: n.get(g.chrome) !== "0",
115
- keyboardMode: n.get(g.keyboardMode) === "1",
116
- reducedMotion: n.get(g.reducedMotion) === "1",
117
- textScale: we.includes(m) ? m : 1,
118
- inspector: n.get(g.inspector) !== "0"
168
+ chrome: o.get(C.chrome) !== "0",
169
+ inspector: o.get(C.inspector) !== "0",
170
+ panelTab: ut(o.get(C.panelTab)) ? o.get(C.panelTab) : "variations",
171
+ zoom: Ae(o.get(C.zoom)),
172
+ rotated: o.get(C.rotated) === "1"
119
173
  };
120
174
  }
121
- function q(e, t) {
122
- const n = new URLSearchParams(), s = t.scenario(e.scenario);
123
- e.component ? n.set(g.component, e.component) : e.scenario && n.set(g.scenario, e.scenario), ee(e) === "ported" && n.set(g.view, "ported"), e.persona && e.persona !== s?.persona && n.set(g.persona, e.persona), e.component && e.fixture ? n.set(g.fixture, e.fixture) : e.fixture && e.fixture !== s?.fixture && n.set(g.fixture, e.fixture), e.network !== (s?.network ?? "success") && n.set(g.network, e.network), e.viewport !== "fit" && n.set(g.viewport, e.viewport), e.viewport === "custom" && e.customWidth && n.set(g.customWidth, String(e.customWidth));
124
- const l = t.product.theme?.modes?.[0];
125
- e.themeMode && e.themeMode !== l && n.set(g.themeMode, e.themeMode);
126
- const a = t.product.theme?.locales?.[0];
127
- e.locale && e.locale !== a && n.set(g.locale, e.locale);
128
- const r = t.product.dataSources?.default ?? "fixtures";
129
- e.dataSource && e.dataSource !== r && n.set(g.dataSource, e.dataSource), e.chromeTheme === "light" && n.set(g.chromeTheme, "light"), e.chrome || n.set(g.chrome, "0"), e.keyboardMode && n.set(g.keyboardMode, "1"), e.reducedMotion && n.set(g.reducedMotion, "1"), e.textScale !== 1 && n.set(g.textScale, String(e.textScale)), e.inspector || n.set(g.inspector, "0");
130
- const c = n.toString();
131
- return c ? `?${c}` : "";
175
+ function J(e, n) {
176
+ const o = new URLSearchParams(), a = n.scenario(e.scenario);
177
+ e.component ? o.set(C.component, e.component) : e.scenario && o.set(C.scenario, e.scenario), e.persona && e.persona !== a?.persona && o.set(C.persona, e.persona), e.component && e.fixture ? o.set(C.fixture, e.fixture) : e.fixture && e.fixture !== a?.fixture && o.set(C.fixture, e.fixture), e.network !== (a?.network ?? "success") && o.set(C.network, e.network), e.viewport !== "fit" && o.set(C.viewport, e.viewport), e.viewport === "custom" && e.customWidth && o.set(C.customWidth, String(e.customWidth));
178
+ const r = n.product.theme?.modes?.[0];
179
+ e.themeMode && e.themeMode !== r && o.set(C.themeMode, e.themeMode);
180
+ const s = n.product.theme?.locales?.[0];
181
+ e.locale && e.locale !== s && o.set(C.locale, e.locale);
182
+ const u = n.product.dataSources?.default ?? "fixtures";
183
+ e.dataSource && e.dataSource !== u && o.set(C.dataSource, e.dataSource), e.chromeTheme && o.set(C.chromeTheme, e.chromeTheme), e.chrome || o.set(C.chrome, "0"), e.inspector || o.set(C.inspector, "0"), e.panelTab === "info" && o.set(C.panelTab, "info");
184
+ const c = Ae(e.zoom === void 0 ? null : String(e.zoom));
185
+ c !== ie && o.set(C.zoom, String(c)), e.rotated && o.set(C.rotated, "1"), ge(o, e.handoff);
186
+ const p = o.toString();
187
+ return p ? `?${p}` : "";
132
188
  }
133
- function Ne(e) {
134
- const [t, n] = $(() => oe());
135
- I(() => {
136
- const v = () => n(oe());
137
- return window.addEventListener("popstate", v), () => window.removeEventListener("popstate", v);
138
- }, []);
139
- const s = C(() => ke(t.search, e), [t.search, e]), l = E((v, i, N = !1) => {
140
- const x = `${v}${i}`;
141
- N ? window.history.replaceState(null, "", x) : window.history.pushState(null, "", x), n({ path: v, search: i });
142
- }, []), a = E(
143
- (v) => {
144
- const i = v.view ?? (v.showPorted === void 0 ? void 0 : v.showPorted ? "ported" : "active"), N = {
145
- ...s,
146
- ...v,
147
- ...i ? { view: i, showPorted: i === "ported" } : {}
148
- };
149
- l(t.path, q(N, e), !0);
189
+ function Oe(e, n = {}) {
190
+ const o = !!n.frame, [a, r] = z(() => de()), s = U(a);
191
+ s.current = a, K(() => {
192
+ const d = () => r(de());
193
+ return window.addEventListener("popstate", d), () => window.removeEventListener("popstate", d);
194
+ }, []), K(() => {
195
+ if (!o || window.parent === window) return;
196
+ const d = window.location.origin, h = (L) => {
197
+ const T = ze(L, { origin: d, source: window.parent });
198
+ if (T?.type !== "location") return;
199
+ const { path: _, search: $ } = pe(T.url);
200
+ window.history.replaceState(null, "", re(_, $)), r({ path: _, search: $ });
201
+ };
202
+ window.addEventListener("message", h);
203
+ const S = de();
204
+ return ne(
205
+ window.parent,
206
+ { ds: 1, type: "ready", url: re(S.path, S.search) },
207
+ d
208
+ ), () => window.removeEventListener("message", h);
209
+ }, [o]);
210
+ const u = D(() => st(a.search, e), [a.search, e]), c = W(
211
+ (d, h, S = !1) => {
212
+ if (o) {
213
+ const T = re(d, h), _ = pe(T);
214
+ window.history.replaceState(null, "", T), r(_), ne(
215
+ window.parent === window ? void 0 : window.parent,
216
+ { ds: 1, type: "navigate", url: T, replace: S },
217
+ window.location.origin
218
+ );
219
+ return;
220
+ }
221
+ const L = `${d}${h}`;
222
+ S ? window.history.replaceState(null, "", L) : window.history.pushState(null, "", L), r({ path: d, search: h });
150
223
  },
151
- [s, t.path, l, e]
152
- ), r = E(
153
- (v) => {
154
- const i = e.scenario(s.scenario), N = !i || (v === "ported" ? i.status === "ported" : i.status !== "ported"), x = {
155
- ...s,
156
- view: v,
157
- showPorted: v === "ported",
158
- ...N ? {} : {
159
- scenario: void 0,
160
- persona: void 0,
161
- fixture: void 0,
162
- network: "success"
163
- }
164
- };
165
- l(N ? t.path : "/", q(x, e), !1);
224
+ [o]
225
+ ), p = W(
226
+ (d) => {
227
+ const h = { ...u, ...d };
228
+ c(a.path, J(h, e), !0);
166
229
  },
167
- [s, t.path, l, e]
168
- ), c = E(
169
- (v, i) => {
170
- const [N, x] = v.split("?"), S = N || "/", d = x ? `?${x}` : t.search;
171
- l(S, d, i?.replace ?? !1);
230
+ [u, a.path, c, e]
231
+ ), l = W(
232
+ (d, h) => {
233
+ const [S, L] = d.split("?"), T = S || "/", _ = new URLSearchParams(L ?? a.search);
234
+ u.handoff && ge(_, u.handoff);
235
+ const $ = _.toString(), i = $ ? `?${$}` : "";
236
+ c(T, i, h?.replace ?? !1);
172
237
  },
173
- [t.search, l]
174
- ), h = E(
175
- (v) => {
176
- const i = e.scenario(v);
177
- if (!i) return;
178
- const N = {
179
- ...s,
180
- scenario: i.id,
181
- view: i.status === "ported" ? "ported" : "active",
182
- showPorted: i.status === "ported",
238
+ [u.handoff, a.search, c]
239
+ ), w = W(
240
+ (d) => {
241
+ const h = e.scenario(d);
242
+ if (!h || !Q(u.handoff, d)) return;
243
+ const S = {
244
+ ...u,
245
+ scenario: h.id,
183
246
  component: void 0,
184
- persona: i.persona,
185
- fixture: i.fixture,
186
- network: i.network ?? "success"
247
+ persona: h.persona,
248
+ fixture: h.fixture,
249
+ network: h.network ?? "success"
250
+ };
251
+ c(h.route, J(S, e), !1);
252
+ },
253
+ [u, c, e]
254
+ ), f = W(
255
+ (d, h) => {
256
+ const S = e.component(d);
257
+ if (!S || !ce(u.handoff, d)) return;
258
+ const L = {
259
+ ...u,
260
+ scenario: void 0,
261
+ component: S.id,
262
+ persona: void 0,
263
+ fixture: void 0,
264
+ network: "success"
187
265
  };
188
- l(i.route, q(N, e), !1);
266
+ L.fixture = e.componentFixture(S.id, S.defaultFixture)?.id ?? S.fixtures?.[0]?.id, c("/", J(L, e), h?.replace ?? !1);
189
267
  },
190
- [s, l, e]
191
- ), p = E(
192
- (v) => {
193
- const i = e.component(v);
194
- if (!i) return;
195
- const N = {
196
- ...s,
268
+ [u, c, e]
269
+ ), b = W(
270
+ (d, h) => {
271
+ const S = e.screensFor({ handoff: u.handoff }).find((_) => _.id === d);
272
+ if (!S) return;
273
+ const L = S.variations[0];
274
+ if (L) {
275
+ const _ = {
276
+ ...u,
277
+ scenario: L.id,
278
+ component: void 0,
279
+ persona: L.persona,
280
+ fixture: L.fixture,
281
+ network: L.network ?? "success"
282
+ };
283
+ c(L.route, J(_, e), h?.replace ?? !1);
284
+ return;
285
+ }
286
+ const T = {
287
+ ...u,
197
288
  scenario: void 0,
198
- component: i.id,
289
+ component: void 0,
199
290
  persona: void 0,
200
291
  fixture: void 0,
201
292
  network: "success"
202
293
  };
203
- N.fixture = e.componentFixture(i.id, i.defaultFixture)?.id ?? i.fixtures?.[0]?.id, l("/", q(N, e), !1);
294
+ c(S.href, J(T, e), h?.replace ?? !1);
204
295
  },
205
- [s, l, e]
206
- ), m = C(() => xe(s), [s]);
296
+ [u, c, e]
297
+ ), M = W(
298
+ (d, h, S) => c(d || "/", h, S?.replace ?? !1),
299
+ [c]
300
+ ), y = D(() => ct(u), [u]);
207
301
  return {
208
- location: t,
209
- controls: s,
210
- viewport: m,
211
- setControls: a,
212
- setScenarioView: r,
213
- navigate: c,
214
- openScenario: h,
215
- openComponent: p
302
+ location: a,
303
+ controls: u,
304
+ viewport: y,
305
+ setControls: p,
306
+ navigate: l,
307
+ openScenario: w,
308
+ openComponent: f,
309
+ openScreen: b,
310
+ go: M
216
311
  };
217
312
  }
218
- function ee(e) {
219
- return e.view ?? (e.showPorted ? "ported" : "active");
313
+ function ct(e) {
314
+ if (e.viewport === "custom")
315
+ return { id: "custom", label: "Personalizado", width: e.customWidth ?? 1024 };
316
+ const n = it.find((o) => o.id === e.viewport) ?? {
317
+ id: "fit",
318
+ label: "Ajustar"
319
+ };
320
+ return e.rotated && n.width && n.height ? { ...n, width: n.height, height: n.width } : { ...n };
220
321
  }
221
- function xe(e) {
222
- const t = ce.find((n) => n.id === e.viewport);
223
- return e.viewport === "custom" ? { id: "custom", label: "Personalizado", width: e.customWidth ?? 1024 } : t ?? { id: "fit", label: "Ajustar" };
322
+ function Ae(e) {
323
+ if (e === null) return ie;
324
+ const n = Number.parseInt(e, 10);
325
+ return Number.isFinite(n) ? Math.min(ve, Math.max(be, n)) : ie;
224
326
  }
225
- function oe() {
327
+ function de() {
226
328
  return typeof window > "u" ? { path: "/", search: "" } : { path: window.location.pathname, search: window.location.search };
227
329
  }
228
- function ye(e) {
229
- return e !== null && ie.includes(e);
330
+ function lt(e) {
331
+ return e !== null && Fe.includes(e);
230
332
  }
231
- function Se(e) {
333
+ function dt(e) {
232
334
  return e === "dark" || e === "light";
233
335
  }
234
- function _e(e) {
235
- if (!e) return;
236
- const t = Number.parseInt(e, 10);
237
- return Number.isFinite(t) && t > 0 ? t : void 0;
238
- }
239
- function Me(e, t) {
240
- const n = e.split("/").filter(Boolean), s = Te(t).split("/").filter(Boolean), l = {};
241
- for (const [a, r] of n.entries()) {
242
- if (r === "*")
243
- return l["*"] = s.slice(a).join("/"), l;
244
- const c = s[a];
245
- if (c === void 0) return null;
246
- if (r.startsWith(":")) {
247
- l[r.slice(1)] = c;
248
- continue;
249
- }
250
- if (r !== c) return null;
251
- }
252
- return n.length !== s.length ? null : l;
253
- }
254
- function Ce(e, t) {
255
- const n = [...e].sort((s, l) => ne(l.path) - ne(s.path));
256
- for (const s of n) {
257
- const l = Me(s.path, t);
258
- if (l) return { definition: s, params: l };
259
- }
260
- }
261
- function ne(e) {
262
- const t = e.split("/").filter(Boolean);
263
- let n = t.length;
264
- for (const s of t)
265
- s === "*" ? n -= 2 : s.startsWith(":") ? n += 1 : n += 4;
266
- return n;
267
- }
268
- function Te(e) {
269
- const t = e.split("?")[0] ?? e;
270
- try {
271
- return decodeURI(t);
272
- } catch {
273
- return t;
274
- }
275
- }
276
- const Ae = 2500;
277
- class Pe extends Error {
278
- constructor(t) {
279
- super(`Falha de rede simulada no cenário "${t}".`), this.name = "SimulatedNetworkError";
280
- }
281
- }
282
- function X(e) {
283
- if (e)
284
- return typeof e.data == "function" ? e.data() : e.data;
285
- }
286
- const Z = {
287
- id: "fixtures",
288
- label: "Fixtures",
289
- load: async ({ scenario: e, fixture: t, network: n }) => {
290
- switch (n) {
291
- case "empty":
292
- return null;
293
- case "error":
294
- throw new Pe(e.id);
295
- case "loading":
296
- return new Promise(() => {
297
- });
298
- case "slow":
299
- return await Le(Ae), X(t);
300
- default:
301
- return X(t);
302
- }
303
- }
304
- };
305
- function gt(e) {
306
- const { id: t, label: n, baseUrl: s, path: l, init: a, fallbackToFixture: r = !0 } = e;
307
- return {
308
- id: t,
309
- label: n,
310
- load: async (c) => {
311
- const h = new URL(l ? l(c) : c.scenario.route, s);
312
- try {
313
- const p = await fetch(h, a);
314
- if (!p.ok) throw new Error(`${p.status} ${p.statusText}`);
315
- return await p.json();
316
- } catch (p) {
317
- if (r) return X(c.fixture);
318
- throw new Error(`Adapter "${t}" falhou em ${h.toString()}`, { cause: p });
319
- }
320
- }
321
- };
322
- }
323
- function Le(e) {
324
- return new Promise((t) => setTimeout(t, e));
336
+ function ut(e) {
337
+ return e === "variations" || e === "info";
325
338
  }
326
- function $e(e) {
327
- const { scenario: t, fixture: n, network: s, adapter: l } = e, [a, r] = $({
328
- data: void 0,
329
- isLoading: !!t,
330
- error: void 0
331
- });
332
- return I(() => {
333
- if (!t) {
334
- r({ data: void 0, isLoading: !1, error: void 0 });
335
- return;
336
- }
337
- let c = !0;
338
- r({ data: void 0, isLoading: !0, error: void 0 });
339
- const h = l ?? Z;
340
- return Promise.resolve(h.load({ scenario: t, fixture: n, network: s })).then((p) => {
341
- c && r({ data: p, isLoading: !1, error: void 0 });
342
- }).catch((p) => {
343
- c && r({
344
- data: void 0,
345
- isLoading: !1,
346
- error: p instanceof Error ? p : new Error(String(p))
347
- });
348
- }), () => {
349
- c = !1;
350
- };
351
- }, [t, n, s, l]), a;
339
+ function ht(e) {
340
+ if (!e) return;
341
+ const n = Number.parseInt(e, 10);
342
+ return Number.isFinite(n) && n > 0 ? n : void 0;
352
343
  }
353
- const Ee = {
354
- a: "link",
355
- article: "article",
356
- aside: "complementary",
357
- button: "button",
358
- dialog: "dialog",
359
- fieldset: "group",
360
- footer: "contentinfo",
361
- form: "form",
362
- h1: "heading",
363
- h2: "heading",
364
- h3: "heading",
365
- h4: "heading",
366
- h5: "heading",
367
- h6: "heading",
368
- header: "banner",
369
- hr: "separator",
370
- img: "img",
371
- li: "listitem",
372
- main: "main",
373
- nav: "navigation",
374
- ol: "list",
375
- option: "option",
376
- output: "status",
377
- progress: "progressbar",
378
- section: "region",
379
- select: "combobox",
380
- table: "table",
381
- tbody: "rowgroup",
382
- td: "cell",
383
- textarea: "textbox",
384
- th: "columnheader",
385
- tr: "row",
386
- ul: "list"
387
- }, Fe = {
388
- button: "button",
389
- checkbox: "checkbox",
390
- email: "textbox",
391
- image: "button",
392
- number: "spinbutton",
393
- radio: "radio",
394
- range: "slider",
395
- reset: "button",
396
- search: "searchbox",
397
- submit: "button",
398
- tel: "textbox",
399
- text: "textbox",
400
- url: "textbox"
344
+ const mt = "@brucesantos/design-space", xe = "0.8.0", pt = {
345
+ mobile: /* @__PURE__ */ g(I, { children: [
346
+ /* @__PURE__ */ t("rect", { x: "7", y: "2.5", width: "10", height: "19", rx: "2" }),
347
+ /* @__PURE__ */ t("path", { d: "M11 18.5h2" })
348
+ ] }),
349
+ tablet: /* @__PURE__ */ g(I, { children: [
350
+ /* @__PURE__ */ t("rect", { x: "4.5", y: "2.5", width: "15", height: "19", rx: "2" }),
351
+ /* @__PURE__ */ t("path", { d: "M11 18.5h2" })
352
+ ] }),
353
+ desktop: /* @__PURE__ */ g(I, { children: [
354
+ /* @__PURE__ */ t("rect", { x: "2.5", y: "4", width: "19", height: "12.5", rx: "1.5" }),
355
+ /* @__PURE__ */ t("path", { d: "M8.5 20.5h7M12 16.5v4" })
356
+ ] }),
357
+ fit: /* @__PURE__ */ t("path", { d: "M3 12h7M3 12l3-3M3 12l3 3M21 12h-7M21 12l-3-3M21 12l-3 3" }),
358
+ rotate: /* @__PURE__ */ g(I, { children: [
359
+ /* @__PURE__ */ t("path", { d: "M20 12a8 8 0 1 1-2.34-5.66" }),
360
+ /* @__PURE__ */ t("path", { d: "M20 4v4.5h-4.5" })
361
+ ] }),
362
+ minus: /* @__PURE__ */ t("path", { d: "M5 12h14" }),
363
+ plus: /* @__PURE__ */ t("path", { d: "M5 12h14M12 5v14" }),
364
+ link: /* @__PURE__ */ g(I, { children: [
365
+ /* @__PURE__ */ t("path", { d: "M10 14a4 4 0 0 0 5.66 0l3-3a4 4 0 0 0-5.66-5.66l-1 1" }),
366
+ /* @__PURE__ */ t("path", { d: "M14 10a4 4 0 0 0-5.66 0l-3 3a4 4 0 0 0 5.66 5.66l1-1" })
367
+ ] }),
368
+ check: /* @__PURE__ */ t("path", { d: "M5 12.5l4.5 4.5L19 7.5" }),
369
+ fullscreen: /* @__PURE__ */ t("path", { d: "M4 9V4h5M15 4h5v5M20 15v5h-5M9 20H4v-5" }),
370
+ sun: /* @__PURE__ */ g(I, { children: [
371
+ /* @__PURE__ */ t("circle", { cx: "12", cy: "12", r: "4" }),
372
+ /* @__PURE__ */ t("path", { d: "M12 2.5v2M12 19.5v2M4.6 4.6 6 6M18 18l1.4 1.4M2.5 12h2M19.5 12h2M4.6 19.4 6 18M18 6l1.4-1.4" })
373
+ ] }),
374
+ moon: /* @__PURE__ */ t("path", { d: "M20 14.5A8 8 0 1 1 9.5 4a6.5 6.5 0 0 0 10.5 10.5Z" }),
375
+ panel: /* @__PURE__ */ g(I, { children: [
376
+ /* @__PURE__ */ t("rect", { x: "3", y: "4", width: "18", height: "16", rx: "2" }),
377
+ /* @__PURE__ */ t("path", { d: "M15 4v16" })
378
+ ] }),
379
+ alert: /* @__PURE__ */ g(I, { children: [
380
+ /* @__PURE__ */ t("circle", { cx: "12", cy: "12", r: "9" }),
381
+ /* @__PURE__ */ t("path", { d: "M12 7.5v5.5M12 16.2v.3" })
382
+ ] }),
383
+ chevron: /* @__PURE__ */ t("path", { d: "M9 6l6 6-6 6" }),
384
+ search: /* @__PURE__ */ g(I, { children: [
385
+ /* @__PURE__ */ t("circle", { cx: "11", cy: "11", r: "6.5" }),
386
+ /* @__PURE__ */ t("path", { d: "M20 20l-4.2-4.2" })
387
+ ] }),
388
+ copy: /* @__PURE__ */ g(I, { children: [
389
+ /* @__PURE__ */ t("rect", { x: "8.5", y: "8.5", width: "12", height: "12", rx: "2" }),
390
+ /* @__PURE__ */ t("path", { d: "M15.5 8.5V5.5a2 2 0 0 0-2-2h-8a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h3" })
391
+ ] })
401
392
  };
402
- function Re(e) {
403
- if (!e || !(e instanceof HTMLElement)) return;
404
- const { name: t, nameFrom: n } = Oe(e);
405
- return {
406
- role: De(e),
407
- name: t,
408
- nameFrom: n,
409
- description: Ie(e),
410
- states: Be(e),
411
- selector: He(e),
412
- hiddenFromTabOrder: e.tabIndex < 0,
413
- hiddenFromAssistiveTech: We(e)
414
- };
415
- }
416
- function De(e) {
417
- const t = e.getAttribute("role");
418
- if (t) return t.split(/\s+/)[0] ?? t;
419
- const n = e.tagName.toLowerCase();
420
- if (n === "input") {
421
- const s = e.type.toLowerCase();
422
- return Fe[s] ?? "textbox";
423
- }
424
- return n === "a" && !e.hasAttribute("href") ? "generic" : Ee[n] ?? "generic";
425
- }
426
- function Oe(e) {
427
- const t = e.getAttribute("aria-labelledby");
428
- if (t) {
429
- const r = t.split(/\s+/).map((c) => e.ownerDocument.getElementById(c)?.textContent?.trim() ?? "").filter(Boolean).join(" ");
430
- if (r) return { name: r, nameFrom: "aria-labelledby" };
431
- }
432
- const n = e.getAttribute("aria-label")?.trim();
433
- if (n) return { name: n, nameFrom: "aria-label" };
434
- if (e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement) {
435
- const r = Array.from(e.labels ?? []).map((c) => c.textContent?.trim() ?? "").filter(Boolean);
436
- if (r.length) return { name: r.join(" "), nameFrom: "label" };
437
- }
438
- if (e instanceof HTMLImageElement) {
439
- const r = e.getAttribute("alt");
440
- if (r !== null) return { name: r, nameFrom: "alt" };
441
- }
442
- const s = e.getAttribute("title")?.trim(), l = je(e);
443
- return l ? { name: l, nameFrom: "content" } : s ? { name: s, nameFrom: "title" } : e instanceof HTMLInputElement && e.value ? { name: e.value, nameFrom: "value" } : e.getAttribute("placeholder")?.trim() ? { name: "", nameFrom: "none" } : { name: "", nameFrom: "none" };
444
- }
445
- function Ie(e) {
446
- const t = e.getAttribute("aria-describedby");
447
- if (t) {
448
- const n = t.split(/\s+/).map((s) => e.ownerDocument.getElementById(s)?.textContent?.trim() ?? "").filter(Boolean).join(" ");
449
- if (n) return n;
450
- }
451
- return e.getAttribute("aria-description")?.trim() || void 0;
452
- }
453
- function Be(e) {
454
- const t = [], n = (s, l = s.replace("aria-", "")) => {
455
- const a = e.getAttribute(s);
456
- a !== null && a !== "false" && t.push(a === "true" || a === "" ? l : `${l}=${a}`);
457
- };
458
- return e.disabled && t.push("disabled"), e.getAttribute("aria-disabled") === "true" && t.push("disabled"), e.required && t.push("required"), e.readOnly && t.push("readonly"), e.checked && t.push("checked"), n("aria-expanded"), n("aria-selected"), n("aria-checked"), n("aria-pressed"), n("aria-current"), n("aria-invalid"), n("aria-busy"), n("aria-live"), n("aria-haspopup"), n("aria-level", "level"), e.ownerDocument.activeElement === e && t.push("focused"), [...new Set(t)];
459
- }
460
- function We(e) {
461
- let t = e;
462
- for (; t; ) {
463
- if (t.getAttribute("aria-hidden") === "true" || t.hasAttribute("hidden")) return !0;
464
- t = t.parentElement;
465
- }
466
- return !1;
467
- }
468
- function je(e) {
469
- const t = e.cloneNode(!0);
470
- for (const n of t.querySelectorAll("[aria-hidden='true'],[hidden]"))
471
- n.remove();
472
- return (t.textContent ?? "").replace(/\s+/g, " ").trim().slice(0, 160);
473
- }
474
- function He(e) {
475
- const t = e.tagName.toLowerCase();
476
- if (e.id) return `${t}#${e.id}`;
477
- const n = e.getAttribute("data-testid");
478
- if (n) return `${t}[data-testid="${n}"]`;
479
- const s = Array.from(e.classList).slice(0, 2);
480
- return s.length ? `${t}.${s.join(".")}` : t;
481
- }
482
- function Ke(e = document) {
483
- const t = [
484
- "a[href]",
485
- "button",
486
- "input",
487
- "select",
488
- "textarea",
489
- "summary",
490
- "[tabindex]",
491
- "[contenteditable='true']"
492
- ].join(",");
493
- return Array.from(e.querySelectorAll(t)).filter((n) => {
494
- if (n.tabIndex < 0 || n.disabled || n.getAttribute("aria-hidden") === "true") return !1;
495
- const s = window.getComputedStyle(n);
496
- return s.display === "none" || s.visibility === "hidden" ? !1 : n.offsetWidth > 0 || n.offsetHeight > 0 || n === document.activeElement;
497
- });
498
- }
499
- function ze(e, t) {
500
- const [n, s] = $(), [l, a] = $([]), r = E(() => {
501
- const c = t.current;
502
- if (!c) {
503
- a([]);
504
- return;
505
- }
506
- a(
507
- Ke(c).map((h, p) => ({
508
- index: p + 1,
509
- element: h,
510
- rect: h.getBoundingClientRect(),
511
- forcedOrder: h.tabIndex > 0
512
- }))
513
- );
514
- }, [t]);
515
- return I(() => {
516
- if (!e) {
517
- s(void 0), a([]);
518
- return;
393
+ function H({ name: e, size: n = 16 }) {
394
+ return /* @__PURE__ */ t(
395
+ "svg",
396
+ {
397
+ className: "ds-icon",
398
+ width: n,
399
+ height: n,
400
+ viewBox: "0 0 24 24",
401
+ fill: "none",
402
+ stroke: "currentColor",
403
+ strokeWidth: 1.75,
404
+ strokeLinecap: "round",
405
+ strokeLinejoin: "round",
406
+ "aria-hidden": "true",
407
+ focusable: "false",
408
+ children: pt[e]
519
409
  }
520
- const c = () => s(Re(document.activeElement));
521
- document.addEventListener("focusin", c), window.addEventListener("resize", r), window.addEventListener("scroll", r, !0), c(), r();
522
- const h = t.current, p = h ? new MutationObserver(() => r()) : void 0;
523
- return p?.observe(h, { childList: !0, subtree: !0, attributes: !0 }), () => {
524
- document.removeEventListener("focusin", c), window.removeEventListener("resize", r), window.removeEventListener("scroll", r, !0), p?.disconnect();
525
- };
526
- }, [e, r, t]), { focused: n, tabStops: l, refresh: r };
410
+ );
527
411
  }
528
- const L = {
529
- status: {
530
- ported: "Portado — não validado",
531
- proposed: "Proposta",
532
- "in-review": "Em revisão",
533
- approved: "Aprovado",
534
- "in-implementation": "Em implementação",
535
- implemented: "Implementado",
536
- superseded: "Superado"
537
- },
538
- statusMeaning: {
539
- ported: "Veio do sistema existente, mas não foi validado e não representa compromisso de implementação.",
540
- proposed: "Exploração ainda não aprovada.",
541
- "in-review": "Aberto para validação de design, negócio ou cliente.",
542
- approved: "Referência autorizada, registrada por URL de commit.",
543
- "in-implementation": "Ligado a um trabalho ativo de engenharia.",
544
- implemented: "Disponível no produto real e validado.",
545
- superseded: "Mantido para histórico ou substituído por outra decisão."
546
- },
412
+ const Y = {
547
413
  network: {
548
414
  success: "Sucesso",
549
415
  loading: "Carregando",
@@ -551,11 +417,6 @@ const L = {
551
417
  error: "Erro",
552
418
  slow: "Lento"
553
419
  },
554
- keyboard: {
555
- full: "Jornada completável só por teclado",
556
- partial: "Parcialmente operável por teclado",
557
- "not-applicable": "Não se aplica"
558
- },
559
420
  viewport: {
560
421
  fit: "Ajustar",
561
422
  mobile: "Celular",
@@ -564,160 +425,119 @@ const L = {
564
425
  custom: "Personalizado"
565
426
  },
566
427
  topbar: {
567
- homeTitle: (e) => `Ir para a página inicial de ${e}`,
568
- toggleNav: "Mostrar ou ocultar a navegação",
428
+ region: "Barra do Design Space",
429
+ viewportGroup: "Viewport",
430
+ rotate: "Girar",
431
+ zoomOut: "Diminuir zoom",
432
+ zoomIn: "Aumentar zoom",
433
+ zoomReset: "Voltar o zoom para 100%",
434
+ zoomValue: (e) => `${e}%`,
569
435
  copyLink: "Copiar link",
570
436
  copied: "Link copiado",
571
- copyPrompt: "Copie o link do cenário:",
572
- cleanReview: "Revisão limpa",
573
- cleanReviewTitle: "Abrir a situação em uma nova aba, sem o chrome do Design Space",
574
- panel: "Painel",
575
- lightMode: "Modo claro",
576
- darkMode: "Modo escuro",
437
+ copyPrompt: "Copie o link:",
438
+ cleanReview: "Revisão limpa (Shift+C)",
439
+ lightMode: "Tema claro",
440
+ darkMode: "Tema escuro",
441
+ engineVersion: (e) => `Design Space ${e}`,
442
+ diagnostics: (e, n) => `Diagnóstico: ${e} ${e === 1 ? "erro" : "erros"}, ${n} ${n === 1 ? "aviso" : "avisos"}`,
577
443
  branchTitle: (e) => `Branch: ${e}`,
578
444
  commitTitle: (e) => `Commit: ${e}`,
579
445
  envTitle: (e) => `Ambiente: ${e}`
580
446
  },
581
447
  sidebar: {
582
- region: "Cenários do produto",
583
- flowsTab: "Fluxos",
448
+ region: "Navegação",
449
+ tabs: "Telas e componentes",
450
+ screensTab: "Telas",
584
451
  componentsTab: "Componentes",
585
- searchPlaceholder: "Buscar situação…",
586
- searchLabel: "Buscar cenário pelo vocabulário do produto",
587
- componentSearchPlaceholder: "Buscar componente…",
588
- componentSearchLabel: "Buscar componente do produto",
452
+ searchPlaceholder: "Buscar",
453
+ searchLabel: "Buscar telas e componentes",
589
454
  searchShortcut: "⌘K",
590
- noMatch: (e) => `Nenhuma situação para "${e}".`,
591
- matchCount: (e) => `${e} ${e === 1 ? "situação" : "situações"}.`,
592
- noComponentMatch: (e) => `Nenhum componente para "${e}".`,
593
- componentMatchCount: (e) => `${e} ${e === 1 ? "componente" : "componentes"}.`,
594
- activeWork: "Trabalho ativo",
595
- portedReferences: (e) => `Referências portadas · ${e}`,
596
- viewPorted: (e) => `Ver ${e} ${e === 1 ? "referência portada" : "referências portadas"}`,
597
- backToActive: "Voltar ao trabalho ativo",
598
- currentView: (e) => `Visão atual: ${e}`,
599
- noActiveWork: "Não há cenários no trabalho ativo.",
600
- noPortedReferences: "Não há referências portadas.",
601
- showPorted: "Mostrar portados",
602
- activePorted: "Aberto por link direto; oculto do trabalho ativo",
603
- emptyModule: "Nenhum cenário ainda.",
455
+ noMatch: (e) => `Nada encontrado para "${e}".`,
456
+ emptyScreens: "Nenhuma tela neste branch. Telas de feature entram por PR, enquanto estão em desenho.",
604
457
  emptyComponents: "O produto ainda não registrou componentes.",
605
- withoutModule: "Sem módulo",
606
- scope: "Escopo ativo",
607
- scopeData: "Dados",
608
- scopePersona: "Persona",
609
- scopeNetwork: "Rede"
458
+ ungrouped: "Outros",
459
+ toggleGroup: (e) => `Mostrar ou ocultar ${e}`,
460
+ resize: "Redimensionar a navegação"
610
461
  },
611
- controls: {
612
- region: "Controles do cenário",
462
+ panel: {
463
+ region: "Painel",
464
+ searchPlaceholder: "Filtrar",
465
+ searchLabel: "Filtrar variações e informações",
466
+ searchShortcut: "⌘F",
467
+ noMatch: (e) => `Nada neste painel para "${e}".`,
468
+ tabs: "Variações e informações",
469
+ variationsTab: "Variações",
470
+ infoTab: "Informações",
471
+ resize: "Redimensionar o painel",
472
+ variationsList: "Variações da tela",
473
+ defaultVariation: "Padrão",
474
+ defaultVariationHint: "A tela sem cenário declarado, sem fixture.",
475
+ noVariations: "Esta tela não tem variações.",
476
+ noComponentVariations: "Este componente não declara variações de dados.",
477
+ nothingSelected: "Escolha uma tela ou um componente na navegação.",
613
478
  persona: "Persona",
614
- fixture: "Dados",
615
- componentFixture: "Dados do componente",
616
- network: "Rede",
617
- viewport: "Viewport",
618
- customWidth: "Largura personalizada em pixels",
479
+ network: "Estado de rede",
619
480
  theme: "Tema",
620
481
  locale: "Idioma",
621
- dataSource: "Fonte",
482
+ dataSource: "Fonte de dados",
622
483
  fixturesOption: "Fixtures",
623
- a11y: "Acessibilidade",
624
- keyboardMode: "Teclado",
625
- keyboardModeTitle: "Percorrer a jornada só por teclado, com foco visível e ordem de tabulação evidenciada",
626
- reducedMotion: "Movimento",
627
- reducedMotionTitle: "Reduzir movimento dentro do palco",
628
- textScale: "Ampliação de texto",
629
- none: "—"
484
+ none: "—",
485
+ fixtureFallback: (e, n) => `A variação \`${e}\` não existe neste componente. Exibindo \`${n}\`.`
630
486
  },
631
- inspector: {
632
- region: "Painel de contexto",
633
- tabScenario: "Cenário",
634
- tabA11y: "Acessibilidade",
635
- tabDiagnostics: "Diagnóstico",
636
- diagnosticsWithErrors: (e) => `Diagnóstico (${e})`,
637
- noScenario: "Nenhum cenário ativo. Escolha uma situação na navegação para ver contexto, regras e critérios.",
638
- componentReference: "Componente",
639
- componentGroup: "Grupo",
640
- componentFixture: "Fixture ativa",
641
- componentFixtureDescription: "Descrição da fixture",
642
- componentFixtureFallback: (e, t) => `A fixture \`${e}\` não existe neste componente. Exibindo \`${t}\` como fallback.`,
643
- situation: "Situação",
644
- reproduction: "Reprodução",
487
+ info: {
488
+ screen: "Tela",
489
+ variation: "Variação",
490
+ component: "Componente",
491
+ name: "Nome",
645
492
  id: "Id",
493
+ group: "Grupo",
494
+ description: "Descrição",
495
+ source: "Origem",
496
+ usedIn: "Usado em",
497
+ notUsed: "Nenhuma tela declara este componente.",
646
498
  route: "Rota",
647
499
  persona: "Persona",
648
- personaSwapped: "trocada",
649
- data: "Dados",
650
- network: "Rede",
651
- goal: (e) => `Objetivo: ${e}`,
652
- permissions: "Permissões efetivas",
500
+ permissions: "Permissões",
501
+ intent: "Intenção",
653
502
  preconditions: "Pré-condições",
503
+ actions: "Ações",
504
+ expected: "Comportamento esperado",
654
505
  rules: "Regras",
655
- actions: "Ações disponíveis",
656
- expected: "Critérios de aceite",
657
- approval: "Aprovação",
658
- openApproved: "Abrir a versão aprovada",
659
- engineering: "Engenharia",
660
- a11yContract: "Contrato do cenário",
661
- keyboard: "Teclado",
662
- contrast: "Contraste",
663
- contrastTarget: (e) => `WCAG 2.2 ${e}`,
664
- announces: "Precisa ser anunciado:",
665
- focusedElement: "Elemento em foco",
666
- keyboardModeOff: "Ligue o modo teclado na barra de controles para inspecionar a árvore acessível.",
667
- pressTab: (e) => `Pressione Tab dentro do palco. ${e} paradas de tabulação foram encontradas.`,
668
- role: "Papel",
669
- name: "Nome",
670
- noAccessibleName: "sem nome acessível",
671
- nameFrom: "Nome vem de",
672
- description: "Descrição",
673
- selector: "Seletor",
674
- focusableButHidden: "Este elemento é focável mas está escondido de tecnologia assistiva. Um leitor de tela recebe foco sem receber conteúdo.",
675
- tabStopsInStage: (e) => `${e} paradas de tabulação no palco.`,
676
- tokenContrast: "Contraste dos tokens",
677
- noContrastPairs: "O produto não declarou pares de contraste em theme.contrastPairs. Contraste é propriedade de par de cores: declarar aqui valida na origem, uma vez.",
678
- pair: "Par",
679
- ratio: "Razão",
680
- pairsFailing: (e) => `${e} ${e === 1 ? "par" : "pares"} fora do alvo. O teste de tokens do produto falha o build por isso.`,
681
- automatedIsFloor: "Verificação automática é piso, não teto. Ordem de leitura confusa, rótulo tecnicamente presente mas sem sentido e fluxo impossível de completar com leitor de tela passam no axe.",
682
- coverage: "Cobertura por status",
683
- scenariosRegistered: (e) => `${e} cenários registrados.`,
684
- scenarioContract: "Contrato de cenário",
685
- noIssues: "Nenhum problema encontrado."
506
+ components: "Componentes usados",
507
+ ticket: "Ticket",
508
+ copyForPr: "Copiar para o PR",
509
+ copiedForPr: "Copiado",
510
+ copyPrompt: "Copie o texto para o PR:"
686
511
  },
687
- home: {
688
- lead: (e) => `Especificação executável: cada situação abaixo abre por link, com persona, dados e regras próprios. ${e} ${e === 1 ? "situação registrada" : "situações registradas"}.`,
689
- statusLegend: "Legenda dos status",
690
- withoutModule: "Sem módulo",
691
- withoutModuleHint: "O prefixo do id não corresponde a nenhum módulo registrado, então estas situações não aparecem na navegação por módulo.",
692
- emptyModule: "Nenhuma situação registrada neste módulo ainda.",
693
- keyboardBadge: "teclado",
694
- noActiveWork: "Não há cenários no trabalho ativo.",
695
- noPortedReferences: "Não há referências portadas nesta coleção."
512
+ diagnostics: {
513
+ title: "Diagnóstico",
514
+ noIssues: "Nenhum problema encontrado.",
515
+ error: "Erro",
516
+ warning: "Aviso",
517
+ close: "Fechar diagnóstico"
518
+ },
519
+ pr: {
520
+ variations: "Variações",
521
+ components: "Componentes",
522
+ component: "Componente",
523
+ source: "Origem",
524
+ expected: "Comportamento esperado",
525
+ commit: (e) => `Commit \`${e}\``,
526
+ immutableLink: "link deste deployment",
527
+ noExpected: "Sem comportamento esperado declarado.",
528
+ empty: "—"
696
529
  },
697
530
  shell: {
698
- restoreChrome: "Mostrar controles",
531
+ restoreChrome: "Mostrar o chrome (Shift+C)",
532
+ frameTitle: (e) => `Pré-visualização de ${e}`,
699
533
  noRoute: "Nenhuma rota para este endereço",
700
- noRouteHint: "não casa com nenhuma rota declarada. Escolha uma situação na navegação."
534
+ noRouteHint: "não casa com nenhuma rota declarada. Escolha uma tela na navegação.",
535
+ outsideHandoff: "Fora do escopo deste handoff",
536
+ outsideHandoffHint: "Este link permite revisar somente os cenários, rotas e componentes listados no handoff. Escolha um item disponível na navegação.",
537
+ empty: "Nada para mostrar ainda",
538
+ emptyHint: "O produto ainda não registrou telas nem componentes."
701
539
  }
702
- }, wt = {
703
- status: {
704
- ported: "Ported — not validated",
705
- proposed: "Proposed",
706
- "in-review": "In review",
707
- approved: "Approved",
708
- "in-implementation": "In implementation",
709
- implemented: "Implemented",
710
- superseded: "Superseded"
711
- },
712
- statusMeaning: {
713
- ported: "Imported from the existing system, but not validated and not an implementation commitment.",
714
- proposed: "Exploration that has not been approved yet.",
715
- "in-review": "Open for design, business, or client validation.",
716
- approved: "Authorized reference, recorded with a commit URL.",
717
- "in-implementation": "Linked to active engineering work.",
718
- implemented: "Available in the real product and validated.",
719
- superseded: "Kept for history or replaced by another decision."
720
- },
540
+ }, jt = {
721
541
  network: {
722
542
  success: "Success",
723
543
  loading: "Loading",
@@ -725,11 +545,6 @@ const L = {
725
545
  error: "Error",
726
546
  slow: "Slow"
727
547
  },
728
- keyboard: {
729
- full: "Journey can be completed with keyboard only",
730
- partial: "Partially operable with keyboard",
731
- "not-applicable": "Not applicable"
732
- },
733
548
  viewport: {
734
549
  fit: "Fit",
735
550
  mobile: "Mobile",
@@ -738,1419 +553,1496 @@ const L = {
738
553
  custom: "Custom"
739
554
  },
740
555
  topbar: {
741
- homeTitle: (e) => `Go to ${e} home`,
742
- toggleNav: "Show or hide navigation",
556
+ region: "Design Space bar",
557
+ viewportGroup: "Viewport",
558
+ rotate: "Rotate",
559
+ zoomOut: "Zoom out",
560
+ zoomIn: "Zoom in",
561
+ zoomReset: "Reset zoom to 100%",
562
+ zoomValue: (e) => `${e}%`,
743
563
  copyLink: "Copy link",
744
564
  copied: "Link copied",
745
- copyPrompt: "Copy the scenario link:",
746
- cleanReview: "Clean review",
747
- cleanReviewTitle: "Open this state in a new tab without the Design Space chrome",
748
- panel: "Panel",
749
- lightMode: "Light mode",
750
- darkMode: "Dark mode",
565
+ copyPrompt: "Copy the link:",
566
+ cleanReview: "Clean review (Shift+C)",
567
+ lightMode: "Light theme",
568
+ darkMode: "Dark theme",
569
+ engineVersion: (e) => `Design Space ${e}`,
570
+ diagnostics: (e, n) => `Diagnostics: ${e} ${e === 1 ? "error" : "errors"}, ${n} ${n === 1 ? "warning" : "warnings"}`,
751
571
  branchTitle: (e) => `Branch: ${e}`,
752
572
  commitTitle: (e) => `Commit: ${e}`,
753
573
  envTitle: (e) => `Environment: ${e}`
754
574
  },
755
575
  sidebar: {
756
- region: "Product scenarios",
757
- flowsTab: "Flows",
576
+ region: "Navigation",
577
+ tabs: "Screens and components",
578
+ screensTab: "Screens",
758
579
  componentsTab: "Components",
759
- searchPlaceholder: "Search scenarios…",
760
- searchLabel: "Search scenarios using product language",
761
- componentSearchPlaceholder: "Search components…",
762
- componentSearchLabel: "Search product components",
580
+ searchPlaceholder: "Search",
581
+ searchLabel: "Search screens and components",
763
582
  searchShortcut: "⌘K",
764
- noMatch: (e) => `No scenarios found for "${e}".`,
765
- matchCount: (e) => `${e} ${e === 1 ? "scenario" : "scenarios"}.`,
766
- noComponentMatch: (e) => `No components found for "${e}".`,
767
- componentMatchCount: (e) => `${e} ${e === 1 ? "component" : "components"}.`,
768
- activeWork: "Active work",
769
- portedReferences: (e) => `Ported references · ${e}`,
770
- viewPorted: (e) => `View ${e} ported ${e === 1 ? "reference" : "references"}`,
771
- backToActive: "Back to active work",
772
- currentView: (e) => `Current view: ${e}`,
773
- noActiveWork: "There are no scenarios in active work.",
774
- noPortedReferences: "There are no ported references.",
775
- showPorted: "Show ported",
776
- activePorted: "Opened by direct link; hidden from active work",
777
- emptyModule: "No scenarios yet.",
583
+ noMatch: (e) => `Nothing found for "${e}".`,
584
+ emptyScreens: "No screens on this branch. Feature screens come in through a pull request while they are being designed.",
778
585
  emptyComponents: "The product has not registered any components yet.",
779
- withoutModule: "No module",
780
- scope: "Active scope",
781
- scopeData: "Data",
782
- scopePersona: "Persona",
783
- scopeNetwork: "Network"
586
+ ungrouped: "Other",
587
+ toggleGroup: (e) => `Show or hide ${e}`,
588
+ resize: "Resize navigation"
784
589
  },
785
- controls: {
786
- region: "Scenario controls",
590
+ panel: {
591
+ region: "Panel",
592
+ searchPlaceholder: "Filter",
593
+ searchLabel: "Filter variations and details",
594
+ searchShortcut: "⌘F",
595
+ noMatch: (e) => `Nothing in this panel for "${e}".`,
596
+ tabs: "Variations and information",
597
+ variationsTab: "Variations",
598
+ infoTab: "Information",
599
+ resize: "Resize panel",
600
+ variationsList: "Screen variations",
601
+ defaultVariation: "Default",
602
+ defaultVariationHint: "The screen without a declared scenario or fixture.",
603
+ noVariations: "This screen has no variations.",
604
+ noComponentVariations: "This component does not declare data variations.",
605
+ nothingSelected: "Choose a screen or a component in the navigation.",
787
606
  persona: "Persona",
788
- fixture: "Data",
789
- componentFixture: "Component data",
790
- network: "Network",
791
- viewport: "Viewport",
792
- customWidth: "Custom width in pixels",
607
+ network: "Network state",
793
608
  theme: "Theme",
794
609
  locale: "Language",
795
- dataSource: "Source",
610
+ dataSource: "Data source",
796
611
  fixturesOption: "Fixtures",
797
- a11y: "Accessibility",
798
- keyboardMode: "Keyboard",
799
- keyboardModeTitle: "Complete the journey with keyboard only, showing focus and tab order",
800
- reducedMotion: "Motion",
801
- reducedMotionTitle: "Reduce motion inside the stage",
802
- textScale: "Text size",
803
- none: "—"
612
+ none: "—",
613
+ fixtureFallback: (e, n) => `Variation \`${e}\` does not exist for this component. Showing \`${n}\`.`
804
614
  },
805
- inspector: {
806
- region: "Context panel",
807
- tabScenario: "Scenario",
808
- tabA11y: "Accessibility",
809
- tabDiagnostics: "Diagnostics",
810
- diagnosticsWithErrors: (e) => `Diagnostics (${e})`,
811
- noScenario: "No active scenario. Choose a state in the navigation to see its context, rules, and criteria.",
812
- componentReference: "Component",
813
- componentGroup: "Group",
814
- componentFixture: "Active fixture",
815
- componentFixtureDescription: "Fixture description",
816
- componentFixtureFallback: (e, t) => `Fixture \`${e}\` does not exist for this component. Showing \`${t}\` as fallback.`,
817
- situation: "State",
818
- reproduction: "Reproduction",
615
+ info: {
616
+ screen: "Screen",
617
+ variation: "Variation",
618
+ component: "Component",
619
+ name: "Name",
819
620
  id: "ID",
621
+ group: "Group",
622
+ description: "Description",
623
+ source: "Source",
624
+ usedIn: "Used in",
625
+ notUsed: "No screen declares this component.",
820
626
  route: "Route",
821
627
  persona: "Persona",
822
- personaSwapped: "changed",
823
- data: "Data",
824
- network: "Network",
825
- goal: (e) => `Goal: ${e}`,
826
- permissions: "Effective permissions",
628
+ permissions: "Permissions",
629
+ intent: "Intent",
827
630
  preconditions: "Preconditions",
631
+ actions: "Actions",
632
+ expected: "Expected behavior",
828
633
  rules: "Rules",
829
- actions: "Available actions",
830
- expected: "Acceptance criteria",
831
- approval: "Approval",
832
- openApproved: "Open approved version",
833
- engineering: "Engineering",
834
- a11yContract: "Scenario contract",
835
- keyboard: "Keyboard",
836
- contrast: "Contrast",
837
- contrastTarget: (e) => `WCAG 2.2 ${e}`,
838
- announces: "Must be announced:",
839
- focusedElement: "Focused element",
840
- keyboardModeOff: "Turn on keyboard mode in the controls to inspect the accessibility tree.",
841
- pressTab: (e) => `Press Tab inside the stage. ${e} tab ${e === 1 ? "stop was" : "stops were"} found.`,
842
- role: "Role",
843
- name: "Name",
844
- noAccessibleName: "no accessible name",
845
- nameFrom: "Name source",
846
- description: "Description",
847
- selector: "Selector",
848
- focusableButHidden: "This element is focusable but hidden from assistive technology. A screen reader receives focus without receiving content.",
849
- tabStopsInStage: (e) => `${e} tab ${e === 1 ? "stop" : "stops"} in the stage.`,
850
- tokenContrast: "Token contrast",
851
- noContrastPairs: "The product has not declared contrast pairs in theme.contrastPairs. Contrast belongs to a pair of colors; declaring pairs here validates them once, at the source.",
852
- pair: "Pair",
853
- ratio: "Ratio",
854
- pairsFailing: (e) => `${e} ${e === 1 ? "pair is" : "pairs are"} below the target. The product token test fails the build for this.`,
855
- automatedIsFloor: "Automated checks are a floor, not a ceiling. Confusing reading order, technically present but meaningless labels, and journeys that cannot be completed with a screen reader can still pass automated tools.",
856
- coverage: "Coverage by status",
857
- scenariosRegistered: (e) => `${e} ${e === 1 ? "scenario" : "scenarios"} registered.`,
858
- scenarioContract: "Scenario contract",
859
- noIssues: "No issues found."
634
+ components: "Components used",
635
+ ticket: "Ticket",
636
+ copyForPr: "Copy for PR",
637
+ copiedForPr: "Copied",
638
+ copyPrompt: "Copy the text for the PR:"
639
+ },
640
+ diagnostics: {
641
+ title: "Diagnostics",
642
+ noIssues: "No issues found.",
643
+ error: "Error",
644
+ warning: "Warning",
645
+ close: "Close diagnostics"
860
646
  },
861
- home: {
862
- lead: (e) => `Executable specification: each state below opens from a link with its own persona, data, and rules. ${e} ${e === 1 ? "state registered" : "states registered"}.`,
863
- statusLegend: "Status legend",
864
- withoutModule: "No module",
865
- withoutModuleHint: "The ID prefix does not match a registered module, so these states do not appear in module navigation.",
866
- emptyModule: "No states have been registered in this module yet.",
867
- keyboardBadge: "keyboard",
868
- noActiveWork: "There are no scenarios in active work.",
869
- noPortedReferences: "There are no ported references in this collection."
647
+ pr: {
648
+ variations: "Variations",
649
+ components: "Components",
650
+ component: "Component",
651
+ source: "Source",
652
+ expected: "Expected behavior",
653
+ commit: (e) => `Commit \`${e}\``,
654
+ immutableLink: "this deployment",
655
+ noExpected: "No expected behavior declared.",
656
+ empty: "—"
870
657
  },
871
658
  shell: {
872
- restoreChrome: "Show controls",
659
+ restoreChrome: "Show chrome (Shift+C)",
660
+ frameTitle: (e) => `${e} preview`,
873
661
  noRoute: "No route for this address",
874
- noRouteHint: "does not match any declared route. Choose a state from the navigation."
662
+ noRouteHint: "does not match any declared route. Choose a screen from the navigation.",
663
+ outsideHandoff: "Outside this handoff scope",
664
+ outsideHandoffHint: "This link only allows review of the scenarios, routes, and components listed in the handoff. Choose an available item from the navigation.",
665
+ empty: "Nothing to show yet",
666
+ emptyHint: "The product has not registered any screens or components yet."
875
667
  }
876
668
  };
877
- function Ue(e) {
878
- if (!e) return L;
879
- const t = { ...L };
880
- for (const n of Object.keys(L)) {
881
- const s = e[n];
882
- s && (t[n] = { ...L[n], ...s });
669
+ function ft(e) {
670
+ if (!e) return Y;
671
+ const n = { ...Y };
672
+ for (const o of Object.keys(Y)) {
673
+ const a = e[o];
674
+ a && (n[o] = { ...Y[o], ...a });
883
675
  }
884
- return t;
676
+ return n;
885
677
  }
886
- const de = he(L);
887
- function P() {
888
- return ue(de);
678
+ const De = Ye(Y);
679
+ function q() {
680
+ return Ze(De);
889
681
  }
890
- const kt = L.status, Nt = L.statusMeaning, xt = L.network, yt = L.keyboard;
891
- function Ve({
892
- registry: e,
893
- activeScenario: t,
894
- activeComponent: n,
895
- controls: s,
896
- onOpenScenario: l,
897
- onOpenComponent: a,
898
- onViewChange: r
682
+ const Gt = Y.network, wt = [
683
+ { id: "mobile", icon: "mobile" },
684
+ { id: "tablet", icon: "tablet" },
685
+ { id: "desktop", icon: "desktop" },
686
+ { id: "fit", icon: "fit" }
687
+ ], Ce = [25, 33, 50, 67, 75, 90, 100, 110, 125, 150];
688
+ function Me(e, n) {
689
+ return n > 0 ? Ce.find((o) => o > e) ?? ve : [...Ce].reverse().find((o) => o < e) ?? be;
690
+ }
691
+ function gt({
692
+ productName: e,
693
+ viewportId: n,
694
+ viewport: o,
695
+ zoom: a,
696
+ rotated: r,
697
+ theme: s,
698
+ issues: u,
699
+ linkUrl: c,
700
+ onViewport: p,
701
+ onRotate: l,
702
+ onZoom: w,
703
+ onCleanReview: f,
704
+ onToggleTheme: b
899
705
  }) {
900
- const c = P(), [h, p] = $(n ? "components" : "flows"), [m, v] = $(""), [i, N] = $(/* @__PURE__ */ new Set()), x = Q(null), S = Q(/* @__PURE__ */ new Map()), d = ee(s), f = e.byStatus("ported").length, k = e.activeScenarios({ view: d }).length, M = d === "ported" ? c.sidebar.portedReferences(f) : c.sidebar.activeWork;
901
- I(() => {
902
- n ? p("components") : t && p("flows");
903
- }, [n, t]), I(() => {
904
- const b = (w) => {
905
- Ye(w) && (w.preventDefault(), x.current?.focus(), x.current?.select());
906
- };
907
- return window.addEventListener("keydown", b), () => window.removeEventListener("keydown", b);
908
- }, []);
909
- const _ = C(() => {
910
- if (m.trim())
911
- return new Set(
912
- e.search(m, { view: d }).map((b) => b.id)
913
- );
914
- }, [m, e, d]), T = C(() => {
915
- const b = re(m);
916
- return (e.product.components ?? []).filter(
917
- (w) => re([w.name, w.id, w.group, w.description].join(" ")).includes(
918
- b
706
+ const M = q(), y = M.topbar, [d, h] = z(!1), S = (n === "mobile" || n === "tablet") && !!(o.width && o.height), L = async () => {
707
+ try {
708
+ await navigator.clipboard.writeText(c);
709
+ } catch {
710
+ window.prompt(y.copyPrompt, c);
711
+ }
712
+ h(!0), window.setTimeout(() => h(!1), 1600);
713
+ };
714
+ return /* @__PURE__ */ g("header", { className: "ds-topbar", "aria-label": y.region, children: [
715
+ /* @__PURE__ */ g("div", { className: "ds-topbar__product", children: [
716
+ /* @__PURE__ */ t("span", { className: "ds-topbar__name", children: e }),
717
+ /* @__PURE__ */ t(
718
+ "a",
719
+ {
720
+ className: "ds-topbar__version",
721
+ href: `https://www.npmjs.com/package/${mt}/v/${xe}`,
722
+ target: "_blank",
723
+ rel: "noreferrer",
724
+ children: y.engineVersion(xe)
725
+ }
919
726
  )
920
- );
921
- }, [m, e.product.components]), B = (b) => _ ? b.filter((w) => _.has(w.id)) : b, W = {
922
- view: d
923
- }, F = e.treeFor(W).map((b) => ({ ...b, scenarios: B(b.scenarios) })).filter((b) => b.scenarios.length > 0), R = B(e.orphansFor(W)), D = F.reduce((b, w) => b + w.scenarios.length, 0) + R.length, j = qe(T), z = h === "flows" ? [...F.flatMap((b) => b.scenarios), ...R].map((b) => b.id) : T.map((b) => b.id), O = (b, w) => {
924
- if (z.length === 0) return;
925
- const y = Je(z, b, w);
926
- y && S.current.get(y)?.focus();
927
- }, U = (b) => {
928
- b.key === "ArrowDown" ? (b.preventDefault(), O(void 0, 1)) : b.key === "Escape" && v("");
929
- }, H = (b, w) => {
930
- w.key !== "ArrowDown" && w.key !== "ArrowUp" || (w.preventDefault(), O(b, w.key === "ArrowDown" ? 1 : -1));
931
- }, K = (b, w) => {
932
- w ? S.current.set(b, w) : S.current.delete(b);
933
- }, V = (b) => N((w) => {
934
- const y = new Set(w);
935
- return y.has(b) ? y.delete(b) : y.add(b), y;
936
- });
937
- return /* @__PURE__ */ u("nav", { className: "ds-chrome ds-sidebar", "aria-label": c.sidebar.region, children: [
938
- /* @__PURE__ */ u("div", { className: "ds-sidebar__tabs", role: "tablist", children: [
939
- /* @__PURE__ */ o(
727
+ ] }),
728
+ /* @__PURE__ */ g("div", { className: "ds-topbar__view", children: [
729
+ /* @__PURE__ */ g("div", { className: "ds-group", role: "group", "aria-label": y.viewportGroup, children: [
730
+ wt.map((T) => {
731
+ const _ = M.viewport[T.id] ?? T.id;
732
+ return /* @__PURE__ */ t(
733
+ "button",
734
+ {
735
+ type: "button",
736
+ className: "ds-btn ds-btn--icon",
737
+ "aria-pressed": n === T.id,
738
+ "aria-label": _,
739
+ title: _,
740
+ onClick: () => p(T.id),
741
+ children: /* @__PURE__ */ t(H, { name: T.icon })
742
+ },
743
+ T.id
744
+ );
745
+ }),
746
+ /* @__PURE__ */ t(
747
+ "button",
748
+ {
749
+ type: "button",
750
+ className: "ds-btn ds-btn--icon",
751
+ "aria-pressed": r,
752
+ "aria-label": y.rotate,
753
+ title: y.rotate,
754
+ disabled: !S,
755
+ onClick: l,
756
+ children: /* @__PURE__ */ t(H, { name: "rotate" })
757
+ }
758
+ )
759
+ ] }),
760
+ /* @__PURE__ */ g("div", { className: "ds-group", role: "group", children: [
761
+ /* @__PURE__ */ t(
762
+ "button",
763
+ {
764
+ type: "button",
765
+ className: "ds-btn ds-btn--icon",
766
+ "aria-label": y.zoomOut,
767
+ title: y.zoomOut,
768
+ disabled: a <= be,
769
+ onClick: () => w(Me(a, -1)),
770
+ children: /* @__PURE__ */ t(H, { name: "minus" })
771
+ }
772
+ ),
773
+ /* @__PURE__ */ t(
774
+ "button",
775
+ {
776
+ type: "button",
777
+ className: "ds-btn ds-btn--zoom",
778
+ "aria-label": y.zoomReset,
779
+ title: y.zoomReset,
780
+ onClick: () => w(ie),
781
+ children: y.zoomValue(a)
782
+ }
783
+ ),
784
+ /* @__PURE__ */ t(
785
+ "button",
786
+ {
787
+ type: "button",
788
+ className: "ds-btn ds-btn--icon",
789
+ "aria-label": y.zoomIn,
790
+ title: y.zoomIn,
791
+ disabled: a >= ve,
792
+ onClick: () => w(Me(a, 1)),
793
+ children: /* @__PURE__ */ t(H, { name: "plus" })
794
+ }
795
+ )
796
+ ] }),
797
+ /* @__PURE__ */ t(
940
798
  "button",
941
799
  {
942
800
  type: "button",
943
- role: "tab",
944
- "aria-selected": h === "flows",
945
- onClick: () => {
946
- p("flows"), v("");
947
- },
948
- children: c.sidebar.flowsTab
801
+ className: "ds-btn ds-btn--icon",
802
+ "aria-label": y.cleanReview,
803
+ title: y.cleanReview,
804
+ onClick: f,
805
+ children: /* @__PURE__ */ t(H, { name: "fullscreen" })
949
806
  }
950
- ),
951
- /* @__PURE__ */ o(
807
+ )
808
+ ] }),
809
+ /* @__PURE__ */ g("div", { className: "ds-topbar__tools", children: [
810
+ /* @__PURE__ */ t(
952
811
  "button",
953
812
  {
954
813
  type: "button",
955
- role: "tab",
956
- "aria-selected": h === "components",
957
- onClick: () => {
958
- p("components"), v("");
959
- },
960
- children: c.sidebar.componentsTab
814
+ className: "ds-btn ds-btn--icon",
815
+ "aria-label": d ? y.copied : y.copyLink,
816
+ title: d ? y.copied : y.copyLink,
817
+ onClick: L,
818
+ children: /* @__PURE__ */ t(H, { name: d ? "check" : "link" })
961
819
  }
962
- )
963
- ] }),
964
- /* @__PURE__ */ u("div", { className: "ds-sidebar__search", children: [
965
- /* @__PURE__ */ o(
966
- "input",
820
+ ),
821
+ /* @__PURE__ */ t(
822
+ "button",
967
823
  {
968
- ref: x,
969
- className: "ds-input ds-input--search",
970
- type: "search",
971
- value: m,
972
- placeholder: h === "flows" ? c.sidebar.searchPlaceholder : c.sidebar.componentSearchPlaceholder,
973
- "aria-label": h === "flows" ? c.sidebar.searchLabel : c.sidebar.componentSearchLabel,
974
- onChange: (b) => v(b.target.value),
975
- onKeyDown: U
824
+ type: "button",
825
+ className: "ds-btn ds-btn--icon",
826
+ "aria-label": s === "dark" ? y.lightMode : y.darkMode,
827
+ title: s === "dark" ? y.lightMode : y.darkMode,
828
+ onClick: b,
829
+ children: /* @__PURE__ */ t(H, { name: s === "dark" ? "sun" : "moon" })
976
830
  }
977
831
  ),
978
- /* @__PURE__ */ o("kbd", { children: c.sidebar.searchShortcut })
979
- ] }),
980
- /* @__PURE__ */ u(
981
- "div",
832
+ u.length > 0 && /* @__PURE__ */ t(bt, { issues: u })
833
+ ] })
834
+ ] });
835
+ }
836
+ function bt({ issues: e }) {
837
+ const n = q(), [o, a] = z(!1), r = U(null), s = e.filter((p) => p.level === "error").length, u = e.length - s, c = n.topbar.diagnostics(s, u);
838
+ return K(() => {
839
+ if (!o) return;
840
+ const p = (w) => {
841
+ r.current?.contains(w.target) || a(!1);
842
+ }, l = (w) => {
843
+ w.key === "Escape" && a(!1);
844
+ };
845
+ return window.addEventListener("pointerdown", p), window.addEventListener("keydown", l), () => {
846
+ window.removeEventListener("pointerdown", p), window.removeEventListener("keydown", l);
847
+ };
848
+ }, [o]), /* @__PURE__ */ g("div", { className: "ds-diagnostics", ref: r, children: [
849
+ /* @__PURE__ */ g(
850
+ "button",
982
851
  {
983
- className: "ds-sidebar__tree",
984
- role: "tabpanel",
985
- "aria-label": h === "flows" ? c.sidebar.currentView(M) : void 0,
852
+ type: "button",
853
+ className: "ds-btn ds-diagnostics__trigger",
854
+ "data-level": s > 0 ? "error" : "warning",
855
+ "aria-expanded": o,
856
+ "aria-label": c,
857
+ title: c,
858
+ onClick: () => a((p) => !p),
986
859
  children: [
987
- h === "flows" && /* @__PURE__ */ u("header", { className: "ds-sidebar__view-header", children: [
988
- /* @__PURE__ */ o("h2", { children: M }),
989
- d === "ported" && /* @__PURE__ */ o(
990
- "button",
991
- {
992
- type: "button",
993
- className: "ds-text-action",
994
- onClick: () => r("active"),
995
- children: c.sidebar.backToActive
996
- }
997
- )
998
- ] }),
999
- m.trim() !== "" && /* @__PURE__ */ o("p", { className: "ds-sidebar__empty", role: "status", children: h === "flows" ? D === 0 ? c.sidebar.noMatch(m) : c.sidebar.matchCount(D) : T.length === 0 ? c.sidebar.noComponentMatch(m) : c.sidebar.componentMatchCount(T.length) }),
1000
- h === "flows" && m.trim() === "" && k === 0 ? /* @__PURE__ */ u("div", { className: "ds-sidebar__view-empty", children: [
1001
- /* @__PURE__ */ o("p", { children: d === "ported" ? c.sidebar.noPortedReferences : c.sidebar.noActiveWork }),
1002
- d === "active" && f > 0 && /* @__PURE__ */ o(
1003
- "button",
1004
- {
1005
- type: "button",
1006
- className: "ds-text-action",
1007
- onClick: () => r("ported"),
1008
- children: c.sidebar.viewPorted(f)
1009
- }
1010
- )
1011
- ] }) : h === "flows" ? /* @__PURE__ */ o(
1012
- Ge,
1013
- {
1014
- nodes: F,
1015
- orphans: R,
1016
- matches: _,
1017
- collapsed: i,
1018
- activeScenario: t?.id,
1019
- withoutModuleLabel: c.sidebar.withoutModule,
1020
- onToggle: V,
1021
- onOpen: l,
1022
- onKeyDown: H,
1023
- setItemRef: K
1024
- }
1025
- ) : j.length === 0 && !m ? /* @__PURE__ */ o("p", { className: "ds-sidebar__empty", children: c.sidebar.emptyComponents }) : j.map(([b, w]) => /* @__PURE__ */ u("section", { className: "ds-component-group", children: [
1026
- /* @__PURE__ */ o("h2", { children: b }),
1027
- /* @__PURE__ */ o("ul", { children: w.map((y) => /* @__PURE__ */ o("li", { children: /* @__PURE__ */ u(
1028
- "button",
1029
- {
1030
- ref: (G) => K(y.id, G),
1031
- type: "button",
1032
- className: "ds-component-item",
1033
- "aria-current": y.id === n,
1034
- onClick: () => a(y.id),
1035
- onKeyDown: (G) => H(y.id, G),
1036
- children: [
1037
- /* @__PURE__ */ o("span", { children: y.name }),
1038
- y.description && /* @__PURE__ */ o("small", { children: y.description })
1039
- ]
1040
- }
1041
- ) }, y.id)) })
1042
- ] }, b))
860
+ /* @__PURE__ */ t(H, { name: "alert" }),
861
+ /* @__PURE__ */ t("span", { children: s > 0 ? s : u })
1043
862
  ]
1044
863
  }
1045
864
  ),
1046
- h === "flows" && d === "active" && k > 0 && f > 0 && /* @__PURE__ */ o("div", { className: "ds-sidebar__view-footer", children: /* @__PURE__ */ o(
1047
- "button",
1048
- {
1049
- type: "button",
1050
- className: "ds-text-action",
1051
- onClick: () => r("ported"),
1052
- children: c.sidebar.viewPorted(f)
1053
- }
1054
- ) }),
1055
- h === "flows" && t && /* @__PURE__ */ u("aside", { className: "ds-sidebar__scope", "aria-label": c.sidebar.scope, children: [
1056
- /* @__PURE__ */ o("h2", { children: c.sidebar.scope }),
1057
- /* @__PURE__ */ u("dl", { children: [
1058
- /* @__PURE__ */ o("dt", { children: c.sidebar.scopeData }),
1059
- /* @__PURE__ */ o("dd", { children: e.fixture(s.fixture ?? t.fixture)?.label ?? c.controls.none }),
1060
- /* @__PURE__ */ o("dt", { children: c.sidebar.scopePersona }),
1061
- /* @__PURE__ */ o("dd", { children: e.persona(s.persona ?? t.persona)?.name ?? c.controls.none }),
1062
- /* @__PURE__ */ o("dt", { children: c.sidebar.scopeNetwork }),
1063
- /* @__PURE__ */ o("dd", { children: c.network[s.network] })
1064
- ] })
865
+ o && /* @__PURE__ */ g("div", { className: "ds-diagnostics__popover", role: "dialog", "aria-label": n.diagnostics.title, children: [
866
+ /* @__PURE__ */ g("div", { className: "ds-diagnostics__head", children: [
867
+ /* @__PURE__ */ t("strong", { children: n.diagnostics.title }),
868
+ /* @__PURE__ */ t("span", { className: "ds-muted", children: c })
869
+ ] }),
870
+ /* @__PURE__ */ t("ul", { className: "ds-diagnostics__list", children: e.map((p, l) => /* @__PURE__ */ g("li", { className: "ds-diagnostics__item", "data-level": p.level, children: [
871
+ /* @__PURE__ */ t("span", { className: "ds-diagnostics__level", children: p.level === "error" ? n.diagnostics.error : n.diagnostics.warning }),
872
+ /* @__PURE__ */ t("code", { className: "ds-diagnostics__where", children: p.where }),
873
+ /* @__PURE__ */ t("span", { className: "ds-diagnostics__message", children: p.message })
874
+ ] }, `${p.where}-${l}`)) })
1065
875
  ] })
1066
876
  ] });
1067
877
  }
1068
- function Ge(e) {
1069
- return /* @__PURE__ */ u(A, { children: [
1070
- e.nodes.map((t) => {
1071
- const n = !e.collapsed.has(t.module.id) || !!e.matches;
1072
- return /* @__PURE__ */ u("section", { className: "ds-module", children: [
1073
- /* @__PURE__ */ u(
878
+ const vt = 16;
879
+ function Ke({ side: e, label: n, value: o, onChange: a, onStart: r, onEnd: s }) {
880
+ const u = U(void 0), c = e === "left" ? 1 : -1, p = (b) => {
881
+ if (b.button === 0) {
882
+ b.preventDefault(), u.current = { x: b.clientX, width: o };
883
+ try {
884
+ b.currentTarget.setPointerCapture(b.pointerId);
885
+ } catch {
886
+ }
887
+ r?.();
888
+ }
889
+ }, l = (b) => {
890
+ u.current && a(u.current.width + (b.clientX - u.current.x) * c);
891
+ }, w = () => {
892
+ u.current && (u.current = void 0, s?.());
893
+ };
894
+ return /* @__PURE__ */ t(
895
+ "div",
896
+ {
897
+ className: "ds-resizer",
898
+ "data-side": e,
899
+ role: "separator",
900
+ "aria-orientation": "vertical",
901
+ "aria-label": n,
902
+ "aria-valuenow": o,
903
+ tabIndex: 0,
904
+ onPointerDown: p,
905
+ onPointerMove: l,
906
+ onPointerUp: w,
907
+ onPointerCancel: w,
908
+ onLostPointerCapture: w,
909
+ onKeyDown: (b) => {
910
+ if (b.key !== "ArrowLeft" && b.key !== "ArrowRight") return;
911
+ b.preventDefault();
912
+ const M = b.key === "ArrowRight" ? 1 : -1;
913
+ a(o + M * c * vt);
914
+ }
915
+ }
916
+ );
917
+ }
918
+ function yt({
919
+ registry: e,
920
+ handoff: n,
921
+ activeScreen: o,
922
+ activeComponent: a,
923
+ onOpenScreen: r,
924
+ onOpenComponent: s,
925
+ width: u,
926
+ onResize: c,
927
+ onResizeStart: p,
928
+ onResizeEnd: l
929
+ }) {
930
+ const f = q().sidebar, [b, M] = z(""), [y, d] = z(() => /* @__PURE__ */ new Set()), h = U(null), S = e.screensFor({ handoff: n }), L = e.componentsFor(n), T = S.length > 0, _ = L.length > 0, [$, i] = z(
931
+ () => a || !T ? "components" : "screens"
932
+ );
933
+ K(() => {
934
+ a && _ ? i("components") : o && T && i("screens");
935
+ }, [a, o, _, T]);
936
+ const m = $;
937
+ K(() => {
938
+ const k = (P) => {
939
+ Nt(P) && (P.preventDefault(), h.current?.focus(), h.current?.select());
940
+ };
941
+ return window.addEventListener("keydown", k), () => window.removeEventListener("keydown", k);
942
+ }, []);
943
+ const v = D(
944
+ () => e.searchScreens(b, { handoff: n }),
945
+ [n, b, e]
946
+ ), E = D(
947
+ () => e.searchComponents(b, n),
948
+ [n, b, e]
949
+ ), N = D(() => St(E, f.ungrouped), [E, f.ungrouped]), O = b.trim().length > 0, x = (k) => d((P) => {
950
+ const F = new Set(P);
951
+ return F.has(k) ? F.delete(k) : F.add(k), F;
952
+ });
953
+ return /* @__PURE__ */ g("nav", { className: "ds-sidebar", "aria-label": f.region, style: { width: u }, children: [
954
+ /* @__PURE__ */ g("div", { className: "ds-search", children: [
955
+ /* @__PURE__ */ t(H, { name: "search", size: 14 }),
956
+ /* @__PURE__ */ t(
957
+ "input",
958
+ {
959
+ ref: h,
960
+ className: "ds-input ds-search__input",
961
+ type: "search",
962
+ value: b,
963
+ placeholder: f.searchPlaceholder,
964
+ "aria-label": f.searchLabel,
965
+ onChange: (k) => M(k.target.value),
966
+ onKeyDown: (k) => {
967
+ k.key === "Escape" && M("");
968
+ }
969
+ }
970
+ ),
971
+ /* @__PURE__ */ t("kbd", { className: "ds-kbd", "aria-hidden": "true", children: f.searchShortcut })
972
+ ] }),
973
+ /* @__PURE__ */ g("div", { className: "ds-tabs", role: "tablist", "aria-label": f.tabs, children: [
974
+ /* @__PURE__ */ t(
975
+ Te,
976
+ {
977
+ selected: m === "screens",
978
+ label: f.screensTab,
979
+ count: O ? v.length : void 0,
980
+ onSelect: () => i("screens")
981
+ }
982
+ ),
983
+ /* @__PURE__ */ t(
984
+ Te,
985
+ {
986
+ selected: m === "components",
987
+ label: f.componentsTab,
988
+ count: O ? E.length : void 0,
989
+ onSelect: () => i("components")
990
+ }
991
+ )
992
+ ] }),
993
+ /* @__PURE__ */ t("div", { className: "ds-sidebar__list", role: "tabpanel", children: m === "screens" ? T ? v.length === 0 ? /* @__PURE__ */ t("p", { className: "ds-empty", children: f.noMatch(b) }) : /* @__PURE__ */ t("ul", { className: "ds-items", children: v.map((k) => /* @__PURE__ */ t(
994
+ kt,
995
+ {
996
+ screen: k,
997
+ active: k.id === o && !a,
998
+ onOpen: r
999
+ },
1000
+ k.id
1001
+ )) }) : /* @__PURE__ */ t("p", { className: "ds-empty", children: f.emptyScreens }) : _ ? E.length === 0 ? /* @__PURE__ */ t("p", { className: "ds-empty", children: f.noMatch(b) }) : N.map(({ group: k, items: P }) => {
1002
+ const F = y.has(k) && !O;
1003
+ return /* @__PURE__ */ g("section", { className: "ds-group-section", children: [
1004
+ /* @__PURE__ */ g(
1074
1005
  "button",
1075
1006
  {
1076
1007
  type: "button",
1077
- className: "ds-module__header",
1078
- "aria-expanded": n,
1079
- onClick: () => e.onToggle(t.module.id),
1008
+ className: "ds-group-section__head",
1009
+ "aria-expanded": !F,
1010
+ "aria-label": f.toggleGroup(k),
1011
+ onClick: () => x(k),
1080
1012
  children: [
1081
- /* @__PURE__ */ o("span", { className: "ds-module__chevron", "aria-hidden": "true", children: "▶" }),
1082
- /* @__PURE__ */ o("span", { children: t.module.name }),
1083
- /* @__PURE__ */ o("span", { className: "ds-module__count", children: t.scenarios.length })
1013
+ /* @__PURE__ */ t(H, { name: "chevron", size: 12 }),
1014
+ /* @__PURE__ */ t("span", { children: k }),
1015
+ /* @__PURE__ */ t("span", { className: "ds-count", children: P.length })
1084
1016
  ]
1085
1017
  }
1086
1018
  ),
1087
- n && /* @__PURE__ */ o("ul", { className: "ds-module__scenarios", children: t.scenarios.map((s) => /* @__PURE__ */ o(ae, { scenario: s, ...e }, s.id)) })
1088
- ] }, t.module.id);
1089
- }),
1090
- e.orphans.length > 0 && /* @__PURE__ */ u("section", { className: "ds-module", children: [
1091
- /* @__PURE__ */ u("div", { className: "ds-module__header", "aria-hidden": "true", children: [
1092
- /* @__PURE__ */ o("span", { className: "ds-module__chevron", children: "▶" }),
1093
- /* @__PURE__ */ o("span", { children: e.withoutModuleLabel }),
1094
- /* @__PURE__ */ o("span", { className: "ds-module__count", children: e.orphans.length })
1095
- ] }),
1096
- /* @__PURE__ */ o("ul", { className: "ds-module__scenarios", children: e.orphans.map((t) => /* @__PURE__ */ o(ae, { scenario: t, ...e }, t.id)) })
1097
- ] })
1019
+ !F && /* @__PURE__ */ t("ul", { className: "ds-items", children: P.map((A) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
1020
+ "button",
1021
+ {
1022
+ type: "button",
1023
+ className: "ds-item",
1024
+ "aria-current": A.id === a ? "true" : void 0,
1025
+ onClick: () => s(A.id),
1026
+ children: /* @__PURE__ */ t("span", { className: "ds-item__title", children: A.name })
1027
+ }
1028
+ ) }, A.id)) })
1029
+ ] }, k);
1030
+ }) : /* @__PURE__ */ t("p", { className: "ds-empty", children: f.emptyComponents }) }),
1031
+ /* @__PURE__ */ t(
1032
+ Ke,
1033
+ {
1034
+ side: "left",
1035
+ label: f.resize,
1036
+ value: u,
1037
+ onChange: c,
1038
+ onStart: p,
1039
+ onEnd: l
1040
+ }
1041
+ )
1098
1042
  ] });
1099
1043
  }
1100
- function ae({
1101
- scenario: e,
1102
- activeScenario: t,
1103
- onOpen: n,
1104
- onKeyDown: s,
1105
- setItemRef: l
1044
+ function Te({
1045
+ selected: e,
1046
+ label: n,
1047
+ count: o,
1048
+ onSelect: a
1049
+ }) {
1050
+ return /* @__PURE__ */ g(
1051
+ "button",
1052
+ {
1053
+ type: "button",
1054
+ role: "tab",
1055
+ className: "ds-tab",
1056
+ "aria-selected": e,
1057
+ tabIndex: e ? 0 : -1,
1058
+ onClick: a,
1059
+ children: [
1060
+ /* @__PURE__ */ t("span", { children: n }),
1061
+ o !== void 0 && /* @__PURE__ */ t("span", { className: "ds-count", children: o })
1062
+ ]
1063
+ }
1064
+ );
1065
+ }
1066
+ function kt({
1067
+ screen: e,
1068
+ active: n,
1069
+ onOpen: o
1106
1070
  }) {
1107
- const a = P().status[e.status];
1108
- return /* @__PURE__ */ o("li", { children: /* @__PURE__ */ u(
1071
+ return /* @__PURE__ */ t("li", { children: /* @__PURE__ */ g(
1109
1072
  "button",
1110
1073
  {
1111
- ref: (r) => l(e.id, r),
1112
1074
  type: "button",
1113
- className: "ds-scenario",
1114
- "aria-current": e.id === t,
1115
- onClick: () => n(e.id),
1116
- onKeyDown: (r) => s(e.id, r),
1075
+ className: "ds-item",
1076
+ "aria-current": n ? "true" : void 0,
1077
+ onClick: () => o(e.id),
1117
1078
  children: [
1118
- /* @__PURE__ */ o("span", { className: "ds-status-dot", "data-status": e.status, title: a }),
1119
- /* @__PURE__ */ o("span", { className: "ds-scenario__title", children: e.title }),
1120
- /* @__PURE__ */ o("span", { className: "ds-visually-hidden", children: a })
1079
+ /* @__PURE__ */ t("span", { className: "ds-item__title", children: e.name }),
1080
+ e.variations.length > 1 && /* @__PURE__ */ t("span", { className: "ds-count", children: e.variations.length })
1121
1081
  ]
1122
1082
  }
1123
1083
  ) });
1124
1084
  }
1125
- function qe(e) {
1126
- const t = /* @__PURE__ */ new Map();
1127
- for (const n of e) {
1128
- const s = n.group ?? "Componentes";
1129
- t.set(s, [...t.get(s) ?? [], n]);
1085
+ function St(e, n) {
1086
+ const o = /* @__PURE__ */ new Map();
1087
+ for (const a of e) {
1088
+ const r = a.group?.trim() || n, s = o.get(r) ?? [];
1089
+ s.push(a), o.set(r, s);
1130
1090
  }
1131
- return [...t.entries()];
1091
+ return [...o].map(([a, r]) => ({ group: a, items: r }));
1132
1092
  }
1133
- function re(e) {
1134
- return e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "").trim();
1093
+ function Nt(e) {
1094
+ return (e.metaKey || e.ctrlKey) && !e.altKey && !e.shiftKey && e.key.toLowerCase() === "k";
1095
+ }
1096
+ function xt({
1097
+ screen: e,
1098
+ variations: n,
1099
+ components: o,
1100
+ deploy: a,
1101
+ labels: r,
1102
+ overrides: s
1103
+ }) {
1104
+ const u = r.pr, c = [`## ${e.name}`, ""];
1105
+ e.description && c.push(e.description, ""), c.push(`\`${e.route.path}\``, "");
1106
+ const p = a.deploymentUrl ? `https://${a.deploymentUrl}` : void 0, l = a.shortCommit ? u.commit(a.shortCommit) : void 0;
1107
+ if (c.push(`### ${u.variations}`, ""), n.length === 0) {
1108
+ const w = new URL(e.href, a.origin);
1109
+ Je(w.searchParams, s), c.push(`- [${r.panel.defaultVariation}](${w.toString()})`);
1110
+ }
1111
+ for (const w of n) {
1112
+ const f = Se(w, { origin: a.origin, overrides: s });
1113
+ let b = `- [${Ct(w.title)}](${f})`;
1114
+ if (p) {
1115
+ const M = Se(w, { origin: p, overrides: s });
1116
+ b += ` · [${l ?? u.immutableLink}](${M})`;
1117
+ } else l && (b += ` · ${l}`);
1118
+ c.push(b);
1119
+ }
1120
+ if (c.push(""), o.length > 0) {
1121
+ c.push(`### ${u.components}`, ""), c.push(`| ${u.component} | ${u.source} |`, "| --- | --- |");
1122
+ for (const w of o) {
1123
+ const f = w.source ? `\`${Ee(w.source)}\`` : u.empty;
1124
+ c.push(`| ${Ee(w.name)} (\`${w.id}\`) | ${f} |`);
1125
+ }
1126
+ c.push("");
1127
+ }
1128
+ c.push(`### ${u.expected}`, ""), n.length === 0 && c.push(`**${r.panel.defaultVariation}**`, "", u.noExpected, "");
1129
+ for (const w of n) {
1130
+ if (c.push(`**${w.title}**`, ""), w.expected?.length)
1131
+ for (const f of w.expected) c.push(`- ${f}`);
1132
+ else
1133
+ c.push(u.noExpected);
1134
+ c.push("");
1135
+ }
1136
+ return `${c.join(`
1137
+ `).trimEnd()}
1138
+ `;
1135
1139
  }
1136
- function Ye(e) {
1137
- const t = e.key.toLowerCase();
1138
- return (e.metaKey || e.ctrlKey) && !e.altKey && !e.shiftKey && (t === "k" || t === "f");
1140
+ function Ee(e) {
1141
+ return e.replace(/\|/g, "\\|").replace(/\n/g, " ");
1139
1142
  }
1140
- function Je(e, t, n) {
1141
- if (e.length === 0) return;
1142
- const s = t ? e.indexOf(t) : -1, l = Math.max(0, Math.min(e.length - 1, s + n));
1143
- return e[l];
1143
+ function Ct(e) {
1144
+ return e.replace(/([[\]])/g, "\\$1");
1144
1145
  }
1145
- function Qe({
1146
- product: e,
1147
- scenario: t,
1148
- deploy: n,
1149
- inspectorOpen: s,
1150
- chromeTheme: l,
1151
- view: a,
1152
- onToggleInspector: r,
1153
- onToggleChromeTheme: c
1154
- }) {
1155
- const h = P().topbar, [p, m] = $(!1), v = async () => {
1156
- const x = t ? fe(t, {
1157
- origin: n.origin,
1158
- overrides: {
1159
- ...l === "light" ? { chromeTheme: l } : {},
1160
- ...a === "ported" ? { view: a } : {}
1146
+ function Mt(e) {
1147
+ const { tab: n, onTab: o, width: a, onResize: r, onResizeStart: s, onResizeEnd: u } = e, c = q().panel, [p, l] = z(""), w = U(null), f = U(null), [b, M] = z(!1);
1148
+ return K(() => {
1149
+ const y = (d) => {
1150
+ Lt(d) && (d.preventDefault(), w.current?.focus(), w.current?.select());
1151
+ };
1152
+ return window.addEventListener("keydown", y), () => window.removeEventListener("keydown", y);
1153
+ }, []), Pe(() => {
1154
+ M(Rt(f.current, p));
1155
+ }), /* @__PURE__ */ g("aside", { className: "ds-panel", "aria-label": c.region, style: { width: a }, children: [
1156
+ /* @__PURE__ */ t(
1157
+ Ke,
1158
+ {
1159
+ side: "right",
1160
+ label: c.resize,
1161
+ value: a,
1162
+ onChange: r,
1163
+ onStart: s,
1164
+ onEnd: u
1161
1165
  }
1162
- }) : `${n.origin}${window.location.pathname}${window.location.search}`;
1163
- try {
1164
- await navigator.clipboard.writeText(x);
1165
- } catch {
1166
- window.prompt(h.copyPrompt, x);
1167
- }
1168
- m(!0), window.setTimeout(() => m(!1), 1600);
1169
- }, i = Xe(
1170
- typeof window > "u" ? `${n.origin}/` : window.location.href
1171
- ), N = Ze(n.origin, l, a);
1172
- return /* @__PURE__ */ u("header", { className: "ds-chrome ds-topbar", children: [
1173
- /* @__PURE__ */ u("div", { className: "ds-topbar__product", children: [
1174
- /* @__PURE__ */ o(
1175
- "a",
1166
+ ),
1167
+ /* @__PURE__ */ g("div", { className: "ds-search", children: [
1168
+ /* @__PURE__ */ t(H, { name: "search", size: 14 }),
1169
+ /* @__PURE__ */ t(
1170
+ "input",
1176
1171
  {
1177
- className: "ds-topbar__home",
1178
- href: N,
1179
- "aria-label": h.homeTitle(e.name),
1180
- title: h.homeTitle(e.name),
1181
- children: e.name
1172
+ ref: w,
1173
+ className: "ds-input ds-search__input",
1174
+ type: "search",
1175
+ value: p,
1176
+ placeholder: c.searchPlaceholder,
1177
+ "aria-label": c.searchLabel,
1178
+ onChange: (y) => l(y.target.value),
1179
+ onKeyDown: (y) => {
1180
+ y.key === "Escape" && l("");
1181
+ }
1182
1182
  }
1183
1183
  ),
1184
- e.tagline && /* @__PURE__ */ o("span", { className: "ds-topbar__tagline", children: e.tagline })
1184
+ /* @__PURE__ */ t("kbd", { className: "ds-kbd", "aria-hidden": "true", children: c.searchShortcut })
1185
1185
  ] }),
1186
- /* @__PURE__ */ o("div", { className: "ds-topbar__spacer" }),
1187
- /* @__PURE__ */ u("div", { className: "ds-topbar__meta", children: [
1188
- n.branch && /* @__PURE__ */ o("code", { title: h.branchTitle(n.branch), children: n.branch.length > 28 ? `${n.branch.slice(0, 27)}…` : n.branch }),
1189
- n.commit && /* @__PURE__ */ o("code", { title: h.commitTitle(n.commit), children: n.shortCommit }),
1190
- /* @__PURE__ */ o("code", { title: h.envTitle(n.env), children: n.env })
1186
+ /* @__PURE__ */ g("div", { className: "ds-tabs", role: "tablist", "aria-label": c.tabs, children: [
1187
+ /* @__PURE__ */ t(
1188
+ "button",
1189
+ {
1190
+ type: "button",
1191
+ role: "tab",
1192
+ className: "ds-tab",
1193
+ "aria-selected": n === "variations",
1194
+ tabIndex: n === "variations" ? 0 : -1,
1195
+ onClick: () => o("variations"),
1196
+ children: c.variationsTab
1197
+ }
1198
+ ),
1199
+ /* @__PURE__ */ t(
1200
+ "button",
1201
+ {
1202
+ type: "button",
1203
+ role: "tab",
1204
+ className: "ds-tab",
1205
+ "aria-selected": n === "info",
1206
+ tabIndex: n === "info" ? 0 : -1,
1207
+ onClick: () => o("info"),
1208
+ children: c.infoTab
1209
+ }
1210
+ )
1191
1211
  ] }),
1192
- /* @__PURE__ */ o(
1193
- "button",
1194
- {
1195
- type: "button",
1196
- className: "ds-btn ds-btn--icon",
1197
- "aria-pressed": l === "light",
1198
- "aria-label": l === "dark" ? h.lightMode : h.darkMode,
1199
- title: l === "dark" ? h.lightMode : h.darkMode,
1200
- onClick: c,
1201
- children: /* @__PURE__ */ o(et, { theme: l })
1202
- }
1203
- ),
1204
- /* @__PURE__ */ o("button", { type: "button", className: "ds-btn", onClick: v, children: p ? h.copied : h.copyLink }),
1205
- /* @__PURE__ */ o(
1206
- "a",
1207
- {
1208
- className: "ds-btn",
1209
- href: i,
1210
- target: "_blank",
1211
- rel: "noreferrer",
1212
- title: h.cleanReviewTitle,
1213
- children: h.cleanReview
1214
- }
1215
- ),
1216
- /* @__PURE__ */ o(
1217
- "button",
1218
- {
1219
- type: "button",
1220
- className: "ds-btn",
1221
- "aria-pressed": s,
1222
- onClick: r,
1223
- children: h.panel
1224
- }
1225
- )
1212
+ /* @__PURE__ */ g("div", { className: "ds-panel__body", role: "tabpanel", ref: f, children: [
1213
+ n === "variations" ? /* @__PURE__ */ t(Tt, { ...e }) : /* @__PURE__ */ t(Et, { ...e }),
1214
+ b && /* @__PURE__ */ t("p", { className: "ds-empty", children: c.noMatch(p) })
1215
+ ] })
1226
1216
  ] });
1227
1217
  }
1228
- function Xe(e) {
1229
- const t = new URL(e);
1230
- return t.searchParams.set(g.chrome, "0"), t.toString();
1231
- }
1232
- function Ze(e, t, n = "active") {
1233
- const s = new URL("/", e);
1234
- return t === "light" && s.searchParams.set(g.chromeTheme, t), n === "ported" && s.searchParams.set(g.view, "ported"), s.toString();
1235
- }
1236
- function et({ theme: e }) {
1237
- const t = {
1238
- width: 15,
1239
- height: 15,
1240
- viewBox: "0 0 24 24",
1241
- fill: "none",
1242
- stroke: "currentColor",
1243
- strokeWidth: 2,
1244
- strokeLinecap: "round",
1245
- strokeLinejoin: "round",
1246
- "aria-hidden": !0
1247
- };
1248
- return e === "dark" ? /* @__PURE__ */ u("svg", { ...t, children: [
1249
- /* @__PURE__ */ o("circle", { cx: "12", cy: "12", r: "4" }),
1250
- /* @__PURE__ */ o("path", { d: "M12 2v2M12 20v2M4.93 4.93l1.42 1.42M17.66 17.66l1.41 1.41M2 12h2M20 12h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.42" })
1251
- ] }) : /* @__PURE__ */ o("svg", { ...t, children: /* @__PURE__ */ o("path", { d: "M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z" }) });
1252
- }
1253
- function tt({
1218
+ function Tt({
1254
1219
  registry: e,
1255
- controls: t,
1256
- scenarioActive: n,
1257
- component: s,
1258
- componentFixture: l,
1259
- onChange: a
1220
+ controls: n,
1221
+ screen: o,
1222
+ variation: a,
1223
+ component: r,
1224
+ componentFixture: s,
1225
+ onOpenScenario: u,
1226
+ onChange: c
1260
1227
  }) {
1261
- const r = P(), c = r.controls, { product: h } = e, p = h.dataSources?.adapters ?? [], m = h.theme?.modes ?? [], v = h.theme?.locales ?? [];
1262
- return /* @__PURE__ */ u("div", { className: "ds-chrome ds-controls", role: "group", "aria-label": c.region, children: [
1263
- s?.fixtures?.length ? /* @__PURE__ */ u("div", { className: "ds-field", children: [
1264
- /* @__PURE__ */ o("label", { htmlFor: "ds-component-fixture", children: c.componentFixture }),
1265
- /* @__PURE__ */ o(
1266
- "select",
1228
+ const p = q(), l = p.panel;
1229
+ if (r) {
1230
+ const d = r.fixtures ?? [];
1231
+ return d.length === 0 ? /* @__PURE__ */ t("p", { className: "ds-empty", children: l.noComponentVariations }) : /* @__PURE__ */ g(I, { children: [
1232
+ s.didFallback && s.requestedId && s.fixture && /* @__PURE__ */ t("p", { className: "ds-notice", children: l.fixtureFallback(s.requestedId, s.fixture.id) }),
1233
+ /* @__PURE__ */ t("ul", { className: "ds-items", "aria-label": l.variationsList, children: d.map((h) => /* @__PURE__ */ t("li", { "data-ds-filter": !0, children: /* @__PURE__ */ g(
1234
+ "button",
1267
1235
  {
1268
- id: "ds-component-fixture",
1269
- className: "ds-select",
1270
- value: l?.fixture?.id ?? "",
1271
- onChange: (i) => a({ fixture: i.target.value || void 0 }),
1272
- children: s.fixtures.map((i) => /* @__PURE__ */ o("option", { value: i.id, children: i.label }, i.id))
1236
+ type: "button",
1237
+ className: "ds-item ds-item--stacked",
1238
+ "aria-current": s.fixture?.id === h.id ? "true" : void 0,
1239
+ onClick: () => c({ fixture: h.id }),
1240
+ children: [
1241
+ /* @__PURE__ */ t("span", { className: "ds-item__title", children: h.label }),
1242
+ h.description && /* @__PURE__ */ t("span", { className: "ds-item__hint", children: h.description })
1243
+ ]
1273
1244
  }
1274
- )
1275
- ] }) : null,
1276
- n && /* @__PURE__ */ u("div", { className: "ds-field", children: [
1277
- /* @__PURE__ */ o("label", { htmlFor: "ds-persona", children: c.persona }),
1278
- /* @__PURE__ */ u(
1245
+ ) }, h.id)) })
1246
+ ] });
1247
+ }
1248
+ if (!o) return /* @__PURE__ */ t("p", { className: "ds-empty", children: l.nothingSelected });
1249
+ const w = o.variations, f = e.product, b = f.theme?.modes ?? [], M = f.theme?.locales ?? [], y = f.dataSources?.adapters ?? [];
1250
+ return /* @__PURE__ */ g(I, { children: [
1251
+ /* @__PURE__ */ t("ul", { className: "ds-items", "aria-label": l.variationsList, children: w.length === 0 ? /* @__PURE__ */ t("li", { children: /* @__PURE__ */ g("div", { className: "ds-item ds-item--stacked", "aria-current": "true", children: [
1252
+ /* @__PURE__ */ t("span", { className: "ds-item__title", children: l.defaultVariation }),
1253
+ /* @__PURE__ */ t("span", { className: "ds-item__hint", children: l.defaultVariationHint })
1254
+ ] }) }) : w.map((d) => /* @__PURE__ */ t("li", { "data-ds-filter": !0, children: /* @__PURE__ */ g(
1255
+ "button",
1256
+ {
1257
+ type: "button",
1258
+ className: "ds-item ds-item--stacked",
1259
+ "aria-current": a?.id === d.id ? "true" : void 0,
1260
+ onClick: () => u(d.id),
1261
+ children: [
1262
+ /* @__PURE__ */ t("span", { className: "ds-item__title", children: d.title }),
1263
+ d.intent && /* @__PURE__ */ t("span", { className: "ds-item__hint", children: d.intent })
1264
+ ]
1265
+ }
1266
+ ) }, d.id)) }),
1267
+ /* @__PURE__ */ g("div", { className: "ds-fields", children: [
1268
+ /* @__PURE__ */ t(ee, { label: l.persona, children: /* @__PURE__ */ g(
1279
1269
  "select",
1280
1270
  {
1281
- id: "ds-persona",
1282
1271
  className: "ds-select",
1283
- value: t.persona ?? "",
1284
- onChange: (i) => a({ persona: i.target.value || void 0 }),
1272
+ value: n.persona ?? "",
1273
+ onChange: (d) => c({ persona: d.target.value || void 0 }),
1285
1274
  children: [
1286
- /* @__PURE__ */ o("option", { value: "", children: c.none }),
1287
- h.personas.map((i) => /* @__PURE__ */ o("option", { value: i.id, children: i.name }, i.id))
1275
+ /* @__PURE__ */ t("option", { value: "", children: l.none }),
1276
+ f.personas.map((d) => /* @__PURE__ */ t("option", { value: d.id, children: d.name }, d.id))
1288
1277
  ]
1289
1278
  }
1290
- )
1291
- ] }),
1292
- n && /* @__PURE__ */ u("div", { className: "ds-field", children: [
1293
- /* @__PURE__ */ o("span", { className: "ds-field__label", id: "ds-network-label", children: c.network }),
1294
- /* @__PURE__ */ o("div", { className: "ds-segmented", role: "group", "aria-labelledby": "ds-network-label", children: ie.map((i) => /* @__PURE__ */ o(
1295
- "button",
1296
- {
1297
- type: "button",
1298
- "aria-pressed": t.network === i,
1299
- onClick: () => a({ network: i }),
1300
- children: r.network[i]
1301
- },
1302
- i
1303
- )) })
1304
- ] }),
1305
- /* @__PURE__ */ u("div", { className: "ds-field", children: [
1306
- /* @__PURE__ */ o("span", { className: "ds-field__label", id: "ds-viewport-label", children: c.viewport }),
1307
- /* @__PURE__ */ o("div", { className: "ds-segmented", role: "group", "aria-labelledby": "ds-viewport-label", children: ce.map((i) => /* @__PURE__ */ o(
1308
- "button",
1309
- {
1310
- type: "button",
1311
- className: "ds-icon-button",
1312
- "aria-pressed": t.viewport === i.id,
1313
- "aria-label": r.viewport[i.id] ?? i.label,
1314
- title: r.viewport[i.id] ?? i.label,
1315
- onClick: () => a({ viewport: i.id }),
1316
- children: /* @__PURE__ */ o(ot, { id: i.id })
1317
- },
1318
- i.id
1319
- )) }),
1320
- t.viewport === "custom" && /* @__PURE__ */ o(
1321
- "input",
1279
+ ) }),
1280
+ /* @__PURE__ */ t(ee, { label: l.network, children: /* @__PURE__ */ t(
1281
+ "select",
1322
1282
  {
1323
- className: "ds-input",
1324
- type: "number",
1325
- min: 240,
1326
- max: 3840,
1327
- step: 10,
1328
- style: { width: 88 },
1329
- "aria-label": c.customWidth,
1330
- value: t.customWidth ?? 1024,
1331
- onChange: (i) => a({ customWidth: Number(i.target.value) || void 0 })
1283
+ className: "ds-select",
1284
+ value: n.network,
1285
+ onChange: (d) => c({ network: d.target.value }),
1286
+ children: Fe.map((d) => /* @__PURE__ */ t("option", { value: d, children: p.network[d] }, d))
1332
1287
  }
1333
- )
1334
- ] }),
1335
- m.length > 1 && /* @__PURE__ */ u("div", { className: "ds-field", children: [
1336
- /* @__PURE__ */ o("label", { htmlFor: "ds-theme", children: c.theme }),
1337
- /* @__PURE__ */ o(
1288
+ ) }),
1289
+ b.length > 1 && /* @__PURE__ */ t(ee, { label: l.theme, children: /* @__PURE__ */ t(
1338
1290
  "select",
1339
1291
  {
1340
- id: "ds-theme",
1341
1292
  className: "ds-select",
1342
- value: t.themeMode ?? m[0],
1343
- onChange: (i) => a({ themeMode: i.target.value }),
1344
- children: m.map((i) => /* @__PURE__ */ o("option", { value: i, children: i }, i))
1293
+ value: n.themeMode ?? b[0],
1294
+ onChange: (d) => c({ themeMode: d.target.value }),
1295
+ children: b.map((d) => /* @__PURE__ */ t("option", { value: d, children: d }, d))
1345
1296
  }
1346
- )
1347
- ] }),
1348
- v.length > 1 && /* @__PURE__ */ u("div", { className: "ds-field", children: [
1349
- /* @__PURE__ */ o("label", { htmlFor: "ds-locale", children: c.locale }),
1350
- /* @__PURE__ */ o(
1297
+ ) }),
1298
+ M.length > 1 && /* @__PURE__ */ t(ee, { label: l.locale, children: /* @__PURE__ */ t(
1351
1299
  "select",
1352
1300
  {
1353
- id: "ds-locale",
1354
1301
  className: "ds-select",
1355
- value: t.locale ?? v[0],
1356
- onChange: (i) => a({ locale: i.target.value }),
1357
- children: v.map((i) => /* @__PURE__ */ o("option", { value: i, children: i }, i))
1302
+ value: n.locale ?? M[0],
1303
+ onChange: (d) => c({ locale: d.target.value }),
1304
+ children: M.map((d) => /* @__PURE__ */ t("option", { value: d, children: d }, d))
1358
1305
  }
1359
- )
1360
- ] }),
1361
- n && p.length > 0 && /* @__PURE__ */ u("div", { className: "ds-field", children: [
1362
- /* @__PURE__ */ o("label", { htmlFor: "ds-source", children: c.dataSource }),
1363
- /* @__PURE__ */ u(
1306
+ ) }),
1307
+ y.length > 0 && /* @__PURE__ */ t(ee, { label: l.dataSource, children: /* @__PURE__ */ g(
1364
1308
  "select",
1365
1309
  {
1366
- id: "ds-source",
1367
1310
  className: "ds-select",
1368
- value: t.dataSource ?? "fixtures",
1369
- onChange: (i) => a({ dataSource: i.target.value }),
1311
+ value: n.dataSource ?? "fixtures",
1312
+ onChange: (d) => c({ dataSource: d.target.value }),
1370
1313
  children: [
1371
- /* @__PURE__ */ o("option", { value: "fixtures", children: c.fixturesOption }),
1372
- p.filter((i) => i.id !== "fixtures").map((i) => /* @__PURE__ */ o("option", { value: i.id, children: i.label }, i.id))
1314
+ /* @__PURE__ */ t("option", { value: "fixtures", children: l.fixturesOption }),
1315
+ y.map((d) => /* @__PURE__ */ t("option", { value: d.id, children: d.label }, d.id))
1373
1316
  ]
1374
1317
  }
1375
- )
1318
+ ) })
1376
1319
  ] })
1377
1320
  ] });
1378
1321
  }
1379
- function ot({ id: e }) {
1380
- const t = {
1381
- width: 16,
1382
- height: 16,
1383
- viewBox: "0 0 24 24",
1384
- fill: "none",
1385
- stroke: "currentColor",
1386
- strokeWidth: 2,
1387
- strokeLinecap: "round",
1388
- strokeLinejoin: "round",
1389
- "aria-hidden": !0
1390
- };
1391
- return e === "fit" ? /* @__PURE__ */ o("svg", { ...t, children: /* @__PURE__ */ o("path", { d: "M8 3H5a2 2 0 0 0-2 2v3M16 3h3a2 2 0 0 1 2 2v3M8 21H5a2 2 0 0 1-2-2v-3M16 21h3a2 2 0 0 0 2-2v-3" }) }) : e === "mobile" ? /* @__PURE__ */ u("svg", { ...t, children: [
1392
- /* @__PURE__ */ o("rect", { width: "14", height: "20", x: "5", y: "2", rx: "2", ry: "2" }),
1393
- /* @__PURE__ */ o("path", { d: "M12 18h.01" })
1394
- ] }) : e === "tablet" ? /* @__PURE__ */ u("svg", { ...t, children: [
1395
- /* @__PURE__ */ o("rect", { width: "16", height: "20", x: "4", y: "2", rx: "2", ry: "2" }),
1396
- /* @__PURE__ */ o("path", { d: "M12 18h.01" })
1397
- ] }) : e === "desktop" ? /* @__PURE__ */ u("svg", { ...t, children: [
1398
- /* @__PURE__ */ o("rect", { width: "20", height: "14", x: "2", y: "3", rx: "2" }),
1399
- /* @__PURE__ */ o("path", { d: "M8 21h8M12 17v4" })
1400
- ] }) : /* @__PURE__ */ o("svg", { ...t, children: /* @__PURE__ */ o("path", { d: "M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7" }) });
1401
- }
1402
- function nt({
1403
- registry: e,
1404
- scenario: t,
1405
- component: n,
1406
- componentFixture: s,
1407
- controls: l,
1408
- focusedNode: a,
1409
- tabStopCount: r
1410
- }) {
1411
- const c = P().inspector, [h, p] = $("scenario"), m = e.issues.filter((v) => v.level === "error").length;
1412
- return /* @__PURE__ */ u("aside", { className: "ds-chrome ds-inspector", "aria-label": c.region, children: [
1413
- /* @__PURE__ */ u("div", { className: "ds-inspector__tabs", role: "tablist", children: [
1414
- /* @__PURE__ */ o(J, { id: "scenario", current: h, onSelect: p, children: n ? c.componentReference : c.tabScenario }),
1415
- /* @__PURE__ */ o(J, { id: "a11y", current: h, onSelect: p, children: c.tabA11y }),
1416
- /* @__PURE__ */ o(J, { id: "diagnostics", current: h, onSelect: p, children: m > 0 ? c.diagnosticsWithErrors(m) : c.tabDiagnostics })
1417
- ] }),
1418
- /* @__PURE__ */ u("div", { className: "ds-inspector__body", role: "tabpanel", children: [
1419
- h === "scenario" && /* @__PURE__ */ o(
1420
- at,
1421
- {
1422
- registry: e,
1423
- scenario: t,
1424
- component: n,
1425
- componentFixture: s,
1426
- controls: l
1427
- }
1428
- ),
1429
- h === "a11y" && /* @__PURE__ */ o(
1430
- rt,
1431
- {
1432
- registry: e,
1433
- scenario: t,
1434
- focusedNode: a,
1435
- keyboardMode: l.keyboardMode,
1436
- tabStopCount: r
1437
- }
1438
- ),
1439
- h === "diagnostics" && /* @__PURE__ */ o(st, { registry: e })
1440
- ] })
1322
+ function ee({ label: e, children: n }) {
1323
+ return /* @__PURE__ */ g("label", { className: "ds-field", "data-ds-filter": !0, children: [
1324
+ /* @__PURE__ */ t("span", { className: "ds-field__label", children: e }),
1325
+ n
1441
1326
  ] });
1442
1327
  }
1443
- function J({
1444
- id: e,
1445
- current: t,
1446
- onSelect: n,
1447
- children: s
1448
- }) {
1449
- return /* @__PURE__ */ o(
1450
- "button",
1451
- {
1452
- type: "button",
1453
- role: "tab",
1454
- "aria-selected": t === e,
1455
- onClick: () => n(e),
1456
- children: s
1457
- }
1458
- );
1459
- }
1460
- function at({
1328
+ function Et({
1461
1329
  registry: e,
1462
- scenario: t,
1463
- component: n,
1464
- componentFixture: s,
1465
- controls: l
1330
+ controls: n,
1331
+ deploy: o,
1332
+ screen: a,
1333
+ variation: r,
1334
+ component: s,
1335
+ onOpenScenario: u,
1336
+ onOpenComponent: c
1466
1337
  }) {
1467
- const a = P(), r = a.inspector;
1468
- if (!t)
1469
- return n ? /* @__PURE__ */ u("div", { className: "ds-block", children: [
1470
- /* @__PURE__ */ o("h2", { className: "ds-block__title", children: r.componentReference }),
1471
- /* @__PURE__ */ o("p", { style: { color: "var(--ds-fg)", fontSize: 15, fontWeight: 600 }, children: n.name }),
1472
- n.description && /* @__PURE__ */ o("p", { children: n.description }),
1473
- /* @__PURE__ */ u("dl", { className: "ds-kv", style: { marginTop: 14 }, children: [
1474
- /* @__PURE__ */ o("dt", { children: r.id }),
1475
- /* @__PURE__ */ o("dd", { style: { fontFamily: "var(--ds-mono)", fontSize: 11 }, children: n.id }),
1476
- n.group && /* @__PURE__ */ u(A, { children: [
1477
- /* @__PURE__ */ o("dt", { children: r.componentGroup }),
1478
- /* @__PURE__ */ o("dd", { children: n.group })
1479
- ] }),
1480
- s?.fixture && /* @__PURE__ */ u(A, { children: [
1481
- /* @__PURE__ */ o("dt", { children: r.componentFixture }),
1482
- /* @__PURE__ */ u("dd", { children: [
1483
- s.fixture.label,
1484
- " ",
1485
- /* @__PURE__ */ o("code", { children: s.fixture.id })
1486
- ] }),
1487
- s.fixture.description && /* @__PURE__ */ u(A, { children: [
1488
- /* @__PURE__ */ o("dt", { children: r.componentFixtureDescription }),
1489
- /* @__PURE__ */ o("dd", { children: s.fixture.description })
1490
- ] })
1491
- ] })
1492
- ] }),
1493
- s?.didFallback && s.fixture && /* @__PURE__ */ o("p", { className: "ds-note", "data-tone": "warn", children: r.componentFixtureFallback(
1494
- s.requestedId ?? "",
1495
- s.fixture.id
1496
- ) })
1497
- ] }) : /* @__PURE__ */ o("p", { className: "ds-block", children: r.noScenario });
1498
- const c = e.persona(l.persona ?? t.persona), h = l.persona ? e.persona(l.persona)?.permissions ?? [] : e.permissionsOf(t), p = e.rulesOf(t), m = e.fixture(l.fixture ?? t.fixture), v = !!(l.persona && l.persona !== t.persona);
1499
- return /* @__PURE__ */ u(A, { children: [
1500
- /* @__PURE__ */ u("div", { className: "ds-block", children: [
1501
- /* @__PURE__ */ o("h2", { className: "ds-block__title", children: r.situation }),
1502
- /* @__PURE__ */ o("p", { style: { color: "var(--ds-fg)", fontSize: 14, fontWeight: 600 }, children: t.title }),
1503
- t.intent && /* @__PURE__ */ o("p", { children: t.intent }),
1504
- /* @__PURE__ */ u("div", { className: "ds-chips", children: [
1505
- /* @__PURE__ */ o("span", { className: "ds-chip", "data-tone": ct(t.status), children: a.status[t.status] }),
1506
- (t.tags ?? []).map((i) => /* @__PURE__ */ o("span", { className: "ds-chip", children: i }, i))
1507
- ] }),
1508
- /* @__PURE__ */ o("p", { style: { marginTop: 6 }, children: a.statusMeaning[t.status] })
1509
- ] }),
1510
- /* @__PURE__ */ u("div", { className: "ds-block", children: [
1511
- /* @__PURE__ */ o("h2", { className: "ds-block__title", children: r.reproduction }),
1512
- /* @__PURE__ */ u("dl", { className: "ds-kv", children: [
1513
- /* @__PURE__ */ o("dt", { children: r.id }),
1514
- /* @__PURE__ */ o("dd", { style: { fontFamily: "var(--ds-mono)", fontSize: 11 }, children: t.id }),
1515
- /* @__PURE__ */ o("dt", { children: r.route }),
1516
- /* @__PURE__ */ o("dd", { style: { fontFamily: "var(--ds-mono)", fontSize: 11 }, children: t.route }),
1517
- /* @__PURE__ */ o("dt", { children: r.persona }),
1518
- /* @__PURE__ */ u("dd", { children: [
1519
- c?.name ?? "—",
1520
- v && /* @__PURE__ */ o("span", { className: "ds-chip", "data-tone": "warn", style: { marginLeft: 6 }, children: r.personaSwapped })
1521
- ] }),
1522
- /* @__PURE__ */ o("dt", { children: r.data }),
1523
- /* @__PURE__ */ o("dd", { children: m?.label ?? "—" }),
1524
- /* @__PURE__ */ o("dt", { children: r.network }),
1525
- /* @__PURE__ */ o("dd", { children: a.network[l.network] })
1338
+ const p = q(), l = p.info, [w, f] = z(!1);
1339
+ if (s) {
1340
+ const h = e.usagesOf(s.id, { handoff: n.handoff });
1341
+ return /* @__PURE__ */ g("div", { className: "ds-info", children: [
1342
+ /* @__PURE__ */ g(te, { title: l.component, children: [
1343
+ /* @__PURE__ */ t(V, { term: l.name, children: s.name }),
1344
+ /* @__PURE__ */ t(V, { term: l.id, children: /* @__PURE__ */ t("code", { children: s.id }) }),
1345
+ s.group && /* @__PURE__ */ t(V, { term: l.group, children: s.group }),
1346
+ s.description && /* @__PURE__ */ t(V, { term: l.description, children: s.description }),
1347
+ s.source && /* @__PURE__ */ t(V, { term: l.source, children: /* @__PURE__ */ t("code", { children: s.source }) })
1526
1348
  ] }),
1527
- c?.goal && /* @__PURE__ */ o("p", { style: { marginTop: 8 }, children: r.goal(c.goal) })
1528
- ] }),
1529
- h.length > 0 && /* @__PURE__ */ u("div", { className: "ds-block", children: [
1530
- /* @__PURE__ */ o("h2", { className: "ds-block__title", children: r.permissions }),
1531
- /* @__PURE__ */ o("div", { className: "ds-chips", children: h.map((i) => /* @__PURE__ */ o("span", { className: "ds-chip", children: i }, i)) })
1532
- ] }),
1533
- t.preconditions?.length ? /* @__PURE__ */ u("div", { className: "ds-block", children: [
1534
- /* @__PURE__ */ o("h2", { className: "ds-block__title", children: r.preconditions }),
1535
- /* @__PURE__ */ o("ul", { className: "ds-list", children: t.preconditions.map((i) => /* @__PURE__ */ o("li", { children: i }, i)) })
1536
- ] }) : null,
1537
- p.length > 0 && /* @__PURE__ */ u("div", { className: "ds-block", children: [
1538
- /* @__PURE__ */ o("h2", { className: "ds-block__title", children: r.rules }),
1539
- p.map((i) => /* @__PURE__ */ u("div", { className: "ds-rule", children: [
1540
- /* @__PURE__ */ o("span", { className: "ds-rule__id", children: i.id }),
1541
- /* @__PURE__ */ o("span", { className: "ds-rule__statement", children: i.statement }),
1542
- i.rationale && /* @__PURE__ */ o("p", { className: "ds-rule__rationale", children: i.rationale })
1543
- ] }, i.id))
1349
+ /* @__PURE__ */ t(te, { title: l.usedIn, children: h.length === 0 ? /* @__PURE__ */ t("p", { className: "ds-muted", children: l.notUsed }) : /* @__PURE__ */ t("ul", { className: "ds-links", children: h.map((S) => {
1350
+ const L = S.variations.find((T) => T.components?.includes(s.id)) ?? S.variations[0];
1351
+ return /* @__PURE__ */ g("li", { "data-ds-filter": !0, children: [
1352
+ /* @__PURE__ */ t(
1353
+ "button",
1354
+ {
1355
+ type: "button",
1356
+ className: "ds-link",
1357
+ onClick: () => L && u(L.id),
1358
+ children: S.name
1359
+ }
1360
+ ),
1361
+ /* @__PURE__ */ t("code", { className: "ds-muted", children: S.id })
1362
+ ] }, S.id);
1363
+ }) }) })
1364
+ ] });
1365
+ }
1366
+ if (!a) return /* @__PURE__ */ t("p", { className: "ds-empty", children: p.panel.nothingSelected });
1367
+ const b = e.componentsOfScreen(a), M = e.persona(n.persona ?? r?.persona), y = e.rulesOf(r), d = async () => {
1368
+ const h = xt({
1369
+ screen: a,
1370
+ variations: a.variations,
1371
+ components: b,
1372
+ deploy: o,
1373
+ labels: p,
1374
+ overrides: n.handoff ? { handoff: n.handoff } : void 0
1375
+ });
1376
+ try {
1377
+ await navigator.clipboard.writeText(h);
1378
+ } catch {
1379
+ window.prompt(l.copyPrompt, h);
1380
+ }
1381
+ f(!0), window.setTimeout(() => f(!1), 1600);
1382
+ };
1383
+ return /* @__PURE__ */ g("div", { className: "ds-info", children: [
1384
+ /* @__PURE__ */ g(te, { title: l.screen, children: [
1385
+ /* @__PURE__ */ t(V, { term: l.name, children: a.name }),
1386
+ /* @__PURE__ */ t(V, { term: l.route, children: /* @__PURE__ */ t("code", { children: a.route.path }) }),
1387
+ a.description && /* @__PURE__ */ t(V, { term: l.description, children: a.description })
1544
1388
  ] }),
1545
- t.actions?.length ? /* @__PURE__ */ u("div", { className: "ds-block", children: [
1546
- /* @__PURE__ */ o("h2", { className: "ds-block__title", children: r.actions }),
1547
- /* @__PURE__ */ o("ul", { className: "ds-list", children: t.actions.map((i) => /* @__PURE__ */ o("li", { children: i }, i)) })
1548
- ] }) : null,
1549
- t.expected?.length ? /* @__PURE__ */ u("div", { className: "ds-block", children: [
1550
- /* @__PURE__ */ o("h2", { className: "ds-block__title", children: r.expected }),
1551
- /* @__PURE__ */ o("ul", { className: "ds-list", children: t.expected.map((i) => /* @__PURE__ */ o("li", { children: i }, i)) })
1552
- ] }) : null,
1553
- t.approvedAt && /* @__PURE__ */ u("div", { className: "ds-block", children: [
1554
- /* @__PURE__ */ o("h2", { className: "ds-block__title", children: r.approval }),
1555
- /* @__PURE__ */ u("p", { children: [
1556
- t.approvedAt.date,
1557
- " · ",
1558
- /* @__PURE__ */ o("code", { children: t.approvedAt.commit.slice(0, 7) })
1559
- ] }),
1560
- /* @__PURE__ */ o("a", { href: t.approvedAt.url, target: "_blank", rel: "noreferrer", children: r.openApproved })
1389
+ r && /* @__PURE__ */ g(te, { title: l.variation, children: [
1390
+ /* @__PURE__ */ t(V, { term: l.name, children: r.title }),
1391
+ /* @__PURE__ */ t(V, { term: l.id, children: /* @__PURE__ */ t("code", { children: r.id }) }),
1392
+ M && /* @__PURE__ */ t(V, { term: l.persona, children: M.name }),
1393
+ r.intent && /* @__PURE__ */ t(V, { term: l.intent, children: r.intent }),
1394
+ /* @__PURE__ */ t(oe, { term: l.preconditions, items: r.preconditions }),
1395
+ /* @__PURE__ */ t(oe, { term: l.actions, items: r.actions }),
1396
+ /* @__PURE__ */ t(oe, { term: l.expected, items: r.expected }),
1397
+ /* @__PURE__ */ t(oe, { term: l.rules, items: y.map((h) => h.statement) }),
1398
+ r.ticket && /* @__PURE__ */ t(V, { term: l.ticket, children: /* @__PURE__ */ t("code", { children: r.ticket }) })
1561
1399
  ] }),
1562
- t.ticket && /* @__PURE__ */ u("div", { className: "ds-block", children: [
1563
- /* @__PURE__ */ o("h2", { className: "ds-block__title", children: r.engineering }),
1564
- /* @__PURE__ */ o("p", { children: t.ticket })
1400
+ b.length > 0 && /* @__PURE__ */ t(te, { title: l.components, children: /* @__PURE__ */ t("ul", { className: "ds-links", children: b.map((h) => /* @__PURE__ */ g("li", { "data-ds-filter": !0, children: [
1401
+ /* @__PURE__ */ t("button", { type: "button", className: "ds-link", onClick: () => c(h.id), children: h.name }),
1402
+ h.source && /* @__PURE__ */ t("code", { className: "ds-muted", children: h.source })
1403
+ ] }, h.id)) }) }),
1404
+ /* @__PURE__ */ g("button", { type: "button", className: "ds-btn ds-btn--block", onClick: d, children: [
1405
+ /* @__PURE__ */ t(H, { name: w ? "check" : "copy", size: 14 }),
1406
+ /* @__PURE__ */ t("span", { children: w ? l.copiedForPr : l.copyForPr })
1565
1407
  ] })
1566
1408
  ] });
1567
1409
  }
1568
- function rt({
1569
- registry: e,
1570
- scenario: t,
1571
- focusedNode: n,
1572
- keyboardMode: s,
1573
- tabStopCount: l
1574
- }) {
1575
- const a = P(), r = a.inspector, c = be(e.product.theme?.contrastPairs), h = c.filter((p) => p.passes !== !0);
1576
- return /* @__PURE__ */ u(A, { children: [
1577
- t && /* @__PURE__ */ u("div", { className: "ds-block", children: [
1578
- /* @__PURE__ */ o("h2", { className: "ds-block__title", children: r.a11yContract }),
1579
- /* @__PURE__ */ u("dl", { className: "ds-kv", children: [
1580
- /* @__PURE__ */ o("dt", { children: r.keyboard }),
1581
- /* @__PURE__ */ o("dd", { children: a.keyboard[t.a11y.keyboard] }),
1582
- /* @__PURE__ */ o("dt", { children: r.contrast }),
1583
- /* @__PURE__ */ o("dd", { children: r.contrastTarget(t.a11y.contrast) })
1584
- ] }),
1585
- t.a11y.announces?.length ? /* @__PURE__ */ u(A, { children: [
1586
- /* @__PURE__ */ o("p", { style: { marginTop: 8 }, children: r.announces }),
1587
- /* @__PURE__ */ o("div", { className: "ds-chips", children: t.a11y.announces.map((p) => /* @__PURE__ */ o("span", { className: "ds-chip", children: p }, p)) })
1588
- ] }) : null,
1589
- t.a11y.notes && /* @__PURE__ */ o("p", { style: { marginTop: 8 }, children: t.a11y.notes })
1590
- ] }),
1591
- /* @__PURE__ */ u("div", { className: "ds-block", children: [
1592
- /* @__PURE__ */ o("h2", { className: "ds-block__title", children: r.focusedElement }),
1593
- s ? n ? /* @__PURE__ */ u(A, { children: [
1594
- /* @__PURE__ */ u("dl", { className: "ds-kv", children: [
1595
- /* @__PURE__ */ o("dt", { children: r.role }),
1596
- /* @__PURE__ */ o("dd", { children: n.role }),
1597
- /* @__PURE__ */ o("dt", { children: r.name }),
1598
- /* @__PURE__ */ o("dd", { children: n.name ? n.name : /* @__PURE__ */ o("span", { style: { color: "var(--ds-err)" }, children: r.noAccessibleName }) }),
1599
- /* @__PURE__ */ o("dt", { children: r.nameFrom }),
1600
- /* @__PURE__ */ o("dd", { children: n.nameFrom }),
1601
- n.description ? /* @__PURE__ */ u(A, { children: [
1602
- /* @__PURE__ */ o("dt", { children: r.description }),
1603
- /* @__PURE__ */ o("dd", { children: n.description })
1604
- ] }) : null,
1605
- /* @__PURE__ */ o("dt", { children: r.selector }),
1606
- /* @__PURE__ */ o("dd", { style: { fontFamily: "var(--ds-mono)", fontSize: 11 }, children: n.selector })
1607
- ] }),
1608
- n.states.length > 0 && /* @__PURE__ */ o("div", { className: "ds-chips", style: { marginTop: 8 }, children: n.states.map((p) => /* @__PURE__ */ o("span", { className: "ds-chip", children: p }, p)) }),
1609
- n.hiddenFromAssistiveTech && /* @__PURE__ */ o("p", { className: "ds-note", style: { marginTop: 8 }, children: r.focusableButHidden }),
1610
- /* @__PURE__ */ o("p", { style: { marginTop: 8 }, children: r.tabStopsInStage(l) })
1611
- ] }) : /* @__PURE__ */ o("p", { children: r.pressTab(l) }) : /* @__PURE__ */ o("p", { children: r.keyboardModeOff })
1612
- ] }),
1613
- /* @__PURE__ */ u("div", { className: "ds-block", children: [
1614
- /* @__PURE__ */ o("h2", { className: "ds-block__title", children: r.tokenContrast }),
1615
- c.length === 0 ? /* @__PURE__ */ o("p", { children: r.noContrastPairs }) : /* @__PURE__ */ u("table", { className: "ds-contrast", children: [
1616
- /* @__PURE__ */ o("thead", { children: /* @__PURE__ */ u("tr", { children: [
1617
- /* @__PURE__ */ o("th", { scope: "col", children: r.pair }),
1618
- /* @__PURE__ */ o("th", { scope: "col", children: r.ratio })
1619
- ] }) }),
1620
- /* @__PURE__ */ o("tbody", { children: c.map((p) => /* @__PURE__ */ u("tr", { children: [
1621
- /* @__PURE__ */ u("td", { children: [
1622
- /* @__PURE__ */ o(
1623
- "span",
1624
- {
1625
- className: "ds-swatch",
1626
- style: { background: p.pair.background },
1627
- "aria-hidden": "true"
1628
- }
1629
- ),
1630
- /* @__PURE__ */ o(
1631
- "span",
1632
- {
1633
- className: "ds-swatch",
1634
- style: { background: p.pair.foreground },
1635
- "aria-hidden": "true"
1636
- }
1637
- ),
1638
- p.pair.name
1639
- ] }),
1640
- /* @__PURE__ */ o(
1641
- "td",
1642
- {
1643
- style: {
1644
- color: p.passes === !0 ? "var(--ds-ok)" : p.passes === !1 ? "var(--ds-err)" : "var(--ds-warn)"
1645
- },
1646
- children: p.label
1647
- }
1648
- )
1649
- ] }, p.pair.name)) })
1650
- ] }),
1651
- h.length > 0 && /* @__PURE__ */ o("p", { className: "ds-note", style: { marginTop: 8 }, children: r.pairsFailing(h.length) })
1652
- ] }),
1653
- /* @__PURE__ */ o("p", { className: "ds-note", children: r.automatedIsFloor })
1410
+ function te({ title: e, children: n }) {
1411
+ return /* @__PURE__ */ g("section", { className: "ds-section", "data-ds-filter-group": !0, children: [
1412
+ /* @__PURE__ */ t("h2", { className: "ds-section__title", children: e }),
1413
+ /* @__PURE__ */ t("div", { className: "ds-defs", children: n })
1654
1414
  ] });
1655
1415
  }
1656
- function st({ registry: e }) {
1657
- const t = P(), n = t.inspector, s = e.coverage({ includePorted: !0 }), { issues: l } = e;
1658
- return /* @__PURE__ */ u(A, { children: [
1659
- /* @__PURE__ */ u("div", { className: "ds-block", children: [
1660
- /* @__PURE__ */ o("h2", { className: "ds-block__title", children: n.coverage }),
1661
- /* @__PURE__ */ o("dl", { className: "ds-kv", children: Object.entries(s).filter(([, a]) => a > 0).map(([a, r]) => /* @__PURE__ */ u("div", { style: { display: "contents" }, children: [
1662
- /* @__PURE__ */ o("dt", { children: t.status[a] }),
1663
- /* @__PURE__ */ o("dd", { style: { fontVariantNumeric: "tabular-nums" }, children: r })
1664
- ] }, a)) }),
1665
- /* @__PURE__ */ o("p", { style: { marginTop: 8 }, children: n.scenariosRegistered(e.product.scenarios.length) })
1666
- ] }),
1667
- /* @__PURE__ */ u("div", { className: "ds-block", children: [
1668
- /* @__PURE__ */ o("h2", { className: "ds-block__title", children: n.scenarioContract }),
1669
- l.length === 0 ? /* @__PURE__ */ o("p", { children: n.noIssues }) : l.map((a, r) => /* @__PURE__ */ u("div", { className: "ds-issue", "data-level": a.level, children: [
1670
- /* @__PURE__ */ o("span", { className: "ds-issue__where", children: a.where }),
1671
- a.message
1672
- ] }, `${a.where}-${r}`))
1673
- ] })
1416
+ function V({ term: e, children: n }) {
1417
+ return /* @__PURE__ */ g("dl", { className: "ds-def", "data-ds-filter": !0, children: [
1418
+ /* @__PURE__ */ t("dt", { children: e }),
1419
+ /* @__PURE__ */ t("dd", { children: n })
1674
1420
  ] });
1675
1421
  }
1676
- const it = {
1677
- ported: void 0,
1678
- proposed: "warn",
1679
- "in-review": "warn",
1680
- approved: "ok",
1681
- "in-implementation": void 0,
1682
- implemented: "ok",
1683
- superseded: void 0
1684
- };
1685
- function ct(e) {
1686
- return it[e];
1422
+ function oe({ term: e, items: n }) {
1423
+ return n?.length ? /* @__PURE__ */ g("dl", { className: "ds-def", "data-ds-filter": !0, children: [
1424
+ /* @__PURE__ */ t("dt", { children: e }),
1425
+ /* @__PURE__ */ t("dd", { children: /* @__PURE__ */ t("ul", { className: "ds-list", children: n.map((o) => /* @__PURE__ */ t("li", { children: o }, o)) }) })
1426
+ ] }) : null;
1687
1427
  }
1688
- const dt = pe(function({ viewport: t, textScale: n, reducedMotion: s, keyboardMode: l, children: a }, r) {
1689
- return /* @__PURE__ */ o("div", { className: "ds-stage-scroll", children: /* @__PURE__ */ o(
1690
- "div",
1691
- {
1692
- ref: r,
1693
- className: "ds-stage",
1694
- "data-viewport": t.id,
1695
- "data-keyboard-mode": l,
1696
- "data-reduced-motion": s,
1697
- style: {
1698
- width: t.width ? `${t.width}px` : "100%",
1699
- minHeight: t.height ? `${t.height}px` : void 0,
1700
- // A ampliação é aplicada no `font-size` do contêiner, não com
1701
- // `transform: scale`. É a diferença entre testar se o layout aguenta
1702
- // texto grande e só dar zoom na captura de tela.
1703
- fontSize: n === 1 ? void 0 : `${n * 100}%`
1704
- },
1705
- children: a
1706
- }
1707
- ) });
1708
- });
1709
- function lt({ stops: e }) {
1710
- return e.length === 0 ? null : /* @__PURE__ */ o("div", { className: "ds-chrome ds-taborder", "aria-hidden": "true", children: e.map((t) => /* @__PURE__ */ o(
1711
- "span",
1712
- {
1713
- className: "ds-taborder__badge",
1714
- "data-forced": t.forcedOrder,
1715
- style: { top: t.rect.top, left: t.rect.left },
1716
- children: t.index
1717
- },
1718
- `${t.index}-${t.rect.top}-${t.rect.left}`
1719
- )) });
1428
+ function Lt(e) {
1429
+ return (e.metaKey || e.ctrlKey) && !e.altKey && !e.shiftKey && e.key.toLowerCase() === "f";
1720
1430
  }
1721
- function ut({ title: e, children: t }) {
1722
- return /* @__PURE__ */ u("div", { className: "ds-chrome ds-stage-empty", children: [
1723
- /* @__PURE__ */ o("h2", { children: e }),
1724
- t
1725
- ] });
1431
+ function Rt(e, n) {
1432
+ if (!e) return !1;
1433
+ const o = G(n), a = [...e.querySelectorAll("[data-ds-filter]")];
1434
+ for (const r of a)
1435
+ r.hidden = o.length > 0 && !G(r.textContent ?? "").includes(o);
1436
+ for (const r of e.querySelectorAll("[data-ds-filter-group]")) {
1437
+ const s = [...r.querySelectorAll("[data-ds-filter]")], u = G(r.querySelector(".ds-section__title")?.textContent ?? "");
1438
+ if (o.length > 0 && u.includes(o)) {
1439
+ r.hidden = !1;
1440
+ for (const c of s) c.hidden = !1;
1441
+ continue;
1442
+ }
1443
+ r.hidden = o.length > 0 && s.every((c) => c.hidden);
1444
+ }
1445
+ return o.length > 0 && a.length > 0 && a.every((r) => r.hidden);
1726
1446
  }
1727
- function ht({
1728
- registry: e,
1729
- onOpenScenario: t,
1730
- view: n,
1731
- onViewChange: s,
1732
- showPorted: l = !1
1447
+ const _t = 24;
1448
+ function Pt({
1449
+ location: e,
1450
+ viewport: n,
1451
+ zoom: o,
1452
+ title: a,
1453
+ resizing: r,
1454
+ onFrameNavigate: s,
1455
+ onShortcut: u,
1456
+ onEffectiveZoom: c
1733
1457
  }) {
1734
- const a = P(), { product: r } = e, c = n ?? (l ? "ported" : "active"), h = { view: c }, p = e.coverage(h), m = e.activeScenarios(h).length, v = e.treeFor(h).filter((S) => S.scenarios.length > 0), i = e.orphansFor(h), N = e.byStatus("ported").length, x = c === "ported" ? a.sidebar.portedReferences(N) : a.sidebar.activeWork;
1735
- return /* @__PURE__ */ u("div", { className: "ds-chrome ds-home", children: [
1736
- /* @__PURE__ */ u("header", { className: "ds-home__header", children: [
1737
- /* @__PURE__ */ o("p", { className: "ds-home__view", "aria-live": "polite", children: x }),
1738
- /* @__PURE__ */ o("h1", { children: r.name }),
1739
- r.tagline && /* @__PURE__ */ o("p", { className: "ds-home__tagline", children: r.tagline }),
1740
- /* @__PURE__ */ o("p", { className: "ds-home__lead", children: a.home.lead(m) }),
1741
- /* @__PURE__ */ o("div", { className: "ds-chips", children: Object.entries(p).filter(([, S]) => S > 0).map(([S, d]) => /* @__PURE__ */ u("span", { className: "ds-chip", children: [
1742
- a.status[S],
1743
- ": ",
1744
- d
1745
- ] }, S)) }),
1746
- m > 0 && c === "active" && N > 0 && /* @__PURE__ */ o(
1747
- "button",
1748
- {
1749
- type: "button",
1750
- className: "ds-text-action ds-home__view-action",
1751
- onClick: () => s?.("ported"),
1752
- children: a.sidebar.viewPorted(N)
1753
- }
1754
- ),
1755
- c === "ported" && /* @__PURE__ */ o(
1756
- "button",
1757
- {
1758
- type: "button",
1759
- className: "ds-text-action ds-home__view-action",
1760
- onClick: () => s?.("active"),
1761
- children: a.sidebar.backToActive
1762
- }
1763
- )
1764
- ] }),
1765
- /* @__PURE__ */ u("section", { className: "ds-home__legend", "aria-labelledby": "ds-status-legend-title", children: [
1766
- /* @__PURE__ */ o("h2", { id: "ds-status-legend-title", children: a.home.statusLegend }),
1767
- /* @__PURE__ */ o("ul", { children: se.map((S) => /* @__PURE__ */ u("li", { children: [
1768
- /* @__PURE__ */ o("span", { className: "ds-status-dot", "data-status": S, "aria-hidden": "true" }),
1769
- /* @__PURE__ */ u("span", { children: [
1770
- /* @__PURE__ */ o("strong", { children: a.status[S] }),
1771
- /* @__PURE__ */ o("small", { children: a.statusMeaning[S] })
1772
- ] })
1773
- ] }, S)) })
1774
- ] }),
1775
- m === 0 && /* @__PURE__ */ u("section", { className: "ds-home__empty", "aria-label": a.sidebar.currentView(x), children: [
1776
- /* @__PURE__ */ o("p", { children: c === "ported" ? a.home.noPortedReferences : a.home.noActiveWork }),
1777
- c === "active" && N > 0 && /* @__PURE__ */ o(
1778
- "button",
1779
- {
1780
- type: "button",
1781
- className: "ds-text-action",
1782
- onClick: () => s?.("ported"),
1783
- children: a.sidebar.viewPorted(N)
1458
+ const p = U(null), l = U(null), w = $t(p), f = re(e.path, e.search), [b] = z(f), M = U(f), y = U(f), d = typeof window > "u" ? "" : window.location.origin, h = W(
1459
+ (N) => {
1460
+ y.current = N;
1461
+ const O = l.current?.contentWindow;
1462
+ try {
1463
+ O?.location.replace(new URL(N, d).toString());
1464
+ } catch {
1465
+ l.current && (l.current.src = N);
1466
+ }
1467
+ },
1468
+ [d]
1469
+ );
1470
+ K(() => {
1471
+ if (f === M.current) return;
1472
+ const N = M.current;
1473
+ M.current = f, Ne(N) !== Ne(f) ? h(f) : ne(l.current?.contentWindow, { ds: 1, type: "location", url: f }, d);
1474
+ }, [f, h, d]), K(() => {
1475
+ const N = (O) => {
1476
+ const x = ze(O, {
1477
+ origin: d,
1478
+ source: l.current?.contentWindow
1479
+ });
1480
+ if (x)
1481
+ switch (x.type) {
1482
+ case "ready": {
1483
+ if (x.url === M.current) return;
1484
+ if (x.url === y.current) {
1485
+ ne(
1486
+ l.current?.contentWindow,
1487
+ { ds: 1, type: "location", url: M.current },
1488
+ d
1489
+ );
1490
+ return;
1491
+ }
1492
+ M.current = x.url, y.current = x.url, s(x.url, !0);
1493
+ return;
1494
+ }
1495
+ case "navigate":
1496
+ M.current = x.url, s(x.url, x.replace);
1497
+ return;
1498
+ case "shortcut":
1499
+ u(x.key);
1500
+ return;
1501
+ default:
1502
+ return;
1784
1503
  }
1785
- )
1786
- ] }),
1787
- v.map(({ module: S, scenarios: d }) => /* @__PURE__ */ o(
1788
- pt,
1789
- {
1790
- module: S,
1791
- scenarios: d,
1792
- registry: e,
1793
- view: c,
1794
- onOpenScenario: t
1795
- },
1796
- S.id
1797
- )),
1798
- i.length > 0 && /* @__PURE__ */ u("section", { className: "ds-home__module", children: [
1799
- /* @__PURE__ */ o("h2", { children: a.home.withoutModule }),
1800
- /* @__PURE__ */ o("p", { className: "ds-home__hint", children: a.home.withoutModuleHint }),
1801
- /* @__PURE__ */ o(
1802
- le,
1504
+ };
1505
+ return window.addEventListener("message", N), () => window.removeEventListener("message", N);
1506
+ }, [s, u, d]);
1507
+ const S = !!n.width, L = S ? _t : 0, T = Math.max(0, w.width - L * 2), _ = Math.max(0, w.height - L * 2), $ = !n.width || T === 0 || n.width <= T, i = o === 100 && !$ ? Math.max(10, Math.floor(T / n.width * 100)) : o, m = i / 100;
1508
+ K(() => {
1509
+ c?.(i);
1510
+ }, [i, c]);
1511
+ const v = n.width ?? T / m, E = n.height ?? _ / m;
1512
+ return /* @__PURE__ */ t("div", { className: "ds-canvas", ref: p, "data-fit": S ? void 0 : "true", children: /* @__PURE__ */ t(
1513
+ "div",
1514
+ {
1515
+ className: "ds-canvas__box",
1516
+ style: { width: Math.floor(v * m), height: Math.floor(E * m) },
1517
+ children: /* @__PURE__ */ t(
1518
+ "iframe",
1803
1519
  {
1804
- scenarios: i,
1805
- registry: e,
1806
- onOpenScenario: t
1520
+ ref: l,
1521
+ [et]: "",
1522
+ className: "ds-frame",
1523
+ src: b,
1524
+ title: a,
1525
+ style: {
1526
+ width: Math.floor(v),
1527
+ height: Math.floor(E),
1528
+ transform: m === 1 ? void 0 : `scale(${m})`,
1529
+ pointerEvents: r ? "none" : void 0
1530
+ }
1807
1531
  }
1808
1532
  )
1809
- ] })
1810
- ] });
1533
+ }
1534
+ ) });
1811
1535
  }
1812
- function pt({
1813
- module: e,
1814
- scenarios: t,
1815
- registry: n,
1816
- view: s,
1817
- onOpenScenario: l
1818
- }) {
1819
- return /* @__PURE__ */ u("section", { className: "ds-home__module", children: [
1820
- /* @__PURE__ */ o("h2", { children: e.name }),
1821
- e.description && /* @__PURE__ */ o("p", { className: "ds-home__hint", children: e.description }),
1822
- (e.flows ?? []).map((a) => /* @__PURE__ */ o(
1823
- mt,
1824
- {
1825
- flow: a,
1826
- registry: n,
1827
- view: s,
1828
- onOpenScenario: l
1829
- },
1830
- a.id
1831
- )),
1832
- /* @__PURE__ */ o(le, { scenarios: t, registry: n, onOpenScenario: l })
1833
- ] });
1536
+ function $t(e) {
1537
+ const [n, o] = z({ width: 0, height: 0 });
1538
+ return Pe(() => {
1539
+ const a = e.current;
1540
+ if (!a) return;
1541
+ const r = () => {
1542
+ const u = a.clientWidth, c = a.clientHeight;
1543
+ o(
1544
+ (p) => p.width === u && p.height === c ? p : { width: u, height: c }
1545
+ );
1546
+ };
1547
+ if (r(), typeof ResizeObserver > "u")
1548
+ return window.addEventListener("resize", r), () => window.removeEventListener("resize", r);
1549
+ const s = new ResizeObserver(r);
1550
+ return s.observe(a), () => s.disconnect();
1551
+ }, [e]), n;
1834
1552
  }
1835
- function mt({
1836
- flow: e,
1837
- registry: t,
1838
- view: n,
1839
- onOpenScenario: s
1840
- }) {
1841
- const l = e.steps.filter((a) => {
1842
- const r = t.scenario(a.scenario);
1843
- return r && (n === "ported" ? r.status === "ported" : r.status !== "ported");
1553
+ const Ft = 2500;
1554
+ class zt extends Error {
1555
+ constructor(n) {
1556
+ super(`Falha de rede simulada no cenário "${n}".`), this.name = "SimulatedNetworkError";
1557
+ }
1558
+ }
1559
+ function fe(e) {
1560
+ if (e)
1561
+ return typeof e.data == "function" ? e.data() : e.data;
1562
+ }
1563
+ const we = {
1564
+ id: "fixtures",
1565
+ label: "Fixtures",
1566
+ load: async ({ scenario: e, fixture: n, network: o }) => {
1567
+ switch (o) {
1568
+ case "empty":
1569
+ return null;
1570
+ case "error":
1571
+ throw new zt(e.id);
1572
+ case "loading":
1573
+ return new Promise(() => {
1574
+ });
1575
+ case "slow":
1576
+ return await Ot(Ft), fe(n);
1577
+ default:
1578
+ return fe(n);
1579
+ }
1580
+ }
1581
+ };
1582
+ function qt(e) {
1583
+ const { id: n, label: o, baseUrl: a, path: r, init: s, fallbackToFixture: u = !0 } = e;
1584
+ return {
1585
+ id: n,
1586
+ label: o,
1587
+ load: async (c) => {
1588
+ const p = new URL(r ? r(c) : c.scenario.route, a);
1589
+ try {
1590
+ const l = await fetch(p, s);
1591
+ if (!l.ok) throw new Error(`${l.status} ${l.statusText}`);
1592
+ return await l.json();
1593
+ } catch (l) {
1594
+ if (u) return fe(c.fixture);
1595
+ throw new Error(`Adapter "${n}" falhou em ${p.toString()}`, { cause: l });
1596
+ }
1597
+ }
1598
+ };
1599
+ }
1600
+ function Ot(e) {
1601
+ return new Promise((n) => setTimeout(n, e));
1602
+ }
1603
+ function At(e) {
1604
+ const { scenario: n, fixture: o, network: a, adapter: r } = e, [s, u] = z({
1605
+ data: void 0,
1606
+ isLoading: !!n,
1607
+ error: void 0
1844
1608
  });
1845
- return l.length === 0 ? null : /* @__PURE__ */ u("div", { className: "ds-flow", children: [
1846
- /* @__PURE__ */ o("h3", { children: e.title }),
1847
- e.description && /* @__PURE__ */ o("p", { className: "ds-home__hint", children: e.description }),
1848
- /* @__PURE__ */ o("ol", { className: "ds-flow__steps", children: l.map((a, r) => {
1849
- const c = t.scenario(a.scenario), h = Object.entries(a.branches ?? {}).filter(([, p]) => {
1850
- const m = t.scenario(p);
1851
- return m && (n === "ported" ? m.status === "ported" : m.status !== "ported");
1609
+ return K(() => {
1610
+ if (!n) {
1611
+ u({ data: void 0, isLoading: !1, error: void 0 });
1612
+ return;
1613
+ }
1614
+ let c = !0;
1615
+ u({ data: void 0, isLoading: !0, error: void 0 });
1616
+ const p = r ?? we;
1617
+ return Promise.resolve(p.load({ scenario: n, fixture: o, network: a })).then((l) => {
1618
+ c && u({ data: l, isLoading: !1, error: void 0 });
1619
+ }).catch((l) => {
1620
+ c && u({
1621
+ data: void 0,
1622
+ isLoading: !1,
1623
+ error: l instanceof Error ? l : new Error(String(l))
1852
1624
  });
1853
- return /* @__PURE__ */ u("li", { children: [
1854
- /* @__PURE__ */ o("button", { type: "button", className: "ds-flow__step", onClick: () => s(a.scenario), children: a.label ?? c?.title ?? a.scenario }),
1855
- a.decision && /* @__PURE__ */ o("p", { className: "ds-flow__decision", children: a.decision }),
1856
- h.length > 0 && /* @__PURE__ */ o("ul", { className: "ds-flow__branches", children: h.map(([p, m]) => /* @__PURE__ */ u("li", { children: [
1857
- /* @__PURE__ */ o("span", { className: "ds-flow__branch-label", children: p }),
1858
- /* @__PURE__ */ o(
1859
- "button",
1860
- {
1861
- type: "button",
1862
- className: "ds-flow__step",
1863
- onClick: () => s(m),
1864
- children: t.scenario(m)?.title ?? m
1865
- }
1866
- )
1867
- ] }, p)) })
1868
- ] }, `${a.scenario}-${r}`);
1869
- }) })
1870
- ] });
1625
+ }), () => {
1626
+ c = !1;
1627
+ };
1628
+ }, [n, o, a, r]), s;
1871
1629
  }
1872
- function le({
1873
- scenarios: e,
1874
- registry: t,
1875
- onOpenScenario: n
1876
- }) {
1877
- const s = P();
1878
- return /* @__PURE__ */ o("ul", { className: "ds-home__grid", children: e.map((l) => /* @__PURE__ */ o("li", { children: /* @__PURE__ */ u("button", { type: "button", className: "ds-home__card", onClick: () => n(l.id), children: [
1879
- /* @__PURE__ */ u("span", { className: "ds-home__card-head", children: [
1880
- /* @__PURE__ */ o("span", { className: "ds-status-dot", "data-status": l.status }),
1881
- /* @__PURE__ */ o("span", { className: "ds-home__card-title", children: l.title })
1882
- ] }),
1883
- l.intent && /* @__PURE__ */ o("span", { className: "ds-home__card-intent", children: l.intent }),
1884
- /* @__PURE__ */ u("span", { className: "ds-home__card-meta", children: [
1885
- t.persona(l.persona)?.name ?? l.persona,
1886
- " · ",
1887
- s.status[l.status],
1888
- l.a11y.keyboard === "full" ? ` · ${s.home.keyboardBadge}` : ""
1889
- ] })
1890
- ] }) }, l.id)) });
1630
+ function Le({ title: e, children: n }) {
1631
+ return /* @__PURE__ */ g("div", { className: "ds-stage-empty", children: [
1632
+ /* @__PURE__ */ t("h2", { className: "ds-stage-empty__title", children: e }),
1633
+ n
1634
+ ] });
1891
1635
  }
1892
- function St({ product: e }) {
1893
- const t = C(() => ge(e), [e]), n = C(() => Ue(e.theme?.labels), [e.theme?.labels]), s = C(() => ve(e.deploy), [e.deploy]), {
1894
- location: l,
1895
- controls: a,
1896
- viewport: r,
1897
- setControls: c,
1898
- setScenarioView: h,
1899
- navigate: p,
1900
- openScenario: m,
1901
- openComponent: v
1902
- } = Ne(t), i = ee(a), N = Q(null), { focused: x, tabStops: S } = ze(a.keyboardMode, N), d = t.scenario(a.scenario), f = t.component(a.component), k = C(
1903
- () => t.resolveComponentFixture(f?.id, f ? a.fixture : void 0),
1904
- [f, a.fixture, t]
1905
- ), M = C(() => {
1906
- const w = k.fixture?.data;
1907
- return typeof w == "function" ? w() : w;
1908
- }, [k.fixture]), _ = t.persona(a.persona ?? d?.persona), T = t.fixture(a.fixture ?? d?.fixture), B = C(() => {
1909
- const w = a.dataSource ?? "fixtures";
1910
- return w === "fixtures" ? Z : e.dataSources?.adapters?.find((y) => y.id === w) ?? Z;
1911
- }, [a.dataSource, e.dataSources?.adapters]), { data: W, isLoading: F, error: R } = $e({ scenario: d, fixture: T, network: a.network, adapter: B });
1912
- I(() => {
1913
- const w = (y) => {
1914
- if (!(!y.shiftKey || y.metaKey || y.ctrlKey || y.altKey || y.target?.matches("input, textarea, select, [contenteditable='true']"))) {
1915
- switch (y.key) {
1916
- case "K":
1917
- c({ keyboardMode: !a.keyboardMode });
1918
- break;
1919
- case "P":
1920
- c({ inspector: !a.inspector });
1921
- break;
1922
- default:
1923
- return;
1636
+ function Dt({ product: e, registry: n }) {
1637
+ const o = q(), { location: a, controls: r, viewport: s, navigate: u, openScenario: c } = Oe(n, {
1638
+ frame: !0
1639
+ }), p = U(null);
1640
+ K(() => {
1641
+ const x = (k) => {
1642
+ if (k.defaultPrevented || k.button !== 0 || k.metaKey || k.ctrlKey || k.shiftKey || k.altKey) return;
1643
+ const P = k.target?.closest?.("a[href]");
1644
+ if (!(P instanceof HTMLAnchorElement) || P.target && P.target !== "_self" || P.hasAttribute("download")) return;
1645
+ const F = P.getAttribute("href") ?? "";
1646
+ if (F.startsWith("#")) return;
1647
+ let A;
1648
+ try {
1649
+ A = new URL(F, window.location.href);
1650
+ } catch {
1651
+ return;
1652
+ }
1653
+ A.origin === window.location.origin && (k.preventDefault(), u(`${A.pathname}${A.search}`));
1654
+ };
1655
+ return document.addEventListener("click", x), () => document.removeEventListener("click", x);
1656
+ }, [u]), K(() => {
1657
+ const x = (k) => {
1658
+ if (window.parent === window) return;
1659
+ const P = Kt(k);
1660
+ if (!P) return;
1661
+ const F = k.target;
1662
+ P === "C" && F?.closest?.("input, textarea, select, [contenteditable='true'], [contenteditable='']") || (k.preventDefault(), ne(window.parent, { ds: 1, type: "shortcut", key: P }, window.location.origin));
1663
+ };
1664
+ return window.addEventListener("keydown", x), () => window.removeEventListener("keydown", x);
1665
+ }, []), K(() => {
1666
+ const x = p.current;
1667
+ if (!x || !r.handoff) return;
1668
+ const k = () => {
1669
+ for (const F of x.querySelectorAll("a[href]")) {
1670
+ const A = F.getAttribute("href");
1671
+ if (!A || A.startsWith("#")) continue;
1672
+ let B;
1673
+ try {
1674
+ B = new URL(A, window.location.href);
1675
+ } catch {
1676
+ continue;
1924
1677
  }
1925
- y.preventDefault();
1678
+ if (B.origin !== window.location.origin) continue;
1679
+ ge(B.searchParams, r.handoff);
1680
+ const Z = `${B.pathname}${B.search}${B.hash}`;
1681
+ A !== Z && F.setAttribute("href", Z);
1926
1682
  }
1927
1683
  };
1928
- return window.addEventListener("keydown", w), () => window.removeEventListener("keydown", w);
1929
- }, [a.keyboardMode, a.inspector, c]);
1930
- const D = C(() => a.persona && a.persona !== d?.persona ? t.persona(a.persona)?.permissions ?? [] : t.permissionsOf(d), [a.persona, t, d]), j = C(
1684
+ k();
1685
+ const P = new MutationObserver(k);
1686
+ return P.observe(x, { subtree: !0, childList: !0, attributes: !0, attributeFilter: ["href"] }), () => P.disconnect();
1687
+ }, [r.handoff]);
1688
+ const l = n.scenario(r.scenario), w = n.component(r.component), f = D(() => {
1689
+ const x = new URLSearchParams(a.search);
1690
+ return {
1691
+ scenario: x.get(C.scenario) ?? void 0,
1692
+ component: x.get(C.component) ?? void 0
1693
+ };
1694
+ }, [a.search]), b = !!(r.handoff && (f.scenario && !Q(r.handoff, f.scenario) || f.component && !ce(r.handoff, f.component) || !f.component && !$e(r.handoff, a.path, e.scenarios))), M = D(
1695
+ () => n.resolveComponentFixture(w?.id, w ? r.fixture : void 0),
1696
+ [w, r.fixture, n]
1697
+ ), y = D(() => {
1698
+ const x = M.fixture?.data;
1699
+ return typeof x == "function" ? x() : x;
1700
+ }, [M.fixture]), d = n.persona(r.persona ?? l?.persona), h = n.fixture(r.fixture ?? l?.fixture), S = D(() => {
1701
+ const x = r.dataSource ?? "fixtures";
1702
+ return x === "fixtures" ? we : e.dataSources?.adapters?.find((k) => k.id === x) ?? we;
1703
+ }, [r.dataSource, e.dataSources?.adapters]), { data: L, isLoading: T, error: _ } = At({
1704
+ scenario: l,
1705
+ fixture: h,
1706
+ network: r.network,
1707
+ adapter: S
1708
+ }), $ = D(() => r.persona && r.persona !== l?.persona ? n.persona(r.persona)?.permissions ?? [] : n.permissionsOf(l), [r.persona, n, l]), i = D(
1931
1709
  () => ({
1932
- scenario: d,
1933
- persona: _,
1934
- permissions: D,
1935
- can: (w) => D.includes(w),
1936
- data: W,
1937
- fixture: T,
1938
- network: a.network,
1939
- isLoading: F,
1940
- error: R,
1941
- rules: t.rulesOf(d),
1942
- viewport: r,
1943
- themeMode: a.themeMode,
1944
- locale: a.locale,
1945
- a11y: {
1946
- keyboardMode: a.keyboardMode,
1947
- reducedMotion: a.reducedMotion,
1948
- textScale: a.textScale
1949
- },
1950
- navigate: p,
1951
- openScenario: m
1710
+ scenario: l,
1711
+ persona: d,
1712
+ permissions: $,
1713
+ can: (x) => $.includes(x),
1714
+ data: L,
1715
+ fixture: h,
1716
+ network: r.network,
1717
+ isLoading: T,
1718
+ error: _,
1719
+ rules: n.rulesOf(l),
1720
+ viewport: s,
1721
+ themeMode: r.themeMode,
1722
+ locale: r.locale,
1723
+ navigate: (x) => u(x),
1724
+ openScenario: c
1952
1725
  }),
1953
1726
  [
1727
+ l,
1954
1728
  d,
1955
- _,
1956
- D,
1957
- W,
1729
+ $,
1730
+ L,
1731
+ h,
1732
+ r.network,
1733
+ r.themeMode,
1734
+ r.locale,
1958
1735
  T,
1959
- a.network,
1960
- a.themeMode,
1961
- a.locale,
1962
- a.keyboardMode,
1963
- a.reducedMotion,
1964
- a.textScale,
1965
- F,
1966
- R,
1967
- t,
1968
- r,
1969
- p,
1970
- m
1736
+ _,
1737
+ n,
1738
+ s,
1739
+ u,
1740
+ c
1971
1741
  ]
1972
- ), z = !d && !f && l.path === "/", O = Ce(e.routes, l.path), U = e.wrapper, H = e.notFound, K = f?.preview, V = K ? /* @__PURE__ */ o(
1973
- K,
1742
+ ), m = me(e.routes ?? [], a.path), v = e.wrapper, E = e.notFound, N = w?.preview, O = b ? /* @__PURE__ */ t(Le, { title: o.shell.outsideHandoff, children: /* @__PURE__ */ t("p", { children: o.shell.outsideHandoffHint }) }) : N ? /* @__PURE__ */ t(
1743
+ N,
1974
1744
  {
1975
- fixture: k.fixture,
1976
- data: M,
1977
- viewport: r,
1978
- themeMode: a.themeMode ?? "default",
1979
- locale: a.locale ?? "default",
1980
- a11y: {
1981
- keyboardMode: a.keyboardMode,
1982
- reducedMotion: a.reducedMotion,
1983
- textScale: a.textScale
1984
- }
1745
+ fixture: M.fixture,
1746
+ data: y,
1747
+ viewport: s,
1748
+ themeMode: r.themeMode ?? "default",
1749
+ locale: r.locale ?? "default"
1985
1750
  }
1986
- ) : O ? /* @__PURE__ */ o(O.definition.screen, { params: O.params, context: j }) : H ? /* @__PURE__ */ o(H, { path: l.path }) : /* @__PURE__ */ o(ut, { title: n.shell.noRoute, children: /* @__PURE__ */ u("p", { children: [
1987
- /* @__PURE__ */ o("code", { children: l.path }),
1751
+ ) : m ? /* @__PURE__ */ t(m.definition.screen, { params: m.params, context: i }) : E ? /* @__PURE__ */ t(E, { path: a.path }) : /* @__PURE__ */ t(Le, { title: o.shell.noRoute, children: /* @__PURE__ */ g("p", { children: [
1752
+ /* @__PURE__ */ t("code", { children: a.path }),
1988
1753
  " ",
1989
- n.shell.noRouteHint
1990
- ] }) }), b = U ? /* @__PURE__ */ o(U, { context: j, children: V }) : V;
1991
- return /* @__PURE__ */ o(de.Provider, { value: n, children: /* @__PURE__ */ u(
1754
+ o.shell.noRouteHint
1755
+ ] }) });
1756
+ return (
1757
+ // `display: contents` deixa o layout do produto como se este nó não
1758
+ // existisse: ele só serve de raiz para observar os links.
1759
+ /* @__PURE__ */ t("div", { ref: p, style: { display: "contents" }, children: v && !b ? /* @__PURE__ */ t(v, { context: i, children: O }) : O })
1760
+ );
1761
+ }
1762
+ function Kt(e) {
1763
+ if (!e.altKey) {
1764
+ if (e.shiftKey && !e.metaKey && !e.ctrlKey && e.key === "C") return "C";
1765
+ if ((e.metaKey || e.ctrlKey) && !e.shiftKey) {
1766
+ const n = e.key.toLowerCase();
1767
+ if (n === "k") return "K";
1768
+ if (n === "f") return "F";
1769
+ }
1770
+ }
1771
+ }
1772
+ const ae = {
1773
+ leftWidth: "ds:left-width",
1774
+ rightWidth: "ds:right-width",
1775
+ appearance: "ds:appearance"
1776
+ };
1777
+ function Ve(e) {
1778
+ try {
1779
+ return window.localStorage.getItem(e) ?? void 0;
1780
+ } catch {
1781
+ return;
1782
+ }
1783
+ }
1784
+ function Ie(e, n) {
1785
+ try {
1786
+ window.localStorage.setItem(e, n);
1787
+ } catch {
1788
+ }
1789
+ }
1790
+ function Re(e, n, o) {
1791
+ return Math.round(Math.min(o, Math.max(n, e)));
1792
+ }
1793
+ function _e(e, n, o, a) {
1794
+ const [r, s] = z(() => {
1795
+ const c = Number.parseInt(Ve(e) ?? "", 10);
1796
+ return Number.isFinite(c) ? Re(c, o, a) : n;
1797
+ }), u = W(
1798
+ (c) => {
1799
+ const p = Re(c, o, a);
1800
+ s(p), Ie(e, String(p));
1801
+ },
1802
+ [e, a, o]
1803
+ );
1804
+ return [r, u];
1805
+ }
1806
+ function Vt() {
1807
+ const e = "(prefers-color-scheme: dark)", n = () => {
1808
+ try {
1809
+ return window.matchMedia(e).matches ? "dark" : "light";
1810
+ } catch {
1811
+ return "light";
1812
+ }
1813
+ }, [o, a] = z(n);
1814
+ return K(() => {
1815
+ let r;
1816
+ try {
1817
+ r = window.matchMedia(e);
1818
+ } catch {
1819
+ return;
1820
+ }
1821
+ const s = () => a(r?.matches ? "dark" : "light");
1822
+ return r.addEventListener?.("change", s), () => r?.removeEventListener?.("change", s);
1823
+ }, []), o;
1824
+ }
1825
+ function It() {
1826
+ const e = Ve(ae.appearance);
1827
+ return e === "dark" || e === "light" ? e : void 0;
1828
+ }
1829
+ function Zt({ product: e }) {
1830
+ const n = D(() => rt(e), [e]), o = D(() => ft(e.theme?.labels), [e.theme?.labels]), [a] = z(() => tt());
1831
+ return /* @__PURE__ */ t(De.Provider, { value: o, children: a ? /* @__PURE__ */ t(Dt, { product: e, registry: n }) : /* @__PURE__ */ t(Wt, { product: e, registry: n }) });
1832
+ }
1833
+ const ue = { initial: 290, min: 200, max: 480 }, he = { initial: 320, min: 260, max: 560 };
1834
+ function Wt({ product: e, registry: n }) {
1835
+ const o = q(), a = D(() => nt(e.deploy), [e.deploy]), { location: r, controls: s, viewport: u, setControls: c, openScenario: p, openComponent: l, openScreen: w, go: f } = Oe(n), b = U(r);
1836
+ b.current = r;
1837
+ const M = Vt(), [y, d] = z(() => It()), h = s.chromeTheme ?? y ?? M, [S, L] = _e(
1838
+ ae.leftWidth,
1839
+ ue.initial,
1840
+ ue.min,
1841
+ ue.max
1842
+ ), [T, _] = _e(
1843
+ ae.rightWidth,
1844
+ he.initial,
1845
+ he.min,
1846
+ he.max
1847
+ ), [$, i] = z(!1), m = s.handoff, v = n.component(s.component), E = n.scenario(s.scenario), N = v ? void 0 : n.screensFor({ handoff: m }).find((R) => R.id === n.screenForPath(r.path)?.id), O = N && E && N.variations.some((R) => R.id === E.id) ? E : void 0, x = D(
1848
+ () => n.resolveComponentFixture(v?.id, v ? s.fixture : void 0),
1849
+ [v, s.fixture, n]
1850
+ ), k = n.screensFor({ handoff: m })[0], P = n.componentsFor(m)[0], F = !k && !P, A = D(() => {
1851
+ const R = new URLSearchParams(r.search);
1852
+ return R.has(C.scenario) || R.has(C.component);
1853
+ }, [r.search]), B = r.path === "/" && !A && !n.screenForPath("/") && !F;
1854
+ K(() => {
1855
+ B && (k ? w(k.id, { replace: !0 }) : P && l(P.id, { replace: !0 }));
1856
+ }, [P, k, l, w, B]);
1857
+ const Z = W(
1858
+ () => c({ chrome: !s.chrome }),
1859
+ [s.chrome, c]
1860
+ ), le = W(
1861
+ (R) => {
1862
+ if (R === "C") {
1863
+ Z();
1864
+ return;
1865
+ }
1866
+ window.dispatchEvent(new KeyboardEvent("keydown", { key: R.toLowerCase(), metaKey: !0 }));
1867
+ },
1868
+ [Z]
1869
+ );
1870
+ K(() => {
1871
+ const R = (j) => {
1872
+ !j.shiftKey || j.metaKey || j.ctrlKey || j.altKey || j.key !== "C" || j.target?.closest?.("input, textarea, select, [contenteditable='true'], [contenteditable='']") || (j.preventDefault(), le(j.key));
1873
+ };
1874
+ return window.addEventListener("keydown", R), () => window.removeEventListener("keydown", R);
1875
+ }, [le]);
1876
+ const We = W(
1877
+ (R, j) => {
1878
+ const { path: ke, search: qe } = pe(R);
1879
+ f(ke, ot(qe, b.current.search), { replace: j });
1880
+ },
1881
+ [f]
1882
+ ), He = () => {
1883
+ const R = h === "dark" ? "light" : "dark";
1884
+ Ie(ae.appearance, R), d(R), c({ chromeTheme: R });
1885
+ }, X = (R) => c(R), Ue = `${a.origin}${r.path}${r.search}`, Be = s.panelTab ?? "variations", ye = s.zoom ?? 100, [je, Ge] = z(ye);
1886
+ return /* @__PURE__ */ g(
1992
1887
  "div",
1993
1888
  {
1994
1889
  className: "ds-root",
1995
- "data-chrome": a.chrome ? "visible" : "hidden",
1996
- "data-appearance": a.chromeTheme ?? "dark",
1997
- "data-inspector": a.inspector ? "open" : "closed",
1998
- "data-viewport": r.id,
1890
+ "data-appearance": h,
1891
+ "data-chrome": s.chrome ? "visible" : "hidden",
1892
+ "data-resizing": $ ? "true" : void 0,
1893
+ "data-viewport": u.id,
1999
1894
  children: [
2000
- a.chrome && /* @__PURE__ */ o(
2001
- Qe,
1895
+ s.chrome && /* @__PURE__ */ t(
1896
+ gt,
2002
1897
  {
2003
- product: e,
2004
- scenario: d,
2005
- deploy: s,
2006
- inspectorOpen: a.inspector,
2007
- chromeTheme: a.chromeTheme ?? "dark",
2008
- view: i,
2009
- onToggleInspector: () => c({ inspector: !a.inspector }),
2010
- onToggleChromeTheme: () => c({ chromeTheme: a.chromeTheme === "light" ? "dark" : "light" })
1898
+ productName: e.name,
1899
+ deploy: a,
1900
+ viewportId: s.viewport,
1901
+ viewport: u,
1902
+ zoom: je,
1903
+ rotated: !!s.rotated,
1904
+ theme: h,
1905
+ issues: n.issues,
1906
+ linkUrl: Ue,
1907
+ onViewport: (R) => X({ viewport: R }),
1908
+ onRotate: () => X({ rotated: !s.rotated }),
1909
+ onZoom: (R) => X({ zoom: R }),
1910
+ onCleanReview: Z,
1911
+ onToggleTheme: He
2011
1912
  }
2012
1913
  ),
2013
- a.chrome && /* @__PURE__ */ o(
2014
- Ve,
2015
- {
2016
- registry: t,
2017
- activeScenario: d,
2018
- activeComponent: a.component,
2019
- controls: a,
2020
- onOpenScenario: m,
2021
- onOpenComponent: v,
2022
- onViewChange: h
2023
- }
2024
- ),
2025
- /* @__PURE__ */ u("div", { className: "ds-stage-area", children: [
2026
- z ? /* @__PURE__ */ o("div", { className: "ds-stage-scroll", children: /* @__PURE__ */ o(
2027
- ht,
1914
+ /* @__PURE__ */ g("div", { className: "ds-body", children: [
1915
+ s.chrome && /* @__PURE__ */ t(
1916
+ yt,
2028
1917
  {
2029
- registry: t,
2030
- view: i,
2031
- onViewChange: h,
2032
- onOpenScenario: m
1918
+ registry: n,
1919
+ handoff: m,
1920
+ activeScreen: N?.id,
1921
+ activeComponent: v?.id,
1922
+ onOpenScreen: (R) => w(R),
1923
+ onOpenComponent: (R) => l(R),
1924
+ width: S,
1925
+ onResize: L,
1926
+ onResizeStart: () => i(!0),
1927
+ onResizeEnd: () => i(!1)
2033
1928
  }
2034
- ) }) : /* @__PURE__ */ o(
2035
- dt,
1929
+ ),
1930
+ /* @__PURE__ */ t("main", { className: "ds-main", children: F ? /* @__PURE__ */ g("div", { className: "ds-chrome-empty", children: [
1931
+ /* @__PURE__ */ t("h1", { className: "ds-chrome-empty__title", children: o.shell.empty }),
1932
+ /* @__PURE__ */ t("p", { className: "ds-muted", children: o.shell.emptyHint })
1933
+ ] }) : B ? null : /* @__PURE__ */ t(
1934
+ Pt,
2036
1935
  {
2037
- ref: N,
2038
- viewport: r,
2039
- textScale: a.textScale,
2040
- reducedMotion: a.reducedMotion,
2041
- keyboardMode: a.keyboardMode,
2042
- children: b
1936
+ location: r,
1937
+ viewport: u,
1938
+ zoom: ye,
1939
+ onEffectiveZoom: Ge,
1940
+ title: o.shell.frameTitle(e.name),
1941
+ resizing: $,
1942
+ onFrameNavigate: We,
1943
+ onShortcut: le
2043
1944
  }
2044
- ),
2045
- a.chrome && /* @__PURE__ */ o(
2046
- tt,
1945
+ ) }),
1946
+ s.chrome && /* @__PURE__ */ t(
1947
+ Mt,
2047
1948
  {
2048
- registry: t,
2049
- controls: a,
2050
- scenarioActive: !!d,
2051
- component: f,
2052
- componentFixture: k,
2053
- onChange: c
1949
+ registry: n,
1950
+ controls: s,
1951
+ deploy: a,
1952
+ screen: N,
1953
+ variation: O,
1954
+ component: v,
1955
+ componentFixture: x,
1956
+ tab: Be,
1957
+ onTab: (R) => X({ panelTab: R }),
1958
+ onOpenScenario: p,
1959
+ onOpenComponent: (R) => l(R),
1960
+ onChange: X,
1961
+ width: T,
1962
+ onResize: _,
1963
+ onResizeStart: () => i(!0),
1964
+ onResizeEnd: () => i(!1)
2054
1965
  }
2055
1966
  )
2056
1967
  ] }),
2057
- a.chrome && /* @__PURE__ */ o(
2058
- nt,
2059
- {
2060
- registry: t,
2061
- scenario: d,
2062
- component: f,
2063
- componentFixture: k,
2064
- controls: a,
2065
- focusedNode: x,
2066
- tabStopCount: S.length
2067
- }
2068
- ),
2069
- a.keyboardMode && /* @__PURE__ */ o(lt, { stops: S }),
2070
- !a.chrome && /* @__PURE__ */ o(
1968
+ !s.chrome && /* @__PURE__ */ t(
2071
1969
  "button",
2072
1970
  {
2073
1971
  type: "button",
2074
- className: "ds-chrome ds-restore",
2075
- onClick: () => c({ chrome: !0 }),
2076
- children: n.shell.restoreChrome
1972
+ className: "ds-restore",
1973
+ "aria-label": o.shell.restoreChrome,
1974
+ title: o.shell.restoreChrome,
1975
+ onClick: Z,
1976
+ children: /* @__PURE__ */ t("span", { className: "ds-restore__dot", "aria-hidden": "true" })
2077
1977
  }
2078
1978
  )
2079
1979
  ]
2080
1980
  }
2081
- ) });
1981
+ );
2082
1982
  }
2083
- function Y(e) {
1983
+ function se(e) {
2084
1984
  return new Date(e.length === 10 ? `${e}T00:00:00` : e);
2085
1985
  }
2086
- function _t(e, t) {
2087
- const n = Y(e), s = Y(t);
2088
- let l = s.getFullYear() - n.getFullYear();
2089
- const a = s.getMonth() - n.getMonth();
2090
- return (a < 0 || a === 0 && s.getDate() < n.getDate()) && (l -= 1), l;
1986
+ function Yt(e, n) {
1987
+ const o = se(e), a = se(n);
1988
+ let r = a.getFullYear() - o.getFullYear();
1989
+ const s = a.getMonth() - o.getMonth();
1990
+ return (s < 0 || s === 0 && a.getDate() < o.getDate()) && (r -= 1), r;
2091
1991
  }
2092
- function Mt(e, t) {
2093
- const n = Y(e), s = Y(t);
2094
- return Math.floor((s.getTime() - n.getTime()) / 864e5);
1992
+ function Qt(e, n) {
1993
+ const o = se(e), a = se(n);
1994
+ return Math.floor((a.getTime() - o.getTime()) / 864e5);
2095
1995
  }
2096
1996
  export {
2097
- At as CONTRAST_THRESHOLDS,
2098
- L as DEFAULT_LABELS,
2099
- St as DesignSpace,
2100
- wt as EN_US_LABELS,
2101
- ht as Home,
2102
- yt as KEYBOARD_LABELS,
2103
- xt as NETWORK_LABELS,
2104
- ie as NETWORK_STATES,
2105
- g as PARAM,
2106
- se as SCENARIO_STATUSES,
2107
- Ae as SLOW_NETWORK_DELAY_MS,
2108
- kt as STATUS_LABELS,
2109
- Nt as STATUS_MEANING,
2110
- Pe as SimulatedNetworkError,
2111
- dt as Stage,
2112
- ut as StageEmpty,
2113
- we as TEXT_SCALES,
2114
- lt as TabOrderOverlay,
2115
- ce as VIEWPORTS,
2116
- _t as ageInYears,
2117
- Pt as applyOverrides,
2118
- Lt as assertContrastPairs,
2119
- $t as checkContrastPair,
2120
- be as checkContrastPairs,
2121
- Et as commitUrl,
2122
- Ft as componentUrl,
2123
- De as computeRole,
2124
- Rt as contrastRatio,
2125
- gt as createHttpAdapter,
2126
- ge as createRegistry,
2127
- Mt as daysBetween,
2128
- Re as describeElement,
2129
- Z as fixtureAdapter,
2130
- Dt as flatten,
2131
- Ot as formatIssues,
2132
- ve as getDeployContext,
2133
- It as hasErrors,
2134
- Me as matchPath,
2135
- Bt as parseColor,
2136
- ke as parseControls,
2137
- Y as parseIsoDate,
2138
- Wt as readCssVariable,
2139
- jt as relativeLuminance,
2140
- X as resolveFixture,
2141
- Ue as resolveLabels,
2142
- Ce as resolveRoute,
2143
- xe as resolveViewport,
2144
- fe as scenarioUrl,
2145
- q as serializeControls,
2146
- Ht as serializeValue,
2147
- He as shortSelector,
2148
- Ke as tabbableElements,
2149
- Ne as useDesignSpaceState,
2150
- ze as useKeyboardMode,
2151
- P as useLabels,
2152
- $e as useScenarioData,
2153
- me as validateProduct,
2154
- Kt as validateScenario
1997
+ Y as DEFAULT_LABELS,
1998
+ Zt as DesignSpace,
1999
+ jt as EN_US_LABELS,
2000
+ et as FRAME_ATTRIBUTE,
2001
+ en as FRAME_PARAM,
2002
+ tn as HANDOFF_PARAM,
2003
+ Gt as NETWORK_LABELS,
2004
+ Fe as NETWORK_STATES,
2005
+ C as PARAM,
2006
+ Ft as SLOW_NETWORK_DELAY_MS,
2007
+ zt as SimulatedNetworkError,
2008
+ Le as StageEmpty,
2009
+ it as VIEWPORTS,
2010
+ ie as ZOOM_DEFAULT,
2011
+ ve as ZOOM_MAX,
2012
+ be as ZOOM_MIN,
2013
+ Yt as ageInYears,
2014
+ ge as applyHandoffScope,
2015
+ Je as applyOverrides,
2016
+ Ae as clampZoom,
2017
+ nn as commitUrl,
2018
+ on as componentUrl,
2019
+ qt as createHttpAdapter,
2020
+ rt as createRegistry,
2021
+ Qt as daysBetween,
2022
+ we as fixtureAdapter,
2023
+ rn as formatIssues,
2024
+ nt as getDeployContext,
2025
+ ce as handoffAllowsComponent,
2026
+ $e as handoffAllowsPath,
2027
+ Q as handoffAllowsScenario,
2028
+ an as hasErrors,
2029
+ sn as matchPath,
2030
+ cn as normalizeHandoffScope,
2031
+ G as normalizeSearch,
2032
+ st as parseControls,
2033
+ Xe as parseHandoffScope,
2034
+ se as parseIsoDate,
2035
+ fe as resolveFixture,
2036
+ ft as resolveLabels,
2037
+ me as resolveRoute,
2038
+ ct as resolveViewport,
2039
+ Se as scenarioUrl,
2040
+ J as serializeControls,
2041
+ ln as serializeValue,
2042
+ Oe as useDesignSpaceState,
2043
+ q as useLabels,
2044
+ At as useScenarioData,
2045
+ Qe as validateProduct,
2046
+ dn as validateScenario
2155
2047
  };
2156
2048
  //# sourceMappingURL=index.js.map