@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.
@@ -1,16 +1,29 @@
1
- import { ComponentPreview, ComponentPreviewFixture, Fixture, Flow, Module, Persona, ProductDefinition, Rule, Scenario, ScenarioStatus, ScenarioView } from '../types/index.js';
1
+ import { ComponentPreview, ComponentPreviewFixture, Fixture, HandoffScope, Persona, ProductDefinition, RouteDefinition, Rule, Scenario } from '../types/index.js';
2
2
  import { ValidationIssue } from './validate.js';
3
- export type ModuleNode = {
4
- module: Module;
5
- scenarios: Scenario[];
3
+ /**
4
+ * Uma tela: uma rota declarada e as variações dela.
5
+ *
6
+ * `variations` vazio é caso válido — a rota ainda é uma tela, aberta numa
7
+ * variação implícita, sem fixture.
8
+ */
9
+ export type ScreenNode = {
10
+ /** O `path` da rota. Estável e único, serve de identificador da tela. */
11
+ id: string;
12
+ /** `route.name`, ou o título do primeiro cenário, ou o `path`. */
13
+ name: string;
14
+ description: string | undefined;
15
+ route: RouteDefinition;
16
+ /**
17
+ * Caminho concreto para abrir a tela quando não há variação: o `path` com
18
+ * `*` removido. Parâmetros `:id` ficam literais.
19
+ */
20
+ href: string;
21
+ /** Cenários da rota, na ordem de `scenarios`. */
22
+ variations: Scenario[];
6
23
  };
7
24
  export type ScenarioQueryOptions = {
8
- /** Coleção consultada. Padrão: trabalho ativo. */
9
- view?: ScenarioView;
10
- /** Inclui o catálogo completo. Reservado a diagnóstico e compatibilidade. */
11
- includePorted?: boolean;
12
- /** @deprecated Deep links agora inferem `view: "ported"`. */
13
- activeScenario?: string;
25
+ /** Recorte de handoff. Sem ele, todo cenário registrado é visível. */
26
+ handoff?: HandoffScope;
14
27
  };
15
28
  export type ComponentFixtureResolution = {
16
29
  fixture: ComponentPreviewFixture | undefined;
@@ -21,10 +34,8 @@ export type ComponentFixtureResolution = {
21
34
  };
22
35
  export type Registry = {
23
36
  product: ProductDefinition;
24
- /** Árvore de navegação: módulos com seus cenários, na ordem declarada. */
25
- tree: ModuleNode[];
26
- /** Cenários cujo prefixo não corresponde a nenhum módulo registrado. */
27
- orphans: Scenario[];
37
+ /** Telas na ordem de `routes`, cada uma com suas variações. */
38
+ screens: ScreenNode[];
28
39
  issues: ValidationIssue[];
29
40
  scenario: (id: string | undefined) => Scenario | undefined;
30
41
  component: (id: string | undefined) => ComponentPreview | undefined;
@@ -33,26 +44,44 @@ export type Registry = {
33
44
  persona: (id: string | undefined) => Persona | undefined;
34
45
  fixture: (id: string | undefined) => Fixture | undefined;
35
46
  rule: (id: string | undefined) => Rule | undefined;
36
- module: (id: string | undefined) => Module | undefined;
37
- flow: (id: string | undefined) => Flow | undefined;
47
+ /** Tela por id (o `path` da rota). */
48
+ screen: (id: string | undefined) => ScreenNode | undefined;
49
+ /** Tela que renderiza um endereço, pelo mesmo casamento do roteador. */
50
+ screenForPath: (path: string) => ScreenNode | undefined;
51
+ /** Tela da qual o cenário é variação. */
52
+ screenOf: (scenario: Scenario | undefined) => ScreenNode | undefined;
53
+ /** Telas permitidas pelo recorte, com variações também filtradas. */
54
+ screensFor: (options?: ScenarioQueryOptions) => ScreenNode[];
38
55
  /** Regras de um cenário, resolvidas e na ordem declarada. */
39
56
  rulesOf: (scenario: Scenario | undefined) => Rule[];
40
57
  /** Permissões efetivas: as do cenário, ou as da persona quando ausentes. */
41
58
  permissionsOf: (scenario: Scenario | undefined) => string[];
42
- /** Cenários que abrem a mesma rota. Serve para o seletor de situação. */
59
+ /** Variações da tela que renderiza `route`. */
43
60
  scenariosForRoute: (route: string, options?: ScenarioQueryOptions) => Scenario[];
44
- /** Cenários da visão pedida; trabalho ativo é o padrão. */
61
+ /** Cenários permitidos pelo recorte; sem handoff devolve todos. */
45
62
  activeScenarios: (options?: ScenarioQueryOptions) => Scenario[];
46
- /** Árvore filtrada para navegação, preservando `tree` como catálogo completo. */
47
- treeFor: (options?: ScenarioQueryOptions) => ModuleNode[];
48
- orphansFor: (options?: ScenarioQueryOptions) => Scenario[];
49
63
  /**
50
- * Busca por vocabulário de negócio. Um PO precisa achar "aprovação bloqueada"
51
- * sem saber o id nem o nome do arquivo (§15.1 "Compreensão de negócio").
64
+ * Busca de cenário por vocabulário de negócio, sem diferenciar acento nem
65
+ * caixa: "aprovacao" acha "Aprovação".
52
66
  */
53
67
  search: (query: string, options?: ScenarioQueryOptions) => Scenario[];
54
- byStatus: (status: ScenarioStatus) => Scenario[];
55
- /** Contagem por status, para o cabeçalho de cobertura. */
56
- coverage: (options?: ScenarioQueryOptions) => Record<ScenarioStatus, number>;
68
+ /** Busca de telas: nome, descrição, rota e as variações de cada uma. */
69
+ searchScreens: (query: string, options?: ScenarioQueryOptions) => ScreenNode[];
70
+ /** Busca de componentes: nome, descrição, grupo, id e `source`. */
71
+ searchComponents: (query: string, handoff?: HandoffScope) => ComponentPreview[];
72
+ /** Componentes permitidos pelo recorte; sem handoff devolve o catálogo. */
73
+ componentsFor: (handoff?: HandoffScope) => ComponentPreview[];
74
+ /**
75
+ * Componentes usados por uma tela: a união de `components` das variações, na
76
+ * ordem em que aparecem. Id sem componente registrado fica de fora.
77
+ */
78
+ componentsOfScreen: (screen: ScreenNode | undefined) => ComponentPreview[];
79
+ /** Telas com ao menos um cenário que lista o componente em `components`. */
80
+ usagesOf: (componentId: string | undefined, options?: ScenarioQueryOptions) => ScreenNode[];
57
81
  };
58
82
  export declare function createRegistry(product: ProductDefinition): Registry;
83
+ /**
84
+ * Minúsculas sem acento e sem espaço nas pontas: "Aprovação" acha "aprovacao".
85
+ * A navegação usa exatamente a mesma regra do registry.
86
+ */
87
+ export declare function normalizeSearch(value: string): string;
@@ -0,0 +1,19 @@
1
+ import { DesignSpaceLocation } from '../controls/state.js';
2
+ import { FrameShortcut } from '../frame/index.js';
3
+ import { ViewportSetting } from '../types/index.js';
4
+ export type CanvasProps = {
5
+ location: DesignSpaceLocation;
6
+ viewport: ViewportSetting;
7
+ /**
8
+ * Zoom em porcentagem. Em 100 (o padrão), um viewport mais largo que a área
9
+ * central encolhe até caber; o valor efetivo volta por `onEffectiveZoom`.
10
+ */
11
+ zoom: number;
12
+ onEffectiveZoom?: (zoom: number) => void;
13
+ title: string;
14
+ /** Desliga o ponteiro no quadro enquanto uma lateral é arrastada. */
15
+ resizing: boolean;
16
+ onFrameNavigate: (url: string, replace: boolean) => void;
17
+ onShortcut: (key: FrameShortcut) => void;
18
+ };
19
+ export declare function Canvas({ location, viewport, zoom, title, resizing, onFrameNavigate, onShortcut, onEffectiveZoom, }: CanvasProps): import("react").JSX.Element;
@@ -0,0 +1,9 @@
1
+ import { ProductDefinition } from '../types/index.js';
2
+ import { Registry } from '../registry/index.js';
3
+ import { FrameShortcut } from '../frame/index.js';
4
+ export declare function FrameView({ product, registry }: {
5
+ product: ProductDefinition;
6
+ registry: Registry;
7
+ }): import("react").JSX.Element;
8
+ /** O atalho do chrome que este evento representa, se algum. */
9
+ export declare function frameShortcutOf(event: Pick<KeyboardEvent, "key" | "metaKey" | "ctrlKey" | "altKey" | "shiftKey">): FrameShortcut | undefined;
@@ -0,0 +1,30 @@
1
+ import { ComponentFixtureResolution, Registry, ScreenNode } from '../registry/index.js';
2
+ import { DeployContext } from '../deploy/index.js';
3
+ import { ComponentPreview, ControlsState, PanelTab, Scenario } from '../types/index.js';
4
+ export type PanelProps = {
5
+ registry: Registry;
6
+ controls: ControlsState;
7
+ deploy: DeployContext;
8
+ screen: ScreenNode | undefined;
9
+ /** Cenário ativo quando ele é variação da tela aberta. */
10
+ variation: Scenario | undefined;
11
+ component: ComponentPreview | undefined;
12
+ componentFixture: ComponentFixtureResolution;
13
+ tab: PanelTab;
14
+ onTab: (tab: PanelTab) => void;
15
+ onOpenScenario: (scenarioId: string) => void;
16
+ onOpenComponent: (componentId: string) => void;
17
+ onChange: (patch: Partial<ControlsState>) => void;
18
+ width: number;
19
+ onResize: (width: number) => void;
20
+ onResizeStart: () => void;
21
+ onResizeEnd: () => void;
22
+ };
23
+ export declare function Panel(props: PanelProps): import("react").JSX.Element;
24
+ /** Cmd/Ctrl+F: o filtro do painel no lugar da busca do navegador. */
25
+ export declare function isFilterShortcut(event: Pick<KeyboardEvent, "key" | "metaKey" | "ctrlKey" | "altKey" | "shiftKey">): boolean;
26
+ /**
27
+ * Esconde as linhas do painel que não casam com o filtro, sem diferenciar
28
+ * acento nem caixa. Devolve `true` quando o filtro não deixou nada visível.
29
+ */
30
+ export declare function applyFilter(root: HTMLElement | null, query: string): boolean;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Alça de redimensionamento das laterais. Arrasta com o ponteiro e responde às
3
+ * setas do teclado, de 16 em 16 px.
4
+ */
5
+ export type ResizerProps = {
6
+ /** Lado da lateral: a esquerda cresce para a direita, a direita, para a esquerda. */
7
+ side: "left" | "right";
8
+ label: string;
9
+ value: number;
10
+ onChange: (value: number) => void;
11
+ onStart?: () => void;
12
+ onEnd?: () => void;
13
+ };
14
+ export declare function Resizer({ side, label, value, onChange, onStart, onEnd }: ResizerProps): import("react").JSX.Element;
@@ -1,14 +1,22 @@
1
1
  import { Registry } from '../registry/index.js';
2
- import { ControlsState, Scenario, ScenarioView } from '../types/index.js';
2
+ import { ComponentPreview, HandoffScope } from '../types/index.js';
3
3
  export type SidebarProps = {
4
4
  registry: Registry;
5
- activeScenario: Scenario | undefined;
5
+ handoff: HandoffScope | undefined;
6
+ activeScreen: string | undefined;
6
7
  activeComponent: string | undefined;
7
- controls: ControlsState;
8
- onOpenScenario: (scenarioId: string) => void;
8
+ onOpenScreen: (screenId: string) => void;
9
9
  onOpenComponent: (componentId: string) => void;
10
- onViewChange: (view: ScenarioView) => void;
10
+ width: number;
11
+ onResize: (width: number) => void;
12
+ onResizeStart: () => void;
13
+ onResizeEnd: () => void;
11
14
  };
12
- export declare function Sidebar({ registry, activeScenario, activeComponent, controls, onOpenScenario, onOpenComponent, onViewChange, }: SidebarProps): import("react").JSX.Element;
15
+ export declare function Sidebar({ registry, handoff, activeScreen, activeComponent, onOpenScreen, onOpenComponent, width, onResize, onResizeStart, onResizeEnd, }: SidebarProps): import("react").JSX.Element;
16
+ /** Componentes agrupados por `group`, na ordem em que cada grupo aparece. */
17
+ export declare function groupComponents(components: ComponentPreview[], ungrouped: string): {
18
+ group: string;
19
+ items: ComponentPreview[];
20
+ }[];
21
+ /** Command/Ctrl + K, sem outros modificadores. */
13
22
  export declare function isSearchShortcut(event: Pick<KeyboardEvent, "key" | "metaKey" | "ctrlKey" | "altKey" | "shiftKey">): boolean;
14
- export declare function nextItemId(ids: string[], currentId: string | undefined, offset: number): string | undefined;
@@ -1,24 +1,4 @@
1
1
  import { ReactNode } from 'react';
2
- import { TabStop } from '../a11y/useKeyboardMode.js';
3
- import { ViewportSetting } from '../types/index.js';
4
- export type StageProps = {
5
- viewport: ViewportSetting;
6
- textScale: number;
7
- reducedMotion: boolean;
8
- keyboardMode: boolean;
9
- children: ReactNode;
10
- };
11
- export declare const Stage: import('react').ForwardRefExoticComponent<StageProps & import('react').RefAttributes<HTMLDivElement>>;
12
- /**
13
- * Numeração da ordem de tabulação sobreposta ao palco.
14
- *
15
- * O amarelo marca `tabindex` positivo, que fura a ordem natural do documento —
16
- * quase sempre um problema, e invisível de qualquer outra forma.
17
- */
18
- export declare function TabOrderOverlay({ stops }: {
19
- stops: TabStop[];
20
- }): import("react").JSX.Element | null;
21
- /** Estado vazio do palco: sem cenário ativo, ou rota sem cenário declarado. */
22
2
  export declare function StageEmpty({ title, children }: {
23
3
  title: string;
24
4
  children?: ReactNode;
@@ -1,15 +1,24 @@
1
1
  import { DeployContext } from '../deploy/index.js';
2
- import { ChromeTheme, ProductDefinition, Scenario, ScenarioView } from '../types/index.js';
2
+ import { ValidationIssue } from '../registry/validate.js';
3
+ import { ChromeTheme, ViewportSetting } from '../types/index.js';
4
+ /** Degraus do zoom, como os de um navegador. */
5
+ export declare const ZOOM_STEPS: readonly [25, 33, 50, 67, 75, 90, 100, 110, 125, 150];
6
+ export declare function nextZoom(current: number, direction: 1 | -1): number;
3
7
  export type TopbarProps = {
4
- product: ProductDefinition;
5
- scenario: Scenario | undefined;
8
+ productName: string;
6
9
  deploy: DeployContext;
7
- inspectorOpen: boolean;
8
- chromeTheme: ChromeTheme;
9
- view: ScenarioView;
10
- onToggleInspector: () => void;
11
- onToggleChromeTheme: () => void;
10
+ viewportId: string;
11
+ viewport: ViewportSetting;
12
+ zoom: number;
13
+ rotated: boolean;
14
+ theme: ChromeTheme;
15
+ issues: ValidationIssue[];
16
+ /** URL absoluta do estado atual. */
17
+ linkUrl: string;
18
+ onViewport: (id: string) => void;
19
+ onRotate: () => void;
20
+ onZoom: (zoom: number) => void;
21
+ onCleanReview: () => void;
22
+ onToggleTheme: () => void;
12
23
  };
13
- export declare function Topbar({ product, scenario, deploy, inspectorOpen, chromeTheme, view, onToggleInspector, onToggleChromeTheme, }: TopbarProps): import("react").JSX.Element;
14
- export declare function buildCleanReviewUrl(href: string): string;
15
- export declare function buildHomeUrl(origin: string, chromeTheme: ChromeTheme, view?: ScenarioView): string;
24
+ export declare function Topbar({ productName, viewportId, viewport, zoom, rotated, theme, issues, linkUrl, onViewport, onRotate, onZoom, onCleanReview, onToggleTheme, }: TopbarProps): import("react").JSX.Element;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Ícones do chrome: traço simples, `currentColor`, 16px. Sem texto, sem cor.
3
+ * Todo ícone é decorativo; o nome acessível fica no botão que o contém.
4
+ */
5
+ export type IconName = "mobile" | "tablet" | "desktop" | "fit" | "rotate" | "minus" | "plus" | "link" | "check" | "fullscreen" | "sun" | "moon" | "panel" | "alert" | "chevron" | "search" | "copy";
6
+ export declare function Icon({ name, size }: {
7
+ name: IconName;
8
+ size?: number;
9
+ }): import("react").JSX.Element;
@@ -1,149 +1,121 @@
1
- import { KeyboardCoverage, NetworkState, ScenarioStatus } from '../types/index.js';
1
+ import { NetworkState } from '../types/index.js';
2
2
  export type Labels = {
3
- status: Record<ScenarioStatus, string>;
4
- statusMeaning: Record<ScenarioStatus, string>;
5
3
  network: Record<NetworkState, string>;
6
- keyboard: Record<KeyboardCoverage, string>;
7
4
  /** Rótulo de viewport por id: `fit`, `mobile`, `tablet`, `desktop`, `custom`. */
8
5
  viewport: Record<string, string>;
9
6
  topbar: {
10
- homeTitle: (product: string) => string;
11
- toggleNav: string;
7
+ region: string;
8
+ viewportGroup: string;
9
+ rotate: string;
10
+ zoomOut: string;
11
+ zoomIn: string;
12
+ zoomReset: string;
13
+ zoomValue: (percent: number) => string;
12
14
  copyLink: string;
13
15
  copied: string;
14
16
  copyPrompt: string;
15
17
  cleanReview: string;
16
- cleanReviewTitle: string;
17
- panel: string;
18
18
  lightMode: string;
19
19
  darkMode: string;
20
+ engineVersion: (version: string) => string;
21
+ diagnostics: (errors: number, warnings: number) => string;
20
22
  branchTitle: (branch: string) => string;
21
23
  commitTitle: (commit: string) => string;
22
24
  envTitle: (env: string) => string;
23
25
  };
24
26
  sidebar: {
25
27
  region: string;
26
- flowsTab: string;
28
+ tabs: string;
29
+ screensTab: string;
27
30
  componentsTab: string;
28
31
  searchPlaceholder: string;
29
32
  searchLabel: string;
30
- componentSearchPlaceholder: string;
31
- componentSearchLabel: string;
32
33
  searchShortcut: string;
33
34
  noMatch: (query: string) => string;
34
- matchCount: (total: number) => string;
35
- noComponentMatch: (query: string) => string;
36
- componentMatchCount: (total: number) => string;
37
- activeWork: string;
38
- portedReferences: (total: number) => string;
39
- viewPorted: (total: number) => string;
40
- backToActive: string;
41
- currentView: (view: string) => string;
42
- noActiveWork: string;
43
- noPortedReferences: string;
44
- /** @deprecated Mantido para overrides escritos para 0.4.0. */
45
- showPorted: string;
46
- /** @deprecated Deep links portados agora abrem a visão correspondente. */
47
- activePorted: string;
48
- /** @deprecated Grupos vazios não são mais renderizados. */
49
- emptyModule: string;
35
+ emptyScreens: string;
50
36
  emptyComponents: string;
51
- withoutModule: string;
52
- scope: string;
53
- scopeData: string;
54
- scopePersona: string;
55
- scopeNetwork: string;
37
+ ungrouped: string;
38
+ toggleGroup: (group: string) => string;
39
+ resize: string;
56
40
  };
57
- controls: {
41
+ panel: {
58
42
  region: string;
43
+ searchPlaceholder: string;
44
+ searchLabel: string;
45
+ searchShortcut: string;
46
+ noMatch: (query: string) => string;
47
+ tabs: string;
48
+ variationsTab: string;
49
+ infoTab: string;
50
+ resize: string;
51
+ variationsList: string;
52
+ defaultVariation: string;
53
+ defaultVariationHint: string;
54
+ noVariations: string;
55
+ noComponentVariations: string;
56
+ nothingSelected: string;
59
57
  persona: string;
60
- fixture: string;
61
- componentFixture: string;
62
58
  network: string;
63
- viewport: string;
64
- customWidth: string;
65
59
  theme: string;
66
60
  locale: string;
67
61
  dataSource: string;
68
62
  fixturesOption: string;
69
- a11y: string;
70
- keyboardMode: string;
71
- keyboardModeTitle: string;
72
- reducedMotion: string;
73
- reducedMotionTitle: string;
74
- textScale: string;
75
63
  none: string;
64
+ fixtureFallback: (requested: string, fallback: string) => string;
76
65
  };
77
- inspector: {
78
- region: string;
79
- tabScenario: string;
80
- tabA11y: string;
81
- tabDiagnostics: string;
82
- diagnosticsWithErrors: (count: number) => string;
83
- noScenario: string;
84
- componentReference: string;
85
- componentGroup: string;
86
- componentFixture: string;
87
- componentFixtureDescription: string;
88
- componentFixtureFallback: (requested: string, fallback: string) => string;
89
- situation: string;
90
- reproduction: string;
66
+ info: {
67
+ screen: string;
68
+ variation: string;
69
+ component: string;
70
+ name: string;
91
71
  id: string;
72
+ group: string;
73
+ description: string;
74
+ source: string;
75
+ usedIn: string;
76
+ notUsed: string;
92
77
  route: string;
93
78
  persona: string;
94
- personaSwapped: string;
95
- data: string;
96
- network: string;
97
- goal: (goal: string) => string;
98
79
  permissions: string;
80
+ intent: string;
99
81
  preconditions: string;
100
- rules: string;
101
82
  actions: string;
102
83
  expected: string;
103
- approval: string;
104
- openApproved: string;
105
- engineering: string;
106
- a11yContract: string;
107
- keyboard: string;
108
- contrast: string;
109
- contrastTarget: (target: string) => string;
110
- announces: string;
111
- focusedElement: string;
112
- keyboardModeOff: string;
113
- pressTab: (tabStops: number) => string;
114
- role: string;
115
- name: string;
116
- noAccessibleName: string;
117
- nameFrom: string;
118
- description: string;
119
- selector: string;
120
- focusableButHidden: string;
121
- tabStopsInStage: (tabStops: number) => string;
122
- tokenContrast: string;
123
- noContrastPairs: string;
124
- pair: string;
125
- ratio: string;
126
- pairsFailing: (count: number) => string;
127
- automatedIsFloor: string;
128
- coverage: string;
129
- scenariosRegistered: (count: number) => string;
130
- scenarioContract: string;
84
+ rules: string;
85
+ components: string;
86
+ ticket: string;
87
+ copyForPr: string;
88
+ copiedForPr: string;
89
+ copyPrompt: string;
90
+ };
91
+ diagnostics: {
92
+ title: string;
131
93
  noIssues: string;
94
+ error: string;
95
+ warning: string;
96
+ close: string;
132
97
  };
133
- home: {
134
- lead: (total: number) => string;
135
- statusLegend: string;
136
- withoutModule: string;
137
- withoutModuleHint: string;
138
- emptyModule: string;
139
- keyboardBadge: string;
140
- noActiveWork: string;
141
- noPortedReferences: string;
98
+ /** Texto do markdown gerado por "Copiar para o PR". */
99
+ pr: {
100
+ variations: string;
101
+ components: string;
102
+ component: string;
103
+ source: string;
104
+ expected: string;
105
+ commit: (shortCommit: string) => string;
106
+ immutableLink: string;
107
+ noExpected: string;
108
+ empty: string;
142
109
  };
143
110
  shell: {
144
111
  restoreChrome: string;
112
+ frameTitle: (product: string) => string;
145
113
  noRoute: string;
146
114
  noRouteHint: string;
115
+ outsideHandoff: string;
116
+ outsideHandoffHint: string;
117
+ empty: string;
118
+ emptyHint: string;
147
119
  };
148
120
  };
149
121
  /** Português. É o padrão, não uma obrigação. */
@@ -163,16 +135,10 @@ export declare function resolveLabels(override?: LabelsOverride): Labels;
163
135
  /**
164
136
  * Rótulos resolvidos, para o chrome inteiro.
165
137
  *
166
- * O padrão do contexto é o português, então `Home` e `Stage` — exportados e
167
- * montáveis fora do `DesignSpace` — continuam funcionando sem provider.
138
+ * O padrão do contexto é o português, então `StageEmpty` — exportado e
139
+ * montável fora do `DesignSpace` — continua funcionando sem provider.
168
140
  */
169
141
  export declare const LabelsContext: import('react').Context<Labels>;
170
142
  export declare function useLabels(): Labels;
171
- /** @deprecated Use `useLabels().status`, ou `DEFAULT_LABELS.status` fora de React. */
172
- export declare const STATUS_LABELS: Record<ScenarioStatus, string>;
173
- /** @deprecated Use `useLabels().statusMeaning`. */
174
- export declare const STATUS_MEANING: Record<ScenarioStatus, string>;
175
143
  /** @deprecated Use `useLabels().network`. */
176
144
  export declare const NETWORK_LABELS: Record<NetworkState, string>;
177
- /** @deprecated Use `useLabels().keyboard`. */
178
- export declare const KEYBOARD_LABELS: Record<KeyboardCoverage, string>;
@@ -0,0 +1,15 @@
1
+ import { DeployContext } from '../deploy/index.js';
2
+ import { ScreenNode } from '../registry/index.js';
3
+ import { ComponentPreview, ControlsState, Scenario } from '../types/index.js';
4
+ import { Labels } from './labels.js';
5
+ export type PrMarkdownInput = {
6
+ screen: ScreenNode;
7
+ /** Variações a listar, normalmente as visíveis no recorte ativo. */
8
+ variations: Scenario[];
9
+ components: ComponentPreview[];
10
+ deploy: DeployContext;
11
+ labels: Labels;
12
+ /** Controles que o link precisa carregar, como o recorte de handoff. */
13
+ overrides?: Partial<ControlsState>;
14
+ };
15
+ export declare function buildPrMarkdown({ screen, variations, components, deploy, labels, overrides, }: PrMarkdownInput): string;
@@ -0,0 +1,14 @@
1
+ import { ChromeTheme } from '../types/index.js';
2
+ export declare const STORAGE_KEYS: {
3
+ readonly leftWidth: "ds:left-width";
4
+ readonly rightWidth: "ds:right-width";
5
+ readonly appearance: "ds:appearance";
6
+ };
7
+ export declare function readStored(key: string): string | undefined;
8
+ export declare function writeStored(key: string, value: string): void;
9
+ export declare function clampWidth(value: number, min: number, max: number): number;
10
+ /** Largura lembrada entre visitas, sempre dentro da faixa. */
11
+ export declare function useStoredWidth(key: string, initial: number, min: number, max: number): [number, (next: number) => void];
12
+ /** Tema do sistema, acompanhando a troca enquanto a página está aberta. */
13
+ export declare function useSystemTheme(): ChromeTheme;
14
+ export declare function storedTheme(): ChromeTheme | undefined;
@@ -1,6 +1,5 @@
1
1
  import { validateProduct, hasErrors, formatIssues } from '../registry/validate.js';
2
- import { assertContrastPairs, checkContrastPair, checkContrastPairs, contrastRatio } from '../a11y/contrast.js';
3
- import { ControlsState, ProductDefinition, Scenario, ScenarioStatus } from '../types/index.js';
2
+ import { ControlsState, ProductDefinition, Scenario } from '../types/index.js';
4
3
  /**
5
4
  * Origem contra a qual os testes rodam.
6
5
  *
@@ -24,16 +23,15 @@ export declare function urlFor(scenario: Scenario, options?: {
24
23
  */
25
24
  export declare function pathFor(scenario: Scenario, overrides?: Partial<ControlsState>): string;
26
25
  /**
27
- * Cenários que valem uma jornada automatizada.
26
+ * Seletor do `<iframe>` onde a UI do produto roda desde a 0.8. Em Playwright:
28
27
  *
29
- * Deliberadamente não é "todos": rodar Playwright em cenário `ported` ou
30
- * `proposed` transforma importação ou exploração em trabalho de manutenção de
31
- * teste, que é o oposto de "governança proporcional" (Princípio 9). O piso é o
32
- * cenário que já foi aprovado ou já existe em produção.
28
+ * ```ts
29
+ * await page.goto(pathFor(scenario));
30
+ * const app = page.frameLocator(FRAME_SELECTOR);
31
+ * await expect(app.getByRole("heading", { name: "Fila" })).toBeVisible();
32
+ * ```
33
33
  */
34
- export declare function scenariosUnderTest(product: ProductDefinition, statuses?: ScenarioStatus[]): Scenario[];
35
- /** Cenários que declaram jornada completável só por teclado. */
36
- export declare function keyboardScenarios(product: ProductDefinition): Scenario[];
34
+ export declare const FRAME_SELECTOR = "iframe[data-ds-frame]";
37
35
  /**
38
36
  * Falha o teste quando o contrato de cenário do produto tem erro.
39
37
  *
@@ -41,5 +39,5 @@ export declare function keyboardScenarios(product: ProductDefinition): Scenario[
41
39
  * inexistente, persona escrita errada, rota que não casa com nada.
42
40
  */
43
41
  export declare function assertValidProduct(product: ProductDefinition): void;
44
- export { assertContrastPairs, checkContrastPair, checkContrastPairs, contrastRatio, formatIssues, hasErrors, validateProduct, };
42
+ export { formatIssues, hasErrors, validateProduct, };
45
43
  export { scenarioUrl } from '../deploy/index.js';