@design.estate/dees-catalog 22.4.0 → 22.5.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 (60) hide show
  1. package/dist_bundle/bundle.js +381 -175
  2. package/dist_bundle/bundle.js.map +1 -1
  3. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-RITCTBBY.js → chunk-K2WA4NFI.js} +2 -2
  4. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-IGD4DLG4.js → chunk-OFVHJYUS.js} +3 -3
  5. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-MK42UYWT.js → chunk-TCT6JQUS.js} +5 -2
  6. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-MK42UYWT.js.map → chunk-TCT6JQUS.js.map} +1 -1
  7. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{de-TN6FRTSU.js → de-VUUYAWTZ.js} +5 -2
  8. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/de-VUUYAWTZ.js.map +1 -0
  9. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-modal-PLLCPO5V.js → dees-modal-KNFCFUX6.js} +3 -3
  10. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-workspace-terminal-7N6EXGH6.js → dees-workspace-terminal-GCBL7RVQ.js} +4 -4
  11. package/dist_ts_web/00_commitinfo_data.js +1 -1
  12. package/dist_ts_web/demos/appui.state.d.ts +7 -0
  13. package/dist_ts_web/demos/charts.d.ts +14 -0
  14. package/dist_ts_web/demos/charts.js +62 -20
  15. package/dist_ts_web/elements/00firstload.d.ts +24 -0
  16. package/dist_ts_web/elements/00firstload.js +52 -0
  17. package/dist_ts_web/elements/00group-chart/dees-chart-echarts-base.d.ts +29 -1
  18. package/dist_ts_web/elements/00group-chart/dees-chart-echarts-base.js +64 -15
  19. package/dist_ts_web/elements/00group-chart/dees-chart-frame.d.ts +15 -0
  20. package/dist_ts_web/elements/00group-chart/dees-chart-frame.js +20 -2
  21. package/dist_ts_web/elements/00group-chart/dees-chart-gauge/component.d.ts +2 -0
  22. package/dist_ts_web/elements/00group-chart/dees-chart-gauge/component.js +3 -1
  23. package/dist_ts_web/elements/00group-chart/dees-chart-line/component.d.ts +33 -0
  24. package/dist_ts_web/elements/00group-chart/dees-chart-line/component.js +104 -8
  25. package/dist_ts_web/elements/00group-harness/dees-harness-chat/dees-harness-chat.d.ts +4 -0
  26. package/dist_ts_web/elements/00group-harness/dees-harness-chat/dees-harness-chat.js +22 -2
  27. package/dist_ts_web/elements/00group-harness/dees-harness-session-sidebar/dees-harness-session-sidebar.d.ts +16 -1
  28. package/dist_ts_web/elements/00group-harness/dees-harness-session-sidebar/dees-harness-session-sidebar.demo.js +9 -2
  29. package/dist_ts_web/elements/00group-harness/dees-harness-session-sidebar/dees-harness-session-sidebar.js +55 -6
  30. package/dist_ts_web/elements/00group-harness/harness.records.js +16 -3
  31. package/dist_ts_web/elements/00group-kanban/dees-kanban/dees-kanban.js +3 -3
  32. package/dist_ts_web/elements/00group-kanban/dees-kanban-activity/dees-kanban-activity.js +3 -3
  33. package/dist_ts_web/i18n/de.d.ts +12 -0
  34. package/dist_ts_web/i18n/de.js +4 -1
  35. package/dist_ts_web/i18n/messages.d.ts +12 -0
  36. package/dist_ts_web/i18n/messages.js +4 -1
  37. package/package.json +2 -2
  38. package/readme.md +41 -2
  39. package/ts_web/00_commitinfo_data.ts +1 -1
  40. package/ts_web/demos/charts.ts +48 -18
  41. package/ts_web/elements/{00group-kanban/kanban.firstload.ts → 00firstload.ts} +8 -7
  42. package/ts_web/elements/00group-chart/dees-chart-echarts-base.ts +55 -4
  43. package/ts_web/elements/00group-chart/dees-chart-frame.ts +31 -1
  44. package/ts_web/elements/00group-chart/dees-chart-gauge/component.ts +2 -0
  45. package/ts_web/elements/00group-chart/dees-chart-line/component.ts +100 -7
  46. package/ts_web/elements/00group-harness/dees-harness-chat/dees-harness-chat.ts +10 -0
  47. package/ts_web/elements/00group-harness/dees-harness-session-sidebar/dees-harness-session-sidebar.demo.ts +9 -1
  48. package/ts_web/elements/00group-harness/dees-harness-session-sidebar/dees-harness-session-sidebar.ts +43 -4
  49. package/ts_web/elements/00group-harness/harness.records.ts +15 -2
  50. package/ts_web/elements/00group-kanban/dees-kanban/dees-kanban.ts +2 -2
  51. package/ts_web/elements/00group-kanban/dees-kanban-activity/dees-kanban-activity.ts +2 -2
  52. package/ts_web/i18n/de.ts +3 -0
  53. package/ts_web/i18n/messages.ts +3 -0
  54. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/de-TN6FRTSU.js.map +0 -1
  55. package/dist_ts_web/elements/00group-kanban/kanban.firstload.d.ts +0 -23
  56. package/dist_ts_web/elements/00group-kanban/kanban.firstload.js +0 -51
  57. /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-RITCTBBY.js.map → chunk-K2WA4NFI.js.map} +0 -0
  58. /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-IGD4DLG4.js.map → chunk-OFVHJYUS.js.map} +0 -0
  59. /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-modal-PLLCPO5V.js.map → dees-modal-KNFCFUX6.js.map} +0 -0
  60. /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-workspace-terminal-7N6EXGH6.js.map → dees-workspace-terminal-GCBL7RVQ.js.map} +0 -0
package/readme.md CHANGED
@@ -4336,6 +4336,22 @@ html`<dees-chart-line label="Bank balances" meta="as each bank statement states
4336
4336
  </dees-chart-line>`;
4337
4337
  ```
4338
4338
 
4339
+ While the host loads a chart's data it sets `loading` (reflected) on any ECharts chart — bar,
4340
+ donut, gauge, line or radar. The first load, while the chart has no data on show, follows the
4341
+ catalog's first-load standard: the plot is covered at once, a placeholder takes its place once
4342
+ the load has run 200 ms, so a quick load never flashes it, and pulses on
4343
+ `--dees-loading-pulse-duration` and `--dees-loading-pulse-opacity`; it holds still under
4344
+ `prefers-reduced-motion: reduce`. After `stillLoadingAfter` (a static, 10 s) the placeholder holds
4345
+ still and the chart says "Still loading chart…" over it. The tile is `aria-busy` while `loading`
4346
+ holds, a visually hidden status says "Loading chart…", and the placeholder is hidden from
4347
+ assistive technology. Data the host sets ends the first load at once; data already on show stays
4348
+ while a refresh loads. A gauge always holds a value, so its first load ends when `loading` does.
4349
+
4350
+ ```typescript
4351
+ html`<dees-chart-bar label="Requests" ?loading=${!report} .categories=${report?.days ?? []}
4352
+ .series=${report?.series ?? []}></dees-chart-bar>`;
4353
+ ```
4354
+
4339
4355
  A series or a slice says what it stands for with `tone` — `'neutral'`, `'accent'`,
4340
4356
  `'success'`, `'warning'` or `'danger'` — and is drawn in the theme's colour for it, in the
4341
4357
  bright and the dark theme alike, so a host never passes a hex for "paid" or "overdue". An
@@ -4526,6 +4542,24 @@ readable, in either theme; a series whose `color` is not a hex colour is tinted
4526
4542
  `showLatestValue` puts each series' latest stated value, formatted by `valueFormatter`, beside
4527
4543
  its name in the legend.
4528
4544
 
4545
+ `stacked` (reflected) stacks the series, the first at the bottom: each is drawn on top of the
4546
+ ones before it, so the topmost line is their total at each moment, a value above zero on those
4547
+ above zero beneath it and a value below zero under those below zero. Series stated on different
4548
+ moments stack all the same: where a series states no value at a moment another one states, it
4549
+ adds what its own drawing reads there — under `step` its value before, under `line` its line
4550
+ between the two values around the moment — and nothing under `points`, before its first value,
4551
+ after its last or beside a missing one. With `fillArea`, each series tints the band between its
4552
+ line and the one beneath it evenly in its colour. The value axis includes zero. A series switched
4553
+ off in the legend leaves the stack, and the others close up. Hovering, the legend and the text
4554
+ summary keep each series' own stated values, and `axisValueFormatter` words the stacked axis.
4555
+
4556
+ ```typescript
4557
+ html`<dees-chart-line label="Cloud spend by service" meta="per week, stacked into the total"
4558
+ presentation="line" stacked fillArea .series=${spendByService}
4559
+ .valueFormatter=${(value: number) => `${value.toFixed(2)} €`}
4560
+ ></dees-chart-line>`;
4561
+ ```
4562
+
4529
4563
  `showMarkers` (default `true`) marks every value with a dot. Turn it off for long series, such as
4530
4564
  a year of daily balances, where a dot on every value crowds the line: `line` and `step` then draw
4531
4565
  the course alone, and while the pointer is over the plot, the moment nearest it is marked and the
@@ -5948,7 +5982,7 @@ chat.refreshMessages();
5948
5982
  chat.refreshMessages([]);
5949
5983
  ```
5950
5984
 
5951
- Key props: `messages`, `permissions`, `questions`, `status`, `transcriptKey`, `hasEarlierMessages`/`loadingEarlier`, `usage`, `todos`/`todosAuthoritative`/`showTodosPanel`, `sessionMetrics`, `scratchpad`/`scratchpadBusy`/`scratchpadError`, `attachedResources`, `workers`/`selectedWorkerId`, `sessionIntelligenceEnabled`/`intelligenceExchanges`/`intelligenceBusy`/`intelligenceError`/`intelligenceAvailabilityStatus`/`intelligenceUnavailableReason`/`intelligenceAvailabilityAction`/`intelligenceHeading`, `showSessionSidebar`, `heading`, `subheading`, `toolbarActions`, `showToolbar`, `busy`, `busyDeliveryModes`, `queuedCount`, `disabled`, `inputLocked`, `abortEnabled`, `abortDisabledReason`, `commands`, `starterPrompts`, `account`/`accountOptions`/`accountNote`, `model`/`modelOptions`, `reasoningEffort`/`effortOptions`, `mode`/`modeOptions`, `menuActions`, `markdownWhileStreaming`, `toolRegistry`. `toolbarActions` accepts `IHarnessChatToolbarAction[]`; each action has `id`, human-readable `label`, `iconName`, `action`, and optional `tooltip`/`disabled`, and renders immediately before the session-details toggle. `disabled: true` makes only that toolbar action inert and prevents its callback without changing the chat-level `disabled` state. `markdownWhileStreaming` defaults to `true`; setting it to `false` keeps active outer and nested subtask markdown as plain text, then performs the final markdown parse when `message-end` arrives. `commands` is forwarded unchanged to the controlled composer. `starterPrompts` (`IHarnessStarterPrompt[]`, each `{ label, prompt? }`) shows as buttons under the empty transcript's text while the composer accepts input; choosing one puts its `prompt` (else its `label`) into the composer, focused and unsent, and emits `harness-input` as typing would. Account options use human-readable `label` values and opaque stable `value` identifiers. The status line renders inside the transcript column (it never pushes between the session panel and the composer), and both the toolbar and the docked composer cast a subtle shadow over the scrolling messages.
5985
+ Key props: `messages`, `permissions`, `questions`, `status`, `transcriptKey`, `hasEarlierMessages`/`loadingEarlier`, `usage`, `todos`/`todosAuthoritative`/`showTodosPanel`, `sessionMetrics`, `scratchpad`/`scratchpadBusy`/`scratchpadError`, `attachedResources`, `workers`/`selectedWorkerId`/`workersHeading`/`workerQuestionCounts`, `sessionIntelligenceEnabled`/`intelligenceExchanges`/`intelligenceBusy`/`intelligenceError`/`intelligenceAvailabilityStatus`/`intelligenceUnavailableReason`/`intelligenceAvailabilityAction`/`intelligenceHeading`, `showSessionSidebar`, `heading`, `subheading`, `toolbarActions`, `showToolbar`, `busy`, `busyDeliveryModes`, `queuedCount`, `disabled`, `inputLocked`, `abortEnabled`, `abortDisabledReason`, `commands`, `starterPrompts`, `account`/`accountOptions`/`accountNote`, `model`/`modelOptions`, `reasoningEffort`/`effortOptions`, `mode`/`modeOptions`, `menuActions`, `markdownWhileStreaming`, `toolRegistry`. `toolbarActions` accepts `IHarnessChatToolbarAction[]`; each action has `id`, human-readable `label`, `iconName`, `action`, and optional `tooltip`/`disabled`, and renders immediately before the session-details toggle. `disabled: true` makes only that toolbar action inert and prevents its callback without changing the chat-level `disabled` state. `markdownWhileStreaming` defaults to `true`; setting it to `false` keeps active outer and nested subtask markdown as plain text, then performs the final markdown parse when `message-end` arrives. `commands` is forwarded unchanged to the controlled composer. `starterPrompts` (`IHarnessStarterPrompt[]`, each `{ label, prompt? }`) shows as buttons under the empty transcript's text while the composer accepts input; choosing one puts its `prompt` (else its `label`) into the composer, focused and unsent, and emits `harness-input` as typing would. Account options use human-readable `label` values and opaque stable `value` identifiers. The status line renders inside the transcript column (it never pushes between the session panel and the composer), and both the toolbar and the docked composer cast a subtle shadow over the scrolling messages.
5952
5986
 
5953
5987
  Light-DOM content assigned to `slot="composer-status"` renders between the transcript and composer, outside the transcript scroller. `inputLocked` keeps the controlled draft readable, focusable, and copyable while blocking every mutation control and canceling queued or in-flight attachment ingestion. It does not disable Stop or the More options menu of `menuActions`. While busy, Stop remains visible; `abortEnabled=${false}` disables it, suppresses `harness-abort`, and exposes `abortDisabledReason` as its explanation.
5954
5988
 
@@ -6080,6 +6114,11 @@ request.outcome = { tone: 'running', text: 'Changing…' };
6080
6114
 
6081
6115
  Inside the chat, permission cards render **inline with the messages**: pending requests pin to the end of the transcript (action required), and answered ones freeze at their response time in the flow. Set `response`/`respondedAt` on the request after handling it and keep it in the array — the card stays in the transcript showing what was granted or rejected.
6082
6116
 
6117
+ Proposal and permission field labels wrap within their record without squeezing the values:
6118
+ two columns reserve at least 8rem for values, and record containers 320px wide or narrower
6119
+ stack each label above its value. The record's width decides, so a narrow assistant in a
6120
+ desktop window remains readable without shortening the host's labels.
6121
+
6083
6122
  #### `DeesHarnessQuestionCard`
6084
6123
 
6085
6124
  A question the agent asks mid-run: option buttons with descriptions (single-select answers on click; `multiSelect` collects then confirms) plus an optional free-text answer (`allowCustom`, default on — Enter or "Send Answer" submits, combining selections with the text). Emits `harness-question-response` with `{ requestId, answers, request }`; for a question, `answers` holds the chosen options' labels and then the reader's own words, `optionIds` the chosen options by their `id` (an option without one by its label) and `text` the own words apart, unset when they wrote none. `readOnly` shows a question to a reader who may not answer it, `frameless` drops the card's border, surface and padding where a host's tile holds it, as the Kanban discussion does, and `focusAnswer(options?)` puts the focus on the first option, or on the field where there is none, with the `FocusOptions` it is given (`preventScroll` for a host that scrolls the card into view itself). Questions flow through `dees-harness-chat`'s `questions` property and render inline like permissions: pending ones pin to the end of the transcript, and answered ones persist showing the chosen answers once the host sets `response`/`respondedAt`.
@@ -6282,7 +6321,7 @@ Direct sidebar hosts can set `intelligenceAvailabilityStatus`, `intelligenceUnav
6282
6321
 
6283
6322
  Set `attachedResources` (`IHarnessResourceMeta[]`) to show the terminals, browsers and other host resources attached to the session, between Session Scratchpad and Session Intelligence. `undefined`, the default, leaves the section out; an empty array shows it with "No resources attached." Each row shows the resource's icon, title and state over its kind and preview, and is one button that emits `harness-attached-resource-open` with `{ resource }` (`IHarnessAttachedResourceOpenDetail`), bubbling and composed; the host opens the resource. `DeesHarnessChat` forwards `attachedResources`, and a defined value keeps its session panel available.
6284
6323
 
6285
- Set `workers` (`IHarnessSessionMeta[]`) to list the sessions this session runs, such as a driver's workers, right after Tasks. `undefined`, the default, leaves the section out; an empty array shows it with "No workers." The panel opens on Workers when there are workers and no tasks. Each row shows the worker's icon (else its harness's, else a bot), title and `statusLabel`, coloured by `state`, over its harness name and preview, and is one button that emits `harness-worker-open` with `{ worker }` (`IHarnessWorkerOpenDetail`), bubbling and composed; the host opens the worker. `selectedWorkerId` marks the row of the worker the host shows with `aria-current="true"`. `DeesHarnessChat` forwards `workers` and `selectedWorkerId`, and a defined `workers` keeps its session panel available.
6324
+ Set `workers` (`IHarnessSessionMeta[]`) to list the sessions this session runs, such as a driver's workers, right after Tasks. `undefined`, the default, leaves the section out; an empty array shows it with "No workers." The panel opens on Workers when there are workers and no tasks. Each row shows the worker's icon (else its harness's, else a bot), title and `statusLabel`, coloured by `state`, over its harness name, its `projectLabel` and its preview, and is one button that emits `harness-worker-open` with `{ worker }` (`IHarnessWorkerOpenDetail`), bubbling and composed; the host opens the worker. `selectedWorkerId` marks the row of the worker the host shows with `aria-current="true"`. `workersHeading` (reflected) names the section in the host's words, such as "Direct reports"; empty, the default, it keeps the catalog's "Workers". `workerQuestionCounts` (`Record<string, number>`, by worker id) counts the questions each worker has open for its owner: a worker with one or more shows the count as a compact warning [`dees-badge`](#deesbadge) after its title, whose title and the row's accessible name say "2 open questions"; a missing, zero or invalid count shows none. `DeesHarnessChat` forwards `workers`, `selectedWorkerId`, `workersHeading` and `workerQuestionCounts`, and a defined `workers` keeps its session panel available.
6286
6325
 
6287
6326
  `openSection(section)` expands and focuses an available section and returns false when that section has no current content. Its argument is the exported `THarnessSessionSidebarSection` union: `'tasks' | 'workers' | 'activity' | 'metrics' | 'scratchpad' | 'resources' | 'intelligence'`.
6288
6327
 
@@ -3,6 +3,6 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@design.estate/dees-catalog',
6
- version: '22.4.0',
6
+ version: '22.5.0',
7
7
  description: 'A comprehensive library that provides dynamic web components for building sophisticated and modern web applications using JavaScript and TypeScript.'
8
8
  }
@@ -1,4 +1,4 @@
1
- import { DeesElement, customElement, html, css, property, state, cssManager, provideI18n } from '@design.estate/dees-element';
1
+ import { DeesElement, customElement, html, css, property, state, cssManager, provideI18n, directives } from '@design.estate/dees-element';
2
2
  import * as plugins from '../elements/00plugins.js';
3
3
  import { demoPage } from './templates.js';
4
4
  import { operationsDemoStyles } from './operations.js';
@@ -59,6 +59,18 @@ export const chartSamples = (step = 0, sampledAt = Date.now()) => {
59
59
  { time: '2026-08-31', value: 8100.15 }, { time: '2026-09-30', value: 5600.4 + offset * 10 },
60
60
  ] },
61
61
  ],
62
+ // Cloud spend by service, stacked into the week's total: compute every Monday, storage as its
63
+ // invoices state it, and a network service booked from August on.
64
+ cloudSpend: [
65
+ { name: 'Compute', data: [1840, 1920, 2010, 1980, 2240, 2310, 2190, 2460, 2520 + offset * 10, 2380, 2610, 2700]
66
+ .map((value, index) => ({ time: new Date(Date.UTC(2026, 6, 6 + index * 7)).toISOString().slice(0, 10), value })) },
67
+ { name: 'Storage', data: [
68
+ { time: '2026-07-06', value: 640 }, { time: '2026-07-24', value: 700 }, { time: '2026-08-14', value: 760 },
69
+ { time: '2026-09-04', value: 820 + offset * 5 }, { time: '2026-09-21', value: 880 },
70
+ ] },
71
+ { name: 'Network', data: [420, 460, 510, 480, 530, 590, 620 + offset * 5, 640]
72
+ .map((value, index) => ({ time: new Date(Date.UTC(2026, 7, 3 + index * 7)).toISOString().slice(0, 10), value })) },
73
+ ],
62
74
  // A dollar account stated on two days in a row, and a year of month-end statements.
63
75
  dayApart: [{ name: 'Dollar account', data: [{ time: '2026-09-29', value: 3120 + offset * 10 }, { time: '2026-09-30', value: 2980 }] }],
64
76
  monthEnds: [{ name: 'Current account', data: [8200, 9400, 7600, 10100, 11800, 9900, 12400, 13100, 11200, 14300, 12900, 15234 + offset * 10]
@@ -78,7 +90,7 @@ const descriptions = {
78
90
  bar: ['Compare traffic', 'Compare requests and cache hits across the week. Switch orientation or stack related series. Below, each month has two columns that reach both ways from zero: money in above, money out below, and the operating column marks its surplus or deficit at its end. Its header states what the chart covers beside the title, and a line of the host\'s own under the plot, at the header\'s inset, names what the chart leaves out: the legend stays the tile\'s last row.'],
79
91
  donut: ['Traffic distribution', 'Understand the share of requests from each region. Labels and legends remain optional. Below, three months of spending: each donut keeps one size whatever its legend holds, and the host\'s own list draws its dots in the charts\' palette.'],
80
92
  gauge: ['Capacity', 'See used capacity against a defined range and warning thresholds.'],
81
- line: ['Stated balances', 'Balances where the statements state them, on an axis proportional to time. A quarterly statement sits three months after the one before. With lines, an area can tint each course down to zero, and the legend can state each account\'s latest balance. The time axis labels whole days, months or years that differ and keep apart at any width: two statements a day apart are labelled by their days, and a year of month ends month by month where there is room. The value axis of the balances states whole euros, while hovering, the legend and the text summary keep the cents. A year of daily balances crowds its line with a dot a day: with markers hidden, lines and steps draw the course alone, hovering marks and reads out the day nearest the pointer, and a value with no neighbour, such as the single savings statement, keeps its dot. The balances state their terms beside the title, with a notice of the host\'s own over the plot and the balances the course does not end on under it, at the header\'s inset: the chart grows with these rows, its plot keeping 240 px, and the legend stays the tile\'s last row.'],
93
+ line: ['Stated balances', 'Balances where the statements state them, on an axis proportional to time. A quarterly statement sits three months after the one before. With lines, an area can tint each course down to zero, and the legend can state each account\'s latest balance. The time axis labels whole days, months or years that differ and keep apart at any width: two statements a day apart are labelled by their days, and a year of month ends month by month where there is room. The value axis of the balances states whole euros, while hovering, the legend and the text summary keep the cents. A year of daily balances crowds its line with a dot a day: with markers hidden, lines and steps draw the course alone, hovering marks and reads out the day nearest the pointer, and a value with no neighbour, such as the single savings statement, keeps its dot. Stacked, each account sits on the ones before it, so the topmost line is the total held, and the cloud spend below stacks services stated on different days into the week\'s total: each tints its own band, a service switched off in the legend leaves the stack, and hovering reads each service\'s own amount. The balances state their terms beside the title, with a notice of the host\'s own over the plot and the balances the course does not end on under it, at the header\'s inset: the chart grows with these rows, its plot keeping 240 px, and the legend stays the tile\'s last row.'],
82
94
  radar: ['Service profile', 'Compare the current service with its targets across five dimensions.'],
83
95
  };
84
96
 
@@ -92,6 +104,9 @@ export class DeesDemoChartWorkspace extends DeesElement {
92
104
  @state() private accessor filled = false;
93
105
  @state() private accessor latest = false;
94
106
  @state() private accessor dotless = false;
107
+ @state() private accessor stackedLines = false;
108
+ /** The host's load: none, a first one with nothing to show yet, or a refresh of what is shown. */
109
+ @state() private accessor load: 'none' | 'first' | 'refresh' = 'none';
95
110
  @state() private accessor language = 'en';
96
111
  private sampledAt = Date.now();
97
112
  /** The language this demo's charts speak, apart from the page's: their own words and the host's numbers follow it. */
@@ -119,6 +134,19 @@ export class DeesDemoChartWorkspace extends DeesElement {
119
134
  .narrow { width: 420px; }
120
135
  `];
121
136
 
137
+ /** A refresh loads over what the charts show: from a first load, the charts show their data first. */
138
+ private async toggleRefresh() {
139
+ if (this.load === 'first') {
140
+ this.load = 'none';
141
+ // the charts render their data once, so the refresh keeps it on show
142
+ await new Promise((resolve) => requestAnimationFrame(resolve));
143
+ }
144
+ this.load = this.load === 'refresh' ? 'none' : 'refresh';
145
+ }
146
+
147
+ /** Nothing to show: an empty period, or a first load still on its way. */
148
+ private get noData() { return this.empty || this.load === 'first'; }
149
+
122
150
  constructor() {
123
151
  super();
124
152
  // lives with this element: the charts in its shadow root speak the demo's language
@@ -149,7 +177,7 @@ export class DeesDemoChartWorkspace extends DeesElement {
149
177
  const palette = getChartPalette(this.goBright);
150
178
  const totals = new Map<string, number>();
151
179
  for (const { data: slices } of data.spending) for (const slice of slices) totals.set(slice.name, (totals.get(slice.name) ?? 0) + slice.value);
152
- return html`<div class="donuts" role="group" aria-label="Spending by month">${data.spending.map(({ month: moment, data: slices }) => html`<dees-chart-donut label=${month.format(moment)} .data=${this.empty ? [] : slices} .showLabels=${!this.alternate} .showLegend=${!this.secondary} .valueFormatter=${wholeEuro}></dees-chart-donut>`)}</div>
180
+ return html`<div class="donuts" role="group" aria-label="Spending by month">${data.spending.map(({ month: moment, data: slices }) => html`<dees-chart-donut .loading=${this.load !== 'none'} label=${month.format(moment)} .data=${this.noData ? [] : slices} .showLabels=${!this.alternate} .showLegend=${!this.secondary} .valueFormatter=${wholeEuro}></dees-chart-donut>`)}</div>
153
181
  <ul class="key" aria-label="Spending over the quarter">${[...totals].map(([name, total], index) => html`<li><span class="dot" style="background: ${palette[index % palette.length]}"></span>${name} <strong>${wholeEuro(total)}</strong></li>`)}</ul>`;
154
182
  }
155
183
 
@@ -159,7 +187,7 @@ export class DeesDemoChartWorkspace extends DeesElement {
159
187
  const toggle = (name: string, active: boolean, action: () => void) => html`<button type="button" aria-pressed=${active} @click=${action}>${name}</button>`;
160
188
  const presentation = this.alternate ? 'step' : this.secondary ? 'line' : 'points';
161
189
  return html`<div class="toolbar"><p class="caption">API gateway · sample ${this.sample + 1}</p>
162
- <div class="dees-demo-row"><dees-button type="ghost" text="Reset chart" @clicked=${() => { this.sample = 0; this.empty = false; this.alternate = false; this.secondary = false; this.filled = false; this.latest = false; this.dotless = false; }}></dees-button>
190
+ <div class="dees-demo-row"><dees-button type="ghost" text="Reset chart" @clicked=${() => { this.sample = 0; this.empty = false; this.alternate = false; this.secondary = false; this.filled = false; this.latest = false; this.dotless = false; this.stackedLines = false; this.load = 'none'; }}></dees-button>
163
191
  <dees-button type="outline" text="Next sample" icon="lucide:RefreshCw" @clicked=${() => { this.sample++; this.empty = false; }}></dees-button></div></div>
164
192
  <div class="options" role="group" aria-label="Chart options">
165
193
  ${this.kind !== 'gauge' ? toggle('Empty period', this.empty, () => { this.empty = !this.empty; }) : ''}
@@ -167,35 +195,37 @@ export class DeesDemoChartWorkspace extends DeesElement {
167
195
  ${this.kind === 'donut' ? html`${toggle('Hide labels', this.alternate, () => { this.alternate = !this.alternate; })}${toggle('Hide legend', this.secondary, () => { this.secondary = !this.secondary; })}` : ''}
168
196
  ${this.kind === 'gauge' ? toggle('Show scale ticks', this.alternate, () => { this.alternate = !this.alternate; }) : ''}
169
197
  ${this.kind === 'radar' ? toggle('Outline only', this.alternate, () => { this.alternate = !this.alternate; }) : ''}
170
- ${this.kind === 'line' ? html`${toggle('Steps', this.alternate, () => { this.alternate = !this.alternate; this.secondary = false; })}${toggle('Lines', this.secondary, () => { this.secondary = !this.secondary; this.alternate = false; })}${toggle('Area', this.filled, () => { this.filled = !this.filled; if (this.filled && !this.alternate) this.secondary = true; })}${toggle('Hide markers', this.dotless, () => { this.dotless = !this.dotless; if (this.dotless && !this.alternate) this.secondary = true; })}${toggle('Latest values', this.latest, () => { this.latest = !this.latest; })}` : ''}
198
+ ${this.kind === 'line' ? html`${toggle('Steps', this.alternate, () => { this.alternate = !this.alternate; this.secondary = false; })}${toggle('Lines', this.secondary, () => { this.secondary = !this.secondary; this.alternate = false; })}${toggle('Area', this.filled, () => { this.filled = !this.filled; if (this.filled && !this.alternate) this.secondary = true; })}${toggle('Hide markers', this.dotless, () => { this.dotless = !this.dotless; if (this.dotless && !this.alternate) this.secondary = true; })}${toggle('Latest values', this.latest, () => { this.latest = !this.latest; })}${toggle('Stack series', this.stackedLines, () => { this.stackedLines = !this.stackedLines; })}` : ''}
199
+ ${this.kind !== 'area' ? html`${toggle('First load', this.load === 'first', () => { this.load = this.load === 'first' ? 'none' : 'first'; })}${toggle('Loading a refresh', this.load === 'refresh', () => { void this.toggleRefresh(); })}` : ''}
171
200
  </div>
172
201
  <div class="options" role="group" aria-label="Language of the charts">${languages.map(({ key, label }) => toggle(label, this.language === key, () => { void this.setLanguage(key); }))}</div>
173
- ${this.kind === 'bar' ? html`<dees-chart-bar label="Requests and cache hits" .categories=${data.categories} .series=${this.empty ? [] : data.series} .horizontal=${this.alternate} .stacked=${this.secondary} .valueFormatter=${(value: number) => `${Math.round(value)}k`}></dees-chart-bar>
174
- <dees-chart-bar label="Month by month, as booked" meta="Fiscal year 2026 to date · net of VAT" .categories=${data.bookings.categories} .series=${this.empty ? [] : data.bookings.series} .stacks=${data.bookings.stacks} .nets=${data.bookings.nets} .horizontal=${this.alternate} .valueFormatter=${this.euro(2)} .netLabelFormatter=${this.compactEuro()}>
202
+ ${directives.keyed(this.load === 'first', html`${this.kind === 'bar' ? html`<dees-chart-bar .loading=${this.load !== 'none'} label="Requests and cache hits" .categories=${data.categories} .series=${this.noData ? [] : data.series} .horizontal=${this.alternate} .stacked=${this.secondary} .valueFormatter=${(value: number) => `${Math.round(value)}k`}></dees-chart-bar>
203
+ <dees-chart-bar .loading=${this.load !== 'none'} label="Month by month, as booked" meta="Fiscal year 2026 to date · net of VAT" .categories=${data.bookings.categories} .series=${this.noData ? [] : data.bookings.series} .stacks=${data.bookings.stacks} .nets=${data.bookings.nets} .horizontal=${this.alternate} .valueFormatter=${this.euro(2)} .netLabelFormatter=${this.compactEuro()}>
175
204
  <p slot="below" class="note">Left out: 0480 Office equipment and 1800 Private withdrawals, which are none of these parts.</p>
176
205
  </dees-chart-bar>` : ''}
177
- ${this.kind === 'area' ? html`<dees-chart-area label="Requests per minute" .series=${this.empty ? [] : data.timeline} .yAxisFormatter=${(value: number) => `${Math.round(value)}k`} .legendStats=${['latest', 'min', 'max']} .chartLines=${[]} .rangeSelectionEnabled=${true}></dees-chart-area>
178
- <dees-chart-area class="withRows" label="Network throughput" meta="edge-1 · per minute" .series=${this.empty ? [] : data.throughput} .yAxisFormatter=${(value: number) => `${value} Mbit/s`} .legendStats=${['latest', 'max']}>
206
+ ${this.kind === 'area' ? html`<dees-chart-area label="Requests per minute" .series=${this.noData ? [] : data.timeline} .yAxisFormatter=${(value: number) => `${Math.round(value)}k`} .legendStats=${['latest', 'min', 'max']} .chartLines=${[]} .rangeSelectionEnabled=${true}></dees-chart-area>
207
+ <dees-chart-area class="withRows" label="Network throughput" meta="edge-1 · per minute" .series=${this.noData ? [] : data.throughput} .yAxisFormatter=${(value: number) => `${value} Mbit/s`} .legendStats=${['latest', 'max']}>
179
208
  <p slot="below" class="note">Outbound leaves out the nightly backup to the offsite store, which runs on a link of its own.</p>
180
209
  </dees-chart-area>` : ''}
181
- ${this.kind === 'donut' ? html`<dees-chart-donut label="Requests by region" .data=${this.empty ? [] : data.regions} .showLabels=${!this.alternate} .showLegend=${!this.secondary} .valueFormatter=${(value: number) => `${Math.round(value)}k`}></dees-chart-donut>
210
+ ${this.kind === 'donut' ? html`<dees-chart-donut .loading=${this.load !== 'none'} label="Requests by region" .data=${this.noData ? [] : data.regions} .showLabels=${!this.alternate} .showLegend=${!this.secondary} .valueFormatter=${(value: number) => `${Math.round(value)}k`}></dees-chart-donut>
182
211
  ${this.renderSpending(data)}` : ''}
183
- ${this.kind === 'gauge' ? html`<dees-chart-gauge label="Queue capacity" .value=${data.capacity} .showTicks=${this.alternate} .thresholds=${[{value:60,tone:'success'},{value:80,tone:'warning'},{value:100,tone:'danger'}]}></dees-chart-gauge>` : ''}
184
- ${this.kind === 'line' ? html`<dees-chart-line class="withRows" label="Account balances" meta="as each bank statement states them" .series=${this.empty ? [] : data.statements} .presentation=${presentation} .fillArea=${this.filled} .showMarkers=${!this.dotless} .showLatestValue=${this.latest} .valueFormatter=${this.euro(2)} .axisValueFormatter=${wholeEuro}>
212
+ ${this.kind === 'gauge' ? html`<dees-chart-gauge .loading=${this.load !== 'none'} label="Queue capacity" .value=${data.capacity} .showTicks=${this.alternate} .thresholds=${[{value:60,tone:'success'},{value:80,tone:'warning'},{value:100,tone:'danger'}]}></dees-chart-gauge>` : ''}
213
+ ${this.kind === 'line' ? html`<dees-chart-line .loading=${this.load !== 'none'} class="withRows" label="Account balances" meta="as each bank statement states them" .series=${this.noData ? [] : data.statements} .presentation=${presentation} .fillArea=${this.filled} .showMarkers=${!this.dotless} .showLatestValue=${this.latest} .valueFormatter=${this.euro(2)} .stacked=${this.stackedLines} .axisValueFormatter=${wholeEuro}>
185
214
  <dees-hint slot="above" type="warning" text="Two statements of the current account for 30 September 2026 state different balances: 2,246.86 € and 2,264.86 €."></dees-hint>
186
215
  <ul slot="below" class="rowList">
187
216
  <li>Savings: 6,000.00 € on 31 July 2026, its latest statement</li>
188
217
  <li>Credit card: no statement states a balance</li>
189
218
  </ul>
190
219
  </dees-chart-line>
191
- <dees-chart-line label="Stated a day apart" .series=${this.empty ? [] : data.dayApart} .presentation=${presentation} .fillArea=${this.filled} .showMarkers=${!this.dotless} .showLatestValue=${this.latest} .valueFormatter=${(value: number) => `$${this.i18n.format.number(value, 'integer')}`}></dees-chart-line>
192
- <dees-chart-line label="A year of daily balances" .series=${this.empty ? [] : data.daily} .presentation=${presentation} .fillArea=${this.filled} .showMarkers=${!this.dotless} .showLatestValue=${this.latest} .valueFormatter=${this.euro(2)} .axisValueFormatter=${wholeEuro}></dees-chart-line>
220
+ <dees-chart-line .loading=${this.load !== 'none'} label="Cloud spend by service" meta="per week, stacked into the total" stacked fillArea .series=${this.noData ? [] : data.cloudSpend} .presentation=${this.alternate ? 'step' : 'line'} .showMarkers=${!this.dotless} .showLatestValue=${this.latest} .valueFormatter=${this.euro(2)} .axisValueFormatter=${wholeEuro}></dees-chart-line>
221
+ <dees-chart-line .loading=${this.load !== 'none'} label="Stated a day apart" .series=${this.noData ? [] : data.dayApart} .presentation=${presentation} .fillArea=${this.filled} .showMarkers=${!this.dotless} .showLatestValue=${this.latest} .valueFormatter=${(value: number) => `$${this.i18n.format.number(value, 'integer')}`}></dees-chart-line>
222
+ <dees-chart-line .loading=${this.load !== 'none'} label="A year of daily balances" .series=${this.noData ? [] : data.daily} .presentation=${presentation} .fillArea=${this.filled} .showMarkers=${!this.dotless} .showLatestValue=${this.latest} .valueFormatter=${this.euro(2)} .axisValueFormatter=${wholeEuro}></dees-chart-line>
193
223
  <div class="widths" role="group" aria-label="A year of month ends at two widths">
194
- <dees-chart-line class="wide" label="A year of month ends, 1440 px wide" .series=${this.empty ? [] : data.monthEnds} .presentation=${presentation} .fillArea=${this.filled} .showMarkers=${!this.dotless} .showLatestValue=${this.latest} .valueFormatter=${wholeEuro}></dees-chart-line>
195
- <dees-chart-line class="narrow" label="420 px wide" .series=${this.empty ? [] : data.monthEnds} .presentation=${presentation} .fillArea=${this.filled} .showMarkers=${!this.dotless} .showLatestValue=${this.latest} .valueFormatter=${wholeEuro}></dees-chart-line>
224
+ <dees-chart-line .loading=${this.load !== 'none'} class="wide" label="A year of month ends, 1440 px wide" .series=${this.noData ? [] : data.monthEnds} .presentation=${presentation} .fillArea=${this.filled} .showMarkers=${!this.dotless} .showLatestValue=${this.latest} .valueFormatter=${wholeEuro}></dees-chart-line>
225
+ <dees-chart-line .loading=${this.load !== 'none'} class="narrow" label="420 px wide" .series=${this.noData ? [] : data.monthEnds} .presentation=${presentation} .fillArea=${this.filled} .showMarkers=${!this.dotless} .showLatestValue=${this.latest} .valueFormatter=${wholeEuro}></dees-chart-line>
196
226
  </div>` : ''}
197
- ${this.kind === 'radar' ? html`<dees-chart-radar label="Current service and target" .indicators=${data.indicators} .series=${this.empty ? [] : data.profiles} .fillArea=${!this.alternate}></dees-chart-radar>` : ''}
198
- <p class="feedback" role="status">${this.empty ? 'There are no measurements for this period.' : `Sample ${this.sample + 1} · Values stay in this example. Use Next sample to compare an update.`}</p>`;
227
+ ${this.kind === 'radar' ? html`<dees-chart-radar .loading=${this.load !== 'none'} label="Current service and target" .indicators=${data.indicators} .series=${this.noData ? [] : data.profiles} .fillArea=${!this.alternate}></dees-chart-radar>` : ''}`)}
228
+ <p class="feedback" role="status">${this.load === 'first' ? 'First load: each chart keeps its place empty for a moment, then shows its placeholder, and after ten seconds says it is still loading.' : this.load === 'refresh' ? 'Loading a refresh: each chart keeps what it shows and states that it is busy.' : this.empty ? 'There are no measurements for this period.' : `Sample ${this.sample + 1} · Values stay in this example. Use Next sample to compare an update.`}</p>`;
199
229
  }
200
230
  }
201
231
  export const chartDemo = (kind: TChartDemo) => demoPage(descriptions[kind][0], descriptions[kind][1], html`<dees-demo-chart-workspace .kind=${kind}></dees-demo-chart-workspace>`);
@@ -1,14 +1,15 @@
1
1
  import type { DeesElement } from '@design.estate/dees-element';
2
- import type { TReactiveController } from '../00controller.js';
2
+ import type { TReactiveController } from './00controller.js';
3
3
 
4
4
  /**
5
- * Counts a first load towards its "still loading", as the catalog's session list does: while
6
- * `isFirstLoad()` holds — loading, with nothing to show yet — the host draws placeholders, and once
7
- * it has held for `stillLoadingAfter()` milliseconds, `stillLoading` turns true and the host
8
- * renders again to say so. Ending the load, or content arriving, forgets the count; a first load
9
- * under way when the host left the page counts again from its return.
5
+ * Counts a first load towards its "still loading", as the catalog's session list does; the Kanban
6
+ * board and the charts count theirs with it. While `isFirstLoad()` holds — loading, with nothing
7
+ * to show yet — the host draws placeholders, and once it has held for `stillLoadingAfter()`
8
+ * milliseconds, `stillLoading` turns true and the host renders again to say so. Ending the load,
9
+ * or content arriving, forgets the count; a first load under way when the host left the page
10
+ * counts again from its return.
10
11
  */
11
- export class KanbanFirstLoadController implements TReactiveController {
12
+ export class FirstLoadController implements TReactiveController {
12
13
  private timer: ReturnType<typeof setTimeout> | undefined;
13
14
  private stalled = false;
14
15
 
@@ -14,6 +14,7 @@ import { chartFrame } from './dees-chart-frame.js';
14
14
  import './dees-legend/dees-legend.js';
15
15
  import type { IDeesLegendItem, IDeesLegendToggleDetail } from './dees-legend/dees-legend.js';
16
16
  import { dcLocalize } from '../../i18n/localize.js';
17
+ import { FirstLoadController } from '../00firstload.js';
17
18
 
18
19
  /**
19
20
  * Abstract base class for ECharts-based chart components.
@@ -35,11 +36,29 @@ import { dcLocalize } from '../../i18n/localize.js';
35
36
  * legend, the plot taking what the rest leaves. A chart whose rows vary takes `height: auto`, and
36
37
  * its plot is then `--dees-chart-plot-height` tall (320px by default, what the default height
37
38
  * leaves the plot under a header and a legend of one row).
39
+ *
40
+ * While the host loads the chart's data it sets `loading`. The first load, before the chart has
41
+ * shown data, covers the plot at once and draws a placeholder in its place once it has taken
42
+ * 200 ms, so a quick load never flashes it; the placeholder pulses on `--dees-loading-pulse-*`,
43
+ * holds still under reduced motion, and after `stillLoadingAfter` (10 s) the chart says it is
44
+ * still loading. The tile is `aria-busy` while loading, a visually hidden status says the load,
45
+ * and the placeholder is hidden from assistive technology. Data already on show stays while a
46
+ * refresh loads.
38
47
  */
39
48
  export abstract class DeesChartEchartsBase extends DeesElement {
49
+ /** How long a first load runs, in milliseconds, before the chart says it is still loading. */
50
+ public static stillLoadingAfter = 10_000;
51
+
40
52
  /** The chart's words and formats, in the reader's language. */
41
53
  protected readonly t = dcLocalize(this);
42
54
 
55
+ /**
56
+ * The host is loading the chart's data. Before the chart has shown data, it draws a placeholder
57
+ * in place of the plot (see the class); data on show stays while it loads again.
58
+ */
59
+ @property({ type: Boolean, reflect: true })
60
+ accessor loading: boolean = false;
61
+
43
62
  /**
44
63
  * The chart's heading, in its tile's standard header bar. Empty, the chart draws no header row,
45
64
  * as in a pane whose header names it; its text alternative then starts with the catalog's
@@ -71,8 +90,16 @@ export abstract class DeesChartEchartsBase extends DeesElement {
71
90
  protected chartInstance: IEchartsInstance | null = null;
72
91
  protected echartsBundle: IEchartsBundle | null = null;
73
92
  private resizeObserver: ResizeObserver | null = null;
74
- @state() private accessor loading = true;
93
+ /** ECharts itself is loading. */
94
+ @state() private accessor libraryLoading = true;
75
95
  @state() private accessor loadError = '';
96
+ /** The chart has shown data: from then on, a load keeps it on show. */
97
+ private shownData = false;
98
+ private readonly firstLoad = new FirstLoadController(
99
+ this,
100
+ () => this.isFirstLoad(),
101
+ () => (this.constructor as typeof DeesChartEchartsBase).stillLoadingAfter,
102
+ );
76
103
  @state() private accessor hiddenSeries = new Set<string>();
77
104
  protected legendItems(): Array<{name: string; color: string; value?: string}> { return []; }
78
105
  /** Whether the reader left a legend entry switched on. */
@@ -94,7 +121,7 @@ export abstract class DeesChartEchartsBase extends DeesElement {
94
121
  super();
95
122
  domtools.elementBasic.setup();
96
123
  this.registerStartupFunction(async (signal) => {
97
- this.loading = true; this.loadError = '';
124
+ this.libraryLoading = true; this.loadError = '';
98
125
  const motion = matchMedia(reducedMotionQuery);
99
126
  const updateMotion = () => { this.reducedMotion = motion.matches; this.updateChart(); };
100
127
  this.reducedMotion = motion.matches;
@@ -127,7 +154,7 @@ export abstract class DeesChartEchartsBase extends DeesElement {
127
154
  if (!signal.aborted) this.loadError = this.t('chart.loadFailed');
128
155
  console.error('Failed to initialize ECharts:', error);
129
156
  } finally {
130
- if (!signal.aborted) this.loading = false;
157
+ if (!signal.aborted) this.libraryLoading = false;
131
158
  }
132
159
  });
133
160
  this.registerGarbageFunction(async () => {
@@ -148,8 +175,29 @@ export abstract class DeesChartEchartsBase extends DeesElement {
148
175
 
149
176
  public render(): TemplateResult { return this.renderChartFrame(); }
150
177
 
178
+ /**
179
+ * Whether data the host sets while it still loads has arrived: the chart shows it at once. A
180
+ * chart that always holds a value to draw, such as a gauge, says no, and its first load ends
181
+ * when the host stops loading.
182
+ */
183
+ protected dataArrivesWhileLoading(): boolean { return true; }
184
+
185
+ /** The first load: the host loads, and the chart has no data on show. */
186
+ protected isFirstLoad(): boolean {
187
+ return this.loading && !(this.hasChartData() && (this.shownData || this.dataArrivesWhileLoading()));
188
+ }
189
+
190
+ public willUpdate(changedProperties: Map<PropertyKey, unknown>): void {
191
+ super.willUpdate(changedProperties);
192
+ if (!this.loading && this.hasChartData()) this.shownData = true;
193
+ }
194
+
151
195
  public renderChartFrame(): TemplateResult {
152
- const message = this.loadError || (this.loading ? this.t('chart.loading') : !this.hasChartData() ? this.t('chart.noData') : '');
196
+ // a library that failed to load says so in place of the placeholder
197
+ const firstLoad = this.isFirstLoad() && !this.loadError;
198
+ const stillLoading = firstLoad && this.firstLoad.stillLoading;
199
+ const message = this.loadError || (firstLoad ? ''
200
+ : this.libraryLoading ? this.t('chart.loading') : !this.hasChartData() ? this.t('chart.noData') : '');
153
201
  const legend: IDeesLegendItem[] = this.legendItems().map((item) => ({
154
202
  label: item.name,
155
203
  color: item.color,
@@ -162,6 +210,9 @@ export abstract class DeesChartEchartsBase extends DeesElement {
162
210
  frameless: this.frameless,
163
211
  plot: html`<div class="chartContainer" aria-hidden="true"><div class="chartPlot"></div></div>`,
164
212
  state: message,
213
+ busy: this.loading,
214
+ firstLoad: firstLoad ? { stillLoading, stillLoadingText: this.t('chart.stillLoading') } : undefined,
215
+ loadingStatus: firstLoad ? this.t(stillLoading ? 'chart.stillLoading' : 'chart.loading') : '',
165
216
  summary: this.summary || this.dataSummary(),
166
217
  footer: legend.length ? html`<dees-legend interactive label=${this.t('chart.series')} .items=${legend} @item-toggle=${(event: CustomEvent<IDeesLegendToggleDetail>) => {
167
218
  const hidden = new Set(this.hiddenSeries);
@@ -41,6 +41,18 @@ export const chartFrameStyles = css`
41
41
  .chartContainer { position: absolute; inset: 0; }
42
42
  .chartState { position: absolute; inset: 0; display: grid; place-content: center; padding: 24px; text-align: center; color: var(--dees-color-text-muted); background: var(--dees-color-bg-primary); }
43
43
  .chartSummary { ${visuallyHidden} }
44
+ /* The first load covers the plot at once, so a quick load flashes neither empty axes nor a
45
+ placeholder; the placeholder shows after 200 ms, pulsing until the load is said to take long. */
46
+ .chartLoading { position: absolute; inset: 0; display: grid; padding: var(--dees-spacing-lg); background: var(--dees-color-bg-primary); }
47
+ .chartPlaceholder { grid-area: 1 / 1; border-radius: var(--dees-radius-md); corner-shape: var(--dees-corner-shape); background: var(--dees-color-fill-secondary); visibility: hidden; animation: dees-chart-placeholder-reveal 1ms linear 200ms both, dees-chart-placeholder-pulse var(--dees-loading-pulse-duration) var(--dees-ease-standard) 200ms infinite; }
48
+ .chartLoading.stalled .chartPlaceholder { animation: dees-chart-placeholder-reveal 1ms linear 200ms both; }
49
+ .chartStillLoading { grid-area: 1 / 1; place-self: center; padding: var(--dees-spacing-lg); text-align: center; color: var(--dees-color-text-muted); }
50
+ .chartLoadingStatus { ${visuallyHidden} }
51
+ @keyframes dees-chart-placeholder-reveal { from { visibility: hidden; } to { visibility: visible; } }
52
+ @keyframes dees-chart-placeholder-pulse { 0%, 100% { opacity: 1; } 50% { opacity: var(--dees-loading-pulse-opacity); } }
53
+ @media (prefers-reduced-motion: reduce) {
54
+ .chartPlaceholder { animation: dees-chart-placeholder-reveal 1ms linear 200ms both; }
55
+ }
44
56
  `;
45
57
 
46
58
  /** What a chart puts into its frame; see `chartFrame`. */
@@ -60,6 +72,18 @@ export interface IChartFrameContent {
60
72
  summary?: string;
61
73
  /** The footer bar's content: the legend, figures about the chart. */
62
74
  footer?: TemplateResult;
75
+ /** The host is loading: the tile is `aria-busy`. */
76
+ busy?: boolean;
77
+ /**
78
+ * The first load, which has nothing to show yet: the plot is covered at once and a placeholder
79
+ * takes its place after 200 ms; `stillLoading` holds it still and says `stillLoadingText` over it.
80
+ */
81
+ firstLoad?: { stillLoading: boolean; stillLoadingText: string };
82
+ /**
83
+ * What a screen reader hears while the first load runs, in a visually hidden status that is
84
+ * there before it speaks; empty otherwise. Unset, the frame has no such status.
85
+ */
86
+ loadingStatus?: string;
63
87
  }
64
88
 
65
89
  /**
@@ -84,7 +108,8 @@ export const chartFrame = (hostArg: DeesElement, contentArg: IChartFrameContent)
84
108
  ? html`<h2 class="chartLabel">${contentArg.label}</h2>`
85
109
  : ''}${contentArg.meta ? html`<span class="chartMeta">${contentArg.meta}</span>` : ''}</div>`
86
110
  : '';
87
- return html`<dees-tile .frameless=${contentArg.frameless}>
111
+ const firstLoad = contentArg.firstLoad;
112
+ return html`<dees-tile .frameless=${contentArg.frameless} aria-busy=${contentArg.busy ? 'true' : 'false'}>
88
113
  ${heading || contentArg.headerTools
89
114
  ? html`<div slot="header" class="chartHeader">${heading}${contentArg.headerTools ?? ''}</div>`
90
115
  : ''}
@@ -92,7 +117,12 @@ export const chartFrame = (hostArg: DeesElement, contentArg: IChartFrameContent)
92
117
  <div class="chartArea">
93
118
  ${contentArg.plot}
94
119
  ${contentArg.state ? html`<div class="chartState" role="status">${contentArg.state}</div>` : ''}
120
+ ${firstLoad ? html`<div class="chartLoading ${firstLoad.stillLoading ? 'stalled' : ''}" aria-hidden="true">
121
+ <span class="chartPlaceholder"></span>
122
+ ${firstLoad.stillLoading ? html`<span class="chartStillLoading">${firstLoad.stillLoadingText}</span>` : ''}
123
+ </div>` : ''}
95
124
  </div>
125
+ ${contentArg.loadingStatus === undefined ? '' : html`<p class="chartLoadingStatus" role="status">${contentArg.loadingStatus}</p>`}
96
126
  ${chartRows(hostArg, 'below')}
97
127
  ${contentArg.summary === undefined ? '' : html`<p class="chartSummary">${contentArg.summary}</p>`}
98
128
  ${contentArg.footer ? html`<div slot="footer" class="chartLegend">${contentArg.footer}</div>` : ''}
@@ -69,6 +69,8 @@ export class DeesChartGauge extends DeesChartEchartsBase {
69
69
  }
70
70
 
71
71
  protected hasChartData() { return Number.isFinite(this.value); }
72
+ /** The gauge always holds a value: its first load ends when the host stops loading. */
73
+ protected dataArrivesWhileLoading() { return false; }
72
74
  protected dataSummary() { return `${this.value}${this.unit}, range ${this.min} to ${this.max}`; }
73
75
 
74
76
  protected buildOption(): Record<string, any> {