@design.estate/dees-catalog 22.2.0 → 22.3.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.
Files changed (45) hide show
  1. package/dist_bundle/bundle.js +346 -43
  2. package/dist_bundle/bundle.js.map +1 -1
  3. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-IASP6M5U.js → chunk-IGD4DLG4.js} +3 -3
  4. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-ZPJBKBPH.js → chunk-MK42UYWT.js} +4 -2
  5. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-ZPJBKBPH.js.map → chunk-MK42UYWT.js.map} +1 -1
  6. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-B6IKM3SA.js → chunk-RITCTBBY.js} +2 -2
  7. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{de-3ZAD2XFI.js → de-TN6FRTSU.js} +4 -2
  8. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/de-TN6FRTSU.js.map +1 -0
  9. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-modal-CPEH77LV.js → dees-modal-PLLCPO5V.js} +3 -3
  10. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-workspace-terminal-65M4HBRK.js → dees-workspace-terminal-7N6EXGH6.js} +4 -4
  11. package/dist_ts_web/00_commitinfo_data.js +1 -1
  12. package/dist_ts_web/elements/00group-kanban/dees-kanban/dees-kanban.d.ts +16 -2
  13. package/dist_ts_web/elements/00group-kanban/dees-kanban/dees-kanban.demo.js +24 -2
  14. package/dist_ts_web/elements/00group-kanban/dees-kanban/dees-kanban.js +78 -16
  15. package/dist_ts_web/elements/00group-kanban/dees-kanban-activity/dees-kanban-activity.d.ts +13 -1
  16. package/dist_ts_web/elements/00group-kanban/dees-kanban-activity/dees-kanban-activity.js +80 -12
  17. package/dist_ts_web/elements/00group-kanban/dees-kanban-card/dees-kanban-card.d.ts +10 -0
  18. package/dist_ts_web/elements/00group-kanban/dees-kanban-card/dees-kanban-card.js +72 -4
  19. package/dist_ts_web/elements/00group-kanban/dees-kanban-column/dees-kanban-column.d.ts +12 -0
  20. package/dist_ts_web/elements/00group-kanban/dees-kanban-column/dees-kanban-column.js +73 -3
  21. package/dist_ts_web/elements/00group-kanban/kanban.firstload.d.ts +23 -0
  22. package/dist_ts_web/elements/00group-kanban/kanban.firstload.js +51 -0
  23. package/dist_ts_web/elements/00group-kanban/kanban.styles.d.ts +8 -0
  24. package/dist_ts_web/elements/00group-kanban/kanban.styles.js +47 -1
  25. package/dist_ts_web/i18n/de.d.ts +8 -0
  26. package/dist_ts_web/i18n/de.js +3 -1
  27. package/dist_ts_web/i18n/messages.d.ts +8 -0
  28. package/dist_ts_web/i18n/messages.js +3 -1
  29. package/package.json +1 -1
  30. package/readme.md +34 -3
  31. package/ts_web/00_commitinfo_data.ts +1 -1
  32. package/ts_web/elements/00group-kanban/dees-kanban/dees-kanban.demo.ts +23 -1
  33. package/ts_web/elements/00group-kanban/dees-kanban/dees-kanban.ts +76 -13
  34. package/ts_web/elements/00group-kanban/dees-kanban-activity/dees-kanban-activity.ts +88 -11
  35. package/ts_web/elements/00group-kanban/dees-kanban-card/dees-kanban-card.ts +60 -2
  36. package/ts_web/elements/00group-kanban/dees-kanban-column/dees-kanban-column.ts +61 -1
  37. package/ts_web/elements/00group-kanban/kanban.firstload.ts +54 -0
  38. package/ts_web/elements/00group-kanban/kanban.styles.ts +47 -0
  39. package/ts_web/i18n/de.ts +2 -0
  40. package/ts_web/i18n/messages.ts +2 -0
  41. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/de-3ZAD2XFI.js.map +0 -1
  42. /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-IASP6M5U.js.map → chunk-IGD4DLG4.js.map} +0 -0
  43. /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-B6IKM3SA.js.map → chunk-RITCTBBY.js.map} +0 -0
  44. /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-modal-CPEH77LV.js.map → dees-modal-PLLCPO5V.js.map} +0 -0
  45. /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-workspace-terminal-65M4HBRK.js.map → dees-workspace-terminal-7N6EXGH6.js.map} +0 -0
package/readme.md CHANGED
@@ -5652,6 +5652,32 @@ lands at its end. Supply `.people` for the assignee picker, `.loading` for loadi
5652
5652
  and `.error` for a host-side board loading failure. Supply new `.tickets` arrays
5653
5653
  for external updates.
5654
5654
 
5655
+ The host owns `loading`. Its first load, `loading` while `.tickets` is empty and
5656
+ no `.error` is set, draws placeholder cards in the board's own columns, card
5657
+ shape and gaps, so the board that replaces them does not move: in the columns
5658
+ already set, under their names, else in four placeholder columns. The
5659
+ placeholders appear only after 200 ms of loading, so a quick load never flashes
5660
+ them, and pulse with the theme's `--dees-loading-pulse-*` tokens, still under
5661
+ reduced motion. After `DeesKanban.stillLoadingAfter` (10 s) the board says
5662
+ "Still loading board…" beside its heading, where the totals come, and the
5663
+ placeholders hold still. The columns are `aria-busy` while loading; a visually
5664
+ hidden status announces the load and the placeholders are hidden from assistive
5665
+ technology. With tickets on show, a refresh keeps them and shows the "Loading
5666
+ board…" line.
5667
+
5668
+ ```typescript
5669
+ board.loading = true; // tickets still empty: the first load
5670
+ try {
5671
+ const snapshot = await api.loadBoard();
5672
+ board.columns = snapshot.columns;
5673
+ board.tickets = snapshot.tickets;
5674
+ } catch (error) {
5675
+ board.error = String(error);
5676
+ } finally {
5677
+ board.loading = false;
5678
+ }
5679
+ ```
5680
+
5655
5681
  The board takes the height its host gives it: the remaining space of a flex
5656
5682
  column, or a box of definite height. Each column's cards scroll below its header
5657
5683
  while the page stays put, and an edge past which cards lie casts a
@@ -5689,7 +5715,8 @@ Public methods and events:
5689
5715
 
5690
5716
  `dees-kanban-column` accepts `.column`, `.tickets`, `.allTickets`, `.columns`,
5691
5717
  `.movable`, `.canCreate`, `.pendingTicketId`, `.draggingTicketId`, `.projects`,
5692
- `.showProjects` and `.collapsed`. It composes
5718
+ `.showProjects` and `.collapsed`; the board sets `.placeholderCards` and
5719
+ `.placeholderStalled` on its first load. It composes
5693
5720
  cards and forwards their open, create and Move menu requests, and a collapsible
5694
5721
  column's toggle as `kanban-column-toggle`. Its cards scroll below its header in
5695
5722
  `cardScroller` once the column's height runs out; a drag that scrolls them from a
@@ -5700,7 +5727,8 @@ Use it through `dees-kanban` for provider handling and board-local drag ownershi
5700
5727
  #### DeesKanbanCard
5701
5728
 
5702
5729
  `dees-kanban-card` accepts `.ticket`, `.epic`, `.subtasks`, `.columns`, `.movable`,
5703
- `.pending`, `.projectName` and `.autoLabelDefinitions`. It displays priority,
5730
+ `.pending`, `.projectName` and `.autoLabelDefinitions`; `placeholder` draws a
5731
+ loading placeholder in the card's shape, `stalled` holds it still. It displays priority,
5704
5732
  assignee, labels and AutoLabels, its project and completion counts.
5705
5733
  `kanban-ticket-open` identifies a requested ticket, and `kanban-move-menu` carries
5706
5734
  the ticket ID and anchor element. Secondary cards remain usable independently.
@@ -5776,7 +5804,10 @@ Set `.showHeader = false` where the host's own header names the discussion.
5776
5804
  `dees-kanban-activity` renders a ticket's history, oldest first: who changed what,
5777
5805
  marked by the kind of change, with the fields each change touched in words.
5778
5806
  Provide `.ticketId`, `.activity` (`IKanbanActivity[]`), `.columns`, `.tickets`,
5779
- `.projects`, `.loading` and `.error`. An entry's `summary` replaces the board's
5807
+ `.projects`, `.loading` and `.error`. Its first load, `loading` without entries,
5808
+ draws placeholder entries after 200 ms and says "Still loading history…" after
5809
+ `DeesKanbanActivity.stillLoadingAfter` (10 s); entries already there stay while it
5810
+ refreshes. An entry's `summary` replaces the board's
5780
5811
  sentence. Its refresh button emits `kanban-activity-refresh` (`ticketId`); set
5781
5812
  `.showHeader = false` where the host's own header names the history.
5782
5813
 
@@ -3,6 +3,6 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@design.estate/dees-catalog',
6
- version: '22.2.0',
6
+ version: '22.3.1',
7
7
  description: 'A comprehensive library that provides dynamic web components for building sophisticated and modern web applications using JavaScript and TypeScript.'
8
8
  }
@@ -46,14 +46,36 @@ export const demoFunc = () => {
46
46
  demo.actAs(mara);
47
47
  await board.refresh();
48
48
  };
49
+ // The host owns `loading`. A first load starts without tickets and draws the board's placeholders
50
+ // until it finishes, saying it is still loading after ten seconds; a refresh keeps the tickets.
51
+ const startFirstLoad = (event: Event) => {
52
+ const board = boardOf(event);
53
+ board.tickets = [];
54
+ board.loading = true;
55
+ };
56
+ const finishLoading = async (event: Event) => {
57
+ const board = boardOf(event);
58
+ await board.refresh();
59
+ board.loading = false;
60
+ };
61
+ const refreshWithTickets = async (event: Event) => {
62
+ const board = boardOf(event);
63
+ board.loading = true;
64
+ await new Promise(resolve => setTimeout(resolve, 1500));
65
+ await board.refresh();
66
+ board.loading = false;
67
+ };
49
68
  // The server sets the AutoLabels: once a question is asked or answered, the board fetches the tickets again.
50
69
  const questionSaved = (event: Event) => void (event.currentTarget as DeesKanban).refresh();
51
70
  // The bar keeps its height and the board fills the rest; its columns scroll their own cards.
52
71
  return demoApp(html`<div style="display: flex; flex-direction: column; height: 100%">
53
72
  <div class="dees-demo-row" style="flex: none; padding: 0 24px 4px">
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>
73
+ <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. A first load shows placeholders until it finishes, and says it is still loading after ten seconds.</p>
55
74
  <dees-button type="outline" size="sm" text="Simulate a teammate's change" @clicked=${simulate}></dees-button>
56
75
  <dees-button type="outline" size="sm" text="Jonas renames CAT-102" @clicked=${rename}></dees-button>
76
+ <dees-button type="outline" size="sm" text="Start a first load" @clicked=${startFirstLoad}></dees-button>
77
+ <dees-button type="outline" size="sm" text="Finish loading" @clicked=${finishLoading}></dees-button>
78
+ <dees-button type="outline" size="sm" text="Refresh with tickets" @clicked=${refreshWithTickets}></dees-button>
57
79
  </div>
58
80
  <dees-kanban
59
81
  heading="Product workspace"
@@ -80,6 +80,8 @@ import { visuallyHidden } from '../../00visuallyhidden.js';
80
80
  import { nextFrame } from '../../00overlay.js';
81
81
  import { demoFunc } from './dees-kanban.demo.js';
82
82
  import { KanbanDragController } from '../kanban.dragcontroller.js';
83
+ import { KanbanFirstLoadController } from '../kanban.firstload.js';
84
+ import { kanbanSkeletonStyles } from '../kanban.styles.js';
83
85
  import '../dees-kanban-column/dees-kanban-column.js';
84
86
  import '../../00group-overlay/dees-popover/dees-popover.js';
85
87
  import '../../00group-utility/dees-icon/dees-icon.js';
@@ -134,6 +136,9 @@ type TKanbanInteraction = {
134
136
  [K in keyof IKanbanInteractionMap]: { type: K; detail: IKanbanInteractionMap[K] }
135
137
  }[keyof IKanbanInteractionMap];
136
138
 
139
+ /** How many placeholder cards each placeholder column holds on a first load, column after column. */
140
+ const placeholderCards = [3, 2, 3, 1];
141
+
137
142
  /** The board's filters in the filter bubble, by their `IKanbanFilterValues` key. */
138
143
  type TKanbanFilterKey = 'project' | 'epic' | 'assignee' | 'label' | 'autoLabel' | 'mine';
139
144
 
@@ -148,6 +153,9 @@ export class DeesKanban extends DeesElement {
148
153
  public static demo = demoFunc;
149
154
  public static demoGroups = ['Kanban'];
150
155
 
156
+ /** How long a first load runs, in milliseconds, before the board says it is still loading. */
157
+ public static stillLoadingAfter = 10_000;
158
+
151
159
  private readonly t = dcLocalize(this);
152
160
 
153
161
  /** The board's heading; while empty, the catalog's word (`kanban.board`). */
@@ -166,6 +174,13 @@ export class DeesKanban extends DeesElement {
166
174
  @property({ attribute: false })
167
175
  accessor provider: IKanbanProvider = {};
168
176
 
177
+ /**
178
+ * The host is loading the board. The first load, `loading` without tickets, draws placeholder
179
+ * columns and cards on the board's own layout once it has taken 200 ms, so a quick load never
180
+ * flashes them, and says it is still loading after `stillLoadingAfter`, beside the heading where
181
+ * the totals come; columns already set show
182
+ * their names. Tickets that are already there stay while a refresh loads.
183
+ */
169
184
  @property({ type: Boolean, reflect: true })
170
185
  accessor loading = false;
171
186
 
@@ -212,6 +227,10 @@ export class DeesKanban extends DeesElement {
212
227
  @state()
213
228
  private accessor operationError = '';
214
229
 
230
+ /** A board fetch failure clears on recovery without replacing a ticket's refusal. */
231
+ @state()
232
+ private accessor boardFetchError = '';
233
+
215
234
  @state()
216
235
  private accessor filtersOpen = false;
217
236
 
@@ -267,6 +286,11 @@ export class DeesKanban extends DeesElement {
267
286
  input => this.persistMove(input),
268
287
  () => !this.pendingTicketId,
269
288
  );
289
+ private readonly firstLoad = new KanbanFirstLoadController(
290
+ this,
291
+ () => this.isFirstLoad(),
292
+ () => DeesKanban.stillLoadingAfter,
293
+ );
270
294
  /** The columns' scrollbar, shown while they scroll sideways. */
271
295
  private readonly scrollbars = new OverlayScrollbarController(
272
296
  this,
@@ -292,6 +316,7 @@ export class DeesKanban extends DeesElement {
292
316
  activeFilterBarStyles,
293
317
  overlayScrollbarStyles,
294
318
  scrollEdgeInlineFadeStyles,
319
+ kanbanSkeletonStyles,
295
320
  css`
296
321
  /*
297
322
  * The board takes the height its host gives it, as a flex column's remaining space or a sized
@@ -361,10 +386,15 @@ export class DeesKanban extends DeesElement {
361
386
  corner-shape: var(--dees-corner-shape);
362
387
  }
363
388
 
364
- .filterStatus {
389
+ .filterStatus,
390
+ .loadingStatus {
365
391
  ${visuallyHidden}
366
392
  }
367
393
 
394
+ .placeholderTotals {
395
+ width: 14ch;
396
+ }
397
+
368
398
  .actions {
369
399
  display: flex;
370
400
  gap: 8px;
@@ -481,10 +511,19 @@ export class DeesKanban extends DeesElement {
481
511
  const count = active.filter(filter => filter.key !== 'text').length;
482
512
  const filterLabel = count ? this.t('kanban.filtersActive', { count }) : this.t('kanban.filters');
483
513
  const projects = kanbanProjects(this.projects, this.tickets);
514
+ const firstLoad = this.isFirstLoad();
515
+ const stillLoading = this.firstLoad.stillLoading;
516
+ const error = this.error || this.operationError || this.boardFetchError;
484
517
  return html`<header class="heading">
485
518
  <div class="identity">
486
519
  <h2>${this.heading || this.t('kanban.board')}</h2>
487
- <span class="totals">${this.t('kanban.totals', { tasks: tasks.length, epics: epics.length })}</span>
520
+ ${firstLoad && stillLoading
521
+ ? html`<span class="totals" aria-hidden="true">${this.t('kanban.stillLoading')}</span>`
522
+ : firstLoad
523
+ ? html`<span class="totals skeleton" aria-hidden="true"><span
524
+ class="skeletonFill skeletonBar placeholderTotals"
525
+ ></span></span>`
526
+ : html`<span class="totals">${this.t('kanban.totals', { tasks: tasks.length, epics: epics.length })}</span>`}
488
527
  </div>
489
528
  <div class="filters">
490
529
  <div class="searchField">
@@ -569,18 +608,33 @@ export class DeesKanban extends DeesElement {
569
608
  </header>
570
609
  ${this.renderActiveFilters(active)}
571
610
  <p class="filterStatus" role="status">${this.filterAnnouncement}</p>
572
- ${this.loading || this.openingTicket
611
+ <p class="loadingStatus" role="status">${firstLoad
612
+ ? this.t(stillLoading ? 'kanban.stillLoading' : 'kanban.loading')
613
+ : ''}</p>
614
+ ${!firstLoad && (this.loading || this.openingTicket)
573
615
  ? html`<p class="caption" role="status">${this.loading
574
616
  ? this.t('kanban.loading')
575
617
  : this.t('kanban.opening')}</p>`
576
618
  : ''}
577
- ${this.error || this.operationError
578
- ? html`<p class="error" role="alert">${this.error || this.operationError}</p>`
619
+ ${error
620
+ ? html`<p class="error" role="alert">${error}</p>`
579
621
  : ''}
580
- ${!this.columns.length
622
+ ${!this.columns.length && !firstLoad
581
623
  ? html`<p class="empty">${this.t('kanban.noColumns')}</p>`
582
- : html`<div class="columns ${this.scrollEdges.fadeClasses()}" aria-label=${this.heading || this.t('kanban.board')}>
583
- ${directives.repeat(this.columns, column => column.id, column => html`<dees-kanban-column
624
+ : html`<div
625
+ class="columns ${this.scrollEdges.fadeClasses()}"
626
+ aria-label=${this.heading || this.t('kanban.board')}
627
+ aria-busy=${this.loading ? 'true' : 'false'}
628
+ >
629
+ ${!this.columns.length
630
+ ? placeholderCards.map(cards => html`<dees-kanban-column
631
+ .placeholderCards=${cards}
632
+ .placeholderStalled=${stillLoading}
633
+ ></dees-kanban-column>`)
634
+ : ''}
635
+ ${directives.repeat(this.columns, column => column.id, (column, index) => html`<dees-kanban-column
636
+ .placeholderCards=${firstLoad ? placeholderCards[index % placeholderCards.length] : 0}
637
+ .placeholderStalled=${stillLoading}
584
638
  .column=${column}
585
639
  .columns=${this.columns}
586
640
  .pointerManaged=${true}
@@ -598,6 +652,11 @@ export class DeesKanban extends DeesElement {
598
652
  </div>`}`;
599
653
  }
600
654
 
655
+ /** The board's first load runs: loading, with no tickets yet and nothing failed. */
656
+ private isFirstLoad(): boolean {
657
+ return this.loading && this.tickets.length === 0 && !this.error;
658
+ }
659
+
601
660
  /**
602
661
  * The active-filter bar: below the header, a chip for each filter off its default and for the
603
662
  * search, each removing what it names, then "Clear all". Nothing filtered, no bar.
@@ -1069,8 +1128,8 @@ export class DeesKanban extends DeesElement {
1069
1128
  * Loads the board again through the provider's `loadBoard` and shows it in place, as a live
1070
1129
  * update does: the open ticket stays open with its unsaved changes and its comment draft, its
1071
1130
  * comments and history load again quietly, and the filters and the scroll stay. Calls made
1072
- * while a load runs share it, and one more load follows it; a snapshot older than `revision`, or
1073
- * loaded while the board saved a change of its own, is not shown.
1131
+ * while a load runs share it, and wait for the follow-up even if the first load fails; a snapshot
1132
+ * older than `revision`, or loaded while the board saved a change of its own, is not shown.
1074
1133
  */
1075
1134
  public refresh(): Promise<void> {
1076
1135
  if (!this.provider.loadBoard) return Promise.resolve();
@@ -1081,7 +1140,7 @@ export class DeesKanban extends DeesElement {
1081
1140
  const load = this.boardLoad = this.loadBoard().finally(() => {
1082
1141
  this.boardLoad = undefined;
1083
1142
  // A call that came after the last load had begun answering.
1084
- if (this.boardAgain && this.isConnected) void this.refresh();
1143
+ if (this.boardAgain && this.isConnected) return this.refresh();
1085
1144
  });
1086
1145
  return load;
1087
1146
  }
@@ -1095,8 +1154,11 @@ export class DeesKanban extends DeesElement {
1095
1154
  try {
1096
1155
  snapshot = await this.provider.loadBoard!(controller.signal);
1097
1156
  } catch (error) {
1098
- if (!controller.signal.aborted) this.reportError(error);
1099
- return;
1157
+ if (controller.signal.aborted || !this.isConnected) return;
1158
+ const message = this.boardFetchError = kanbanError(error);
1159
+ kanbanEvent(this, 'kanban-error', { error, message });
1160
+ if (controller.signal.aborted || !this.isConnected) return;
1161
+ continue;
1100
1162
  }
1101
1163
  if (controller.signal.aborted || !this.isConnected) return;
1102
1164
  if (this.mutationEpoch !== epoch) {
@@ -1114,6 +1176,7 @@ export class DeesKanban extends DeesElement {
1114
1176
  }
1115
1177
 
1116
1178
  private applySnapshot(snapshot: IKanbanBoardSnapshot): void {
1179
+ this.boardFetchError = '';
1117
1180
  this.tickets = [...snapshot.tickets];
1118
1181
  if (snapshot.columns) this.columns = [...snapshot.columns];
1119
1182
  if (snapshot.revision !== undefined) this.revision = snapshot.revision;
@@ -17,7 +17,9 @@ import type {
17
17
  TKanbanLink,
18
18
  TKanbanPriority,
19
19
  } from '../interfaces.js';
20
- import { kanbanFeedStyles, kanbanStyles } from '../kanban.styles.js';
20
+ import { kanbanFeedStyles, kanbanSkeletonStyles, kanbanStyles } from '../kanban.styles.js';
21
+ import { KanbanFirstLoadController } from '../kanban.firstload.js';
22
+ import { visuallyHidden } from '../../00visuallyhidden.js';
21
23
  import {
22
24
  kanbanEvent,
23
25
  kanbanLinkText,
@@ -33,6 +35,8 @@ declare global {
33
35
  }
34
36
  }
35
37
 
38
+ /** The placeholder entries a first load draws. */
39
+ const placeholderEntries = 3;
36
40
  /** A changed field's value that is not there. */
37
41
  const noValue = '—';
38
42
  /** The characters of a changed text the history shows before it cuts the text short. */
@@ -55,11 +59,24 @@ interface IChangeLine {
55
59
  value: string;
56
60
  }
57
61
 
58
- /** A ticket's history: who changed what, oldest first, with the fields each change touched. */
62
+ /**
63
+ * A ticket's history: who changed what, oldest first, with the fields each change touched. Its first
64
+ * load, `loading` without entries, draws placeholder entries once it has taken 200 ms and says it is
65
+ * still loading after `stillLoadingAfter`; entries that are already there stay while more load.
66
+ */
59
67
  @customElement('dees-kanban-activity')
60
68
  export class DeesKanbanActivity extends DeesElement {
69
+ /** How long a first load runs, in milliseconds, before the history says it is still loading. */
70
+ public static stillLoadingAfter = 10_000;
71
+
61
72
  private readonly t = dcLocalize(this);
62
73
 
74
+ private readonly firstLoad = new KanbanFirstLoadController(
75
+ this,
76
+ () => this.isFirstLoad(),
77
+ () => DeesKanbanActivity.stillLoadingAfter,
78
+ );
79
+
63
80
  @property({ type: String, reflect: true })
64
81
  accessor ticketId = '';
65
82
 
@@ -92,6 +109,7 @@ export class DeesKanbanActivity extends DeesElement {
92
109
  public static styles = [
93
110
  ...kanbanStyles,
94
111
  kanbanFeedStyles,
112
+ kanbanSkeletonStyles,
95
113
  css`
96
114
  li {
97
115
  grid-template-columns: 24px minmax(0, 1fr);
@@ -150,18 +168,45 @@ export class DeesKanbanActivity extends DeesElement {
150
168
  min-width: 0;
151
169
  overflow-wrap: anywhere;
152
170
  }
171
+
172
+ .loadingStatus {
173
+ ${visuallyHidden}
174
+ }
175
+
176
+ /* A placeholder entry's lines, of differing lengths from entry to entry. */
177
+ .placeholderAuthor {
178
+ width: 10ch;
179
+ }
180
+
181
+ .placeholderWhat {
182
+ width: 18ch;
183
+ }
184
+
185
+ li:nth-child(3n + 2) .placeholderWhat {
186
+ width: 12ch;
187
+ }
188
+
189
+ li:nth-child(3n) .placeholderWhat {
190
+ width: 22ch;
191
+ }
192
+
193
+ .placeholderTime {
194
+ width: 12ch;
195
+ }
153
196
  `,
154
197
  ];
155
198
 
156
199
  public render(): TemplateResult {
157
- const entries = this.activity
158
- .filter(entry => entry.ticketId === this.ticketId)
159
- .slice()
160
- .sort((a, b) => Date.parse(a.createdAt) - Date.parse(b.createdAt));
200
+ const entries = this.entries();
201
+ const firstLoad = this.isFirstLoad();
202
+ const stillLoading = this.firstLoad.stillLoading;
203
+ const skeleton = `skeleton ${stillLoading ? 'stalled' : ''}`;
161
204
  return html`${this.showHeader
162
205
  ? html`<header>
163
206
  <h3>${this.t('kanban.history')}</h3>
164
- <span class="count">${entries.length}</span>
207
+ ${firstLoad
208
+ ? html`<span class=${skeleton} aria-hidden="true"><span class="count skeletonFill"></span></span>`
209
+ : html`<span class="count">${entries.length}</span>`}
165
210
  <span class="spacer"></span>
166
211
  <dees-button
167
212
  class="refresh"
@@ -175,16 +220,48 @@ export class DeesKanbanActivity extends DeesElement {
175
220
  ></dees-button>
176
221
  </header>`
177
222
  : ''}
178
- ${this.loading
179
- ? html`<p class="caption" role="status">${this.t('kanban.loadingHistory')}</p>`
180
- : ''}
223
+ <p class="loadingStatus" role="status">${firstLoad
224
+ ? this.t(stillLoading ? 'kanban.stillLoadingHistory' : 'kanban.loadingHistory')
225
+ : ''}</p>
226
+ ${firstLoad && stillLoading
227
+ ? html`<p class="caption" aria-hidden="true">${this.t('kanban.stillLoadingHistory')}</p>`
228
+ : !firstLoad && this.loading
229
+ ? html`<p class="caption" role="status">${this.t('kanban.loadingHistory')}</p>`
230
+ : ''}
181
231
  ${this.error ? html`<p class="error" role="alert">${this.error}</p>` : ''}
182
- <ol aria-label=${this.t('kanban.history')}>${entries.map(entry => this.renderEntry(entry))}</ol>
232
+ <ol aria-label=${this.t('kanban.history')} aria-busy=${this.loading ? 'true' : 'false'}>${firstLoad
233
+ ? Array.from({ length: placeholderEntries }, () => this.renderPlaceholderEntry(skeleton))
234
+ : entries.map(entry => this.renderEntry(entry))}</ol>
183
235
  ${!entries.length && !this.loading && !this.error
184
236
  ? html`<p class="empty">${this.t('kanban.noHistory')}</p>`
185
237
  : ''}`;
186
238
  }
187
239
 
240
+ /** The history's first load runs: loading, with no entries of the ticket yet and nothing failed. */
241
+ private isFirstLoad(): boolean {
242
+ return this.loading && !this.error && this.entries().length === 0;
243
+ }
244
+
245
+ private entries(): IKanbanActivity[] {
246
+ return this.activity
247
+ .filter(entry => entry.ticketId === this.ticketId)
248
+ .slice()
249
+ .sort((a, b) => Date.parse(a.createdAt) - Date.parse(b.createdAt));
250
+ }
251
+
252
+ /** A placeholder entry, on an entry's own glyph and meta row. */
253
+ private renderPlaceholderEntry(skeleton: string): TemplateResult {
254
+ return html`<li class=${skeleton} aria-hidden="true">
255
+ <span class="glyph skeletonFill"></span><div>
256
+ <div class="row meta">
257
+ <span><span class="author skeletonFill skeletonBar placeholderAuthor"></span> <span
258
+ class="what skeletonFill skeletonBar placeholderWhat"
259
+ ></span></span>
260
+ <time class="skeletonFill skeletonBar placeholderTime"></time>
261
+ </div>
262
+ </div></li>`;
263
+ }
264
+
188
265
  private renderEntry(entry: IKanbanActivity): TemplateResult {
189
266
  const lines = this.changeLines(entry);
190
267
  return html`<li>
@@ -1,7 +1,7 @@
1
1
  import { DeesElement, customElement, property, html, css } from '@design.estate/dees-element';
2
2
  import { dcLocalize } from '../../../i18n/localize.js';
3
3
  import type { IKanbanAutoLabel, IKanbanTicket, IKanbanColumn } from '../interfaces.js';
4
- import { kanbanStyles } from '../kanban.styles.js';
4
+ import { kanbanSkeletonStyles, kanbanStyles } from '../kanban.styles.js';
5
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';
@@ -50,8 +50,21 @@ export class DeesKanbanCard extends DeesElement {
50
50
  @property({ attribute: false })
51
51
  accessor pointerManaged = false;
52
52
 
53
+ /**
54
+ * A placeholder for a card still loading, in the card's own shape: a key, a line of title and a
55
+ * footer with a label and an assignee, hidden from assistive technology. The board draws them on
56
+ * its first load; `ticket` is not read.
57
+ */
58
+ @property({ type: Boolean, reflect: true })
59
+ accessor placeholder = false;
60
+
61
+ /** The placeholder's load runs long: it holds still. */
62
+ @property({ type: Boolean, reflect: true })
63
+ accessor stalled = false;
64
+
53
65
  public static styles = [
54
66
  ...kanbanStyles,
67
+ kanbanSkeletonStyles,
55
68
  css`
56
69
  article {
57
70
  padding: 12px;
@@ -62,7 +75,7 @@ export class DeesKanbanCard extends DeesElement {
62
75
  box-shadow: var(--dees-shadow-xs);
63
76
  }
64
77
 
65
- article:hover {
78
+ article:not(.skeleton):hover {
66
79
  border-color: var(--dees-color-border-strong);
67
80
  }
68
81
 
@@ -256,6 +269,35 @@ export class DeesKanbanCard extends DeesElement {
256
269
  color: var(--dees-color-link);
257
270
  }
258
271
 
272
+ /* A placeholder's lines, of differing lengths from card to card, as real titles are. */
273
+ .skeleton .title {
274
+ cursor: default;
275
+ }
276
+
277
+ .placeholderKey {
278
+ width: 7ch;
279
+ }
280
+
281
+ .placeholderTitle {
282
+ width: 82%;
283
+ }
284
+
285
+ :host(:nth-child(3n + 2)) .placeholderTitle {
286
+ width: 58%;
287
+ }
288
+
289
+ :host(:nth-child(3n)) .placeholderTitle {
290
+ width: 70%;
291
+ }
292
+
293
+ .placeholderLabel {
294
+ width: 9ch;
295
+ }
296
+
297
+ .placeholderName {
298
+ width: 8ch;
299
+ }
300
+
259
301
  @media (pointer: coarse) {
260
302
  .move::part(button) {
261
303
  width: 32px;
@@ -276,6 +318,7 @@ export class DeesKanbanCard extends DeesElement {
276
318
  private readonly t = dcLocalize(this);
277
319
 
278
320
  public render() {
321
+ if (this.placeholder) return this.renderPlaceholder();
279
322
  const ticket = this.ticket;
280
323
  if (!ticket) return html``;
281
324
  const completed = this.subtasks.filter(task =>
@@ -382,4 +425,19 @@ export class DeesKanbanCard extends DeesElement {
382
425
  : ''}
383
426
  </article>`;
384
427
  }
428
+
429
+ /** The placeholder card: each line on the card's own boxes, so the card that replaces it takes its place. */
430
+ private renderPlaceholder() {
431
+ return html`<article class="skeleton ${this.stalled ? 'stalled' : ''}" aria-hidden="true">
432
+ <div class="meta"><span class="skeletonFill skeletonBar placeholderKey"></span></div>
433
+ <div class="title"><span class="skeletonFill skeletonBar placeholderTitle"></span></div>
434
+ <div class="row footer">
435
+ <span class="badge skeletonFill placeholderLabel">\u200b</span>
436
+ <span class="assignee">
437
+ <span class="avatar skeletonFill"></span>
438
+ <span class="skeletonFill skeletonBar placeholderName"></span>
439
+ </span>
440
+ </div>
441
+ </article>`;
442
+ }
385
443
  }