yarramate 1.28.0 → 1.29.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.
@@ -37,6 +37,20 @@ export interface VisualQuestionEntry {
37
37
  */
38
38
  readonly trigger?: readonly CatalogueCondition[];
39
39
  }
40
+ /**
41
+ * The next load-bearing open question (#534, ADR 0154): the row `design`
42
+ * would serve first, by design's own rule (the first open question in wave
43
+ * order, then catalogue order within the wave; a subject-scoped question
44
+ * names the first open subject it is open for). Computed host-side beside
45
+ * the overlay so both hosts and the browser agree on which row it is, and
46
+ * nobody re-derives the rule from the lists.
47
+ */
48
+ export interface VisualNextQuestion extends VisualQuestionEntry {
49
+ readonly wave: string;
50
+ /** The subject it is open for; absent for a workspace-scoped question. */
51
+ readonly subjectId?: string;
52
+ readonly subjectName?: string;
53
+ }
40
54
  /**
41
55
  * The interrogation report, folded for drawing (#292).
42
56
  *
@@ -56,6 +70,12 @@ export interface VisualInterrogationOverlay {
56
70
  readonly workspace: readonly VisualQuestionEntry[];
57
71
  /** Open questions per qualified subject id — `CanvasNode.id`'s space. */
58
72
  readonly subjects: Readonly<Record<string, readonly VisualQuestionEntry[]>>;
73
+ /**
74
+ * The one to ask next (#534). Absent when nothing is open, or when the
75
+ * host that built this overlay predates the field: a reader treats absence
76
+ * as "no next question", never as a fault.
77
+ */
78
+ readonly next?: VisualNextQuestion;
59
79
  }
60
80
  /** The resolved graph a session renders, as the browser receives it. */
61
81
  export interface VisualRenderedModel {
@@ -132,6 +132,10 @@ dismissed = []) => {
132
132
  .map(({ questionId, subject }) => `${questionId}\u0000${subject}`));
133
133
  const workspace = [];
134
134
  const subjects = {};
135
+ // The first row kept is the next question (#534): the loop already walks
136
+ // waves in order and questions in catalogue order, which is `design`'s
137
+ // rule, so "first kept" is the rule and not a second one.
138
+ let next;
135
139
  for (const wave of report.waves) {
136
140
  for (const question of wave.questions) {
137
141
  if (!question.open)
@@ -149,22 +153,31 @@ dismissed = []) => {
149
153
  trigger: question.trigger,
150
154
  };
151
155
  if (question.subjects === undefined) {
152
- workspace.push({
156
+ const row = {
153
157
  ...base,
154
158
  scope: "workspace",
155
159
  question: question.question,
156
- });
160
+ };
161
+ workspace.push(row);
162
+ next ??= { ...row, wave: wave.id };
157
163
  continue;
158
164
  }
159
165
  for (const subject of question.subjects) {
160
166
  if (dismissedForSubject.has(`${question.id}\u0000${subject.id}`)) {
161
167
  continue;
162
168
  }
163
- (subjects[subject.id] ??= []).push({
169
+ const row = {
164
170
  ...base,
165
171
  scope: "subject",
166
172
  question: subject.question,
167
- });
173
+ };
174
+ (subjects[subject.id] ??= []).push(row);
175
+ next ??= {
176
+ ...row,
177
+ wave: wave.id,
178
+ subjectId: subject.id,
179
+ ...(subject.name === undefined ? {} : { subjectName: subject.name }),
180
+ };
168
181
  }
169
182
  }
170
183
  }
@@ -173,6 +186,7 @@ dismissed = []) => {
173
186
  semantics: report.semantics,
174
187
  workspace,
175
188
  subjects,
189
+ ...(next === undefined ? {} : { next }),
176
190
  };
177
191
  };
178
192
  /**