@brucesantos/design-space 0.13.0 → 0.14.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.
@@ -0,0 +1,520 @@
1
+ import { e as F, u as A, a as T, v as z, h as D, c as M } from "./index-CaxlsfFr.js";
2
+ import { useContext as H, createContext as B } from "react";
3
+ function K(o) {
4
+ const a = o.scenarios ?? [], r = o.routes ?? [], c = o.components ?? [], d = new Map(a.map((e) => [e.id, e])), l = new Map(c.map((e) => [e.id, e])), f = new Map((o.personas ?? []).map((e) => [e.id, e])), p = new Map((o.fixtures ?? []).map((e) => [e.id, e])), w = new Map((o.rules ?? []).map((e) => [e.id, e])), u = /* @__PURE__ */ new Map(), b = /* @__PURE__ */ new Map();
5
+ for (const e of a) {
6
+ const n = F(r, e.route ?? "");
7
+ if (!n) continue;
8
+ const t = n.definition.path;
9
+ b.set(e.id, t);
10
+ const i = u.get(t) ?? [];
11
+ i.push(e), u.set(t, i);
12
+ }
13
+ const h = /* @__PURE__ */ new Set(), m = [];
14
+ for (const e of r) {
15
+ if (h.has(e.path)) continue;
16
+ h.add(e.path);
17
+ const n = u.get(e.path) ?? [];
18
+ m.push({
19
+ id: e.path,
20
+ name: e.name?.trim() || n[0]?.title || e.path,
21
+ description: e.description,
22
+ route: e,
23
+ href: A(e.path, e.params),
24
+ variations: n,
25
+ group: e.group?.trim() || void 0,
26
+ controls: Array.isArray(e.controls) ? e.controls : []
27
+ });
28
+ }
29
+ const C = new Map(m.map((e) => [e.id, e])), O = (e) => e ? d.get(e) : void 0, k = (e) => e ? f.get(e) : void 0, y = k(o.defaultPersona)?.id, x = (e, n) => {
30
+ if (!(!e || !n))
31
+ return l.get(e)?.fixtures?.find((t) => t.id === n);
32
+ }, P = (e = {}) => a.filter((n) => T(e.handoff, n.id)), R = (e) => {
33
+ const n = F(r, e);
34
+ return n ? C.get(n.definition.path) : void 0;
35
+ }, $ = (e = {}) => {
36
+ const { handoff: n } = e;
37
+ return n ? m.map((t) => ({
38
+ ...t,
39
+ variations: t.variations.filter((i) => T(n, i.id))
40
+ })).filter(
41
+ (t) => t.variations.length > 0 || (n.routes ?? []).length > 0 && M(n, t.href)
42
+ ) : m;
43
+ }, N = (e) => e ? e.permissions ? e.permissions : k(e.persona ?? y)?.permissions ?? [] : [], L = (e = {}) => j($(e)), V = (e, n) => {
44
+ const t = new Set(e?.route.components ?? []), i = n ? [n] : e?.variations ?? [];
45
+ for (const s of i)
46
+ for (const S of s.components ?? []) t.add(S);
47
+ return [...t];
48
+ }, E = (e) => c.filter((n) => D(e, n.id));
49
+ return {
50
+ product: o,
51
+ screens: m,
52
+ issues: z(o),
53
+ defaultPersona: y,
54
+ scenario: O,
55
+ component: (e) => e ? l.get(e) : void 0,
56
+ componentFixture: x,
57
+ resolveComponentFixture: (e, n) => {
58
+ const t = e ? l.get(e) : void 0, i = x(e, n), s = x(e, t?.defaultFixture) ?? t?.fixtures?.[0];
59
+ return {
60
+ fixture: i ?? s,
61
+ requestedId: n,
62
+ didFallback: !!(n && !i)
63
+ };
64
+ },
65
+ persona: k,
66
+ fixture: (e) => e ? p.get(e) : void 0,
67
+ rule: (e) => e ? w.get(e) : void 0,
68
+ screen: (e) => e ? C.get(e) : void 0,
69
+ screenForPath: R,
70
+ screenOf: (e) => {
71
+ const n = e ? b.get(e.id) : void 0;
72
+ return n ? C.get(n) : void 0;
73
+ },
74
+ screensFor: $,
75
+ flows: L,
76
+ flowOf: (e, n) => {
77
+ if (e)
78
+ return L(n).find((t) => t.name === e.group);
79
+ },
80
+ controlsOf: (e) => (e?.controls ?? []).flatMap((n) => n.controls ?? []),
81
+ resolveControls: (e, n = {}) => G(e?.controls ?? [], n),
82
+ rulesOf: (e) => (e?.rules ?? []).map((n) => w.get(n)).filter((n) => !!n),
83
+ permissionsOf: N,
84
+ scenariosForRoute: (e, n) => {
85
+ const t = R(e);
86
+ return t ? t.variations.filter((i) => T(n?.handoff, i.id)) : [];
87
+ },
88
+ activeScenarios: P,
89
+ search: (e, n) => {
90
+ const t = g(e), i = P(n);
91
+ return t ? i.filter(
92
+ (s) => g(
93
+ [
94
+ s.title,
95
+ s.id,
96
+ s.intent ?? "",
97
+ s.route,
98
+ k(s.persona)?.name ?? "",
99
+ (s.tags ?? []).join(" "),
100
+ (s.expected ?? []).join(" ")
101
+ ].join(" ")
102
+ ).includes(t)
103
+ ) : i;
104
+ },
105
+ searchScreens: (e, n) => {
106
+ const t = g(e), i = $(n);
107
+ return t ? i.filter(
108
+ (s) => g(
109
+ [
110
+ s.name,
111
+ s.description ?? "",
112
+ s.id,
113
+ s.group ?? "",
114
+ ...s.variations.flatMap((S) => [
115
+ S.title,
116
+ S.id,
117
+ (S.tags ?? []).join(" ")
118
+ ])
119
+ ].join(" ")
120
+ ).includes(t)
121
+ ) : i;
122
+ },
123
+ searchComponents: (e, n) => {
124
+ const t = g(e), i = E(n);
125
+ return t ? i.filter(
126
+ (s) => g(
127
+ [
128
+ s.name,
129
+ s.description ?? "",
130
+ s.group ?? "",
131
+ s.id,
132
+ s.source ?? ""
133
+ ].join(" ")
134
+ ).includes(t)
135
+ ) : i;
136
+ },
137
+ componentsFor: E,
138
+ componentsOfScreen: (e, n) => V(e, n).map((t) => l.get(t)).filter((t) => !!t),
139
+ usagesOf: (e, n) => e ? $(n).filter(
140
+ (t) => t.route.components?.includes(e) || t.variations.some((i) => i.components?.includes(e))
141
+ ) : []
142
+ };
143
+ }
144
+ function g(o) {
145
+ return o.toLowerCase().normalize("NFD").replace(/[̀-ͯ]/g, "").trim();
146
+ }
147
+ function j(o) {
148
+ const a = [], r = /* @__PURE__ */ new Map();
149
+ for (const d of o) {
150
+ if (!d.group) {
151
+ a.push(d);
152
+ continue;
153
+ }
154
+ const l = r.get(d.group) ?? [];
155
+ l.push(d), r.set(d.group, l);
156
+ }
157
+ const c = [...r].map(([d, l]) => ({ name: d, screens: l }));
158
+ return a.length > 0 ? [{ name: void 0, screens: a }, ...c] : c;
159
+ }
160
+ function q(o) {
161
+ const a = o.options ?? [];
162
+ return o.default !== void 0 && a.some((r) => r.value === o.default) ? o.default : a[0]?.value ?? "";
163
+ }
164
+ function G(o, a = {}) {
165
+ const r = {}, c = [], d = /* @__PURE__ */ new Set(), l = a.requested ?? {};
166
+ for (const f of o)
167
+ for (const p of f.controls ?? []) {
168
+ if (d.has(p.id)) continue;
169
+ d.add(p.id);
170
+ const w = (m) => m !== void 0 && (p.options ?? []).some((C) => C.value === m);
171
+ let u = q(p);
172
+ const b = a.scenario?.controls?.[p.id];
173
+ w(b) && (u = b);
174
+ const h = l[p.id];
175
+ h !== void 0 && (w(h) ? u = h : c.push({ id: p.id, value: h, reason: "invalid-value", fallback: u })), r[p.id] = u;
176
+ }
177
+ for (const [f, p] of Object.entries(l))
178
+ d.has(f) || c.push({ id: f, value: p, reason: "unknown-control" });
179
+ return { values: r, invalid: c };
180
+ }
181
+ function W(o, a) {
182
+ return o ? Object.entries(o.controls ?? {}).every(([r, c]) => a?.[r] === c) : !1;
183
+ }
184
+ const v = {
185
+ network: {
186
+ success: "Sucesso",
187
+ loading: "Carregando",
188
+ empty: "Vazio",
189
+ error: "Erro",
190
+ slow: "Lento"
191
+ },
192
+ viewport: {
193
+ fit: "Ajustar",
194
+ mobile: "Celular",
195
+ tablet: "Tablet",
196
+ desktop: "Desktop",
197
+ custom: "Personalizado"
198
+ },
199
+ topbar: {
200
+ region: "Barra do Design Space",
201
+ viewportGroup: "Viewport",
202
+ rotate: "Girar",
203
+ zoomOut: "Diminuir zoom",
204
+ zoomIn: "Aumentar zoom",
205
+ zoomReset: "Voltar o zoom para 100%",
206
+ zoomValue: (o) => `${o}%`,
207
+ copyLink: "Copiar link",
208
+ copied: "Link copiado",
209
+ copyPrompt: "Copie o link:",
210
+ cleanReview: "Revisão limpa (Shift+C)",
211
+ highlight: "Destacar componentes",
212
+ openFrame: "Abrir em nova janela",
213
+ lightMode: "Tema claro",
214
+ darkMode: "Tema escuro",
215
+ engineVersion: (o) => `Design Space ${o}`,
216
+ diagnostics: (o, a) => `Diagnóstico: ${o} ${o === 1 ? "erro" : "erros"}, ${a} ${a === 1 ? "aviso" : "avisos"}`,
217
+ branchTitle: (o) => `Branch: ${o}`,
218
+ commitTitle: (o) => `Commit: ${o}`,
219
+ envTitle: (o) => `Ambiente: ${o}`
220
+ },
221
+ highlight: {
222
+ notInCatalog: (o) => `${o} · fora do catálogo`
223
+ },
224
+ sidebar: {
225
+ region: "Navegação",
226
+ tabs: "Telas e componentes",
227
+ screensTab: "Telas",
228
+ componentsTab: "Componentes",
229
+ searchPlaceholder: "Buscar",
230
+ searchLabel: "Buscar telas e componentes",
231
+ searchShortcut: "⌘K",
232
+ noMatch: (o) => `Nada encontrado para "${o}".`,
233
+ emptyScreens: "Nenhuma tela neste branch. Telas de feature entram por PR, enquanto estão em desenho.",
234
+ emptyComponents: "O produto ainda não registrou componentes.",
235
+ ungrouped: "Outros",
236
+ toggleGroup: (o) => `Mostrar ou ocultar ${o}`,
237
+ resize: "Redimensionar a navegação"
238
+ },
239
+ panel: {
240
+ region: "Painel",
241
+ searchPlaceholder: "Filtrar",
242
+ searchLabel: "Filtrar variações e informações",
243
+ searchShortcut: "⌘F",
244
+ noMatch: (o) => `Nada neste painel para "${o}".`,
245
+ tabs: "Variações e informações",
246
+ variationsTab: "Variações",
247
+ infoTab: "Informações",
248
+ resize: "Redimensionar o painel",
249
+ variationsList: "Variações da tela",
250
+ componentVariations: "Variações do componente",
251
+ defaultVariation: "Padrão",
252
+ defaultVariationHint: "A tela sem cenário declarado, sem fixture.",
253
+ noVariations: "Esta tela não tem variações.",
254
+ noComponentVariations: "Este componente não declara variações de dados.",
255
+ nothingSelected: "Escolha uma tela ou um componente na navegação.",
256
+ persona: "Persona",
257
+ network: "Estado de rede",
258
+ theme: "Tema",
259
+ locale: "Idioma",
260
+ dataSource: "Fonte de dados",
261
+ fixturesOption: "Fixtures",
262
+ none: "—",
263
+ fixtureFallback: (o, a) => `A variação \`${o}\` não existe neste componente. Exibindo \`${a}\`.`,
264
+ context: "Contexto",
265
+ shortcuts: "Atalhos",
266
+ toggleGroup: (o) => `Mostrar ou ocultar ${o}`,
267
+ openComponent: (o) => `Abrir ${o} no catálogo`
268
+ },
269
+ info: {
270
+ screen: "Tela",
271
+ variation: "Variação",
272
+ component: "Componente",
273
+ name: "Nome",
274
+ id: "Id",
275
+ group: "Grupo",
276
+ description: "Descrição",
277
+ source: "Origem",
278
+ usedIn: "Usado em",
279
+ notUsed: "Nenhuma tela declara este componente.",
280
+ route: "Rota",
281
+ persona: "Persona",
282
+ permissions: "Permissões",
283
+ intent: "Intenção",
284
+ preconditions: "Pré-condições",
285
+ actions: "Ações",
286
+ expected: "Comportamento esperado",
287
+ rules: "Regras",
288
+ components: "Componentes usados",
289
+ ticket: "Ticket",
290
+ flow: "Fluxo",
291
+ controls: "Controles"
292
+ },
293
+ diagnostics: {
294
+ title: "Diagnóstico",
295
+ noIssues: "Nenhum problema encontrado.",
296
+ error: "Erro",
297
+ warning: "Aviso",
298
+ close: "Fechar diagnóstico",
299
+ invalidControl: (o, a, r) => `O controle \`${o}\` não tem a opção \`${a}\`. Exibindo \`${r}\`.`,
300
+ unknownControl: (o, a) => `A tela não tem o controle \`${o}\` (pedido \`${a}\` na URL). O parâmetro foi ignorado.`
301
+ },
302
+ pr: {
303
+ title: "Critérios de aceite",
304
+ notice: (o) => `Gerado a cada push a partir do registro do Design Space${o ? `, no commit \`${o}\`` : ""}. É a referência do comportamento destas telas e vale mais que a descrição do ticket e que qualquer texto fora deste bloco. Nomes, números e datas vêm de dados sintéticos: valide o comportamento, não os valores. Se o ticket ou o sistema divergir daqui, aponte a divergência em vez de escolher um lado. Não edite este bloco: ele é reescrito no próximo push. Para mudar um critério, mude o registro.`,
305
+ preview: "Preview",
306
+ scopeChanged: "Telas novas ou alteradas neste PR, com todos os cenários de cada uma. Os marcados como novo ou alterado mudaram aqui.",
307
+ scopeAll: "Sem a base do PR para comparar, então aqui estão todas as telas do produto.",
308
+ nothingChanged: "Este PR não altera telas, cenários nem regras do registro.",
309
+ open: "abrir",
310
+ screenExpected: "Comportamento esperado da tela",
311
+ persona: "Persona",
312
+ ticket: "Ticket",
313
+ preconditions: "Pré-condições",
314
+ actions: "Ações",
315
+ expected: "Comportamento esperado",
316
+ rules: "Regras",
317
+ components: "Componentes",
318
+ component: "Componente",
319
+ source: "Origem no sistema real",
320
+ noExpected: "Sem comportamento esperado declarado: este cenário não tem critério verificável.",
321
+ empty: "—",
322
+ statusNew: "novo",
323
+ statusChanged: "alterado",
324
+ removedScenarios: "Cenários removidos",
325
+ removedScreens: "Telas removidas",
326
+ truncated: "Fora deste bloco por tamanho (veja no preview)"
327
+ },
328
+ shell: {
329
+ restoreChrome: "Mostrar o chrome (Shift+C)",
330
+ frameTitle: (o) => `Pré-visualização de ${o}`,
331
+ noRoute: "Nenhuma rota para este endereço",
332
+ noRouteHint: "não casa com nenhuma rota declarada. Escolha uma tela na navegação.",
333
+ outsideHandoff: "Fora do escopo deste handoff",
334
+ outsideHandoffHint: "Este link permite revisar somente os cenários, rotas e componentes listados no handoff. Escolha um item disponível na navegação.",
335
+ empty: "Nada para mostrar ainda",
336
+ emptyHint: "O produto ainda não registrou telas nem componentes."
337
+ }
338
+ }, Z = {
339
+ network: {
340
+ success: "Success",
341
+ loading: "Loading",
342
+ empty: "Empty",
343
+ error: "Error",
344
+ slow: "Slow"
345
+ },
346
+ viewport: {
347
+ fit: "Fit",
348
+ mobile: "Mobile",
349
+ tablet: "Tablet",
350
+ desktop: "Desktop",
351
+ custom: "Custom"
352
+ },
353
+ topbar: {
354
+ region: "Design Space bar",
355
+ viewportGroup: "Viewport",
356
+ rotate: "Rotate",
357
+ zoomOut: "Zoom out",
358
+ zoomIn: "Zoom in",
359
+ zoomReset: "Reset zoom to 100%",
360
+ zoomValue: (o) => `${o}%`,
361
+ copyLink: "Copy link",
362
+ copied: "Link copied",
363
+ copyPrompt: "Copy the link:",
364
+ cleanReview: "Clean review (Shift+C)",
365
+ highlight: "Highlight components",
366
+ openFrame: "Open in new window",
367
+ lightMode: "Light theme",
368
+ darkMode: "Dark theme",
369
+ engineVersion: (o) => `Design Space ${o}`,
370
+ diagnostics: (o, a) => `Diagnostics: ${o} ${o === 1 ? "error" : "errors"}, ${a} ${a === 1 ? "warning" : "warnings"}`,
371
+ branchTitle: (o) => `Branch: ${o}`,
372
+ commitTitle: (o) => `Commit: ${o}`,
373
+ envTitle: (o) => `Environment: ${o}`
374
+ },
375
+ highlight: {
376
+ notInCatalog: (o) => `${o} · not in catalog`
377
+ },
378
+ sidebar: {
379
+ region: "Navigation",
380
+ tabs: "Screens and components",
381
+ screensTab: "Screens",
382
+ componentsTab: "Components",
383
+ searchPlaceholder: "Search",
384
+ searchLabel: "Search screens and components",
385
+ searchShortcut: "⌘K",
386
+ noMatch: (o) => `Nothing found for "${o}".`,
387
+ emptyScreens: "No screens on this branch. Feature screens come in through a pull request while they are being designed.",
388
+ emptyComponents: "The product has not registered any components yet.",
389
+ ungrouped: "Other",
390
+ toggleGroup: (o) => `Show or hide ${o}`,
391
+ resize: "Resize navigation"
392
+ },
393
+ panel: {
394
+ region: "Panel",
395
+ searchPlaceholder: "Filter",
396
+ searchLabel: "Filter variations and details",
397
+ searchShortcut: "⌘F",
398
+ noMatch: (o) => `Nothing in this panel for "${o}".`,
399
+ tabs: "Variations and information",
400
+ variationsTab: "Variations",
401
+ infoTab: "Information",
402
+ resize: "Resize panel",
403
+ variationsList: "Screen variations",
404
+ componentVariations: "Component variations",
405
+ defaultVariation: "Default",
406
+ defaultVariationHint: "The screen without a declared scenario or fixture.",
407
+ noVariations: "This screen has no variations.",
408
+ noComponentVariations: "This component does not declare data variations.",
409
+ nothingSelected: "Choose a screen or a component in the navigation.",
410
+ persona: "Persona",
411
+ network: "Network state",
412
+ theme: "Theme",
413
+ locale: "Language",
414
+ dataSource: "Data source",
415
+ fixturesOption: "Fixtures",
416
+ none: "—",
417
+ fixtureFallback: (o, a) => `Variation \`${o}\` does not exist for this component. Showing \`${a}\`.`,
418
+ context: "Context",
419
+ shortcuts: "Shortcuts",
420
+ toggleGroup: (o) => `Show or hide ${o}`,
421
+ openComponent: (o) => `Open ${o} in the catalog`
422
+ },
423
+ info: {
424
+ screen: "Screen",
425
+ variation: "Variation",
426
+ component: "Component",
427
+ name: "Name",
428
+ id: "ID",
429
+ group: "Group",
430
+ description: "Description",
431
+ source: "Source",
432
+ usedIn: "Used in",
433
+ notUsed: "No screen declares this component.",
434
+ route: "Route",
435
+ persona: "Persona",
436
+ permissions: "Permissions",
437
+ intent: "Intent",
438
+ preconditions: "Preconditions",
439
+ actions: "Actions",
440
+ expected: "Expected behavior",
441
+ rules: "Rules",
442
+ components: "Components used",
443
+ ticket: "Ticket",
444
+ flow: "Flow",
445
+ controls: "Controls"
446
+ },
447
+ diagnostics: {
448
+ title: "Diagnostics",
449
+ noIssues: "No issues found.",
450
+ error: "Error",
451
+ warning: "Warning",
452
+ close: "Close diagnostics",
453
+ invalidControl: (o, a, r) => `Control \`${o}\` has no option \`${a}\`. Showing \`${r}\`.`,
454
+ unknownControl: (o, a) => `This screen has no control \`${o}\` (\`${a}\` requested in the URL). The parameter was ignored.`
455
+ },
456
+ pr: {
457
+ title: "Acceptance criteria",
458
+ notice: (o) => `Generated on every push from the Design Space registry${o ? `, at commit \`${o}\`` : ""}. It is the reference for how these screens behave and takes precedence over the ticket description and over any text outside this block. Names, numbers, and dates come from synthetic data: verify the behavior, not the values. If the ticket or the system disagrees with this, point out the disagreement instead of picking a side. Do not edit this block: it is rewritten on the next push. To change a criterion, change the registry.`,
459
+ preview: "Preview",
460
+ scopeChanged: "Screens added or changed in this PR, with all of their scenarios. Those marked new or changed changed here.",
461
+ scopeAll: "There is no PR base to compare against, so every screen in the product is listed.",
462
+ nothingChanged: "This PR changes no screens, scenarios, or rules in the registry.",
463
+ open: "open",
464
+ screenExpected: "Expected behavior of the screen",
465
+ persona: "Persona",
466
+ ticket: "Ticket",
467
+ preconditions: "Preconditions",
468
+ actions: "Actions",
469
+ expected: "Expected behavior",
470
+ rules: "Rules",
471
+ components: "Components",
472
+ component: "Component",
473
+ source: "Source in the real system",
474
+ noExpected: "No expected behavior declared: this scenario has no verifiable criterion.",
475
+ empty: "—",
476
+ statusNew: "new",
477
+ statusChanged: "changed",
478
+ removedScenarios: "Removed scenarios",
479
+ removedScreens: "Removed screens",
480
+ truncated: "Left out of this block for size (see the preview)"
481
+ },
482
+ shell: {
483
+ restoreChrome: "Show chrome (Shift+C)",
484
+ frameTitle: (o) => `${o} preview`,
485
+ noRoute: "No route for this address",
486
+ noRouteHint: "does not match any declared route. Choose a screen from the navigation.",
487
+ outsideHandoff: "Outside this handoff scope",
488
+ outsideHandoffHint: "This link only allows review of the scenarios, routes, and components listed in the handoff. Choose an available item from the navigation.",
489
+ empty: "Nothing to show yet",
490
+ emptyHint: "The product has not registered any screens or components yet."
491
+ }
492
+ };
493
+ function J(o) {
494
+ if (!o) return v;
495
+ const a = { ...v };
496
+ for (const r of Object.keys(v)) {
497
+ const c = o[r];
498
+ c && (a[r] = { ...v[r], ...c });
499
+ }
500
+ return a;
501
+ }
502
+ const I = B(v);
503
+ function Q() {
504
+ return H(I);
505
+ }
506
+ const X = v.network;
507
+ export {
508
+ v as D,
509
+ Z as E,
510
+ I as L,
511
+ X as N,
512
+ K as a,
513
+ q as c,
514
+ j as g,
515
+ g as n,
516
+ J as r,
517
+ W as s,
518
+ Q as u
519
+ };
520
+ //# sourceMappingURL=labels-BlpcrSph.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"labels-BlpcrSph.js","sources":["../src/registry/index.ts","../src/shell/labels.ts"],"sourcesContent":["/**\n * Registry: índice consultável do produto (E1).\n *\n * A navegação e o agente de IA precisam localizar tela, cenário, persona,\n * fixture, regra e componente sem varrer o projeto. O registry é esse índice,\n * construído uma vez a partir da `ProductDefinition`.\n *\n * O modelo de organização é o menor possível: **uma tela é uma rota**, e as\n * **variações** da tela são os cenários cuja `route` casa com ela. Não existe\n * outra camada de agrupamento para manter em sincronia com as rotas.\n */\n\nimport type {\n ComponentPreview,\n Control,\n ControlGroup,\n ComponentPreviewFixture,\n Fixture,\n HandoffScope,\n Persona,\n ProductDefinition,\n RouteDefinition,\n Rule,\n Scenario,\n} from \"../types/index.js\";\nimport { validateProduct, type ValidationIssue } from \"./validate.js\";\nimport {\n handoffAllowsComponent,\n handoffAllowsPath,\n handoffAllowsScenario,\n} from \"../handoff/index.js\";\nimport { resolveRoute, screenHref } from \"../router/index.js\";\n\n/**\n * Uma tela: uma rota declarada e as variações dela.\n *\n * `variations` vazio é caso válido — a rota ainda é uma tela, aberta numa\n * variação implícita, sem fixture.\n */\nexport type ScreenNode = {\n /** O `path` da rota. Estável e único, serve de identificador da tela. */\n id: string;\n /** `route.name`, ou o título do primeiro cenário, ou o `path`. */\n name: string;\n description: string | undefined;\n route: RouteDefinition;\n /**\n * Caminho concreto para abrir a tela sem cenário: o `path` com os exemplos de\n * `route.params` no lugar dos parâmetros. `*` sem exemplo é removido; `:id`\n * sem exemplo fica literal.\n */\n href: string;\n /** Cenários da rota, na ordem de `scenarios`. */\n variations: Scenario[];\n /** `route.group`, sem espaços nas pontas; `undefined` quando a tela não tem fluxo. */\n group: string | undefined;\n /** `route.controls`, ou lista vazia. */\n controls: ControlGroup[];\n};\n\n/**\n * Um fluxo: as telas que declaram o mesmo `route.group`, na ordem de `routes`.\n * O fluxo sem nome reúne as telas sem `group` e vem sempre primeiro.\n */\nexport type FlowNode = {\n name: string | undefined;\n screens: ScreenNode[];\n};\n\n/** Um valor de controle pedido pela URL que o motor não pôde usar. */\nexport type InvalidControl = {\n id: string;\n value: string;\n /** `unknown-control`: a tela não tem esse controle. `invalid-value`: o valor não é uma das opções. */\n reason: \"unknown-control\" | \"invalid-value\";\n /** Valor usado no lugar, quando o controle existe. */\n fallback?: string;\n};\n\nexport type ControlResolution = {\n /** Valor de cada controle da tela, na ordem declarada. */\n values: Record<string, string>;\n invalid: InvalidControl[];\n};\n\nexport type ScenarioQueryOptions = {\n /** Recorte de handoff. Sem ele, todo cenário registrado é visível. */\n handoff?: HandoffScope;\n};\n\nexport type ComponentFixtureResolution = {\n fixture: ComponentPreviewFixture | undefined;\n /** Id que veio da URL, inclusive quando não existe. */\n requestedId: string | undefined;\n /** `true` quando a URL pediu um id inexistente e o motor usou o fallback. */\n didFallback: boolean;\n};\n\nexport type Registry = {\n product: ProductDefinition;\n /** Telas na ordem de `routes`, cada uma com suas variações. */\n screens: ScreenNode[];\n issues: ValidationIssue[];\n /**\n * `product.defaultPersona`, quando é uma persona registrada. É a persona de\n * toda tela e cenário sem persona própria.\n */\n defaultPersona: string | undefined;\n\n scenario: (id: string | undefined) => Scenario | undefined;\n component: (id: string | undefined) => ComponentPreview | undefined;\n componentFixture: (\n componentId: string | undefined,\n fixtureId: string | undefined,\n ) => ComponentPreviewFixture | undefined;\n resolveComponentFixture: (\n componentId: string | undefined,\n requestedId: string | undefined,\n ) => ComponentFixtureResolution;\n persona: (id: string | undefined) => Persona | undefined;\n fixture: (id: string | undefined) => Fixture | undefined;\n rule: (id: string | undefined) => Rule | undefined;\n\n /** Tela por id (o `path` da rota). */\n screen: (id: string | undefined) => ScreenNode | undefined;\n /** Tela que renderiza um endereço, pelo mesmo casamento do roteador. */\n screenForPath: (path: string) => ScreenNode | undefined;\n /** Tela da qual o cenário é variação. */\n screenOf: (scenario: Scenario | undefined) => ScreenNode | undefined;\n /** Telas permitidas pelo recorte, com variações também filtradas. */\n screensFor: (options?: ScenarioQueryOptions) => ScreenNode[];\n /** Telas permitidas pelo recorte, agrupadas por fluxo (`route.group`). */\n flows: (options?: ScenarioQueryOptions) => FlowNode[];\n /** O fluxo de uma tela, com as telas dele permitidas pelo recorte. */\n flowOf: (screen: ScreenNode | undefined, options?: ScenarioQueryOptions) => FlowNode | undefined;\n /** Controles da tela, na ordem dos grupos. */\n controlsOf: (screen: ScreenNode | undefined) => Control[];\n /**\n * Valores dos controles da tela: o padrão de cada controle, depois o que o\n * cenário fixa, depois o que a URL pede. Pedido inválido cai no valor de baixo\n * e volta em `invalid`.\n */\n resolveControls: (\n screen: ScreenNode | undefined,\n input?: { scenario?: Scenario; requested?: Record<string, string> },\n ) => ControlResolution;\n\n /** Regras de um cenário, resolvidas e na ordem declarada. */\n rulesOf: (scenario: Scenario | undefined) => Rule[];\n /**\n * Permissões efetivas: as do cenário, ou as da persona dele quando ausentes —\n * e a persona dele é a própria ou, na falta, a padrão do produto.\n */\n permissionsOf: (scenario: Scenario | undefined) => string[];\n /** Variações da tela que renderiza `route`. */\n scenariosForRoute: (route: string, options?: ScenarioQueryOptions) => Scenario[];\n /** Cenários permitidos pelo recorte; sem handoff devolve todos. */\n activeScenarios: (options?: ScenarioQueryOptions) => Scenario[];\n /**\n * Busca de cenário por vocabulário de negócio, sem diferenciar acento nem\n * caixa: \"aprovacao\" acha \"Aprovação\".\n */\n search: (query: string, options?: ScenarioQueryOptions) => Scenario[];\n /** Busca de telas: nome, descrição, rota, fluxo e as variações de cada uma. */\n searchScreens: (query: string, options?: ScenarioQueryOptions) => ScreenNode[];\n /** Busca de componentes: nome, descrição, grupo, id e `source`. */\n searchComponents: (query: string, handoff?: HandoffScope) => ComponentPreview[];\n /** Componentes permitidos pelo recorte; sem handoff devolve o catálogo. */\n componentsFor: (handoff?: HandoffScope) => ComponentPreview[];\n /**\n * Componentes usados por uma tela: `route.components` e depois a união de\n * `components` das variações, na ordem em que aparecem. Id sem componente\n * registrado fica de fora.\n */\n componentsOfScreen: (screen: ScreenNode | undefined, scenario?: Scenario) => ComponentPreview[];\n /** Telas que listam o componente em `route.components` ou em um cenário. */\n usagesOf: (componentId: string | undefined, options?: ScenarioQueryOptions) => ScreenNode[];\n};\n\nexport function createRegistry(product: ProductDefinition): Registry {\n const scenarioList = product.scenarios ?? [];\n const routeList = product.routes ?? [];\n const componentList = product.components ?? [];\n\n const scenarios = new Map(scenarioList.map((s) => [s.id, s]));\n const components = new Map(componentList.map((component) => [component.id, component]));\n const personas = new Map((product.personas ?? []).map((p) => [p.id, p]));\n const fixtures = new Map((product.fixtures ?? []).map((f) => [f.id, f]));\n const rules = new Map((product.rules ?? []).map((r) => [r.id, r]));\n\n // Cada cenário pertence à rota que o roteador escolheria para ele. Casar pela\n // forma, e não por igualdade de texto, é o que põe `/requests/REQ-1` na tela\n // `/requests/:id` — e a especificidade põe `/requests/new` na tela literal.\n const variationsByPath = new Map<string, Scenario[]>();\n const screenPathOf = new Map<string, string>();\n for (const scenario of scenarioList) {\n const match = resolveRoute(routeList, scenario.route ?? \"\");\n if (!match) continue;\n const path = match.definition.path;\n screenPathOf.set(scenario.id, path);\n const list = variationsByPath.get(path) ?? [];\n list.push(scenario);\n variationsByPath.set(path, list);\n }\n\n const seen = new Set<string>();\n const screens: ScreenNode[] = [];\n for (const route of routeList) {\n // Rota duplicada é erro de validação; aqui só a primeira vira tela.\n if (seen.has(route.path)) continue;\n seen.add(route.path);\n const variations = variationsByPath.get(route.path) ?? [];\n screens.push({\n id: route.path,\n name: route.name?.trim() || variations[0]?.title || route.path,\n description: route.description,\n route,\n href: screenHref(route.path, route.params),\n variations,\n group: route.group?.trim() || undefined,\n controls: Array.isArray(route.controls) ? route.controls : [],\n });\n }\n const screensById = new Map(screens.map((screen) => [screen.id, screen]));\n\n const scenario = (id: string | undefined) => (id ? scenarios.get(id) : undefined);\n const persona = (id: string | undefined) => (id ? personas.get(id) : undefined);\n const defaultPersona = persona(product.defaultPersona)?.id;\n const componentFixture = (componentId: string | undefined, fixtureId: string | undefined) => {\n if (!componentId || !fixtureId) return undefined;\n return components.get(componentId)?.fixtures?.find((fixture) => fixture.id === fixtureId);\n };\n const visibleScenarios = (options: ScenarioQueryOptions = {}) =>\n scenarioList.filter((target) => handoffAllowsScenario(options.handoff, target.id));\n\n const screenForPath = (path: string) => {\n const match = resolveRoute(routeList, path);\n return match ? screensById.get(match.definition.path) : undefined;\n };\n\n const screensFor = (options: ScenarioQueryOptions = {}): ScreenNode[] => {\n const { handoff } = options;\n if (!handoff) return screens;\n return screens\n .map((screen) => ({\n ...screen,\n variations: screen.variations.filter((target) => handoffAllowsScenario(handoff, target.id)),\n }))\n .filter(\n (screen) =>\n screen.variations.length > 0 ||\n ((handoff.routes ?? []).length > 0 && handoffAllowsPath(handoff, screen.href)),\n );\n };\n\n const permissionsOf = (target: Scenario | undefined): string[] => {\n if (!target) return [];\n if (target.permissions) return target.permissions;\n return persona(target.persona ?? defaultPersona)?.permissions ?? [];\n };\n\n const flows = (options: ScenarioQueryOptions = {}) => groupScreens(screensFor(options));\n\n const componentIdsOf = (screen: ScreenNode | undefined, scenario?: Scenario): string[] => {\n const ids = new Set<string>(screen?.route.components ?? []);\n const sources = scenario ? [scenario] : (screen?.variations ?? []);\n for (const variation of sources) {\n for (const id of variation.components ?? []) ids.add(id);\n }\n return [...ids];\n };\n\n const componentsFor = (handoff?: HandoffScope) =>\n componentList.filter((component) => handoffAllowsComponent(handoff, component.id));\n\n return {\n product,\n screens,\n issues: validateProduct(product),\n defaultPersona,\n\n scenario,\n component: (id) => (id ? components.get(id) : undefined),\n componentFixture,\n resolveComponentFixture: (componentId, requestedId) => {\n const component = componentId ? components.get(componentId) : undefined;\n const requested = componentFixture(componentId, requestedId);\n const fallback =\n componentFixture(componentId, component?.defaultFixture) ?? component?.fixtures?.[0];\n return {\n fixture: requested ?? fallback,\n requestedId,\n didFallback: Boolean(requestedId && !requested),\n };\n },\n persona,\n fixture: (id) => (id ? fixtures.get(id) : undefined),\n rule: (id) => (id ? rules.get(id) : undefined),\n\n screen: (id) => (id ? screensById.get(id) : undefined),\n screenForPath,\n screenOf: (target) => {\n const path = target ? screenPathOf.get(target.id) : undefined;\n return path ? screensById.get(path) : undefined;\n },\n screensFor,\n flows,\n flowOf: (screen, options) => {\n if (!screen) return undefined;\n return flows(options).find((flow) => flow.name === screen.group);\n },\n controlsOf: (screen) => (screen?.controls ?? []).flatMap((group) => group.controls ?? []),\n resolveControls: (screen, input = {}) =>\n resolveScreenControls(screen?.controls ?? [], input),\n\n rulesOf: (target) =>\n (target?.rules ?? []).map((id) => rules.get(id)).filter((r): r is Rule => Boolean(r)),\n permissionsOf,\n\n scenariosForRoute: (route, options) => {\n const screen = screenForPath(route);\n if (!screen) return [];\n return screen.variations.filter((target) => handoffAllowsScenario(options?.handoff, target.id));\n },\n\n activeScenarios: visibleScenarios,\n\n search: (query, options) => {\n const needle = normalizeSearch(query);\n const visible = visibleScenarios(options);\n if (!needle) return visible;\n return visible.filter((s) =>\n normalizeSearch(\n [\n s.title,\n s.id,\n s.intent ?? \"\",\n s.route,\n persona(s.persona)?.name ?? \"\",\n (s.tags ?? []).join(\" \"),\n (s.expected ?? []).join(\" \"),\n ].join(\" \"),\n ).includes(needle),\n );\n },\n\n searchScreens: (query, options) => {\n const needle = normalizeSearch(query);\n const visible = screensFor(options);\n if (!needle) return visible;\n return visible.filter((screen) =>\n normalizeSearch(\n [\n screen.name,\n screen.description ?? \"\",\n screen.id,\n screen.group ?? \"\",\n ...screen.variations.flatMap((variation) => [\n variation.title,\n variation.id,\n (variation.tags ?? []).join(\" \"),\n ]),\n ].join(\" \"),\n ).includes(needle),\n );\n },\n\n searchComponents: (query, handoff) => {\n const needle = normalizeSearch(query);\n const visible = componentsFor(handoff);\n if (!needle) return visible;\n return visible.filter((component) =>\n normalizeSearch(\n [\n component.name,\n component.description ?? \"\",\n component.group ?? \"\",\n component.id,\n component.source ?? \"\",\n ].join(\" \"),\n ).includes(needle),\n );\n },\n\n componentsFor,\n\n componentsOfScreen: (screen, scenario) =>\n componentIdsOf(screen, scenario)\n .map((id) => components.get(id))\n .filter((component): component is ComponentPreview => Boolean(component)),\n\n usagesOf: (componentId, options) => {\n if (!componentId) return [];\n return screensFor(options).filter(\n (screen) =>\n screen.route.components?.includes(componentId) ||\n screen.variations.some((variation) => variation.components?.includes(componentId)),\n );\n },\n };\n}\n\n/**\n * Minúsculas sem acento e sem espaço nas pontas: \"Aprovação\" acha \"aprovacao\".\n * A navegação usa exatamente a mesma regra do registry.\n */\nexport function normalizeSearch(value: string): string {\n return value\n .toLowerCase()\n .normalize(\"NFD\")\n .replace(/[̀-ͯ]/g, \"\")\n .trim();\n}\n\n/**\n * Telas agrupadas por fluxo, na ordem em que cada fluxo aparece. As telas sem\n * fluxo formam o primeiro grupo, sem nome.\n */\nexport function groupScreens(screens: ScreenNode[]): FlowNode[] {\n const loose: ScreenNode[] = [];\n const named = new Map<string, ScreenNode[]>();\n for (const screen of screens) {\n if (!screen.group) {\n loose.push(screen);\n continue;\n }\n const list = named.get(screen.group) ?? [];\n list.push(screen);\n named.set(screen.group, list);\n }\n const flows: FlowNode[] = [...named].map(([name, items]) => ({ name, screens: items }));\n return loose.length > 0 ? [{ name: undefined, screens: loose }, ...flows] : flows;\n}\n\n/** Valor padrão de um controle: `default` quando é uma opção, senão a primeira. */\nexport function controlDefault(control: Control): string {\n const options = control.options ?? [];\n if (control.default !== undefined && options.some((option) => option.value === control.default)) {\n return control.default;\n }\n return options[0]?.value ?? \"\";\n}\n\n/**\n * Resolve os valores de um conjunto de grupos de controles. Precedência, do mais\n * fraco ao mais forte: padrão do controle, valor do cenário, pedido da URL. Um\n * valor que não é opção do controle nunca é usado.\n */\nexport function resolveScreenControls(\n groups: ControlGroup[],\n input: { scenario?: Scenario; requested?: Record<string, string> } = {},\n): ControlResolution {\n const values: Record<string, string> = {};\n const invalid: InvalidControl[] = [];\n const known = new Set<string>();\n const requested = input.requested ?? {};\n for (const group of groups) {\n for (const control of group.controls ?? []) {\n if (known.has(control.id)) continue;\n known.add(control.id);\n const isOption = (value: string | undefined) =>\n value !== undefined && (control.options ?? []).some((option) => option.value === value);\n let value = controlDefault(control);\n const fromScenario = input.scenario?.controls?.[control.id];\n if (isOption(fromScenario)) value = fromScenario!;\n const asked = requested[control.id];\n if (asked !== undefined) {\n if (isOption(asked)) value = asked;\n else invalid.push({ id: control.id, value: asked, reason: \"invalid-value\", fallback: value });\n }\n values[control.id] = value;\n }\n }\n for (const [id, value] of Object.entries(requested)) {\n if (!known.has(id)) invalid.push({ id, value, reason: \"unknown-control\" });\n }\n return { values, invalid };\n}\n\n/**\n * `true` quando os valores atuais ainda são a combinação que o cenário fixa. É o\n * que decide se o atalho aparece destacado depois de um controle mudar.\n */\nexport function scenarioMatchesControls(\n scenario: Scenario | undefined,\n values: Record<string, string> | undefined,\n): boolean {\n if (!scenario) return false;\n return Object.entries(scenario.controls ?? {}).every(([id, value]) => values?.[id] === value);\n}\n","/**\n * Vocabulário do motor, com o português como padrão e override pelo produto.\n *\n * O motor é neutro quanto ao produto e agora também quanto ao idioma. A razão é\n * concreta: o chrome fica na mesma tela que a UI do cliente, então um Design\n * Space revisado em inglês misturava \"Copiar link\" e \"Revisão limpa\" com a\n * interface dele. Traduzir só parte do chrome seria pior que não traduzir — o\n * rótulo em outro idioma vira ruído no meio da revisão.\n *\n * Rótulo de **produto** continua vindo do produto: nome de tela, título de\n * cenário, nome de persona, rótulo de fixture. O que vive aqui é rótulo de\n * **mecanismo**.\n *\n * O produto sobrescreve o que quiser em `theme.labels`, por grupo, e o que não\n * declarar fica no padrão:\n *\n * ```ts\n * theme: {\n * labels: {\n * network: { success: \"Success\", error: \"Error\" },\n * topbar: { copyLink: \"Copy link\" },\n * },\n * }\n * ```\n */\n\nimport { createContext, useContext } from \"react\";\n\nimport type { NetworkState } from \"../types/index.js\";\n\nexport type Labels = {\n network: Record<NetworkState, string>;\n /** Rótulo de viewport por id: `fit`, `mobile`, `tablet`, `desktop`, `custom`. */\n viewport: Record<string, string>;\n topbar: {\n region: string;\n viewportGroup: string;\n rotate: string;\n zoomOut: string;\n zoomIn: string;\n zoomReset: string;\n zoomValue: (percent: number) => string;\n copyLink: string;\n copied: string;\n copyPrompt: string;\n cleanReview: string;\n highlight: string;\n /** Abre o quadro sozinho, sem o chrome, numa janela própria. */\n openFrame: string;\n lightMode: string;\n darkMode: string;\n engineVersion: (version: string) => string;\n diagnostics: (errors: number, warnings: number) => string;\n branchTitle: (branch: string) => string;\n commitTitle: (commit: string) => string;\n envTitle: (env: string) => string;\n };\n highlight: {\n /** Rótulo do contorno quando o id marcado não está no catálogo. */\n notInCatalog: (id: string) => string;\n };\n sidebar: {\n region: string;\n tabs: string;\n screensTab: string;\n componentsTab: string;\n searchPlaceholder: string;\n searchLabel: string;\n searchShortcut: string;\n noMatch: (query: string) => string;\n emptyScreens: string;\n emptyComponents: string;\n ungrouped: string;\n toggleGroup: (group: string) => string;\n resize: string;\n };\n panel: {\n region: string;\n searchPlaceholder: string;\n searchLabel: string;\n searchShortcut: string;\n noMatch: (query: string) => string;\n tabs: string;\n variationsTab: string;\n infoTab: string;\n resize: string;\n variationsList: string;\n componentVariations: string;\n defaultVariation: string;\n defaultVariationHint: string;\n noVariations: string;\n noComponentVariations: string;\n nothingSelected: string;\n persona: string;\n network: string;\n theme: string;\n locale: string;\n dataSource: string;\n fixturesOption: string;\n none: string;\n fixtureFallback: (requested: string, fallback: string) => string;\n /** Título do bloco de persona, rede, tema, idioma e fonte de dados. */\n context: string;\n /** Título do bloco dos cenários da tela, depois dos controles. */\n shortcuts: string;\n toggleGroup: (group: string) => string;\n openComponent: (component: string) => string;\n };\n info: {\n screen: string;\n variation: string;\n component: string;\n name: string;\n id: string;\n group: string;\n description: string;\n source: string;\n usedIn: string;\n notUsed: string;\n route: string;\n persona: string;\n permissions: string;\n intent: string;\n preconditions: string;\n actions: string;\n expected: string;\n rules: string;\n components: string;\n ticket: string;\n flow: string;\n controls: string;\n /** @deprecated Sem uso desde a 0.14: o PR passou a ser escrito por `design-space-pr`. */\n copyForPr?: string;\n /** @deprecated Sem uso desde a 0.14. */\n copiedForPr?: string;\n /** @deprecated Sem uso desde a 0.14. */\n copyPrompt?: string;\n };\n diagnostics: {\n title: string;\n noIssues: string;\n error: string;\n warning: string;\n close: string;\n invalidControl: (id: string, value: string, fallback: string) => string;\n unknownControl: (id: string, value: string) => string;\n };\n /**\n * Texto da descrição do PR que `design-space-pr` escreve: o bloco gerado do\n * registro e as seções que só uma pessoa sabe preencher. Ver a decisão 0018.\n */\n pr: {\n title: string;\n /** Recado para quem implementa ou valida, inclusive agentes. */\n notice: (shortCommit: string | undefined) => string;\n preview: string;\n scopeChanged: string;\n scopeAll: string;\n nothingChanged: string;\n open: string;\n screenExpected: string;\n persona: string;\n ticket: string;\n preconditions: string;\n actions: string;\n expected: string;\n rules: string;\n components: string;\n component: string;\n source: string;\n noExpected: string;\n empty: string;\n statusNew: string;\n statusChanged: string;\n removedScenarios: string;\n removedScreens: string;\n /** Telas que não couberam no limite de tamanho da descrição. */\n truncated: string;\n /** @deprecated Sem uso desde a 0.14, junto com o \"Copiar para o PR\". */\n variations?: string;\n /** @deprecated Sem uso desde a 0.14. */\n commit?: (shortCommit: string) => string;\n /** @deprecated Sem uso desde a 0.14. */\n immutableLink?: string;\n /** @deprecated Sem uso desde a 0.14. */\n controls?: string;\n /** @deprecated Sem uso desde a 0.14. */\n shortcuts?: string;\n /** @deprecated Sem uso desde a 0.14. */\n defaultOption?: string;\n };\n shell: {\n restoreChrome: string;\n frameTitle: (product: string) => string;\n noRoute: string;\n noRouteHint: string;\n outsideHandoff: string;\n outsideHandoffHint: string;\n empty: string;\n emptyHint: string;\n };\n};\n\n/** Português. É o padrão, não uma obrigação. */\nexport const DEFAULT_LABELS: Labels = {\n network: {\n success: \"Sucesso\",\n loading: \"Carregando\",\n empty: \"Vazio\",\n error: \"Erro\",\n slow: \"Lento\",\n },\n\n viewport: {\n fit: \"Ajustar\",\n mobile: \"Celular\",\n tablet: \"Tablet\",\n desktop: \"Desktop\",\n custom: \"Personalizado\",\n },\n\n topbar: {\n region: \"Barra do Design Space\",\n viewportGroup: \"Viewport\",\n rotate: \"Girar\",\n zoomOut: \"Diminuir zoom\",\n zoomIn: \"Aumentar zoom\",\n zoomReset: \"Voltar o zoom para 100%\",\n zoomValue: (percent) => `${percent}%`,\n copyLink: \"Copiar link\",\n copied: \"Link copiado\",\n copyPrompt: \"Copie o link:\",\n cleanReview: \"Revisão limpa (Shift+C)\",\n highlight: \"Destacar componentes\",\n openFrame: \"Abrir em nova janela\",\n lightMode: \"Tema claro\",\n darkMode: \"Tema escuro\",\n engineVersion: (version) => `Design Space ${version}`,\n diagnostics: (errors, warnings) =>\n `Diagnóstico: ${errors} ${errors === 1 ? \"erro\" : \"erros\"}, ${warnings} ${\n warnings === 1 ? \"aviso\" : \"avisos\"\n }`,\n branchTitle: (branch) => `Branch: ${branch}`,\n commitTitle: (commit) => `Commit: ${commit}`,\n envTitle: (env) => `Ambiente: ${env}`,\n },\n\n highlight: {\n notInCatalog: (id) => `${id} · fora do catálogo`,\n },\n\n sidebar: {\n region: \"Navegação\",\n tabs: \"Telas e componentes\",\n screensTab: \"Telas\",\n componentsTab: \"Componentes\",\n searchPlaceholder: \"Buscar\",\n searchLabel: \"Buscar telas e componentes\",\n searchShortcut: \"⌘K\",\n noMatch: (query) => `Nada encontrado para \"${query}\".`,\n emptyScreens: \"Nenhuma tela neste branch. Telas de feature entram por PR, enquanto estão em desenho.\",\n emptyComponents: \"O produto ainda não registrou componentes.\",\n ungrouped: \"Outros\",\n toggleGroup: (group) => `Mostrar ou ocultar ${group}`,\n resize: \"Redimensionar a navegação\",\n },\n\n panel: {\n region: \"Painel\",\n searchPlaceholder: \"Filtrar\",\n searchLabel: \"Filtrar variações e informações\",\n searchShortcut: \"⌘F\",\n noMatch: (query) => `Nada neste painel para \"${query}\".`,\n tabs: \"Variações e informações\",\n variationsTab: \"Variações\",\n infoTab: \"Informações\",\n resize: \"Redimensionar o painel\",\n variationsList: \"Variações da tela\",\n componentVariations: \"Variações do componente\",\n defaultVariation: \"Padrão\",\n defaultVariationHint: \"A tela sem cenário declarado, sem fixture.\",\n noVariations: \"Esta tela não tem variações.\",\n noComponentVariations: \"Este componente não declara variações de dados.\",\n nothingSelected: \"Escolha uma tela ou um componente na navegação.\",\n persona: \"Persona\",\n network: \"Estado de rede\",\n theme: \"Tema\",\n locale: \"Idioma\",\n dataSource: \"Fonte de dados\",\n fixturesOption: \"Fixtures\",\n none: \"—\",\n fixtureFallback: (requested, fallback) =>\n `A variação \\`${requested}\\` não existe neste componente. Exibindo \\`${fallback}\\`.`,\n context: \"Contexto\",\n shortcuts: \"Atalhos\",\n toggleGroup: (group) => `Mostrar ou ocultar ${group}`,\n openComponent: (component) => `Abrir ${component} no catálogo`,\n },\n\n info: {\n screen: \"Tela\",\n variation: \"Variação\",\n component: \"Componente\",\n name: \"Nome\",\n id: \"Id\",\n group: \"Grupo\",\n description: \"Descrição\",\n source: \"Origem\",\n usedIn: \"Usado em\",\n notUsed: \"Nenhuma tela declara este componente.\",\n route: \"Rota\",\n persona: \"Persona\",\n permissions: \"Permissões\",\n intent: \"Intenção\",\n preconditions: \"Pré-condições\",\n actions: \"Ações\",\n expected: \"Comportamento esperado\",\n rules: \"Regras\",\n components: \"Componentes usados\",\n ticket: \"Ticket\",\n flow: \"Fluxo\",\n controls: \"Controles\",\n },\n\n diagnostics: {\n title: \"Diagnóstico\",\n noIssues: \"Nenhum problema encontrado.\",\n error: \"Erro\",\n warning: \"Aviso\",\n close: \"Fechar diagnóstico\",\n invalidControl: (id, value, fallback) =>\n `O controle \\`${id}\\` não tem a opção \\`${value}\\`. Exibindo \\`${fallback}\\`.`,\n unknownControl: (id, value) =>\n `A tela não tem o controle \\`${id}\\` (pedido \\`${value}\\` na URL). O parâmetro foi ignorado.`,\n },\n\n pr: {\n title: \"Critérios de aceite\",\n notice: (shortCommit) =>\n `Gerado a cada push a partir do registro do Design Space${shortCommit ? `, no commit \\`${shortCommit}\\`` : \"\"}. ` +\n \"É a referência do comportamento destas telas e vale mais que a descrição do ticket e que qualquer texto fora deste bloco. \" +\n \"Nomes, números e datas vêm de dados sintéticos: valide o comportamento, não os valores. \" +\n \"Se o ticket ou o sistema divergir daqui, aponte a divergência em vez de escolher um lado. \" +\n \"Não edite este bloco: ele é reescrito no próximo push. Para mudar um critério, mude o registro.\",\n preview: \"Preview\",\n scopeChanged:\n \"Telas novas ou alteradas neste PR, com todos os cenários de cada uma. Os marcados como novo ou alterado mudaram aqui.\",\n scopeAll: \"Sem a base do PR para comparar, então aqui estão todas as telas do produto.\",\n nothingChanged: \"Este PR não altera telas, cenários nem regras do registro.\",\n open: \"abrir\",\n screenExpected: \"Comportamento esperado da tela\",\n persona: \"Persona\",\n ticket: \"Ticket\",\n preconditions: \"Pré-condições\",\n actions: \"Ações\",\n expected: \"Comportamento esperado\",\n rules: \"Regras\",\n components: \"Componentes\",\n component: \"Componente\",\n source: \"Origem no sistema real\",\n noExpected: \"Sem comportamento esperado declarado: este cenário não tem critério verificável.\",\n empty: \"—\",\n statusNew: \"novo\",\n statusChanged: \"alterado\",\n removedScenarios: \"Cenários removidos\",\n removedScreens: \"Telas removidas\",\n truncated: \"Fora deste bloco por tamanho (veja no preview)\",\n },\n\n shell: {\n restoreChrome: \"Mostrar o chrome (Shift+C)\",\n frameTitle: (product) => `Pré-visualização de ${product}`,\n noRoute: \"Nenhuma rota para este endereço\",\n noRouteHint: \"não casa com nenhuma rota declarada. Escolha uma tela na navegação.\",\n outsideHandoff: \"Fora do escopo deste handoff\",\n outsideHandoffHint:\n \"Este link permite revisar somente os cenários, rotas e componentes listados no handoff. Escolha um item disponível na navegação.\",\n empty: \"Nada para mostrar ainda\",\n emptyHint: \"O produto ainda não registrou telas nem componentes.\",\n },\n};\n\n/** English (United States), selectable by the product through `theme.labels`. */\nexport const EN_US_LABELS: Labels = {\n network: {\n success: \"Success\",\n loading: \"Loading\",\n empty: \"Empty\",\n error: \"Error\",\n slow: \"Slow\",\n },\n\n viewport: {\n fit: \"Fit\",\n mobile: \"Mobile\",\n tablet: \"Tablet\",\n desktop: \"Desktop\",\n custom: \"Custom\",\n },\n\n topbar: {\n region: \"Design Space bar\",\n viewportGroup: \"Viewport\",\n rotate: \"Rotate\",\n zoomOut: \"Zoom out\",\n zoomIn: \"Zoom in\",\n zoomReset: \"Reset zoom to 100%\",\n zoomValue: (percent) => `${percent}%`,\n copyLink: \"Copy link\",\n copied: \"Link copied\",\n copyPrompt: \"Copy the link:\",\n cleanReview: \"Clean review (Shift+C)\",\n highlight: \"Highlight components\",\n openFrame: \"Open in new window\",\n lightMode: \"Light theme\",\n darkMode: \"Dark theme\",\n engineVersion: (version) => `Design Space ${version}`,\n diagnostics: (errors, warnings) =>\n `Diagnostics: ${errors} ${errors === 1 ? \"error\" : \"errors\"}, ${warnings} ${\n warnings === 1 ? \"warning\" : \"warnings\"\n }`,\n branchTitle: (branch) => `Branch: ${branch}`,\n commitTitle: (commit) => `Commit: ${commit}`,\n envTitle: (env) => `Environment: ${env}`,\n },\n\n highlight: {\n notInCatalog: (id) => `${id} · not in catalog`,\n },\n\n sidebar: {\n region: \"Navigation\",\n tabs: \"Screens and components\",\n screensTab: \"Screens\",\n componentsTab: \"Components\",\n searchPlaceholder: \"Search\",\n searchLabel: \"Search screens and components\",\n searchShortcut: \"⌘K\",\n noMatch: (query) => `Nothing found for \"${query}\".`,\n emptyScreens: \"No screens on this branch. Feature screens come in through a pull request while they are being designed.\",\n emptyComponents: \"The product has not registered any components yet.\",\n ungrouped: \"Other\",\n toggleGroup: (group) => `Show or hide ${group}`,\n resize: \"Resize navigation\",\n },\n\n panel: {\n region: \"Panel\",\n searchPlaceholder: \"Filter\",\n searchLabel: \"Filter variations and details\",\n searchShortcut: \"⌘F\",\n noMatch: (query) => `Nothing in this panel for \"${query}\".`,\n tabs: \"Variations and information\",\n variationsTab: \"Variations\",\n infoTab: \"Information\",\n resize: \"Resize panel\",\n variationsList: \"Screen variations\",\n componentVariations: \"Component variations\",\n defaultVariation: \"Default\",\n defaultVariationHint: \"The screen without a declared scenario or fixture.\",\n noVariations: \"This screen has no variations.\",\n noComponentVariations: \"This component does not declare data variations.\",\n nothingSelected: \"Choose a screen or a component in the navigation.\",\n persona: \"Persona\",\n network: \"Network state\",\n theme: \"Theme\",\n locale: \"Language\",\n dataSource: \"Data source\",\n fixturesOption: \"Fixtures\",\n none: \"—\",\n fixtureFallback: (requested, fallback) =>\n `Variation \\`${requested}\\` does not exist for this component. Showing \\`${fallback}\\`.`,\n context: \"Context\",\n shortcuts: \"Shortcuts\",\n toggleGroup: (group) => `Show or hide ${group}`,\n openComponent: (component) => `Open ${component} in the catalog`,\n },\n\n info: {\n screen: \"Screen\",\n variation: \"Variation\",\n component: \"Component\",\n name: \"Name\",\n id: \"ID\",\n group: \"Group\",\n description: \"Description\",\n source: \"Source\",\n usedIn: \"Used in\",\n notUsed: \"No screen declares this component.\",\n route: \"Route\",\n persona: \"Persona\",\n permissions: \"Permissions\",\n intent: \"Intent\",\n preconditions: \"Preconditions\",\n actions: \"Actions\",\n expected: \"Expected behavior\",\n rules: \"Rules\",\n components: \"Components used\",\n ticket: \"Ticket\",\n flow: \"Flow\",\n controls: \"Controls\",\n },\n\n diagnostics: {\n title: \"Diagnostics\",\n noIssues: \"No issues found.\",\n error: \"Error\",\n warning: \"Warning\",\n close: \"Close diagnostics\",\n invalidControl: (id, value, fallback) =>\n `Control \\`${id}\\` has no option \\`${value}\\`. Showing \\`${fallback}\\`.`,\n unknownControl: (id, value) =>\n `This screen has no control \\`${id}\\` (\\`${value}\\` requested in the URL). The parameter was ignored.`,\n },\n\n pr: {\n title: \"Acceptance criteria\",\n notice: (shortCommit) =>\n `Generated on every push from the Design Space registry${shortCommit ? `, at commit \\`${shortCommit}\\`` : \"\"}. ` +\n \"It is the reference for how these screens behave and takes precedence over the ticket description and over any text outside this block. \" +\n \"Names, numbers, and dates come from synthetic data: verify the behavior, not the values. \" +\n \"If the ticket or the system disagrees with this, point out the disagreement instead of picking a side. \" +\n \"Do not edit this block: it is rewritten on the next push. To change a criterion, change the registry.\",\n preview: \"Preview\",\n scopeChanged:\n \"Screens added or changed in this PR, with all of their scenarios. Those marked new or changed changed here.\",\n scopeAll: \"There is no PR base to compare against, so every screen in the product is listed.\",\n nothingChanged: \"This PR changes no screens, scenarios, or rules in the registry.\",\n open: \"open\",\n screenExpected: \"Expected behavior of the screen\",\n persona: \"Persona\",\n ticket: \"Ticket\",\n preconditions: \"Preconditions\",\n actions: \"Actions\",\n expected: \"Expected behavior\",\n rules: \"Rules\",\n components: \"Components\",\n component: \"Component\",\n source: \"Source in the real system\",\n noExpected: \"No expected behavior declared: this scenario has no verifiable criterion.\",\n empty: \"—\",\n statusNew: \"new\",\n statusChanged: \"changed\",\n removedScenarios: \"Removed scenarios\",\n removedScreens: \"Removed screens\",\n truncated: \"Left out of this block for size (see the preview)\",\n },\n\n shell: {\n restoreChrome: \"Show chrome (Shift+C)\",\n frameTitle: (product) => `${product} preview`,\n noRoute: \"No route for this address\",\n noRouteHint: \"does not match any declared route. Choose a screen from the navigation.\",\n outsideHandoff: \"Outside this handoff scope\",\n outsideHandoffHint:\n \"This link only allows review of the scenarios, routes, and components listed in the handoff. Choose an available item from the navigation.\",\n empty: \"Nothing to show yet\",\n emptyHint: \"The product has not registered any screens or components yet.\",\n },\n};\n\n/** Override por grupo. O que não vier declarado fica no padrão. */\nexport type LabelsOverride = {\n [Group in keyof Labels]?: Partial<Labels[Group]>;\n};\n\n/**\n * Mescla um grupo por vez. Dois níveis bastam porque a estrutura tem dois, e\n * mesclagem profunda genérica engoliria erro de digitação em vez de deixar o\n * TypeScript reclamar.\n */\nexport function resolveLabels(override?: LabelsOverride): Labels {\n if (!override) return DEFAULT_LABELS;\n\n const merged: Labels = { ...DEFAULT_LABELS };\n for (const key of Object.keys(DEFAULT_LABELS) as (keyof Labels)[]) {\n const group = override[key];\n // O cast é aqui porque o TypeScript perde a correlação entre a chave e o tipo\n // do grupo dentro do laço. A superfície pública continua tipada: quem escreve\n // `theme.labels` é checado contra `LabelsOverride`.\n if (group) (merged as Record<string, unknown>)[key] = { ...DEFAULT_LABELS[key], ...group };\n }\n return merged;\n}\n\n/**\n * Rótulos resolvidos, para o chrome inteiro.\n *\n * O padrão do contexto é o português, então `StageEmpty` — exportado e\n * montável fora do `DesignSpace` — continua funcionando sem provider.\n */\nexport const LabelsContext = createContext<Labels>(DEFAULT_LABELS);\n\nexport function useLabels(): Labels {\n return useContext(LabelsContext);\n}\n\n/* ------------------------------------------------------------------ *\n * Compatibilidade\n * ------------------------------------------------------------------ */\n\n/** @deprecated Use `useLabels().network`. */\nexport const NETWORK_LABELS = DEFAULT_LABELS.network;\n"],"names":["createRegistry","product","scenarioList","routeList","componentList","scenarios","s","components","component","personas","p","fixtures","f","rules","r","variationsByPath","screenPathOf","scenario","match","resolveRoute","path","list","seen","screens","route","variations","screenHref","screensById","screen","id","persona","defaultPersona","componentFixture","componentId","fixtureId","fixture","visibleScenarios","options","target","handoffAllowsScenario","screenForPath","screensFor","handoff","handoffAllowsPath","permissionsOf","flows","groupScreens","componentIdsOf","ids","sources","variation","componentsFor","handoffAllowsComponent","validateProduct","requestedId","requested","fallback","flow","group","input","resolveScreenControls","query","needle","normalizeSearch","visible","value","loose","named","name","items","controlDefault","control","option","groups","values","invalid","known","isOption","fromScenario","asked","scenarioMatchesControls","DEFAULT_LABELS","percent","version","errors","warnings","branch","commit","env","shortCommit","EN_US_LABELS","resolveLabels","override","merged","key","LabelsContext","createContext","useLabels","useContext","NETWORK_LABELS"],"mappings":";;AAmLO,SAASA,EAAeC,GAAsC;AACnE,QAAMC,IAAeD,EAAQ,aAAa,CAAA,GACpCE,IAAYF,EAAQ,UAAU,CAAA,GAC9BG,IAAgBH,EAAQ,cAAc,CAAA,GAEtCI,IAAY,IAAI,IAAIH,EAAa,IAAI,CAACI,MAAM,CAACA,EAAE,IAAIA,CAAC,CAAC,CAAC,GACtDC,IAAa,IAAI,IAAIH,EAAc,IAAI,CAACI,MAAc,CAACA,EAAU,IAAIA,CAAS,CAAC,CAAC,GAChFC,IAAW,IAAI,KAAKR,EAAQ,YAAY,CAAA,GAAI,IAAI,CAACS,MAAM,CAACA,EAAE,IAAIA,CAAC,CAAC,CAAC,GACjEC,IAAW,IAAI,KAAKV,EAAQ,YAAY,CAAA,GAAI,IAAI,CAACW,MAAM,CAACA,EAAE,IAAIA,CAAC,CAAC,CAAC,GACjEC,IAAQ,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