@bakers-build/addon-bakers-ui 0.6.1-next.4 → 0.6.1-next.6

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.
Files changed (154) hide show
  1. package/dist/src/Component/section-list/index.d.ts +5 -5
  2. package/dist/src/Component/section-list/index.js +2 -2
  3. package/dist/src/Entity/conductor/Data/conductors.d.ts +2 -12
  4. package/dist/src/Entity/conductor/Data/conductors.js +3 -25
  5. package/dist/src/Entity/conductor/Data/own-conductor.d.ts +5 -7
  6. package/dist/src/Entity/conductor/Data/own-conductor.js +9 -16
  7. package/dist/src/Entity/project/Screen/projects-screen.js +1 -4
  8. package/dist/src/Entity/run/Component/run-detail/index.d.ts +1 -1
  9. package/dist/src/Entity/run/Component/run-detail/index.js +1 -1
  10. package/dist/src/Entity/run/Data/query.d.ts +0 -5
  11. package/dist/src/Entity/run/Data/query.js +0 -8
  12. package/dist/src/Entity/run/Data/runs.d.ts +0 -2
  13. package/dist/src/Entity/run/Data/runs.js +1 -26
  14. package/dist/src/Entity/run/Screen/run-detail.d.ts +1 -1
  15. package/dist/src/Entity/run/Screen/run-detail.js +1 -1
  16. package/dist/src/Entity/ticket/Component/edit-form/index.d.ts +1 -2
  17. package/dist/src/Entity/ticket/Component/edit-form/index.js +1 -2
  18. package/dist/src/Entity/ticket/Component/ticket-content/index.d.ts +3 -8
  19. package/dist/src/Entity/ticket/Component/ticket-content/index.js +4 -71
  20. package/dist/src/Entity/ticket/Component/ticket-content/model.d.ts +0 -25
  21. package/dist/src/Entity/ticket/Component/ticket-content/model.js +0 -195
  22. package/dist/src/Entity/ticket/Data/parents.d.ts +3 -3
  23. package/dist/src/Entity/ticket/Data/parents.js +8 -9
  24. package/dist/src/Entity/ticket/Data/query.d.ts +0 -2
  25. package/dist/src/Entity/ticket/Data/query.js +0 -8
  26. package/dist/src/Entity/ticket/Data/tickets.d.ts +0 -2
  27. package/dist/src/Entity/ticket/Data/tickets.js +1 -20
  28. package/dist/src/Entity/ticket/Data/write.d.ts +0 -32
  29. package/dist/src/Entity/ticket/Data/write.js +0 -94
  30. package/dist/src/Entity/ticket/Form/edit-data.js +10 -4
  31. package/dist/src/Entity/ticket/Form/edit-parent-source.d.ts +1 -1
  32. package/dist/src/Entity/ticket/Form/edit.d.ts +11 -8
  33. package/dist/src/Entity/ticket/Form/edit.js +1 -1
  34. package/dist/src/Entity/ticket/Form/parent-filter.d.ts +2 -2
  35. package/dist/src/Entity/ticket/Form/parent-filter.js +1 -1
  36. package/dist/src/Entity/ticket/Form/parent-source.d.ts +11 -2
  37. package/dist/src/Entity/ticket/Form/parent-source.js +5 -7
  38. package/dist/src/Entity/ticket/Screen/edit-assignment-form.d.ts +2 -2
  39. package/dist/src/Entity/ticket/Screen/edit-assignment-form.js +3 -3
  40. package/dist/src/Entity/ticket/Screen/parent-filter-form.js +3 -4
  41. package/dist/src/Entity/ticket/Screen/ticket-content-screen.d.ts +1 -1
  42. package/dist/src/Entity/ticket/Screen/ticket-content-screen.js +1 -1
  43. package/dist/src/Entity/ticket/Screen/ticket-react-markdown.js +2 -2
  44. package/dist/src/Entity/ticket/Screen/ticket-runs.d.ts +2 -0
  45. package/dist/src/Entity/ticket/Screen/ticket-runs.js +26 -16
  46. package/dist/src/Entity/ticket/Screen/ticket-search.d.ts +1 -1
  47. package/dist/src/Entity/ticket/Screen/tickets.d.ts +1 -2
  48. package/dist/src/Entity/ticket/Screen/tickets.js +0 -23
  49. package/dist/src/Entity/user/Data/member-context.d.ts +1 -1
  50. package/dist/src/Entity/user/Data/users.d.ts +17 -98
  51. package/dist/src/Entity/user/Data/users.js +27 -74
  52. package/dist/src/Entity/user/Screen/member-overview.d.ts +12 -29
  53. package/dist/src/Entity/user/Screen/member-overview.js +38 -38
  54. package/dist/src/Entity/workspace/Screen/workspace-picker.js +1 -2
  55. package/dist/src/Form/field.js +1 -1
  56. package/dist/src/Kernel/key-input.d.ts +1 -2
  57. package/dist/src/Kernel/key-input.js +1 -2
  58. package/dist/src/Kernel/logo.d.ts +3 -0
  59. package/dist/src/Kernel/logo.js +48 -0
  60. package/dist/src/Kernel/splash.js +5 -5
  61. package/dist/src/Kernel/tui-kernel.js +1 -5
  62. package/dist/src/Routing/context.d.ts +0 -5
  63. package/dist/src/Routing/context.js +0 -6
  64. package/dist/src/Routing/registry.js +3 -6
  65. package/dist/src/Routing/routes.js +1 -24
  66. package/dist/src/Screen/async-modal-screen.d.ts +1 -1
  67. package/dist/src/Screen/async-modal-screen.js +1 -1
  68. package/dist/src/Widget/chrome.d.ts +1 -1
  69. package/dist/src/Widget/chrome.js +1 -1
  70. package/dist/src/Widget/option-source.js +3 -3
  71. package/dist/src/Widget/types.d.ts +2 -3
  72. package/dist/src/index.d.ts +0 -1
  73. package/dist/src/index.js +1 -2
  74. package/dist/src/launcher.d.ts +7 -14
  75. package/dist/src/launcher.js +2 -10
  76. package/dist/src/lib/cursor.d.ts +5 -5
  77. package/dist/src/lib/cursor.js +5 -5
  78. package/dist/src/lib/refresh-signal.d.ts +1 -1
  79. package/dist/src/lib/theme.d.ts +7 -23
  80. package/dist/src/lib/theme.js +7 -23
  81. package/dist/src/plugin.d.ts +1 -2
  82. package/dist/src/plugin.js +3 -7
  83. package/dist/src/react-experiment.js +0 -2
  84. package/dist/src/route.js +1 -1
  85. package/dist/src/types.d.ts +5 -56
  86. package/package.json +4 -4
  87. package/dist/src/Agent/launch.d.ts +0 -25
  88. package/dist/src/Agent/launch.js +0 -57
  89. package/dist/src/Component/badge/index.d.ts +0 -11
  90. package/dist/src/Component/badge/index.js +0 -10
  91. package/dist/src/Component/bar-chart/index.d.ts +0 -16
  92. package/dist/src/Component/bar-chart/index.js +0 -63
  93. package/dist/src/Component/heat-map/index.d.ts +0 -21
  94. package/dist/src/Component/heat-map/index.js +0 -86
  95. package/dist/src/Component/stats-panel/index.d.ts +0 -61
  96. package/dist/src/Component/stats-panel/index.js +0 -112
  97. package/dist/src/Component/team-member-workload-list/index.d.ts +0 -9
  98. package/dist/src/Component/team-member-workload-list/index.js +0 -31
  99. package/dist/src/Entity/team/Data/members.d.ts +0 -30
  100. package/dist/src/Entity/team/Data/members.js +0 -83
  101. package/dist/src/Entity/team/Data/projects.d.ts +0 -3
  102. package/dist/src/Entity/team/Data/projects.js +0 -23
  103. package/dist/src/Entity/team/Data/team.d.ts +0 -22
  104. package/dist/src/Entity/team/Data/team.js +0 -38
  105. package/dist/src/Entity/team/Data/teams.d.ts +0 -223
  106. package/dist/src/Entity/team/Data/teams.js +0 -268
  107. package/dist/src/Entity/team/Data/workload.d.ts +0 -25
  108. package/dist/src/Entity/team/Data/workload.js +0 -60
  109. package/dist/src/Entity/team/Screen/team-member-work.d.ts +0 -41
  110. package/dist/src/Entity/team/Screen/team-member-work.js +0 -56
  111. package/dist/src/Entity/team/Screen/team-users.d.ts +0 -63
  112. package/dist/src/Entity/team/Screen/team-users.js +0 -210
  113. package/dist/src/Entity/team/Screen/team-work.d.ts +0 -39
  114. package/dist/src/Entity/team/Screen/team-work.js +0 -112
  115. package/dist/src/Entity/team/Screen/teams-screen.d.ts +0 -110
  116. package/dist/src/Entity/team/Screen/teams-screen.js +0 -264
  117. package/dist/src/Entity/ticket/Component/create-form/index.d.ts +0 -28
  118. package/dist/src/Entity/ticket/Component/create-form/index.js +0 -74
  119. package/dist/src/Entity/ticket/Component/demo-statistics.d.ts +0 -14
  120. package/dist/src/Entity/ticket/Component/demo-statistics.js +0 -88
  121. package/dist/src/Entity/ticket/Component/react-statistics.d.ts +0 -14
  122. package/dist/src/Entity/ticket/Component/react-statistics.js +0 -23
  123. package/dist/src/Entity/ticket/Data/workflow.d.ts +0 -9
  124. package/dist/src/Entity/ticket/Data/workflow.js +0 -18
  125. package/dist/src/Entity/ticket/Form/create-data.d.ts +0 -75
  126. package/dist/src/Entity/ticket/Form/create-data.js +0 -217
  127. package/dist/src/Entity/ticket/Form/create.d.ts +0 -230
  128. package/dist/src/Entity/ticket/Form/create.js +0 -198
  129. package/dist/src/Entity/ticket/Screen/create-ticket-form.d.ts +0 -133
  130. package/dist/src/Entity/ticket/Screen/create-ticket-form.js +0 -621
  131. package/dist/src/Entity/ticket/Screen/ticket-agents.d.ts +0 -134
  132. package/dist/src/Entity/ticket/Screen/ticket-agents.js +0 -253
  133. package/dist/src/Entity/ticket/Screen/ticket-react.d.ts +0 -41
  134. package/dist/src/Entity/ticket/Screen/ticket-react.js +0 -136
  135. package/dist/src/Entity/ticket-template/Data/templates.d.ts +0 -26
  136. package/dist/src/Entity/ticket-template/Data/templates.js +0 -62
  137. package/dist/src/Kernel/braid.d.ts +0 -4
  138. package/dist/src/Kernel/braid.js +0 -10
  139. package/dist/src/Screen/empty-overview.d.ts +0 -9
  140. package/dist/src/Screen/empty-overview.js +0 -14
  141. package/dist/src/Statistics/client.d.ts +0 -73
  142. package/dist/src/Statistics/client.js +0 -220
  143. package/dist/src/Statistics/comparison-chart.d.ts +0 -7
  144. package/dist/src/Statistics/comparison-chart.js +0 -525
  145. package/dist/src/Statistics/dashboard.d.ts +0 -93
  146. package/dist/src/Statistics/dashboard.js +0 -206
  147. package/dist/src/Statistics/figures.d.ts +0 -18
  148. package/dist/src/Statistics/figures.js +0 -162
  149. package/dist/src/Statistics/member-stats.d.ts +0 -58
  150. package/dist/src/Statistics/member-stats.js +0 -152
  151. package/dist/src/Statistics/presentation.d.ts +0 -8
  152. package/dist/src/Statistics/presentation.js +0 -36
  153. package/dist/src/Statistics/screen.d.ts +0 -44
  154. package/dist/src/Statistics/screen.js +0 -204
@@ -1,264 +0,0 @@
1
- import { actionItem } from '../../../Component/footer-actions/index.js';
2
- import { sectionRowNode, } from '../../../Component/section-list/index.js';
3
- import { ListCursor } from '../../../lib/cursor.js';
4
- import { columnNode } from '../../../lib/vnode.js';
5
- import { AsyncScreen } from '../../../Screen/async-screen.js';
6
- import { EmptyOverviewScreen } from '../../../Screen/empty-overview.js';
7
- import { loadGroupStatistics, } from '../../../Statistics/client.js';
8
- import { StatisticsScreen } from '../../../Statistics/screen.js';
9
- import { listRowIds, listTableTree } from '../../collection.js';
10
- import { loadTeamRows, TEAM_LIST_PAGE_SIZE, TEAM_TABLE, } from '../Data/teams.js';
11
- import { TeamWorkScreen } from './team-work.js';
12
- // BB-391 (AC4) — the team SURFACE: a list on the root level and a detail that
13
- // is the team-scoped statistics.
14
- //
15
- // Both screens live in one module because they are one surface, exactly as
16
- // `Entity/project/Screen/projects-screen.ts` is one list and
17
- // `Entity/user/Screen/` splits a list from an overview: the split there exists
18
- // because the user OVERVIEW owns a whole tab LEVEL (Overview · Tickets · Runs),
19
- // and a team owns no level — there is nothing under it to tab between.
20
- //
21
- // The detail reads `?team_id=` and nothing else, matching the user statistics
22
- // overview. BB-321 decided a team is a reporting crew, not an access carrier,
23
- // so this surface deliberately does
24
- // not offer membership editing (BB-320's work) and there is no team filter
25
- // on the ticket list: `bb_ticket` carries no `team_id`, and expanding one
26
- // client-side through `og_membership` would build the access carrier that
27
- // decision refused.
28
- //
29
- // BB-456 — the figures themselves are read through the configured-figure
30
- // contract (spec D5) rather than a fixed document: discovery names whichever
31
- // of `team_runs_per_user`, `team_runs_per_project` and
32
- // `team_tickets_per_user` the account's rank grants, and `figureSections`
33
- // maps each by its own `display` kind.
34
- const plainRows = (key, lines) => lines.map((text, index) => ({ key: `${key}-${index}`, text, bold: false }));
35
- /**
36
- * The Teams list — a ROOT tab, which is what makes it reachable.
37
- *
38
- * Root rather than project level, by the argument BB-232 used for Conductors: a
39
- * team cuts ACROSS customer projects (it is the level that does, per BB-321), so
40
- * "which crews are there" must be answerable without first choosing a project.
41
- *
42
- * `weight: 40` puts it last, after Conductors, preserving the root navigation
43
- * order while leaving intermediate weights available for addon screens.
44
- */
45
- export class TeamsScreen extends AsyncScreen {
46
- frameId = 'teams';
47
- reload(context) {
48
- this.retry(context);
49
- }
50
- static route = {
51
- id: 'teams',
52
- path: '/teams',
53
- tab: { id: 'teams', label: 'Teams', scope: 'root', weight: 30 },
54
- };
55
- id = TeamsScreen.route.id;
56
- cursor = new ListCursor();
57
- get selectedIndex() {
58
- return this.cursor.index;
59
- }
60
- set selectedIndex(value) {
61
- this.cursor.index = value;
62
- }
63
- saveState() {
64
- return { selectedIndex: this.selectedIndex };
65
- }
66
- restoreState(token) {
67
- if (token &&
68
- typeof token === 'object' &&
69
- typeof token.selectedIndex === 'number') {
70
- this.selectedIndex = token.selectedIndex;
71
- }
72
- }
73
- get rows() {
74
- return this.readyValue?.error === undefined
75
- ? (this.readyValue?.rows ?? [])
76
- : [];
77
- }
78
- load(context) {
79
- if (!context.services)
80
- throw new Error('Teams requires services');
81
- return loadTeamRows({ client: context.services.client });
82
- }
83
- renderLoading() {
84
- return ['Loading teams…'];
85
- }
86
- renderReady(result) {
87
- // A REFUSED read and an empty collection are different answers, and the
88
- // loader is the only thing that knows which one this is (BB-257 D4). The
89
- // table's own `emptyMessage` speaks for the second case only; rendering the
90
- // first through it would report a 403 as "this instance has no crews".
91
- if (result.error !== undefined) {
92
- return columnNode('teams', ...plainRows('teams-error', [
93
- 'Could not read the team list.',
94
- '',
95
- result.error,
96
- ]).map((row) => sectionRowNode('teams', row)));
97
- }
98
- return listTableTree(TEAM_TABLE, result.rows, undefined, {
99
- selectedIndex: this.selectedIndex,
100
- });
101
- }
102
- chrome(context) {
103
- const rows = this.rows;
104
- const where = ` · ${context.services?.baseUrl ?? ''}`;
105
- if (this.readyValue?.error !== undefined) {
106
- return {
107
- selectable: 0,
108
- selectedIndex: 0,
109
- rowIds: [],
110
- title: 'bakers.build teams',
111
- meta: `team list unavailable${where}`,
112
- };
113
- }
114
- // `links.next` and nothing else. `rows.length >= TEAM_LIST_PAGE_SIZE` was a
115
- // guess dressed as a measurement: the server bounds a page at 50 rows
116
- // whatever `page[limit]` asked for, so a full page says nothing about what
117
- // follows it — and an instance with exactly 50 teams was told, every draw,
118
- // that it was seeing only the first page of them.
119
- const capped = this.readyValue?.hasNext ?? false;
120
- return {
121
- selectable: rows.length,
122
- selectedIndex: this.selectedIndex,
123
- rowIds: listRowIds(TEAM_TABLE, rows),
124
- title: 'bakers.build teams',
125
- meta: capped
126
- ? `${rows.length} team(s) · first page (≤${TEAM_LIST_PAGE_SIZE})${where}`
127
- : `${rows.length} team(s)${where}`,
128
- };
129
- }
130
- actions() {
131
- return [
132
- actionItem('teams-enter', 'Enter', 'open'),
133
- actionItem('teams-tab', 'Tab', 'tabs'),
134
- ];
135
- }
136
- activate(index, context) {
137
- const row = this.rows[index];
138
- if (!row || !context.navigate)
139
- return false;
140
- context.navigate(TeamWorkScreen.route.id, {
141
- teamId: row.id,
142
- teamName: row.name,
143
- });
144
- return true;
145
- }
146
- select(index, context) {
147
- if (index < 0 || index >= this.rows.length)
148
- return false;
149
- this.selectedIndex = index;
150
- context.requestDraw();
151
- return true;
152
- }
153
- handleInput(input, context) {
154
- if (super.handleInput(input, context))
155
- return true;
156
- if (this.readyValue === undefined)
157
- return false;
158
- const rows = this.rows;
159
- if (this.cursor.handle(input, rows.length)) {
160
- context.requestDraw();
161
- return true;
162
- }
163
- if (input === 'enter')
164
- return this.activate(this.selectedIndex, context);
165
- return false;
166
- }
167
- reset() {
168
- this.cursor.reset();
169
- super.reset();
170
- }
171
- }
172
- /**
173
- * ONE team's report: the crew's identity plus its configured figures,
174
- * discovered and read for the team's own uuid (BB-456 spec D5).
175
- *
176
- * `fallback` points at the list, so Escape from a deep link lands somewhere real
177
- * rather than on the default route — the rule `UserOverviewScreen` follows.
178
- */
179
- export class TeamOverviewScreen extends EmptyOverviewScreen {
180
- frameId = 'team-overview';
181
- /**
182
- * BB-391 AC4 (second round) — the team level's landing tab.
183
- *
184
- * The earlier round declared no `tab` here and argued a team owns no LEVEL
185
- * because "there is nothing under it to tab between". The operator's ruling is
186
- * the opposite: the users level is under it, so the crew has a bar of its own
187
- * (Overview · Users) and this screen is its first entry.
188
- */
189
- static route = {
190
- id: 'team.overview',
191
- path: '/teams/:teamId',
192
- tab: { id: 'overview', label: 'Overview', scope: 'team', weight: 1 },
193
- fallback: { routeId: TeamsScreen.route.id },
194
- };
195
- id = TeamOverviewScreen.route.id;
196
- chrome(context) {
197
- const name = context.params?.teamName ?? context.params?.teamId ?? 'team';
198
- return { title: `${name} · overview` };
199
- }
200
- actions() {
201
- return [actionItem('team-overview-tab', 'Tab', 'tabs')];
202
- }
203
- }
204
- export class TeamStatsScreen extends StatisticsScreen {
205
- frameId = 'team-stats';
206
- static route = {
207
- id: 'team.stats',
208
- path: '/teams/:teamId/stats',
209
- tab: { id: 'stats', label: 'Stats', scope: 'team', weight: 10 },
210
- fallback: { routeId: TeamOverviewScreen.route.id, preserveParams: true },
211
- };
212
- id = TeamStatsScreen.route.id;
213
- reload(context) {
214
- this.retry(context);
215
- }
216
- load(context) {
217
- if (!context.services)
218
- throw new Error('Team overview requires services');
219
- const teamId = context.params?.teamId;
220
- if (!teamId)
221
- throw new Error('Team overview requires teamId');
222
- return loadGroupStatistics(context.services.client, { team: teamId }, this.statisticsFilters());
223
- }
224
- renderLoading() {
225
- return ['Loading team overview…'];
226
- }
227
- readyRows(statistics) {
228
- if (statistics.kind === 'unsupported')
229
- return plainRows('unsupported', [
230
- 'This control plane does not serve /jsonapi/bakers/statistics.',
231
- ]);
232
- if (statistics.kind === 'error')
233
- return plainRows('error', [
234
- 'Could not read /jsonapi/bakers/statistics.',
235
- '',
236
- statistics.message,
237
- ]);
238
- if (statistics.groups.length === 0)
239
- return plainRows('empty', ['No figures configured for this team.']);
240
- // A zero month is a real answer — a crew that closed nothing this month is
241
- // not an empty screen.
242
- return [];
243
- }
244
- statistics(value) {
245
- return value;
246
- }
247
- chrome(context) {
248
- const result = this.readyValue;
249
- // The RESOLVED name wins over the param: the param is what the list happened
250
- // to be showing when the operator pressed Enter, and a deep link carries
251
- // none at all. It is the placeholder while the read is in flight, which is
252
- // the one thing it is good for.
253
- const name = context.params?.teamName ?? context.params?.teamId ?? 'team';
254
- const meta = result?.kind === 'ok'
255
- ? `${result.groups.reduce((sum, group) => sum + group.figures.length, 0)} figure(s)`
256
- : this.state === 'loading'
257
- ? 'loading…'
258
- : 'statistics unavailable';
259
- return { title: `${name} · stats`, meta };
260
- }
261
- actions() {
262
- return [actionItem('team-stats-tab', 'Tab', 'tabs')];
263
- }
264
- }
@@ -1,28 +0,0 @@
1
- import type { VNode } from '@opentui/core';
2
- import type { CreateFieldId, CreateFormOptions, CreateFormState, FieldDef } from '../../Form/create.js';
3
- /** The chrome the kernel wraps this tree in. */
4
- export interface CreateFormChrome {
5
- /**
6
- * Usable width inside the popup box. Load-bearing for AC-1: the kernel draws
7
- * every row as `'│ ' + fitLine(row, width) + ' │'`, and `fitLine` TRUNCATES
8
- * with an ellipsis — so a description line longer than this budget lost its
9
- * tail and the writer could not read back what they had typed (BB-257 F1).
10
- * Wrapping therefore happens below this line, where it is known which rows are
11
- * prose; the overlay draws two different popups and knows nothing of that.
12
- */
13
- width?: number | undefined;
14
- /**
15
- * A failure line drawn inside the popup (BB-309 D6).
16
- *
17
- * The same channel `editFormTree` already has, and for the same reason: a
18
- * rejected write must be reported WHERE the writer is looking, without
19
- * costing them the text they typed. It sits at the top beside the
20
- * option-load note, because that is where this popup already reports a thing
21
- * that belongs to no single field.
22
- */
23
- message?: string | undefined;
24
- }
25
- /** The id the popup's body column is rooted at. */
26
- export declare const CREATE_FORM_REGION = "create-form";
27
- /** Render the "New ticket" popup as the tree the kernel frames. */
28
- export declare function createFormTree(fields: FieldDef<CreateFieldId>[], s: CreateFormState, opts: CreateFormOptions, chrome?: CreateFormChrome): VNode;
@@ -1,74 +0,0 @@
1
- // The "New ticket" popup (BB-190) as CHROME around its declaration.
2
- //
3
- // It renders no field. It walks `FIELDS` through the widget layer and adds the
4
- // one thing that is genuinely the FORM's rather than a kind's: the note for a
5
- // bag whose failure has no field to be reported at. Everything this file used to
6
- // spell out — prose wrap, the search box, the suggestion window, the checkbox
7
- // list, the `< value >` ring, `[ … ]`, and the field order written out by name —
8
- // now lives once, per kind, in `src/Widget/` (BB-257 re-entry AC-10/AC-11).
9
- //
10
- // The consequence worth stating: adding a field to `Form/create.ts` makes it
11
- // appear here, in declaration order, with no edit to this file.
12
- //
13
- // BB-340 Task 9 — and it returns a RENDERABLE TREE. The rows are gone with the
14
- // caret channel they carried: the Title and Description values and the Parent
15
- // field's query are `FieldTextarea` nodes inside `renderDeclaredFieldsTree`'s
16
- // tree, so there is no row for `onCaret` to rebase and no array for the screen
17
- // to rebase again onto its own.
18
- import { columnNode, textNode } from '../../../../lib/vnode.js';
19
- import { note, renderDeclaredFieldsTree, widgetFor, } from '../../../../Widget/index.js';
20
- const DEFAULT_WIDTH = 58;
21
- /** The id the popup's body column is rooted at. */
22
- export const CREATE_FORM_REGION = 'create-form';
23
- /** The whole load failed, rather than one bag. It belongs to no field. */
24
- const WHOLE_FORM = 'The form options';
25
- /**
26
- * How a failed bag is NAMED.
27
- *
28
- * A field's label names the single value it holds ("Parent", "Assignee"), so
29
- * the collection behind it is `<label> options`. A multiselect's label already
30
- * IS the collection's name ("Labels"), so it needs no suffix. Derived rather
31
- * than tabulated, because a table of bag names is a second copy of the
32
- * declaration and drifts from it the moment a field is renamed.
33
- */
34
- const bagName = (field) => field.kind === 'multiselect' ? field.label : `${field.label} options`;
35
- /** Render the "New ticket" popup as the tree the kernel frames. */
36
- export function createFormTree(fields, s, opts, chrome = {}) {
37
- const width = chrome.width ?? DEFAULT_WIDTH;
38
- // Keyed by BAG, which is what `from` names; the typed shape is the adapter's
39
- // business, and reading it by key is what keeps this loop declaration-driven.
40
- const errors = (opts.errors ?? {});
41
- const reason = (field) => {
42
- const message = field.from === undefined ? undefined : errors[field.from];
43
- return message === undefined
44
- ? undefined
45
- : `${bagName(field)} could not be loaded: ${message}`;
46
- };
47
- // A bag whose kind draws its own failure reports at the field; every other
48
- // one, plus a whole-form failure, collapses into ONE row at the top. It is a
49
- // note, not a refusal: a failed OPTION read must not cost the writer the
50
- // description they opened the popup to type (D4).
51
- const formLevel = fields
52
- .filter((f) => !widgetFor(f).ownsError)
53
- .map(reason)
54
- .filter((sentence) => sentence !== undefined);
55
- if (errors.form !== undefined) {
56
- formLevel.push(`${WHOLE_FORM} could not be loaded: ${errors.form}`);
57
- }
58
- /** A `⚠` note, wrapped, as the rows it occupies. */
59
- const noteNodes = (text, id) => note(text, '', width).map((row, index) => textNode({ id: `${id}-${index}`, content: row }));
60
- return columnNode(CREATE_FORM_REGION, ...(formLevel.length > 0
61
- ? noteNodes(formLevel.join('; '), 'create-form-load-note')
62
- : []),
63
- // `note` supplies the `⚠` sigil itself, so the message is passed plain —
64
- // and it WRAPS, which is what keeps a long server message off the frame's
65
- // ellipsis (the same reason the option-load note above it wraps).
66
- ...(chrome.message ? noteNodes(chrome.message, 'create-form-message') : []), renderDeclaredFieldsTree(fields, s, opts, {
67
- width,
68
- errorFor: reason,
69
- // A form-level failure means no read succeeded, so an empty bag may not
70
- // be reported as genuinely empty either — the note above is then the only
71
- // truthful thing on screen.
72
- trusted: formLevel.length === 0,
73
- }));
74
- }
@@ -1,14 +0,0 @@
1
- import type { StatisticFigureGroup } from '../../../Statistics/client.js';
2
- /**
3
- * Local example data for the optional Statistics demo tab.
4
- *
5
- * Shaped as the server's configured-figure contract, so the demo paints through
6
- * the same `StatisticsFigures` composition the production Stats screens use
7
- * rather than through a separate set of demo-only widgets. No value here is
8
- * read from or written to a control plane.
9
- */
10
- export interface StatisticExample {
11
- readonly name: string;
12
- readonly groups: readonly StatisticFigureGroup[];
13
- }
14
- export declare const STATISTIC_EXAMPLES: readonly StatisticExample[];
@@ -1,88 +0,0 @@
1
- const DAYS = [
2
- '2026-09-21',
3
- '2026-09-22',
4
- '2026-09-23',
5
- '2026-09-24',
6
- '2026-09-25',
7
- '2026-09-26',
8
- '2026-09-27',
9
- ];
10
- const WEEKDAYS = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];
11
- const STATES = ['Ready', 'Coding', 'Review', 'Done'];
12
- const figure = (id, label, widget, categories, measurements) => {
13
- const empty = measurements.every((measurement) => Object.values(measurement.values).every((value) => value === null));
14
- return {
15
- id,
16
- label,
17
- description: '',
18
- widget,
19
- generated: '2026-09-27T00:00:00Z',
20
- filters: {},
21
- categories,
22
- measurements: measurements.map((measurement) => ({
23
- value_type: 'integer',
24
- unit: 'count',
25
- ...measurement,
26
- })),
27
- empty: {
28
- is_empty: empty,
29
- message: empty ? 'No example values for this scenario.' : null,
30
- },
31
- cache: { max_age: 0, contexts: [], tags: [] },
32
- };
33
- };
34
- const example = (name, states, trend) => {
35
- const value = (values, index) => values[index] ?? null;
36
- return {
37
- name,
38
- groups: [
39
- {
40
- id: 'demo',
41
- label: 'Example statistics',
42
- figures: [
43
- figure('demo-states', 'Tickets by state', 'matrix', STATES.map((state, index) => ({
44
- key: `state-${index}`,
45
- label: state,
46
- })), [
47
- {
48
- id: 'tickets',
49
- label: 'Tickets',
50
- values: Object.fromEntries(STATES.map((_, index) => [
51
- `state-${index}`,
52
- value(states, index),
53
- ])),
54
- },
55
- ]),
56
- figure('demo-share', 'Share by state', 'grouped_horizontal_bars', STATES.map((state, index) => ({
57
- key: `share-${index}`,
58
- label: state,
59
- })), [
60
- {
61
- id: 'share',
62
- label: 'Tickets',
63
- values: Object.fromEntries(STATES.map((_, index) => [
64
- `share-${index}`,
65
- value(states, index),
66
- ])),
67
- },
68
- ]),
69
- figure('demo-completed', 'Completed per day', 'line', DAYS.map((day, index) => ({
70
- key: day,
71
- label: WEEKDAYS[index] ?? day,
72
- })), [
73
- {
74
- id: 'completed',
75
- label: 'Completed',
76
- values: Object.fromEntries(DAYS.map((day, index) => [day, value(trend, index)])),
77
- },
78
- ]),
79
- ],
80
- },
81
- ],
82
- };
83
- };
84
- export const STATISTIC_EXAMPLES = [
85
- example('Steady week', [12, 7, 4, 26], [3, 5, 4, 8, 6, 9, 11]),
86
- example('Busy week', [5, 14, 8, 42], [5, 8, 6, 13, 9, 15, 18]),
87
- example('Empty project', [], []),
88
- ];
@@ -1,14 +0,0 @@
1
- import { type VNode } from '@opentui/core';
2
- export { STATISTIC_EXAMPLES } from './demo-statistics.js';
3
- export interface DemoStatisticsProps {
4
- readonly id: string;
5
- readonly scenario: number;
6
- /** The figure grid's last measured width, and where a new one is reported. */
7
- readonly width: number;
8
- readonly onResize: (width: number) => void;
9
- }
10
- /**
11
- * The demo's chart area: a labelled local scenario painted through the same
12
- * `StatisticsFigures` the production Stats screens use.
13
- */
14
- export declare function DemoStatistics({ id, scenario, width, onResize, }: DemoStatisticsProps): VNode;
@@ -1,23 +0,0 @@
1
- import { BoxRenderable, h } from '@opentui/core';
2
- import { Badge } from '../../../Component/badge/index.js';
3
- import { FOREGROUND, paragraphNode, plainRun } from '../../../lib/vnode.js';
4
- import { StatisticsFigures } from '../../../Statistics/figures.js';
5
- import { STATISTIC_EXAMPLES } from './demo-statistics.js';
6
- export { STATISTIC_EXAMPLES } from './demo-statistics.js';
7
- /**
8
- * The demo's chart area: a labelled local scenario painted through the same
9
- * `StatisticsFigures` the production Stats screens use.
10
- */
11
- export function DemoStatistics({ id, scenario, width, onResize, }) {
12
- const example = STATISTIC_EXAMPLES[scenario] ?? STATISTIC_EXAMPLES[0];
13
- return h(BoxRenderable, { id, flexDirection: 'column', gap: 1 }, h(BoxRenderable, { id: `${id}-label`, flexDirection: 'row', gap: 2 }, Badge({ id: `${id}-badge`, label: 'Example data', variant: 'info' }), paragraphNode({
14
- id: `${id}-scenario`,
15
- runs: [plainRun(`${example?.name ?? ''} · n: next scenario`)],
16
- fg: FOREGROUND,
17
- })), StatisticsFigures({
18
- id: `${id}-grid`,
19
- groups: example?.groups ?? [],
20
- width,
21
- onResize,
22
- }));
23
- }
@@ -1,9 +0,0 @@
1
- /** One entry of the classification: the stored id and how it is shown. */
2
- export interface WorkflowKind {
3
- id: string;
4
- label: string;
5
- }
6
- /** The single source of truth, in the create form picker's order. */
7
- export declare const WORKFLOW_KINDS: readonly WorkflowKind[];
8
- /** The picker's `{id, label}` list — what the create form's `workflow` field offers. */
9
- export declare const WORKFLOW_OPTIONS: WorkflowKind[];
@@ -1,18 +0,0 @@
1
- // The `bb_ticket` `workflow` field's fixed vocabulary — a ticket property, so it
2
- // lives in the ticket slice.
3
- //
4
- // BB-236 entity-slice phase 4 merged what were TWO spellings of this same enum
5
- // into one declaration. BB-299 D2 then removed the filter consumer (the `t type`
6
- // filter is gone), leaving exactly ONE consumer: the create form's workflow picker.
7
- // The declaration stays because the `workflow` ATTRIBUTE stays (spec F4).
8
- /** The single source of truth, in the create form picker's order. */
9
- export const WORKFLOW_KINDS = [
10
- // BAKERS-17: one workflow for every work ticket; feature/bug/chore is the
11
- // ticket's `ticket_type` term now, not its workflow.
12
- { id: 'bb_work', label: 'work' },
13
- ];
14
- /** The picker's `{id, label}` list — what the create form's `workflow` field offers. */
15
- export const WORKFLOW_OPTIONS = WORKFLOW_KINDS.map((k) => ({
16
- id: k.id,
17
- label: k.label,
18
- }));
@@ -1,75 +0,0 @@
1
- import type { DropshClient } from '../../../types.js';
2
- import { type OptionSource, type OptionSources } from '../../../Widget/index.js';
3
- import { type CreateFormOptions } from './create.js';
4
- export { type EditFormClients, type EditFormHints, loadEditFormOptions, } from './edit-data.js';
5
- export { parentLabel } from './parent-source.js';
6
- /** Hints from the launcher used to preselect the machine's own user + conductor. */
7
- export interface CreateFormHints {
8
- currentUser?: string | undefined;
9
- ownConductorMachineId?: string | undefined;
10
- /**
11
- * The project the parent candidates are scoped to (BB-257 D8).
12
- *
13
- * `n` is a global key — the popup also opens from the dashboard, where no
14
- * project is selected. Absent ⇒ the Parent field declares NO source, so no
15
- * candidate read is attempted, the bag stays ABSENT, and the field renders
16
- * "no project context". Resolving a fallback slug to a uuid with an extra
17
- * request is deliberately not done: it would add a failure mode to the only
18
- * path where the popup is already working from a guess.
19
- */
20
- projectId?: string | undefined;
21
- /** The launcher's user uuid; hoists everything the machine's user owns (BB-460). */
22
- ownerUserId?: string | undefined;
23
- /** Workspace UUID for the Reviewers bag (membership ∩ users). */
24
- workspaceId?: string | undefined;
25
- }
26
- /**
27
- * Stable-partition the machine's own row to the front: index 0 is what a ring
28
- * defaults to. This popup's only ordering rule, and it reads the same for users and
29
- * conductors — only what counts as "own" differs, which the caller passes in.
30
- */
31
- export declare const ownFirst: <T>(rows: T[], isOwn: (row: T) => boolean) => T[];
32
- /**
33
- * The `conductors` option source for one (possibly absent) project.
34
- *
35
- * Extracted from `createFormSources` (BB-664 AC-8) so the screen can call it
36
- * a SECOND time, scoped to whatever project the operator just picked in the
37
- * new Project field — the only way the Conductor bag can re-scope without a
38
- * second, hand-written read living beside this one.
39
- */
40
- export declare function conductorOptionSource(client: DropshClient, hints: Pick<CreateFormHints, 'projectId' | 'ownerUserId' | 'ownConductorMachineId'>): OptionSource;
41
- /** The `templates` option source for one project and its workspace. */
42
- export declare function templateOptionSource(client: DropshClient, projectId: string, workspaceId?: string): OptionSource;
43
- /**
44
- * The option sources this popup's fields load through, keyed by FIELD id.
45
- *
46
- * The one place each bag is obtained (AC-12): the read, the mapping to `Option`
47
- * and the error travel together, so the preloaded page and every debounced
48
- * re-query can never label a row two ways or report a failure differently.
49
- *
50
- * The Parent source is the only one with a `debounceMs`, and that is the whole
51
- * of "which fields re-query as you type": a source without one is primed once
52
- * and filtered locally, which is what a fixed ring wants.
53
- *
54
- * Three rules together are what make its suggestion list trustworthy (D7), and
55
- * they are stated here because this is the only place all three are visible:
56
- *
57
- * 1. one project-scoped page is preloaded at open — `composeCreateFormOptions`
58
- * calls every source with the EMPTY query — so ←/→ works before a character
59
- * is typed;
60
- * 2. a change to the query re-queries the server, DEBOUNCED, so a match beyond
61
- * that first page is still reachable;
62
- * 3. the WIDGET always applies the kernel's own local substring filter over
63
- * whatever bag is present. So between a keystroke and its response the list
64
- * can lag, but it can never show a row contradicting the text on screen.
65
- */
66
- export declare function createFormSources(client: DropshClient, hints?: CreateFormHints): OptionSources;
67
- /**
68
- * Prime every declared source into the popup's option object.
69
- *
70
- * `workflows` is a fixed enum, not a read, so it is not a source and cannot
71
- * fail. The preload uses the EMPTY query, so ←/→ browses the project's most
72
- * recently changed tickets before a single character is typed (D7).
73
- */
74
- export declare function composeCreateFormOptions(sources: OptionSources): Promise<CreateFormOptions>;
75
- export declare function loadCreateFormOptions(client: DropshClient, hints?: CreateFormHints): Promise<CreateFormOptions>;