@brucesantos/design-space 0.1.0 → 0.2.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/CHANGELOG.md +126 -8
- package/README.md +55 -18
- package/dist/contrast-BXd_acxo.js +260 -0
- package/dist/contrast-BXd_acxo.js.map +1 -0
- package/dist/deploy/index.d.ts +21 -8
- package/dist/index.d.ts +2 -2
- package/dist/index.js +864 -762
- package/dist/index.js.map +1 -1
- package/dist/registry/index.d.ts +1 -1
- package/dist/registry/validate.d.ts +1 -1
- package/dist/router/index.d.ts +2 -2
- package/dist/shell/labels.d.ts +135 -0
- package/dist/testing.js +2 -2
- package/dist/types/index.d.ts +66 -13
- package/dist/util/date.d.ts +3 -4
- package/package.json +2 -2
- package/dist/contrast-MPoK6VR1.js +0 -265
- package/dist/contrast-MPoK6VR1.js.map +0 -1
package/dist/registry/index.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ export type Registry = {
|
|
|
24
24
|
/** Cenários que abrem a mesma rota. Serve para o seletor de situação. */
|
|
25
25
|
scenariosForRoute: (route: string) => Scenario[];
|
|
26
26
|
/**
|
|
27
|
-
* Busca por vocabulário de negócio. Um PO precisa achar "
|
|
27
|
+
* Busca por vocabulário de negócio. Um PO precisa achar "aprovação bloqueada"
|
|
28
28
|
* sem saber o id nem o nome do arquivo (§15.1 "Compreensão de negócio").
|
|
29
29
|
*/
|
|
30
30
|
search: (query: string) => Scenario[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ProductDefinition, Scenario } from '../types/index.js';
|
|
2
2
|
export type ValidationIssue = {
|
|
3
3
|
level: "error" | "warning";
|
|
4
|
-
/** Onde o problema está: `scenario:
|
|
4
|
+
/** Onde o problema está: `scenario:requests.approve-blocked`. */
|
|
5
5
|
where: string;
|
|
6
6
|
message: string;
|
|
7
7
|
};
|
package/dist/router/index.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export type RouteMatch = {
|
|
|
9
9
|
*/
|
|
10
10
|
export declare function matchPath(pattern: string, path: string): Record<string, string> | null;
|
|
11
11
|
/**
|
|
12
|
-
* Resolve a rota ativa. Rotas mais específicas primeiro: entre `/
|
|
13
|
-
* e `/
|
|
12
|
+
* Resolve a rota ativa. Rotas mais específicas primeiro: entre `/requests/new`
|
|
13
|
+
* e `/requests/:id`, a literal ganha, independente da ordem de declaração.
|
|
14
14
|
*/
|
|
15
15
|
export declare function resolveRoute(routes: RouteDefinition[], path: string): RouteMatch | undefined;
|
package/dist/shell/labels.d.ts
CHANGED
|
@@ -1,5 +1,140 @@
|
|
|
1
1
|
import { KeyboardCoverage, NetworkState, ScenarioStatus } from '../types/index.js';
|
|
2
|
+
export type Labels = {
|
|
3
|
+
status: Record<ScenarioStatus, string>;
|
|
4
|
+
statusMeaning: Record<ScenarioStatus, string>;
|
|
5
|
+
network: Record<NetworkState, string>;
|
|
6
|
+
keyboard: Record<KeyboardCoverage, string>;
|
|
7
|
+
/** Rótulo de viewport por id: `fit`, `mobile`, `tablet`, `desktop`, `custom`. */
|
|
8
|
+
viewport: Record<string, string>;
|
|
9
|
+
topbar: {
|
|
10
|
+
toggleNav: string;
|
|
11
|
+
copyLink: string;
|
|
12
|
+
copied: string;
|
|
13
|
+
copyPrompt: string;
|
|
14
|
+
cleanReview: string;
|
|
15
|
+
cleanReviewTitle: string;
|
|
16
|
+
panel: string;
|
|
17
|
+
branchTitle: (branch: string) => string;
|
|
18
|
+
commitTitle: (commit: string) => string;
|
|
19
|
+
envTitle: (env: string) => string;
|
|
20
|
+
};
|
|
21
|
+
sidebar: {
|
|
22
|
+
region: string;
|
|
23
|
+
searchPlaceholder: string;
|
|
24
|
+
searchLabel: string;
|
|
25
|
+
noMatch: (query: string) => string;
|
|
26
|
+
matchCount: (total: number) => string;
|
|
27
|
+
emptyModule: string;
|
|
28
|
+
withoutModule: string;
|
|
29
|
+
};
|
|
30
|
+
controls: {
|
|
31
|
+
region: string;
|
|
32
|
+
persona: string;
|
|
33
|
+
fixture: string;
|
|
34
|
+
network: string;
|
|
35
|
+
viewport: string;
|
|
36
|
+
customWidth: string;
|
|
37
|
+
theme: string;
|
|
38
|
+
locale: string;
|
|
39
|
+
dataSource: string;
|
|
40
|
+
fixturesOption: string;
|
|
41
|
+
a11y: string;
|
|
42
|
+
keyboardMode: string;
|
|
43
|
+
keyboardModeTitle: string;
|
|
44
|
+
reducedMotion: string;
|
|
45
|
+
reducedMotionTitle: string;
|
|
46
|
+
textScale: string;
|
|
47
|
+
none: string;
|
|
48
|
+
};
|
|
49
|
+
inspector: {
|
|
50
|
+
region: string;
|
|
51
|
+
tabScenario: string;
|
|
52
|
+
tabA11y: string;
|
|
53
|
+
tabDiagnostics: string;
|
|
54
|
+
diagnosticsWithErrors: (count: number) => string;
|
|
55
|
+
noScenario: string;
|
|
56
|
+
situation: string;
|
|
57
|
+
reproduction: string;
|
|
58
|
+
id: string;
|
|
59
|
+
route: string;
|
|
60
|
+
persona: string;
|
|
61
|
+
personaSwapped: string;
|
|
62
|
+
data: string;
|
|
63
|
+
network: string;
|
|
64
|
+
goal: (goal: string) => string;
|
|
65
|
+
permissions: string;
|
|
66
|
+
preconditions: string;
|
|
67
|
+
rules: string;
|
|
68
|
+
actions: string;
|
|
69
|
+
expected: string;
|
|
70
|
+
approval: string;
|
|
71
|
+
openApproved: string;
|
|
72
|
+
engineering: string;
|
|
73
|
+
a11yContract: string;
|
|
74
|
+
keyboard: string;
|
|
75
|
+
contrast: string;
|
|
76
|
+
contrastTarget: (target: string) => string;
|
|
77
|
+
announces: string;
|
|
78
|
+
focusedElement: string;
|
|
79
|
+
keyboardModeOff: string;
|
|
80
|
+
pressTab: (tabStops: number) => string;
|
|
81
|
+
role: string;
|
|
82
|
+
name: string;
|
|
83
|
+
noAccessibleName: string;
|
|
84
|
+
nameFrom: string;
|
|
85
|
+
description: string;
|
|
86
|
+
selector: string;
|
|
87
|
+
focusableButHidden: string;
|
|
88
|
+
tabStopsInStage: (tabStops: number) => string;
|
|
89
|
+
tokenContrast: string;
|
|
90
|
+
noContrastPairs: string;
|
|
91
|
+
pair: string;
|
|
92
|
+
ratio: string;
|
|
93
|
+
pairsFailing: (count: number) => string;
|
|
94
|
+
automatedIsFloor: string;
|
|
95
|
+
coverage: string;
|
|
96
|
+
scenariosRegistered: (count: number) => string;
|
|
97
|
+
scenarioContract: string;
|
|
98
|
+
noIssues: string;
|
|
99
|
+
};
|
|
100
|
+
home: {
|
|
101
|
+
lead: (total: number) => string;
|
|
102
|
+
withoutModule: string;
|
|
103
|
+
withoutModuleHint: string;
|
|
104
|
+
emptyModule: string;
|
|
105
|
+
keyboardBadge: string;
|
|
106
|
+
};
|
|
107
|
+
shell: {
|
|
108
|
+
restoreChrome: string;
|
|
109
|
+
noRoute: string;
|
|
110
|
+
noRouteHint: string;
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
/** Português. É o padrão, não uma obrigação. */
|
|
114
|
+
export declare const DEFAULT_LABELS: Labels;
|
|
115
|
+
/** Override por grupo. O que não vier declarado fica no padrão. */
|
|
116
|
+
export type LabelsOverride = {
|
|
117
|
+
[Group in keyof Labels]?: Partial<Labels[Group]>;
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* Mescla um grupo por vez. Dois níveis bastam porque a estrutura tem dois, e
|
|
121
|
+
* mesclagem profunda genérica engoliria erro de digitação em vez de deixar o
|
|
122
|
+
* TypeScript reclamar.
|
|
123
|
+
*/
|
|
124
|
+
export declare function resolveLabels(override?: LabelsOverride): Labels;
|
|
125
|
+
/**
|
|
126
|
+
* Rótulos resolvidos, para o chrome inteiro.
|
|
127
|
+
*
|
|
128
|
+
* O padrão do contexto é o português, então `Home` e `Stage` — exportados e
|
|
129
|
+
* montáveis fora do `DesignSpace` — continuam funcionando sem provider.
|
|
130
|
+
*/
|
|
131
|
+
export declare const LabelsContext: import('react').Context<Labels>;
|
|
132
|
+
export declare function useLabels(): Labels;
|
|
133
|
+
/** @deprecated Use `useLabels().status`, ou `DEFAULT_LABELS.status` fora de React. */
|
|
2
134
|
export declare const STATUS_LABELS: Record<ScenarioStatus, string>;
|
|
135
|
+
/** @deprecated Use `useLabels().statusMeaning`. */
|
|
3
136
|
export declare const STATUS_MEANING: Record<ScenarioStatus, string>;
|
|
137
|
+
/** @deprecated Use `useLabels().network`. */
|
|
4
138
|
export declare const NETWORK_LABELS: Record<NetworkState, string>;
|
|
139
|
+
/** @deprecated Use `useLabels().keyboard`. */
|
|
5
140
|
export declare const KEYBOARD_LABELS: Record<KeyboardCoverage, string>;
|
package/dist/testing.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { v as n, j as o, i, s as t } from "./contrast-
|
|
2
|
-
import { b as v, d as P, c as g, f as E } from "./contrast-
|
|
1
|
+
import { v as n, j as o, i, s as t } from "./contrast-BXd_acxo.js";
|
|
2
|
+
import { b as v, d as P, c as g, f as E } from "./contrast-BXd_acxo.js";
|
|
3
3
|
function a(e = "http://localhost:5173") {
|
|
4
4
|
const r = typeof process < "u" ? process.env : {};
|
|
5
5
|
return (r.PREVIEW_URL || r.BASE_URL || e).replace(/\/$/, "");
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ComponentType, ReactNode } from 'react';
|
|
2
|
+
import { LabelsOverride } from '../shell/labels.js';
|
|
2
3
|
/**
|
|
3
4
|
* Estado de ciclo de vida do cenário (§18.1). Existe para evitar que a
|
|
4
5
|
* referência envelheça em silêncio quando o produto real muda.
|
|
@@ -19,9 +20,9 @@ export type A11yContract = {
|
|
|
19
20
|
contrast: ContrastTarget;
|
|
20
21
|
/**
|
|
21
22
|
* Eventos que precisam ser anunciados para leitor de tela. São chaves de
|
|
22
|
-
* domínio, não seletores: `
|
|
23
|
+
* domínio, não seletores: `request.status`, `retry.result`.
|
|
23
24
|
*
|
|
24
|
-
* Um cenário de
|
|
25
|
+
* Um cenário de aprovação bloqueada em que a recusa não é anunciada está
|
|
25
26
|
* incompleto, não está pronto para aprovação.
|
|
26
27
|
*/
|
|
27
28
|
announces?: string[];
|
|
@@ -31,7 +32,7 @@ export type A11yContract = {
|
|
|
31
32
|
export type Persona = {
|
|
32
33
|
/** Identificador estável usado em URL e em cenário. */
|
|
33
34
|
id: string;
|
|
34
|
-
/** Nome no vocabulário do cliente: "
|
|
35
|
+
/** Nome no vocabulário do cliente: "Aprovador". */
|
|
35
36
|
name: string;
|
|
36
37
|
/** O que essa pessoa está tentando fazer. */
|
|
37
38
|
goal?: string;
|
|
@@ -46,7 +47,7 @@ export type Rule = {
|
|
|
46
47
|
statement: string;
|
|
47
48
|
/** Por que a regra existe. Contexto, não implementação. */
|
|
48
49
|
rationale?: string;
|
|
49
|
-
/** Onde a regra vive no código, quando existir: `src/rules/
|
|
50
|
+
/** Onde a regra vive no código, quando existir: `src/rules/requests.ts`. */
|
|
50
51
|
source?: string;
|
|
51
52
|
};
|
|
52
53
|
/**
|
|
@@ -72,9 +73,9 @@ export declare const NETWORK_STATES: readonly NetworkState[];
|
|
|
72
73
|
* disponíveis, regras e resultado esperado.
|
|
73
74
|
*/
|
|
74
75
|
export type Scenario = {
|
|
75
|
-
/** `modulo.situacao` em kebab-case: `
|
|
76
|
+
/** `modulo.situacao` em kebab-case: `requests.approve-blocked`. */
|
|
76
77
|
id: string;
|
|
77
|
-
/** Título no vocabulário do negócio: "
|
|
78
|
+
/** Título no vocabulário do negócio: "Aprovação bloqueada por falta de documento". */
|
|
78
79
|
title: string;
|
|
79
80
|
/** Rota que o cenário abre. Precisa casar com uma rota do produto. */
|
|
80
81
|
route: string;
|
|
@@ -82,8 +83,8 @@ export type Scenario = {
|
|
|
82
83
|
persona: string;
|
|
83
84
|
/**
|
|
84
85
|
* Permissões efetivas do cenário. Quando ausente, herda as da persona.
|
|
85
|
-
* Declarar aqui permite representar "
|
|
86
|
-
*
|
|
86
|
+
* Declarar aqui permite representar "solicitante sem permissão de aprovar"
|
|
87
|
+
* sem inventar uma segunda persona.
|
|
87
88
|
*/
|
|
88
89
|
permissions?: string[];
|
|
89
90
|
/** Id de uma fixture registrada no produto. */
|
|
@@ -125,7 +126,7 @@ export type Scenario = {
|
|
|
125
126
|
*/
|
|
126
127
|
export type Flow = {
|
|
127
128
|
id: string;
|
|
128
|
-
/** Título de negócio: "
|
|
129
|
+
/** Título de negócio: "Decidir uma solicitação". */
|
|
129
130
|
title: string;
|
|
130
131
|
description?: string;
|
|
131
132
|
steps: FlowStep[];
|
|
@@ -141,9 +142,9 @@ export type FlowStep = {
|
|
|
141
142
|
branches?: Record<string, string>;
|
|
142
143
|
};
|
|
143
144
|
export type Module = {
|
|
144
|
-
/** `
|
|
145
|
+
/** `requests`, `catalog`, `billing`. */
|
|
145
146
|
id: string;
|
|
146
|
-
/** Nome no vocabulário do cliente: "
|
|
147
|
+
/** Nome no vocabulário do cliente: "Solicitações". */
|
|
147
148
|
name: string;
|
|
148
149
|
description?: string;
|
|
149
150
|
/** Jornadas guiadas do módulo. Opcional: navegação livre é o padrão. */
|
|
@@ -200,6 +201,18 @@ export type ProductTheme = {
|
|
|
200
201
|
modes?: string[];
|
|
201
202
|
/** Idiomas disponíveis, quando o produto tiver essa variação. */
|
|
202
203
|
locales?: string[];
|
|
204
|
+
/**
|
|
205
|
+
* Rótulos do chrome do motor. Sobrescreve por grupo o que estiver em
|
|
206
|
+
* `DEFAULT_LABELS`; o que não for declarado fica no padrão em português.
|
|
207
|
+
*
|
|
208
|
+
* Serve para o Design Space de um cliente que revisa em outro idioma: o chrome
|
|
209
|
+
* divide a tela com a UI do produto, e chrome em português ao lado de interface
|
|
210
|
+
* em inglês é ruído no meio da revisão.
|
|
211
|
+
*
|
|
212
|
+
* Isto é rótulo de **mecanismo**. Nome de módulo, título de cenário e nome de
|
|
213
|
+
* persona continuam vindo do catálogo do produto.
|
|
214
|
+
*/
|
|
215
|
+
labels?: LabelsOverride;
|
|
203
216
|
};
|
|
204
217
|
export type ContrastPair = {
|
|
205
218
|
/** Nome do par: `fg-1 sobre bg-app`. */
|
|
@@ -214,9 +227,9 @@ export type ContrastPair = {
|
|
|
214
227
|
largeText?: boolean;
|
|
215
228
|
};
|
|
216
229
|
export type ProductDefinition = {
|
|
217
|
-
/** `
|
|
230
|
+
/** `acme`. */
|
|
218
231
|
id: string;
|
|
219
|
-
/** "
|
|
232
|
+
/** "Acme". */
|
|
220
233
|
name: string;
|
|
221
234
|
/** Uma linha sobre o produto, exibida na entrada do Design Space. */
|
|
222
235
|
tagline?: string;
|
|
@@ -235,6 +248,29 @@ export type ProductDefinition = {
|
|
|
235
248
|
default: string;
|
|
236
249
|
adapters?: DataSourceAdapter[];
|
|
237
250
|
};
|
|
251
|
+
/**
|
|
252
|
+
* Contexto do deployment, informado pelo produto. **Opcional**: um Design
|
|
253
|
+
* Space que roda só local não precisa dele.
|
|
254
|
+
*
|
|
255
|
+
* O motor **não consegue** descobrir isso sozinho. Ele é uma biblioteca já
|
|
256
|
+
* compilada: o `import.meta.env` do código dele foi resolvido no build do
|
|
257
|
+
* pacote, não no build do produto, então não sobra nada para o bundler do
|
|
258
|
+
* produto substituir. Quem tem acesso ao próprio ambiente de build é o produto.
|
|
259
|
+
*
|
|
260
|
+
* Passe os valores do bundler, com o nome que o seu build usar:
|
|
261
|
+
*
|
|
262
|
+
* ```ts
|
|
263
|
+
* deploy: {
|
|
264
|
+
* env: import.meta.env.VITE_DEPLOY_ENV,
|
|
265
|
+
* branch: import.meta.env.VITE_DEPLOY_BRANCH,
|
|
266
|
+
* commit: import.meta.env.VITE_DEPLOY_COMMIT,
|
|
267
|
+
* }
|
|
268
|
+
* ```
|
|
269
|
+
*
|
|
270
|
+
* Sem isso o cabeçalho da revisão mostra "development" e omite branch e
|
|
271
|
+
* commit — e é o commit que torna uma aprovação rastreável.
|
|
272
|
+
*/
|
|
273
|
+
deploy?: DeployOverrides;
|
|
238
274
|
/** Renderizado quando nenhuma rota casa. Padrão: aviso neutro do motor. */
|
|
239
275
|
notFound?: ComponentType<{
|
|
240
276
|
path: string;
|
|
@@ -245,6 +281,23 @@ export type ProductDefinition = {
|
|
|
245
281
|
context: ScenarioContext;
|
|
246
282
|
}>;
|
|
247
283
|
};
|
|
284
|
+
/**
|
|
285
|
+
* Contexto do deployment informado pelo produto. Todos os campos são opcionais,
|
|
286
|
+
* e é essa a fonte única: o motor não lê ambiente nem conhece provedor de
|
|
287
|
+
* hospedagem. Campo ausente cai no padrão local.
|
|
288
|
+
*/
|
|
289
|
+
export type DeployOverrides = {
|
|
290
|
+
/** `development`, `preview` ou `production`. */
|
|
291
|
+
env?: string;
|
|
292
|
+
/** Domínio da branch, sem protocolo. Quando ausente, usa a origem da janela. */
|
|
293
|
+
branchUrl?: string;
|
|
294
|
+
/** Domínio único deste deployment, sem protocolo. */
|
|
295
|
+
deploymentUrl?: string;
|
|
296
|
+
/** Nome da branch, para rotular a revisão. */
|
|
297
|
+
branch?: string;
|
|
298
|
+
/** Commit exato, gravado junto com o status de aprovação do cenário. */
|
|
299
|
+
commit?: string;
|
|
300
|
+
};
|
|
248
301
|
/**
|
|
249
302
|
* O que a UI do produto recebe do motor. Deliberadamente pequeno: dados,
|
|
250
303
|
* papel, permissões e estado de ambiente. Nada de componente, token ou
|
package/dist/util/date.d.ts
CHANGED
|
@@ -8,10 +8,9 @@
|
|
|
8
8
|
*
|
|
9
9
|
* O bug que a originou: `new Date("2011-09-08")` é parseado como meia-noite
|
|
10
10
|
* **UTC**. Formatado em qualquer fuso a oeste de Greenwich — o Brasil inteiro —
|
|
11
|
-
* exibe o dia anterior.
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* dia.
|
|
11
|
+
* exibe o dia anterior. Em um produto isso apareceu como data de nascimento
|
|
12
|
+
* atrasada em um dia, o que deslocava a idade calculada e portanto uma regra que
|
|
13
|
+
* dependia dela; em outro, como vencimento errado por um dia.
|
|
15
14
|
*
|
|
16
15
|
* Os dois produtos escreveram a mesma correção separadamente. Quando isso
|
|
17
16
|
* acontece, o lugar da correção é o motor — senão o terceiro produto reescreve o
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brucesantos/design-space",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Motor neutro do Bananas Design Space: registry de cenários, shell, deep links, controles de persona/viewport/rede, inspetor de regras e ferramentas de acessibilidade. Não contém UI de cliente.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -64,4 +64,4 @@
|
|
|
64
64
|
"typecheck": "tsc --noEmit",
|
|
65
65
|
"test": "vitest run"
|
|
66
66
|
}
|
|
67
|
-
}
|
|
67
|
+
}
|
|
@@ -1,265 +0,0 @@
|
|
|
1
|
-
const b = [
|
|
2
|
-
"proposed",
|
|
3
|
-
"in-review",
|
|
4
|
-
"approved",
|
|
5
|
-
"in-implementation",
|
|
6
|
-
"implemented",
|
|
7
|
-
"superseded"
|
|
8
|
-
], w = [
|
|
9
|
-
"success",
|
|
10
|
-
"loading",
|
|
11
|
-
"empty",
|
|
12
|
-
"error",
|
|
13
|
-
"slow"
|
|
14
|
-
], x = /^[a-z0-9]+([.\-][a-z0-9]+)*$/;
|
|
15
|
-
function p(e) {
|
|
16
|
-
return typeof e == "string" && e.trim().length > 0;
|
|
17
|
-
}
|
|
18
|
-
function S(e, o) {
|
|
19
|
-
const t = [], r = p(e?.id) ? `scenario:${e.id}` : `scenario[${o ?? "?"}]`, n = (d) => t.push({ level: "error", where: r, message: d }), i = (d) => t.push({ level: "warning", where: r, message: d });
|
|
20
|
-
p(e?.id) ? x.test(e.id) ? e.id.includes(".") || i("`id` sem prefixo de módulo dificulta a navegação e a busca do agente.") : n(
|
|
21
|
-
"`id` deve ser minúsculo em kebab-case, com o módulo como prefixo: `finance.insurance-denied`."
|
|
22
|
-
) : n("`id` é obrigatório."), p(e?.title) || n("`title` é obrigatório e deve usar o vocabulário do negócio."), p(e?.route) ? e.route.startsWith("/") || n("`route` deve começar com `/`.") : n("`route` é obrigatório."), p(e?.persona) || n("`persona` é obrigatório."), p(e?.fixture) || n("`fixture` é obrigatório. O padrão do ambiente é dado sintético (D-05)."), b.includes(e?.status) || n(`\`status\` deve ser um de: ${b.join(", ")}.`), e?.network && !w.includes(e.network) && n(`\`network\` deve ser um de: ${w.join(", ")}.`);
|
|
23
|
-
const a = e?.a11y;
|
|
24
|
-
return !a || typeof a != "object" ? n(
|
|
25
|
-
"`a11y` é obrigatório. Acessibilidade é campo do contrato, não auditoria de fim de projeto (D-15)."
|
|
26
|
-
) : (["full", "partial", "not-applicable"].includes(a.keyboard) || n("`a11y.keyboard` deve ser `full`, `partial` ou `not-applicable`."), ["AA", "AAA"].includes(a.contrast) || n("`a11y.contrast` deve ser `AA` ou `AAA`. O padrão interno é WCAG 2.2 AA."), a.announces !== void 0 && !Array.isArray(a.announces) && n("`a11y.announces` deve ser uma lista de chaves de evento de domínio.")), e?.status === "approved" && a?.keyboard === "partial" && i(
|
|
27
|
-
'Cenário aprovado com `a11y.keyboard: "partial"`. Confirme que esta jornada não é crítica.'
|
|
28
|
-
), e?.status === "approved" && !e.approvedAt && i(
|
|
29
|
-
"Cenário aprovado sem `approvedAt`. A aprovação deve ser registrada por URL de commit (§10.2), senão muda de conteúdo debaixo de quem aprovou."
|
|
30
|
-
), e?.expected?.length || i(
|
|
31
|
-
"Sem `expected`, o cenário não vira caso verificável no handoff — é tela bonita sem critério (risco: prototype theater)."
|
|
32
|
-
), t;
|
|
33
|
-
}
|
|
34
|
-
function M(e) {
|
|
35
|
-
const o = [], t = (c, s, l) => o.push({ level: c, where: s, message: l }), r = new Set(e.personas?.map((c) => c.id) ?? []), n = new Set(e.fixtures?.map((c) => c.id) ?? []), i = new Set(e.rules?.map((c) => c.id) ?? []), a = new Set(e.modules?.map((c) => c.id) ?? []), d = /* @__PURE__ */ new Set();
|
|
36
|
-
p(e.id) || t("error", "product", "`id` é obrigatório."), p(e.name) || t("error", "product", "`name` é obrigatório."), e.routes?.length || t("error", "product", "`routes` está vazio: nenhum cenário conseguirá renderizar.");
|
|
37
|
-
for (const [c, s] of (e.scenarios ?? []).entries()) {
|
|
38
|
-
o.push(...S(s, c));
|
|
39
|
-
const l = `scenario:${s?.id ?? c}`;
|
|
40
|
-
if (s?.id) {
|
|
41
|
-
d.has(s.id) && t("error", l, `\`id\` duplicado: ${s.id}.`), d.add(s.id);
|
|
42
|
-
const f = s.id.split(".")[0];
|
|
43
|
-
f && a.size > 0 && !a.has(f) && t(
|
|
44
|
-
"warning",
|
|
45
|
-
l,
|
|
46
|
-
`Prefixo \`${f}\` não corresponde a nenhum módulo registrado. O cenário não vai aparecer na navegação.`
|
|
47
|
-
);
|
|
48
|
-
}
|
|
49
|
-
s?.persona && !r.has(s.persona) && t("error", l, `Persona não registrada: \`${s.persona}\`.`), s?.fixture && !n.has(s.fixture) && t("error", l, `Fixture não registrada: \`${s.fixture}\`.`);
|
|
50
|
-
for (const f of s?.rules ?? [])
|
|
51
|
-
i.has(f) || t("error", l, `Regra não registrada: \`${f}\`.`);
|
|
52
|
-
s?.route && !R(s.route, e) && t(
|
|
53
|
-
"error",
|
|
54
|
-
l,
|
|
55
|
-
`Rota \`${s.route}\` não casa com nenhuma rota declarada. O deep link abriria a tela de rota inexistente.`
|
|
56
|
-
);
|
|
57
|
-
}
|
|
58
|
-
for (const c of e.modules ?? [])
|
|
59
|
-
for (const s of c.flows ?? []) {
|
|
60
|
-
const l = `flow:${c.id}/${s.id}`;
|
|
61
|
-
s.steps?.length || t("warning", l, "Jornada sem passos.");
|
|
62
|
-
for (const f of s.steps ?? []) {
|
|
63
|
-
d.has(f.scenario) || t("error", l, `Passo aponta para cenário inexistente: \`${f.scenario}\`.`);
|
|
64
|
-
for (const [_, g] of Object.entries(f.branches ?? {}))
|
|
65
|
-
d.has(g) || t(
|
|
66
|
-
"error",
|
|
67
|
-
l,
|
|
68
|
-
`Ramificação "${_}" aponta para cenário inexistente: \`${g}\`.`
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
const u = e.dataSources?.default;
|
|
73
|
-
return u && u !== "fixtures" && (new Set(e.dataSources?.adapters?.map((s) => s.id) ?? []).has(u) || t("error", "product", `\`dataSources.default\` aponta para adapter inexistente: \`${u}\`.`), t(
|
|
74
|
-
"warning",
|
|
75
|
-
"product",
|
|
76
|
-
"A fonte padrão não é `fixtures`. O padrão do ambiente é dado sintético e determinístico (D-05); API real entra como adapter opcional, com justificativa."
|
|
77
|
-
)), o;
|
|
78
|
-
}
|
|
79
|
-
function R(e, o) {
|
|
80
|
-
const t = e.split("?")[0] ?? e;
|
|
81
|
-
return (o.routes ?? []).some((r) => $(r.path, t));
|
|
82
|
-
}
|
|
83
|
-
function $(e, o) {
|
|
84
|
-
const t = e.split("/").filter(Boolean), r = o.split("/").filter(Boolean);
|
|
85
|
-
for (const [n, i] of t.entries()) {
|
|
86
|
-
if (i === "*") return !0;
|
|
87
|
-
const a = r[n];
|
|
88
|
-
if (a === void 0) return !1;
|
|
89
|
-
if (!i.startsWith(":") && i !== a)
|
|
90
|
-
return !1;
|
|
91
|
-
}
|
|
92
|
-
return t.length === r.length;
|
|
93
|
-
}
|
|
94
|
-
function j(e) {
|
|
95
|
-
return e.some((o) => o.level === "error");
|
|
96
|
-
}
|
|
97
|
-
function U(e) {
|
|
98
|
-
return e.length === 0 ? "Nenhum problema encontrado." : e.map((o) => `${o.level === "error" ? "✖" : "▲"} ${o.where}
|
|
99
|
-
${o.message}`).join(`
|
|
100
|
-
`);
|
|
101
|
-
}
|
|
102
|
-
const m = {
|
|
103
|
-
scenario: "scenario",
|
|
104
|
-
persona: "persona",
|
|
105
|
-
fixture: "fixture",
|
|
106
|
-
network: "network",
|
|
107
|
-
viewport: "viewport",
|
|
108
|
-
customWidth: "w",
|
|
109
|
-
themeMode: "theme",
|
|
110
|
-
locale: "locale",
|
|
111
|
-
dataSource: "source",
|
|
112
|
-
chrome: "chrome",
|
|
113
|
-
keyboardMode: "kb",
|
|
114
|
-
reducedMotion: "motion",
|
|
115
|
-
textScale: "scale",
|
|
116
|
-
inspector: "panel"
|
|
117
|
-
};
|
|
118
|
-
function C(e) {
|
|
119
|
-
return typeof e == "boolean" ? e ? "1" : "0" : String(e);
|
|
120
|
-
}
|
|
121
|
-
function y(e, o = {}) {
|
|
122
|
-
for (const [t, r] of Object.entries(o)) {
|
|
123
|
-
if (r == null) continue;
|
|
124
|
-
const n = m[t];
|
|
125
|
-
n && e.set(n, C(r));
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
const I = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1 };
|
|
129
|
-
function T() {
|
|
130
|
-
const e = I;
|
|
131
|
-
return e || (typeof process < "u" && process.env ? process.env : {});
|
|
132
|
-
}
|
|
133
|
-
function A() {
|
|
134
|
-
const e = T(), o = e.VITE_VERCEL_BRANCH_URL || e.VERCEL_BRANCH_URL, t = e.VITE_VERCEL_URL || e.VERCEL_URL, r = e.VITE_VERCEL_ENV || e.VERCEL_ENV, n = e.VITE_VERCEL_GIT_COMMIT_SHA || e.VERCEL_GIT_COMMIT_SHA, i = o && `https://${o}` || t && `https://${t}` || (typeof window < "u" ? window.location.origin : "http://localhost:5173");
|
|
135
|
-
return {
|
|
136
|
-
env: r ?? "development",
|
|
137
|
-
origin: i.replace(/\/$/, ""),
|
|
138
|
-
branchUrl: o,
|
|
139
|
-
deploymentUrl: t,
|
|
140
|
-
branch: e.VITE_VERCEL_GIT_COMMIT_REF || e.VERCEL_GIT_COMMIT_REF,
|
|
141
|
-
commit: n,
|
|
142
|
-
shortCommit: n?.slice(0, 7),
|
|
143
|
-
isDeployed: r === "preview" || r === "production"
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
|
-
function N(e, o = {}) {
|
|
147
|
-
const t = o.origin ?? A().origin, r = new URL(e.route, t);
|
|
148
|
-
return r.searchParams.set(m.scenario, e.id), r.searchParams.set(m.persona, e.persona), r.searchParams.set(m.fixture, e.fixture), e.network && e.network !== "success" && r.searchParams.set(m.network, e.network), y(r.searchParams, o.overrides), r.toString();
|
|
149
|
-
}
|
|
150
|
-
function D(e, o) {
|
|
151
|
-
const t = o.commit ?? A().shortCommit;
|
|
152
|
-
if (!t) return;
|
|
153
|
-
const r = `https://${o.project}-${t}-${o.scope}.vercel.app`;
|
|
154
|
-
return N(e, { origin: r });
|
|
155
|
-
}
|
|
156
|
-
const E = {
|
|
157
|
-
AA: { normal: 4.5, large: 3 },
|
|
158
|
-
AAA: { normal: 7, large: 4.5 }
|
|
159
|
-
}, k = {
|
|
160
|
-
white: "#ffffff",
|
|
161
|
-
black: "#000000",
|
|
162
|
-
transparent: "#00000000"
|
|
163
|
-
};
|
|
164
|
-
function v(e) {
|
|
165
|
-
const o = e.trim().toLowerCase(), t = k[o];
|
|
166
|
-
if (t) return v(t);
|
|
167
|
-
if (o.startsWith("#")) {
|
|
168
|
-
const n = o.slice(1), i = (a) => Number.parseInt(a.repeat(2), 16);
|
|
169
|
-
if (n.length === 3 || n.length === 4) {
|
|
170
|
-
const [a, d, u, c] = [...n];
|
|
171
|
-
return !a || !d || !u ? void 0 : { r: i(a), g: i(d), b: i(u), a: c ? i(c) / 255 : 1 };
|
|
172
|
-
}
|
|
173
|
-
if (n.length === 6 || n.length === 8) {
|
|
174
|
-
const a = (u) => Number.parseInt(n.slice(u, u + 2), 16), d = [a(0), a(2), a(4)];
|
|
175
|
-
return d.some(Number.isNaN) ? void 0 : {
|
|
176
|
-
r: d[0],
|
|
177
|
-
g: d[1],
|
|
178
|
-
b: d[2],
|
|
179
|
-
a: n.length === 8 ? a(6) / 255 : 1
|
|
180
|
-
};
|
|
181
|
-
}
|
|
182
|
-
return;
|
|
183
|
-
}
|
|
184
|
-
const r = o.match(/^rgba?\(([^)]+)\)$/);
|
|
185
|
-
if (r?.[1]) {
|
|
186
|
-
const n = r[1].split(/[\s,/]+/).filter(Boolean), [i, a, d, u] = n.map(Number);
|
|
187
|
-
return [i, a, d].some((c) => c === void 0 || Number.isNaN(c)) ? void 0 : { r: i, g: a, b: d, a: u === void 0 || Number.isNaN(u) ? 1 : u };
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
function L(e, o) {
|
|
191
|
-
if (e.a >= 1) return e;
|
|
192
|
-
const t = (r, n) => r * e.a + n * (1 - e.a);
|
|
193
|
-
return {
|
|
194
|
-
r: t(e.r, o.r),
|
|
195
|
-
g: t(e.g, o.g),
|
|
196
|
-
b: t(e.b, o.b),
|
|
197
|
-
a: 1
|
|
198
|
-
};
|
|
199
|
-
}
|
|
200
|
-
function h({ r: e, g: o, b: t }) {
|
|
201
|
-
const r = (n) => {
|
|
202
|
-
const i = n / 255;
|
|
203
|
-
return i <= 0.03928 ? i / 12.92 : ((i + 0.055) / 1.055) ** 2.4;
|
|
204
|
-
};
|
|
205
|
-
return 0.2126 * r(e) + 0.7152 * r(o) + 0.0722 * r(t);
|
|
206
|
-
}
|
|
207
|
-
function P(e, o) {
|
|
208
|
-
const t = v(o), r = v(e);
|
|
209
|
-
if (!t || !r) return;
|
|
210
|
-
const n = L(r, t), i = Math.max(h(n), h(t)), a = Math.min(h(n), h(t));
|
|
211
|
-
return (i + 0.05) / (a + 0.05);
|
|
212
|
-
}
|
|
213
|
-
function V(e) {
|
|
214
|
-
const o = e.target ?? "AA", t = e.largeText ? E[o].large : E[o].normal, r = P(e.foreground, e.background);
|
|
215
|
-
return {
|
|
216
|
-
pair: e,
|
|
217
|
-
target: o,
|
|
218
|
-
ratio: r,
|
|
219
|
-
required: t,
|
|
220
|
-
passes: r === void 0 ? void 0 : r >= t,
|
|
221
|
-
label: r === void 0 ? "não medido" : `${r.toFixed(2)}:1`
|
|
222
|
-
};
|
|
223
|
-
}
|
|
224
|
-
function O(e = []) {
|
|
225
|
-
return e.map(V);
|
|
226
|
-
}
|
|
227
|
-
function z(e) {
|
|
228
|
-
const o = O(e).filter((r) => r.passes !== !0);
|
|
229
|
-
if (o.length === 0) return;
|
|
230
|
-
const t = o.map(
|
|
231
|
-
(r) => ` ✖ ${r.pair.name}: ${r.label} (mínimo ${r.required}:1 para ${r.target}${r.pair.largeText ? ", texto grande" : ""})`
|
|
232
|
-
).join(`
|
|
233
|
-
`);
|
|
234
|
-
throw new Error(`Pares de contraste fora do alvo:
|
|
235
|
-
${t}`);
|
|
236
|
-
}
|
|
237
|
-
function B(e, o) {
|
|
238
|
-
if (typeof window > "u") return;
|
|
239
|
-
const t = o ?? document.documentElement;
|
|
240
|
-
return window.getComputedStyle(t).getPropertyValue(e).trim() || void 0;
|
|
241
|
-
}
|
|
242
|
-
export {
|
|
243
|
-
E as C,
|
|
244
|
-
w as N,
|
|
245
|
-
m as P,
|
|
246
|
-
b as S,
|
|
247
|
-
y as a,
|
|
248
|
-
z as b,
|
|
249
|
-
O as c,
|
|
250
|
-
V as d,
|
|
251
|
-
D as e,
|
|
252
|
-
P as f,
|
|
253
|
-
A as g,
|
|
254
|
-
L as h,
|
|
255
|
-
U as i,
|
|
256
|
-
j,
|
|
257
|
-
h as k,
|
|
258
|
-
C as l,
|
|
259
|
-
S as m,
|
|
260
|
-
v as p,
|
|
261
|
-
B as r,
|
|
262
|
-
N as s,
|
|
263
|
-
M as v
|
|
264
|
-
};
|
|
265
|
-
//# sourceMappingURL=contrast-MPoK6VR1.js.map
|