@design.estate/dees-catalog 21.46.0 → 21.47.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.
Files changed (69) hide show
  1. package/dist_bundle/bundle.js +825 -259
  2. package/dist_bundle/bundle.js.map +1 -1
  3. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-FCUX4QGD.js → chunk-Q5VY4AV7.js} +3 -3
  4. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-LWT7IIPZ.js → chunk-QG5BHDQO.js} +2 -2
  5. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-VJVZHESI.js → chunk-UPDBEHU2.js} +16 -3
  6. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-VJVZHESI.js.map → chunk-UPDBEHU2.js.map} +1 -1
  7. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{de-7PGZC4IF.js → de-E2CUVVOP.js} +16 -3
  8. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/de-E2CUVVOP.js.map +1 -0
  9. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-modal-VOIWY235.js → dees-modal-YOGT7PSU.js} +3 -3
  10. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-workspace-terminal-EJRHSZ5F.js → dees-workspace-terminal-ORLONA36.js} +4 -4
  11. package/dist_ts_web/00_commitinfo_data.js +1 -1
  12. package/dist_ts_web/elements/00group-dataview/dees-table/dees-table.d.ts +24 -7
  13. package/dist_ts_web/elements/00group-dataview/dees-table/dees-table.js +53 -18
  14. package/dist_ts_web/elements/00group-dataview/dees-thread/dees-thread.d.ts +9 -1
  15. package/dist_ts_web/elements/00group-dataview/dees-thread/dees-thread.js +42 -5
  16. package/dist_ts_web/elements/00group-dataview/dees-thread/interfaces.d.ts +11 -0
  17. package/dist_ts_web/elements/00group-harness/dees-harness-question-card/dees-harness-question-card.d.ts +30 -8
  18. package/dist_ts_web/elements/00group-harness/dees-harness-question-card/dees-harness-question-card.js +95 -24
  19. package/dist_ts_web/elements/00group-harness/interfaces.d.ts +14 -3
  20. package/dist_ts_web/elements/00group-kanban/dees-kanban/dees-kanban.d.ts +17 -5
  21. package/dist_ts_web/elements/00group-kanban/dees-kanban/dees-kanban.demo.js +6 -2
  22. package/dist_ts_web/elements/00group-kanban/dees-kanban/dees-kanban.js +76 -20
  23. package/dist_ts_web/elements/00group-kanban/dees-kanban-activity/dees-kanban-activity.js +3 -1
  24. package/dist_ts_web/elements/00group-kanban/dees-kanban-card/dees-kanban-card.d.ts +3 -1
  25. package/dist_ts_web/elements/00group-kanban/dees-kanban-card/dees-kanban-card.js +17 -3
  26. package/dist_ts_web/elements/00group-kanban/dees-kanban-column/dees-kanban-column.d.ts +3 -1
  27. package/dist_ts_web/elements/00group-kanban/dees-kanban-column/dees-kanban-column.js +12 -2
  28. package/dist_ts_web/elements/00group-kanban/dees-kanban-discussion/dees-kanban-discussion.d.ts +41 -5
  29. package/dist_ts_web/elements/00group-kanban/dees-kanban-discussion/dees-kanban-discussion.js +196 -20
  30. package/dist_ts_web/elements/00group-kanban/dees-kanban-ticket-detail/dees-kanban-ticket-detail.d.ts +25 -2
  31. package/dist_ts_web/elements/00group-kanban/dees-kanban-ticket-detail/dees-kanban-ticket-detail.js +137 -8
  32. package/dist_ts_web/elements/00group-kanban/index.d.ts +1 -0
  33. package/dist_ts_web/elements/00group-kanban/index.js +2 -1
  34. package/dist_ts_web/elements/00group-kanban/interfaces.d.ts +96 -3
  35. package/dist_ts_web/elements/00group-kanban/kanban.demodata.js +119 -3
  36. package/dist_ts_web/elements/00group-kanban/kanban.helpers.d.ts +19 -1
  37. package/dist_ts_web/elements/00group-kanban/kanban.helpers.js +50 -1
  38. package/dist_ts_web/elements/00group-kanban/kanban.styles.js +32 -1
  39. package/dist_ts_web/i18n/de.d.ts +53 -1
  40. package/dist_ts_web/i18n/de.js +15 -2
  41. package/dist_ts_web/i18n/messages.d.ts +53 -1
  42. package/dist_ts_web/i18n/messages.js +15 -2
  43. package/package.json +1 -1
  44. package/readme.md +58 -19
  45. package/ts_web/00_commitinfo_data.ts +1 -1
  46. package/ts_web/elements/00group-dataview/dees-table/dees-table.ts +54 -17
  47. package/ts_web/elements/00group-dataview/dees-thread/dees-thread.ts +39 -4
  48. package/ts_web/elements/00group-dataview/dees-thread/interfaces.ts +11 -0
  49. package/ts_web/elements/00group-harness/dees-harness-question-card/dees-harness-question-card.ts +83 -21
  50. package/ts_web/elements/00group-harness/interfaces.ts +14 -3
  51. package/ts_web/elements/00group-kanban/dees-kanban/dees-kanban.demo.ts +5 -1
  52. package/ts_web/elements/00group-kanban/dees-kanban/dees-kanban.ts +82 -23
  53. package/ts_web/elements/00group-kanban/dees-kanban-activity/dees-kanban-activity.ts +2 -0
  54. package/ts_web/elements/00group-kanban/dees-kanban-card/dees-kanban-card.ts +11 -2
  55. package/ts_web/elements/00group-kanban/dees-kanban-column/dees-kanban-column.ts +6 -1
  56. package/ts_web/elements/00group-kanban/dees-kanban-discussion/dees-kanban-discussion.ts +199 -21
  57. package/ts_web/elements/00group-kanban/dees-kanban-ticket-detail/dees-kanban-ticket-detail.ts +144 -6
  58. package/ts_web/elements/00group-kanban/index.ts +1 -0
  59. package/ts_web/elements/00group-kanban/interfaces.ts +101 -4
  60. package/ts_web/elements/00group-kanban/kanban.demodata.ts +126 -2
  61. package/ts_web/elements/00group-kanban/kanban.helpers.ts +70 -0
  62. package/ts_web/elements/00group-kanban/kanban.styles.ts +31 -0
  63. package/ts_web/i18n/de.ts +14 -1
  64. package/ts_web/i18n/messages.ts +14 -1
  65. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/de-7PGZC4IF.js.map +0 -1
  66. /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-FCUX4QGD.js.map → chunk-Q5VY4AV7.js.map} +0 -0
  67. /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-LWT7IIPZ.js.map → chunk-QG5BHDQO.js.map} +0 -0
  68. /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-modal-VOIWY235.js.map → dees-modal-YOGT7PSU.js.map} +0 -0
  69. /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-workspace-terminal-EJRHSZ5F.js.map → dees-workspace-terminal-ORLONA36.js.map} +0 -0
@@ -121,7 +121,13 @@ const STATE_BADGE: Record<Exclude<THarnessProposalState, 'pending'>, 'success' |
121
121
  * masked until shown, a link only to an http or https address) and kept as
122
122
  * briefly. A host that refuses a confirmation it was sent asks again with
123
123
  * `rejectResponse()`: the card waits once more, keeps the changes the reader
124
- * left out, and says why at each value the host named.
124
+ * left out, and says why at each value the host named. A host may refuse a
125
+ * question's answer the same way: the card waits again with the options chosen
126
+ * and the own words kept. Options with an `id` are answered by it as well
127
+ * (`optionIds`), and the own words come apart from them (`text`). `frameless`
128
+ * drops the card's border, surface and padding where a host's tile holds it;
129
+ * `readOnly` shows a question to a reader who may not answer it, and
130
+ * `focusAnswer()` takes the focus to its first option or field.
125
131
  */
126
132
  @customElement('dees-harness-question-card')
127
133
  export class DeesHarnessQuestionCard extends DeesElement {
@@ -139,6 +145,17 @@ export class DeesHarnessQuestionCard extends DeesElement {
139
145
  @property({ attribute: false })
140
146
  accessor viewState: IHarnessQuestionViewState | undefined = undefined;
141
147
 
148
+ /**
149
+ * Where the host owns the surface, such as a comment's tile: no border, radius or surface of the
150
+ * card's own, and no padding around its content either, so it lines up with the host's.
151
+ */
152
+ @property({ type: Boolean, reflect: true })
153
+ accessor frameless: boolean = false;
154
+
155
+ /** The reader may see the question but not answer it, such as one without the right to: its options and field take no input. */
156
+ @property({ type: Boolean, reflect: true })
157
+ accessor readOnly: boolean = false;
158
+
142
159
  /** local optimistic answer; request.response (host echo) takes precedence */
143
160
  @state()
144
161
  accessor answered: string[] | undefined = undefined;
@@ -259,9 +276,9 @@ export class DeesHarnessQuestionCard extends DeesElement {
259
276
  && this.includedPersonFields.every((field) => this.personValueOf(field).length <= field.maxLength);
260
277
  }
261
278
 
262
- /** Whether the card takes no answer: answered, waiting for the host (`busy`), or its changes under way or decided. */
279
+ /** Whether the card takes no answer: answered, waiting for the host (`busy`), read-only, or its changes under way or decided. */
263
280
  private get locked(): boolean {
264
- return this.busy || this.effectiveResponse !== undefined || this.proposalState !== 'pending';
281
+ return this.busy || this.readOnly || this.effectiveResponse !== undefined || this.proposalState !== 'pending';
265
282
  }
266
283
 
267
284
  public static styles = [
@@ -298,6 +315,27 @@ export class DeesHarnessQuestionCard extends DeesElement {
298
315
  padding: 16px;
299
316
  }
300
317
 
318
+ /* the host's surface and padding hold the card; its severity shows in the title's icon */
319
+ /* with no padding of its own, a control's focus ring reaches past the card into the host's */
320
+ :host([frameless]),
321
+ :host([frameless]) .card {
322
+ overflow: visible;
323
+ }
324
+
325
+ :host([frameless]) .card {
326
+ border: none;
327
+ border-radius: 0;
328
+ background: none;
329
+ }
330
+
331
+ :host([frameless]) .body {
332
+ padding: 0;
333
+ }
334
+
335
+ :host([frameless]) dees-actionfooter {
336
+ --dees-actionfooter-inset: 0px;
337
+ }
338
+
301
339
  .body > :last-child {
302
340
  margin-bottom: 0;
303
341
  }
@@ -723,7 +761,8 @@ export class DeesHarnessQuestionCard extends DeesElement {
723
761
  private renderQuestion(): TemplateResult {
724
762
  const request = this.request;
725
763
  const response = this.effectiveResponse;
726
- const disabled = this.busy || response !== undefined;
764
+ const disabled = this.busy || this.readOnly || response !== undefined;
765
+ const rejection = this.effectiveRejection;
727
766
  return response
728
767
  ? html`
729
768
  <div class="answeredNote">
@@ -732,6 +771,9 @@ export class DeesHarnessQuestionCard extends DeesElement {
732
771
  </div>
733
772
  `
734
773
  : html`
774
+ ${rejection
775
+ ? html`<p class="rejection" role="alert">${rejection.message || this.t('question.answerRefused')}</p>`
776
+ : ''}
735
777
  ${request.options?.length
736
778
  ? html`
737
779
  <div class="options" role=${request.multiSelect ? 'group' : 'radiogroup'}>
@@ -764,18 +806,14 @@ export class DeesHarnessQuestionCard extends DeesElement {
764
806
  }}
765
807
  @keydown=${(event: KeyboardEvent) => {
766
808
  if (event.key === 'Enter' && this.effectiveCustomText.trim()) {
767
- this.respond([...this.effectiveSelected, this.effectiveCustomText.trim()]);
809
+ this.answerQuestion([...this.effectiveSelected], this.effectiveCustomText);
768
810
  }
769
811
  }}
770
812
  />
771
813
  <dees-button
772
814
  size="sm"
773
815
  ?disabled=${disabled || (!this.effectiveCustomText.trim() && !this.effectiveSelected.size)}
774
- @clicked=${() => {
775
- const answers = [...this.effectiveSelected];
776
- if (this.effectiveCustomText.trim()) answers.push(this.effectiveCustomText.trim());
777
- this.respond(answers);
778
- }}
816
+ @clicked=${() => this.answerQuestion([...this.effectiveSelected], this.effectiveCustomText)}
779
817
  >${this.t('question.send')}</dees-button>
780
818
  </div>
781
819
  `
@@ -787,7 +825,7 @@ export class DeesHarnessQuestionCard extends DeesElement {
787
825
  type="accent"
788
826
  size="sm"
789
827
  ?disabled=${disabled || !this.effectiveSelected.size}
790
- @clicked=${() => this.respond([...this.effectiveSelected])}
828
+ @clicked=${() => this.answerQuestion([...this.effectiveSelected], '')}
791
829
  >${this.t('question.confirm')}</dees-button>
792
830
  </div>
793
831
  `
@@ -1203,10 +1241,18 @@ export class DeesHarnessQuestionCard extends DeesElement {
1203
1241
  if (this.viewState) this.viewState.selected = [...next];
1204
1242
  return;
1205
1243
  }
1206
- this.respond([label]);
1244
+ this.answerQuestion([label], '');
1207
1245
  }
1208
1246
 
1209
- private respond(answers: string[]): void {
1247
+ /** Answers a question with the options chosen, by label, and the reader's own words. */
1248
+ private answerQuestion(labelsArg: readonly string[], textArg: string): void {
1249
+ const text = textArg.trim();
1250
+ const chosen = new Set(labelsArg);
1251
+ const optionIds = (this.request.options ?? []).filter((option) => chosen.has(option.label)).map((option) => option.id ?? option.label);
1252
+ this.respond(text ? [...labelsArg, text] : [...labelsArg], text ? { optionIds, text } : { optionIds });
1253
+ }
1254
+
1255
+ private respond(answers: string[], questionAnswerArg: Pick<IHarnessQuestionResponseDetail, 'optionIds' | 'text'> = {}): void {
1210
1256
  if (this.locked || !answers.length) return;
1211
1257
  const items = this.request.items ?? [];
1212
1258
  const confirming = answers[0] === 'confirm';
@@ -1229,6 +1275,7 @@ export class DeesHarnessQuestionCard extends DeesElement {
1229
1275
  const detail: IHarnessQuestionResponseDetail = {
1230
1276
  requestId: this.request.id,
1231
1277
  answers,
1278
+ ...questionAnswerArg,
1232
1279
  request: harnessWithoutCredentials(this.request),
1233
1280
  };
1234
1281
  if (leftOut.size > 0) detail.declinedItemIds = items.filter((item) => leftOut.has(item.id)).map((item) => item.id);
@@ -1243,22 +1290,37 @@ export class DeesHarnessQuestionCard extends DeesElement {
1243
1290
  }
1244
1291
 
1245
1292
  /**
1246
- * The host refused the answer it was sent, such as a confirmation its server turned down: the
1247
- * card waits for an answer again, keeps the changes the reader left out, and shows the host's
1248
- * `message` and the error of each value it names. What the person entered went with the answer
1249
- * and is entered anew. The refusal stands until the next answer, in the view state as well, so a
1250
- * card the transcript remounts still shows it. A question that is not a proposal, a card whose
1251
- * request carries the host's `response`, and one the host decided otherwise stay as they are: `false`.
1293
+ * The host refused the answer it was sent, such as a confirmation its server turned down or an
1294
+ * answer it could not save: the card waits for an answer again, keeps the options chosen, the
1295
+ * reader's own words and the changes left out, and shows the host's `message` and the error of
1296
+ * each value it names. What the person entered in `personFields` went with the answer and is
1297
+ * entered anew. The refusal stands until the next answer, in the view state as well, so a card
1298
+ * the transcript remounts still shows it. A card whose request carries the host's `response`,
1299
+ * and a proposal the host decided otherwise, stay as they are: `false`.
1252
1300
  */
1253
1301
  public rejectResponse(rejectionArg: IHarnessQuestionRejection = {}): boolean {
1254
- if (this.request.kind !== 'proposal' || this.request.response !== undefined) return false;
1255
- if (harnessProposalState(this.request, undefined) !== 'pending') return false;
1302
+ if (this.request.response !== undefined) return false;
1303
+ if (this.request.kind === 'proposal' && harnessProposalState(this.request, undefined) !== 'pending') return false;
1256
1304
  this.answered = undefined;
1257
1305
  if (this.viewState) this.viewState.answered = undefined;
1258
1306
  this.setRejection(rejectionArg);
1259
1307
  return true;
1260
1308
  }
1261
1309
 
1310
+ /**
1311
+ * Puts the focus on a question's first option, or on the field for the reader's own words where
1312
+ * it has none, with `options` as `focus()` takes them (`preventScroll` for a host that scrolls the
1313
+ * card into view itself). `false` for a proposal and for a card that takes no answer.
1314
+ */
1315
+ public async focusAnswer(options?: FocusOptions): Promise<boolean> {
1316
+ await this.updateComplete;
1317
+ if (this.request.kind === 'proposal' || this.locked) return false;
1318
+ const control = this.shadowRoot?.querySelector<HTMLElement>('.option, .customRow input');
1319
+ if (!control) return false;
1320
+ control.focus(options);
1321
+ return true;
1322
+ }
1323
+
1262
1324
  public willUpdate(changedProperties: Map<PropertyKey, unknown>): void {
1263
1325
  super.willUpdate(changedProperties);
1264
1326
  const previous = changedProperties.get('request') as IHarnessQuestionRequest | undefined;
@@ -469,6 +469,8 @@ export interface IHarnessPermissionLinkDetail {
469
469
  }
470
470
 
471
471
  export interface IHarnessQuestionOption {
472
+ /** the option's own id, as the answer names it in `optionIds`; unset, its label stands for it */
473
+ id?: string;
472
474
  label: string;
473
475
  description?: string;
474
476
  }
@@ -581,9 +583,10 @@ export interface IHarnessQuestionPersonFieldError {
581
583
  }
582
584
 
583
585
  /**
584
- * Why the host refused a confirmation it could not carry out as sent: what to say over the
585
- * changes, and what to say at each value it refused. The card asks again (`rejectQuestionResponse()`
586
- * on the list and the chat, `rejectResponse()` on the card).
586
+ * Why the host refused an answer it could not take as sent, such as a confirmation it could not
587
+ * carry out: what to say over the question or the changes, and what to say at each value it
588
+ * refused. The card asks again (`rejectQuestionResponse()` on the list and the chat,
589
+ * `rejectResponse()` on the card).
587
590
  */
588
591
  export interface IHarnessQuestionRejection {
589
592
  message?: string;
@@ -646,7 +649,15 @@ export interface IHarnessQuestionRequest {
646
649
 
647
650
  export interface IHarnessQuestionResponseDetail {
648
651
  requestId: string;
652
+ /** the chosen options' labels, then the reader's own words; a proposal's `['confirm']` or `['decline']` */
649
653
  answers: string[];
654
+ /**
655
+ * a question's chosen options by `id` (an option without one by its label), in the order the
656
+ * card lists them; none chosen, empty. Unset for a proposal
657
+ */
658
+ optionIds?: string[];
659
+ /** a question's answer in the reader's own words, apart from the options; unset when they wrote none */
660
+ text?: string;
650
661
  /** with `['confirm']` of a proposal whose reader left changes out: their item ids */
651
662
  declinedItemIds?: string[];
652
663
  /**
@@ -46,10 +46,12 @@ export const demoFunc = () => {
46
46
  demo.actAs(mara);
47
47
  await board.refresh();
48
48
  };
49
+ // The server sets the AutoLabels: once a question is asked or answered, the board fetches the tickets again.
50
+ const questionSaved = (event: Event) => void (event.currentTarget as DeesKanban).refresh();
49
51
  // The bar keeps its height and the board fills the rest; its columns scroll their own cards.
50
52
  return demoApp(html`<div style="display: flex; flex-direction: column; height: 100%">
51
53
  <div class="dees-demo-row" style="flex: none; padding: 0 24px 4px">
52
- <p class="dees-demo-caption">Signed in as Mara Chen. Jonas and Alex work on the same board. To see a refused stale edit, start editing CAT-102, close it, let Jonas rename it and save.</p>
54
+ <p class="dees-demo-caption">Signed in as Mara Chen. Jonas and Alex work on the same board; Alex waits for Mara's answer on CAT-103. To see a refused stale edit, start editing CAT-102, close it, let Jonas rename it and save.</p>
53
55
  <dees-button type="outline" size="sm" text="Simulate a teammate's change" @clicked=${simulate}></dees-button>
54
56
  <dees-button type="outline" size="sm" text="Jonas renames CAT-102" @clicked=${rename}></dees-button>
55
57
  </div>
@@ -62,6 +64,8 @@ export const demoFunc = () => {
62
64
  .projects=${kanbanDemoProjects}
63
65
  .revision=${demo.revision}
64
66
  .provider=${demo.provider}
67
+ @kanban-question-asked=${questionSaved}
68
+ @kanban-question-answer=${questionSaved}
65
69
  ></dees-kanban>
66
70
  </div>`);
67
71
  };
@@ -11,6 +11,7 @@ import {
11
11
  import { dcLocalize } from '../../../i18n/localize.js';
12
12
  import type {
13
13
  IKanbanActivity,
14
+ IKanbanAutoLabel,
14
15
  IKanbanBoardSnapshot,
15
16
  IKanbanColumn,
16
17
  IKanbanComment,
@@ -21,8 +22,11 @@ import type {
21
22
  IKanbanPerson,
22
23
  IKanbanProject,
23
24
  IKanbanProvider,
25
+ IKanbanQuestion,
26
+ IKanbanQuestionAnswerInput,
24
27
  IKanbanTicket,
25
28
  IKanbanTicketDraft,
29
+ TKanbanDiscussionItem,
26
30
  TKanbanDraftField,
27
31
  } from '../interfaces.js';
28
32
  import type {
@@ -46,9 +50,11 @@ import { DeesKanbanTicketDetail } from '../dees-kanban-ticket-detail/dees-kanban
46
50
  import { kanbanStyles } from '../kanban.styles.js';
47
51
  import {
48
52
  isKanbanRevisionConflict,
53
+ kanbanAutoLabel,
49
54
  kanbanDraftChanges,
50
55
  kanbanError,
51
56
  kanbanEvent,
57
+ kanbanItemKey,
52
58
  kanbanProjectName,
53
59
  kanbanProjects,
54
60
  kanbanTicketVersion,
@@ -91,6 +97,8 @@ const interactionEvents = [
91
97
  'kanban-ticket-draft',
92
98
  'kanban-comment-draft',
93
99
  'kanban-comment-added',
100
+ 'kanban-question-added',
101
+ 'kanban-question-answered',
94
102
  'kanban-comments-refresh',
95
103
  'kanban-activity-refresh',
96
104
  'kanban-detail-back',
@@ -109,6 +117,8 @@ interface IKanbanInteractionMap {
109
117
  'kanban-ticket-draft': { ticketId: string; draft?: IKanbanTicketDraft };
110
118
  'kanban-comment-draft': { ticketId: string; body: TReferenceContent };
111
119
  'kanban-comment-added': { comment: IKanbanComment; submittedBody: TReferenceContent };
120
+ 'kanban-question-added': { question: IKanbanQuestion; submittedBody: TReferenceContent };
121
+ 'kanban-question-answered': { question: IKanbanQuestion; answer: IKanbanQuestionAnswerInput };
112
122
  'kanban-comments-refresh': { ticketId: string };
113
123
  'kanban-activity-refresh': { ticketId: string };
114
124
  'kanban-detail-back': Record<string, never>;
@@ -123,7 +133,7 @@ type TKanbanInteraction = {
123
133
  }[keyof IKanbanInteractionMap];
124
134
 
125
135
  /** The board's filters in the filter bubble, by their `IKanbanFilterValues` key. */
126
- type TKanbanFilterKey = 'project' | 'epic' | 'assignee' | 'label' | 'mine';
136
+ type TKanbanFilterKey = 'project' | 'epic' | 'assignee' | 'label' | 'autoLabel' | 'mine';
127
137
 
128
138
  /** What narrows the board now, as its active-filter bar shows it. */
129
139
  interface IKanbanActiveFilter {
@@ -164,6 +174,13 @@ export class DeesKanban extends DeesElement {
164
174
  @property({ attribute: false })
165
175
  accessor projects: IKanbanProject[] = [];
166
176
 
177
+ /**
178
+ * How the AutoLabels the tickets carry show, by `label`: name, description, icon and tone. The
179
+ * board names `openQuestion` itself; another label without a definition shows as it is.
180
+ */
181
+ @property({ attribute: false })
182
+ accessor autoLabelDefinitions: IKanbanAutoLabel[] = [];
183
+
167
184
  /**
168
185
  * Every task and epic belongs to a project: the create dialog offers no "No project", says so,
169
186
  * and creates nothing until one is chosen; a subtask still takes its parent's. The provider
@@ -226,7 +243,7 @@ export class DeesKanban extends DeesElement {
226
243
  /** Counts the tickets the board took from its own saves, moves and creations. */
227
244
  private mutationEpoch = 0;
228
245
  private activityCache = new Map<string, IKanbanActivity[]>();
229
- private commentCache = new Map<string, IKanbanComment[]>();
246
+ private commentCache = new Map<string, TKanbanDiscussionItem[]>();
230
247
  private commentRevisions = new Map<string, number>();
231
248
  private commentDrafts = new Map<string, TReferenceContent>();
232
249
  private ticketDrafts = new Map<string, IKanbanTicketDraft>();
@@ -540,6 +557,7 @@ export class DeesKanban extends DeesElement {
540
557
  .tickets=${tasks.filter(ticket => ticket.columnId === column.id)}
541
558
  .allTickets=${this.tickets}
542
559
  .projects=${projects}
560
+ .autoLabelDefinitions=${this.autoLabelDefinitions}
543
561
  .showProjects=${!filters.project && projects.length > 0}
544
562
  .movable=${Boolean(this.provider.moveTicket)}
545
563
  .canCreate=${Boolean(this.provider.createTicket)}
@@ -604,6 +622,7 @@ export class DeesKanban extends DeesElement {
604
622
  ? !ticket.assignee
605
623
  : ticket.assignee?.id === filters.assignee)) &&
606
624
  (!filters.label || Boolean(ticket.labels?.includes(filters.label))) &&
625
+ (!filters.autoLabel || Boolean(ticket.autoLabels?.includes(filters.autoLabel))) &&
607
626
  (!mine || ticket.assignee?.id === this.currentPersonId) &&
608
627
  (!query ||
609
628
  [
@@ -612,6 +631,7 @@ export class DeesKanban extends DeesElement {
612
631
  ticket.project ? kanbanProjectName(this.projects, ticket.project) : '',
613
632
  ticket.assignee?.name,
614
633
  ...ticket.labels ?? [],
634
+ ...(ticket.autoLabels ?? []).map(label => this.autoLabelName(label)),
615
635
  ...this.tickets
616
636
  .filter(child => child.parentId === ticket.id)
617
637
  .map(child => `${child.key} ${child.title}`),
@@ -622,10 +642,15 @@ export class DeesKanban extends DeesElement {
622
642
  );
623
643
  }
624
644
 
645
+ /** An AutoLabel's name, as its chip shows it. */
646
+ private autoLabelName(label: string): string {
647
+ return kanbanAutoLabel(this.t, this.autoLabelDefinitions, label).name;
648
+ }
649
+
625
650
  /**
626
651
  * The filter bubble's fields, as the table's filters: a project, an epic (of that project), an
627
- * assignee and a label, each with an "all" option, and "Assigned to me" while the board knows
628
- * its reader. A field with nothing to choose from is left out; a value set in code that no
652
+ * assignee, a label and an AutoLabel, each with an "all" option, and "Assigned to me" while the
653
+ * board knows its reader. The AutoLabels are the defined ones and those a ticket carries. A field with nothing to choose from is left out; a value set in code that no
629
654
  * ticket has stays a choice.
630
655
  */
631
656
  private filterFields(): ITableFilter[] {
@@ -669,6 +694,12 @@ export class DeesKanban extends DeesElement {
669
694
  ];
670
695
  const labels = [...new Set(this.tickets.flatMap(ticket => ticket.labels ?? []))]
671
696
  .sort((a, b) => a.localeCompare(b));
697
+ const autoLabels = [...new Set([
698
+ ...this.autoLabelDefinitions.map(definition => definition.label),
699
+ ...this.tickets.flatMap(ticket => ticket.autoLabels ?? []),
700
+ ])]
701
+ .map(label => ({ key: label, label: this.autoLabelName(label) }))
702
+ .sort((a, b) => a.label.localeCompare(b.label));
672
703
  const fields = [
673
704
  choices('project', this.t('kanban.project'), this.t('kanban.allProjects'),
674
705
  projects.map(project => ({ key: project.id, label: project.name }))),
@@ -682,6 +713,7 @@ export class DeesKanban extends DeesElement {
682
713
  : []),
683
714
  choices('label', this.t('kanban.label'), this.t('kanban.allLabels'),
684
715
  labels.map(label => ({ key: label, label }))),
716
+ choices('autoLabel', this.t('kanban.autoLabel'), this.t('kanban.allAutoLabels'), autoLabels),
685
717
  ].filter((field): field is ITableFilter => Boolean(field));
686
718
  if (this.currentPersonId)
687
719
  fields.push({
@@ -891,6 +923,7 @@ export class DeesKanban extends DeesElement {
891
923
  this.detail.provider = this.provider;
892
924
  this.detail.searchTickets = this.searchTickets;
893
925
  this.detail.projects = this.projects;
926
+ this.detail.autoLabelDefinitions = this.autoLabelDefinitions;
894
927
  this.detail.comments = this.commentCache.get(this.selectedId) ?? [];
895
928
  this.detail.activity = this.activityCache.get(this.selectedId) ?? [];
896
929
  this.detail.commentDraft = this.commentDrafts.get(this.selectedId) ?? [];
@@ -901,8 +934,8 @@ export class DeesKanban extends DeesElement {
901
934
  if (this.modal) this.modal.heading = this.detail.ticket.key;
902
935
  }
903
936
 
904
- /** Replace a ticket's discussion with an authoritative snapshot (for realtime updates). */
905
- public setComments(ticketId: string, comments: IKanbanComment[]): void {
937
+ /** Replace a ticket's discussion, comments and questions, with an authoritative snapshot (for realtime updates). */
938
+ public setComments(ticketId: string, comments: TKanbanDiscussionItem[]): void {
906
939
  if (comments.some(comment => comment.ticketId !== ticketId))
907
940
  throw new Error('Comment ticket IDs must match.');
908
941
  this.commentCache.set(ticketId, [...comments]);
@@ -910,6 +943,23 @@ export class DeesKanban extends DeesElement {
910
943
  this.syncDetail();
911
944
  }
912
945
 
946
+ /**
947
+ * Takes a comment or question the discussion saved into the ticket's discussion, over its earlier
948
+ * state; the composer's kept text leaves once it is what was posted. The history loads again.
949
+ */
950
+ private keepDiscussionItem(item: TKanbanDiscussionItem, submittedBody?: TReferenceContent): void {
951
+ const key = kanbanItemKey(item);
952
+ const items = this.commentCache.get(item.ticketId) ?? [];
953
+ this.commentCache.set(item.ticketId, [...items.filter(other => kanbanItemKey(other) !== key), item]);
954
+ if (
955
+ submittedBody &&
956
+ JSON.stringify(this.commentDrafts.get(item.ticketId) ?? []) === JSON.stringify(submittedBody)
957
+ )
958
+ this.commentDrafts.delete(item.ticketId);
959
+ this.syncDetail();
960
+ if (item.ticketId === this.selectedId) void this.refreshActivity(item.ticketId, true);
961
+ }
962
+
913
963
  /** Loads a ticket's comments again; `quiet` keeps the shown ones without a loading line meanwhile. */
914
964
  public async refreshComments(ticketId = this.selectedId, quiet = false): Promise<void> {
915
965
  this.commentsAbort?.abort();
@@ -922,7 +972,7 @@ export class DeesKanban extends DeesElement {
922
972
  return;
923
973
  }
924
974
  const revision = this.commentRevisions.get(ticketId) ?? 0;
925
- const existingIds = new Set((this.commentCache.get(ticketId) ?? []).map(comment => comment.id));
975
+ const before = new Map((this.commentCache.get(ticketId) ?? []).map(item => [kanbanItemKey(item), item]));
926
976
  if (this.detail && ticketId === this.selectedId && !quiet) {
927
977
  this.detail.loadingComments = true;
928
978
  this.detail.commentsError = '';
@@ -930,10 +980,18 @@ export class DeesKanban extends DeesElement {
930
980
  try {
931
981
  const comments = await this.provider.loadComments(ticketId, controller.signal);
932
982
  if (!controller.signal.aborted && (this.commentRevisions.get(ticketId) ?? 0) === revision) {
933
- const postedWhileLoading = (this.commentCache.get(ticketId) ?? []).filter(
934
- comment => !existingIds.has(comment.id) && !comments.some(item => item.id === comment.id),
935
- );
936
- this.setComments(ticketId, [...comments, ...postedWhileLoading]);
983
+ // What the board saved meanwhile stays: a comment or question the snapshot lacks, and a
984
+ // question answered since, over the snapshot's open one.
985
+ const loaded = new Set(comments.map(kanbanItemKey));
986
+ const savedWhileLoading = new Map((this.commentCache.get(ticketId) ?? [])
987
+ .filter(item => before.get(kanbanItemKey(item)) !== item)
988
+ .map(item => [kanbanItemKey(item), item]));
989
+ this.setComments(ticketId, [
990
+ ...comments.map(item => before.has(kanbanItemKey(item))
991
+ ? savedWhileLoading.get(kanbanItemKey(item)) ?? item
992
+ : item),
993
+ ...[...savedWhileLoading.values()].filter(item => !loaded.has(kanbanItemKey(item))),
994
+ ]);
937
995
  if (this.detail && ticketId === this.selectedId) this.detail.commentsError = '';
938
996
  }
939
997
  } catch (error) {
@@ -1475,21 +1533,22 @@ export class DeesKanban extends DeesElement {
1475
1533
  break;
1476
1534
  case 'kanban-comment-added': {
1477
1535
  const { comment, submittedBody } = detail;
1478
- const comments = this.commentCache.get(comment.ticketId) ?? [];
1479
- this.commentCache.set(comment.ticketId, [
1480
- ...comments.filter(item => item.id !== comment.id),
1481
- comment,
1482
- ]);
1483
- if (
1484
- JSON.stringify(this.commentDrafts.get(comment.ticketId) ?? []) ===
1485
- JSON.stringify(submittedBody)
1486
- )
1487
- this.commentDrafts.delete(comment.ticketId);
1488
- this.syncDetail();
1489
- if (comment.ticketId === this.selectedId) void this.refreshActivity(comment.ticketId, true);
1536
+ this.keepDiscussionItem(comment, submittedBody);
1490
1537
  kanbanEvent(this, 'kanban-comment-saved', { comment });
1491
1538
  break;
1492
1539
  }
1540
+ case 'kanban-question-added': {
1541
+ const { question, submittedBody } = detail;
1542
+ this.keepDiscussionItem(question, submittedBody);
1543
+ kanbanEvent(this, 'kanban-question-asked', { question });
1544
+ break;
1545
+ }
1546
+ case 'kanban-question-answered': {
1547
+ const { question, answer } = detail;
1548
+ this.keepDiscussionItem(question);
1549
+ kanbanEvent(this, 'kanban-question-answer', { ...answer, question });
1550
+ break;
1551
+ }
1493
1552
  case 'kanban-comments-refresh':
1494
1553
  void this.refreshComments(detail.ticketId);
1495
1554
  break;
@@ -45,6 +45,8 @@ const actionIcons: Record<TKanbanActivityAction, string> = {
45
45
  reordered: 'lucide:ArrowUpDown',
46
46
  commented: 'lucide:MessageSquare',
47
47
  linked: 'lucide:Link',
48
+ asked: 'lucide:MessageCircleQuestionMark',
49
+ answered: 'lucide:MessageCircleReply',
48
50
  };
49
51
 
50
52
  interface IChangeLine {
@@ -1,8 +1,8 @@
1
1
  import { DeesElement, customElement, property, html, css } from '@design.estate/dees-element';
2
2
  import { dcLocalize } from '../../../i18n/localize.js';
3
- import type { IKanbanTicket, IKanbanColumn } from '../interfaces.js';
3
+ import type { IKanbanAutoLabel, IKanbanTicket, IKanbanColumn } from '../interfaces.js';
4
4
  import { kanbanStyles } from '../kanban.styles.js';
5
- import { kanbanEvent, kanbanInitials, kanbanPriorityIcon } from '../kanban.helpers.js';
5
+ import { kanbanEvent, kanbanInitials, kanbanPriorityIcon, renderKanbanAutoLabels } from '../kanban.helpers.js';
6
6
  import '../../00group-button/dees-button/dees-button.js';
7
7
  import '../../00group-utility/dees-icon/dees-icon.js';
8
8
 
@@ -30,6 +30,10 @@ export class DeesKanbanCard extends DeesElement {
30
30
  @property({ attribute: false })
31
31
  accessor columns: IKanbanColumn[] = [];
32
32
 
33
+ /** What the host's AutoLabels are called and how they look; see the board's `autoLabelDefinitions`. */
34
+ @property({ attribute: false })
35
+ accessor autoLabelDefinitions: IKanbanAutoLabel[] = [];
36
+
33
37
  @property({ type: Boolean, reflect: true })
34
38
  accessor movable = false;
35
39
 
@@ -173,6 +177,10 @@ export class DeesKanbanCard extends DeesElement {
173
177
  text-overflow: ellipsis;
174
178
  }
175
179
 
180
+ .badge.auto {
181
+ display: inline-flex;
182
+ }
183
+
176
184
  .assignee {
177
185
  display: flex;
178
186
  align-items: center;
@@ -338,6 +346,7 @@ export class DeesKanbanCard extends DeesElement {
338
346
  aria-hidden="true"
339
347
  ></dees-icon>${this.t('kanban.priority', { priority: ticket.priority })}</span>`
340
348
  : ''}
349
+ ${renderKanbanAutoLabels(this.t, this.autoLabelDefinitions, ticket.autoLabels)}
341
350
  ${ticket.labels?.map(label => html`<span class="badge" title=${label}>${label}</span>`)}
342
351
  <span class="assignee" title=${ticket.assignee?.name ?? this.t('kanban.unassigned')}>
343
352
  <span
@@ -9,7 +9,7 @@ import {
9
9
  } from '@design.estate/dees-element';
10
10
  import { dcLocalize } from '../../../i18n/localize.js';
11
11
  import { ScrollEdgeShadowController, scrollEdgeShadowStyles } from '../../00scrolledges.js';
12
- import type { IKanbanColumn, IKanbanProject, IKanbanTicket } from '../interfaces.js';
12
+ import type { IKanbanAutoLabel, IKanbanColumn, IKanbanProject, IKanbanTicket } from '../interfaces.js';
13
13
  import type { IKanbanMotion } from '../kanban.dragcontroller.js';
14
14
  import { kanbanStyles } from '../kanban.styles.js';
15
15
  import { kanbanEvent, kanbanProjectName, sortKanbanTickets } from '../kanban.helpers.js';
@@ -44,6 +44,10 @@ export class DeesKanbanColumn extends DeesElement {
44
44
  @property({ attribute: false })
45
45
  accessor projects: IKanbanProject[] = [];
46
46
 
47
+ /** The host's AutoLabels, for the cards' chips. */
48
+ @property({ attribute: false })
49
+ accessor autoLabelDefinitions: IKanbanAutoLabel[] = [];
50
+
47
51
  /** Shows each card's project; off while the board shows one project. */
48
52
  @property({ type: Boolean, reflect: true })
49
53
  accessor showProjects = false;
@@ -349,6 +353,7 @@ export class DeesKanbanColumn extends DeesElement {
349
353
  : html`<dees-kanban-card
350
354
  .ticket=${ticket}
351
355
  .columns=${this.columns}
356
+ .autoLabelDefinitions=${this.autoLabelDefinitions}
352
357
  .projectName=${this.showProjects && ticket.project
353
358
  ? kanbanProjectName(this.projects, ticket.project)
354
359
  : ''}