uidex 0.10.0 → 0.11.1

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.
@@ -37,19 +37,39 @@ interface StateDecl {
37
37
  name: string;
38
38
  /** Canonical kind for the state-matrix axis (defaults to `variant`). */
39
39
  kind?: StateKind;
40
- /** Acceptance criteria that only this state can evidence. */
41
- acceptance?: string[];
40
+ /**
41
+ * Acceptance criteria that only this state can evidence. Normalized into the
42
+ * same `{ id, rev, text }` regime as entity-level `acceptance` (one
43
+ * criterion-id namespace per entity), so per-state criteria are claimable by
44
+ * `uidexCovers` and visible to every acceptance gate.
45
+ */
46
+ acceptance?: AcceptanceCriterion[];
42
47
  description?: string;
43
48
  }
49
+ /**
50
+ * A normalized acceptance criterion. Authored either as a bare string (sugar:
51
+ * `id` is a deterministic kebab slug of the text, `rev` is 1) or as an object
52
+ * `{ id, rev?, text }`; parse-time normalization means everything downstream —
53
+ * audit, scaffold, the devtools — always sees this object shape. `rev` is the
54
+ * pin flows cover against (`uidexCovers("entity", "id@rev")`): bumping it when
55
+ * the criterion's meaning changes is what makes outdated-coverage detectable.
56
+ */
57
+ interface AcceptanceCriterion {
58
+ id: string;
59
+ rev: number;
60
+ text: string;
61
+ }
44
62
  interface Metadata {
45
63
  name?: string;
46
64
  description?: string;
47
- acceptance?: string[];
65
+ acceptance?: AcceptanceCriterion[];
48
66
  notes?: string;
49
67
  composes?: EntityRef[];
50
68
  flows?: readonly string[];
51
69
  features?: string[];
52
70
  widgets?: string[];
71
+ /** Page ids a feature declares it must be mounted on (feature kind only). */
72
+ surfaces?: string[];
53
73
  /** Declared render states (see StateDecl); the capture-completeness gate. */
54
74
  states?: StateDecl[];
55
75
  /**
@@ -87,12 +107,25 @@ interface FlowStep {
87
107
  entityId: string;
88
108
  action?: string;
89
109
  }
110
+ /**
111
+ * A per-criterion coverage claim a flow makes via
112
+ * `uidexCovers("<entityId>", "<criterionId>@<rev>")`. The rev is REQUIRED at
113
+ * the claim site — a rev-less claim could never go stale, which would defeat
114
+ * the outdated-detection the pin exists for.
115
+ */
116
+ interface FlowCover {
117
+ entity: string;
118
+ criterion: string;
119
+ rev: number;
120
+ }
90
121
  interface Flow {
91
122
  kind: "flow";
92
123
  id: string;
93
124
  loc: Location;
94
125
  touches: string[];
95
126
  steps: FlowStep[];
127
+ /** Acceptance-criterion coverage claims made inside this flow's describe. */
128
+ covers?: FlowCover[];
96
129
  }
97
130
  interface Page extends EntityWithMetaBase {
98
131
  kind: "page";
@@ -37,19 +37,39 @@ interface StateDecl {
37
37
  name: string;
38
38
  /** Canonical kind for the state-matrix axis (defaults to `variant`). */
39
39
  kind?: StateKind;
40
- /** Acceptance criteria that only this state can evidence. */
41
- acceptance?: string[];
40
+ /**
41
+ * Acceptance criteria that only this state can evidence. Normalized into the
42
+ * same `{ id, rev, text }` regime as entity-level `acceptance` (one
43
+ * criterion-id namespace per entity), so per-state criteria are claimable by
44
+ * `uidexCovers` and visible to every acceptance gate.
45
+ */
46
+ acceptance?: AcceptanceCriterion[];
42
47
  description?: string;
43
48
  }
49
+ /**
50
+ * A normalized acceptance criterion. Authored either as a bare string (sugar:
51
+ * `id` is a deterministic kebab slug of the text, `rev` is 1) or as an object
52
+ * `{ id, rev?, text }`; parse-time normalization means everything downstream —
53
+ * audit, scaffold, the devtools — always sees this object shape. `rev` is the
54
+ * pin flows cover against (`uidexCovers("entity", "id@rev")`): bumping it when
55
+ * the criterion's meaning changes is what makes outdated-coverage detectable.
56
+ */
57
+ interface AcceptanceCriterion {
58
+ id: string;
59
+ rev: number;
60
+ text: string;
61
+ }
44
62
  interface Metadata {
45
63
  name?: string;
46
64
  description?: string;
47
- acceptance?: string[];
65
+ acceptance?: AcceptanceCriterion[];
48
66
  notes?: string;
49
67
  composes?: EntityRef[];
50
68
  flows?: readonly string[];
51
69
  features?: string[];
52
70
  widgets?: string[];
71
+ /** Page ids a feature declares it must be mounted on (feature kind only). */
72
+ surfaces?: string[];
53
73
  /** Declared render states (see StateDecl); the capture-completeness gate. */
54
74
  states?: StateDecl[];
55
75
  /**
@@ -87,12 +107,25 @@ interface FlowStep {
87
107
  entityId: string;
88
108
  action?: string;
89
109
  }
110
+ /**
111
+ * A per-criterion coverage claim a flow makes via
112
+ * `uidexCovers("<entityId>", "<criterionId>@<rev>")`. The rev is REQUIRED at
113
+ * the claim site — a rev-less claim could never go stale, which would defeat
114
+ * the outdated-detection the pin exists for.
115
+ */
116
+ interface FlowCover {
117
+ entity: string;
118
+ criterion: string;
119
+ rev: number;
120
+ }
90
121
  interface Flow {
91
122
  kind: "flow";
92
123
  id: string;
93
124
  loc: Location;
94
125
  touches: string[];
95
126
  steps: FlowStep[];
127
+ /** Acceptance-criterion coverage claims made inside this flow's describe. */
128
+ covers?: FlowCover[];
96
129
  }
97
130
  interface Page extends EntityWithMetaBase {
98
131
  kind: "page";
@@ -7335,7 +7335,10 @@ function createEntityDetailView(config) {
7335
7335
  sections.push({ id: "description", text: meta.description });
7336
7336
  }
7337
7337
  if (offerAcceptance && meta?.acceptance?.length) {
7338
- sections.push({ id: "acceptance", items: meta.acceptance });
7338
+ sections.push({
7339
+ id: "acceptance",
7340
+ items: meta.acceptance.map((c) => c.text)
7341
+ });
7339
7342
  }
7340
7343
  if (entity) {
7341
7344
  for (const s of config.extraSections?.(ctx, entity) ?? []) {