@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.
@@ -1,4 +1,4 @@
1
- import { ControlsState, Scenario } from '../types/index.js';
1
+ import { ControlsState, DeployOverrides, Scenario } from '../types/index.js';
2
2
  export type DeployContext = {
3
3
  /** `development`, `preview` ou `production`. */
4
4
  env: string;
@@ -14,11 +14,17 @@ export type DeployContext = {
14
14
  commit: string | undefined;
15
15
  /** Primeiros 7 caracteres do commit. */
16
16
  shortCommit: string | undefined;
17
- /** `true` quando roda em preview ou produção na Vercel. */
17
+ /** `true` quando o produto informou preview ou produção. */
18
18
  isDeployed: boolean;
19
19
  };
20
- /** Lê o contexto do deployment. Seguro em SSR, em Node e no browser. */
21
- export declare function getDeployContext(): DeployContext;
20
+ /**
21
+ * Monta o contexto do deployment a partir do que o produto informou.
22
+ *
23
+ * Campo ausente ou vazio cai no padrão local — string vazia é o que um `define`
24
+ * de bundler produz quando a variável não existe, e um cabeçalho de revisão com
25
+ * branch vazia é pior que um sem branch.
26
+ */
27
+ export declare function getDeployContext(overrides?: DeployOverrides): DeployContext;
22
28
  /**
23
29
  * URL absoluta de um cenário: rota mais os controles necessários para
24
30
  * reproduzir a situação. É o link que um PO envia sem precisar explicar
@@ -32,11 +38,18 @@ export declare function scenarioUrl(scenario: Scenario, options?: {
32
38
  * URL imutável de aprovação (§10.2). Aponta para o commit exato, então a
33
39
  * aprovação não muda de conteúdo debaixo de quem aprovou.
34
40
  *
35
- * Requer o escopo do projeto na Vercel, que é a parte do domínio depois do
36
- * hash e não está exposta como variável — por isso vem do produto.
41
+ * O formato da URL é do provedor, não do motor, então vem do produto como
42
+ * template com `{commit}` ou `{shortCommit}`:
43
+ *
44
+ * ```ts
45
+ * commitUrl(scenario, { template: "https://acme-{shortCommit}-time.example.app" });
46
+ * commitUrl(scenario, { template: "https://{commit}.review.acme.dev" });
47
+ * ```
48
+ *
49
+ * Sem commit não há aprovação rastreável, e a função devolve `undefined` em vez
50
+ * de um link que aponta para o lugar errado.
37
51
  */
38
52
  export declare function commitUrl(scenario: Scenario, options: {
39
- project: string;
40
- scope: string;
53
+ template: string;
41
54
  commit?: string;
42
55
  }): string | undefined;
package/dist/index.d.ts CHANGED
@@ -9,7 +9,7 @@
9
9
  export { DesignSpace, type DesignSpaceProps } from './shell/DesignSpace.js';
10
10
  export { Stage, StageEmpty, TabOrderOverlay, type StageProps } from './shell/Stage.js';
11
11
  export { Home, type HomeProps } from './shell/Home.js';
12
- export { KEYBOARD_LABELS, NETWORK_LABELS, STATUS_LABELS, STATUS_MEANING, } from './shell/labels.js';
12
+ export { DEFAULT_LABELS, KEYBOARD_LABELS, NETWORK_LABELS, STATUS_LABELS, STATUS_MEANING, resolveLabels, useLabels, type Labels, type LabelsOverride, } from './shell/labels.js';
13
13
  export { createRegistry, type ModuleNode, type Registry } from './registry/index.js';
14
14
  export { formatIssues, hasErrors, validateProduct, validateScenario, type ValidationIssue, } from './registry/validate.js';
15
15
  export { matchPath, resolveRoute, type RouteMatch } from './router/index.js';
@@ -22,4 +22,4 @@ export { CONTRAST_THRESHOLDS, assertContrastPairs, checkContrastPair, checkContr
22
22
  export { computeRole, describeElement, shortSelector, tabbableElements, type AccessibleNode, } from './a11y/accessible-tree.js';
23
23
  export { useKeyboardMode, type KeyboardModeResult, type TabStop, } from './a11y/useKeyboardMode.js';
24
24
  export { ageInYears, daysBetween, parseIsoDate } from './util/date.js';
25
- export { NETWORK_STATES, SCENARIO_STATUSES, type A11yContract, type ContrastPair, type ContrastTarget, type ControlsState, type DataRequest, type DataSourceAdapter, type Fixture, type Flow, type FlowStep, type KeyboardCoverage, type Module, type NetworkState, type Persona, type ProductDefinition, type ProductTheme, type Rule, type RouteDefinition, type Scenario, type ScenarioContext, type ScenarioStatus, type ScreenProps, type ViewportSetting, } from './types/index.js';
25
+ export { NETWORK_STATES, SCENARIO_STATUSES, type A11yContract, type ContrastPair, type ContrastTarget, type ControlsState, type DeployOverrides, type DataRequest, type DataSourceAdapter, type Fixture, type Flow, type FlowStep, type KeyboardCoverage, type Module, type NetworkState, type Persona, type ProductDefinition, type ProductTheme, type Rule, type RouteDefinition, type Scenario, type ScenarioContext, type ScenarioStatus, type ScreenProps, type ViewportSetting, } from './types/index.js';