@camstack/ui-library 1.2.383 → 1.2.385

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.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.2.385] - 2026-11-05
11
+
12
+ ### Removed
13
+
14
+ - The generated client no longer offers the retired per-integration settings methods
15
+
16
+ ## [1.2.384] - 2026-11-05
17
+
18
+ ### Changed
19
+
20
+ - Device History tab lists an appliance's runs (start, end, duration, energy, peak and average power, outcome) and shades each run on the power chart
21
+
10
22
  ## [1.2.383] - 2026-11-04
11
23
 
12
24
  ### Changed
@@ -0,0 +1,23 @@
1
+ /**
2
+ * DeviceRunsPanel — the runs of an appliance, newest first, on the device's
3
+ * History tab: start, end, duration, energy, peak and mean power, outcome.
4
+ * A row opens the run's window (the run plus a margin) in the history view.
5
+ *
6
+ * Presentational: the caller reads the runs (`useDeviceRuns`) and decides
7
+ * whether the device has any — the panel never answers "no runs" itself, an
8
+ * unanswered query is not an empty one (D315). A measurement that failed is
9
+ * `—`, never `0` (D393).
10
+ */
11
+ import { type JSX } from "react";
12
+ import type { DeviceRun } from "@camstack/types";
13
+ import type { HistoryWindow } from "./device-history/history-window";
14
+ export interface DeviceRunsPanelProps {
15
+ /** Runs as the cap returned them (newest first); never an unanswered query. */
16
+ readonly runs: readonly DeviceRun[];
17
+ /** The instant an open run counts up to. */
18
+ readonly now: number;
19
+ /** A row was chosen: show this window. */
20
+ readonly onSelectWindow: (window: HistoryWindow) => void;
21
+ readonly className?: string;
22
+ }
23
+ export declare function DeviceRunsPanel({ runs, now, onSelectWindow, className }: DeviceRunsPanelProps): JSX.Element;
@@ -12,10 +12,12 @@
12
12
  */
13
13
  import { type JSX, type ReactNode } from "react";
14
14
  import type { DisplayPreference } from "@camstack/types";
15
+ import { type ChartBand } from "./chart-bands";
15
16
  import { type ValueAxisSpec } from "./chart-uplot";
16
17
  import { type ChartWindowToggleProps } from "./chart-window";
17
18
  import { type TimeSeriesDef } from "./time-series-model";
18
19
  export type { TimeSeriesDef } from "./time-series-model";
20
+ export type { ChartBand, ChartBandTone } from "./chart-bands";
19
21
  export interface ChartRange {
20
22
  readonly from: number;
21
23
  readonly to: number;
@@ -23,6 +25,8 @@ export interface ChartRange {
23
25
  export interface TimeSeriesChartProps<TId extends string = string> {
24
26
  readonly title: string;
25
27
  readonly series: readonly TimeSeriesDef[];
28
+ /** Spans shaded behind the lines (a run, a window); the point tooltip names the ones under the cursor. */
29
+ readonly bands?: readonly ChartBand[];
26
30
  /** The window the x axis spans; default: the data's own span. */
27
31
  readonly range?: ChartRange;
28
32
  /** Plot height in px. Default 120. */
@@ -48,4 +52,4 @@ export interface TimeSeriesChartProps<TId extends string = string> {
48
52
  readonly windowToggle?: ChartWindowToggleProps<TId>;
49
53
  readonly className?: string;
50
54
  }
51
- export declare function TimeSeriesChart<TId extends string = string>({ title, series, range, height, stacked, area, syncKey, formatValue, displayPreference, axisFor, emptyMessage, pending, actions, footer, windowToggle, className }: TimeSeriesChartProps<TId>): JSX.Element;
55
+ export declare function TimeSeriesChart<TId extends string = string>({ title, series, bands, range, height, stacked, area, syncKey, formatValue, displayPreference, axisFor, emptyMessage, pending, actions, footer, windowToggle, className }: TimeSeriesChartProps<TId>): JSX.Element;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Shaded bands over a chart's time axis: a span that means something (a
3
+ * washing cycle, a maintenance window) drawn behind the lines. Pure model;
4
+ * `TimeSeriesChart` paints it and states it in the point tooltip.
5
+ */
6
+ import type { ChartChromeToken } from "./chart-palette";
7
+ export type ChartBandTone = "neutral" | "info" | "success" | "warning" | "danger";
8
+ export interface ChartBand {
9
+ readonly id: string;
10
+ readonly from: number;
11
+ readonly to: number;
12
+ /** Short name of the kind of span ("Run"); the tooltip row's label. */
13
+ readonly title: string;
14
+ /** What the span was ("1h 40m · 1.32 kWh"); the tooltip row's value. */
15
+ readonly label: string;
16
+ readonly tone: ChartBandTone;
17
+ }
18
+ export declare function bandToken(tone: ChartBandTone): ChartChromeToken;
19
+ /** The bands that contain `x` (edges included), in input order. */
20
+ export declare function bandsAt(bands: readonly ChartBand[], x: number): readonly ChartBand[];
21
+ /** Bands clipped to `[from, to]`; one that lies wholly outside, or is empty, is dropped. */
22
+ export declare function clipBands(bands: readonly ChartBand[], from: number, to: number): readonly ChartBand[];
@@ -31,7 +31,7 @@ export declare function swatchFillClass(token: ChartSwatchToken): string;
31
31
  /** The utility that colours a dashed swatch's line with `token`. */
32
32
  export declare function swatchLineClass(token: ChartSwatchToken): string;
33
33
  /** Neutral roles the canvas draws with (axes, grid, gap shading). */
34
- export type ChartChromeToken = "foreground-subtle" | "foreground-muted" | "border" | "border-subtle" | "surface" | "primary";
34
+ export type ChartChromeToken = "foreground-subtle" | "foreground-muted" | "border" | "border-subtle" | "surface" | "primary" | "info" | "success" | "warning" | "danger";
35
35
  /**
36
36
  * Resolve a theme token to the colour the canvas paints. Reads the computed
37
37
  * value of `--color-<token>` on the chart's own root (so a scoped theme block
@@ -146,6 +146,8 @@ export interface LineTooltipBodyInput {
146
146
  readonly timeLabel: string;
147
147
  readonly series: readonly LineTooltipSample[];
148
148
  readonly preference?: DisplayPreference;
149
+ /** Rows after the series (e.g. the bands under the cursor). */
150
+ readonly extra?: readonly ChartTooltipLine[];
149
151
  }
150
152
  /** Time plus one line per visible series. */
151
153
  export declare function lineTooltipBody(input: LineTooltipBodyInput): ChartTooltipBody;
@@ -4,6 +4,7 @@
4
4
  * hole shading. Every colour is a FUNCTION so a theme switch is a redraw.
5
5
  */
6
6
  import type uPlot from "uplot";
7
+ import { type ChartBand } from "./chart-bands";
7
8
  import { type GapSpan } from "./chart-data";
8
9
  import { type AxisScale } from "./chart-scale";
9
10
  /** The x axis: wall-clock time under the plot, at the window's precision. */
@@ -32,6 +33,8 @@ export declare function chartCursor(syncKey: string | undefined): uPlot.Cursor;
32
33
  * missing ground and never as a quiet period.
33
34
  */
34
35
  export declare function gapShadeHook(spans: () => readonly GapSpan[]): (u: uPlot) => void;
36
+ /** Paint the bands behind the lines, each in its tone. */
37
+ export declare function bandShadeHook(bands: () => readonly ChartBand[]): (u: uPlot) => void;
35
38
  /** Is this unit a byte count (binary axis and formatter)? */
36
39
  export declare function isByteUnit(unit: string | null | undefined): boolean;
37
40
  /** The default axis spec for a unit. */
@@ -2,7 +2,7 @@
2
2
  * The chart family (D899): one look for every time-based chart, built on
3
3
  * uPlot, themed only through `--color-chart-series-*` and the neutral tokens.
4
4
  */
5
- export { TimeSeriesChart, type ChartRange, type TimeSeriesChartProps } from "./TimeSeriesChart";
5
+ export { TimeSeriesChart, type ChartBand, type ChartBandTone, type ChartRange, type TimeSeriesChartProps } from "./TimeSeriesChart";
6
6
  export { StateTimeline, stateStyle, type StateRowDef, type StateTimelineProps } from "./StateTimeline";
7
7
  export { BarSeries, type BarSeriesProps } from "./BarSeries";
8
8
  export { Sparkline, type SparklinePoint, type SparklineProps } from "./Sparkline";
@@ -8,7 +8,7 @@
8
8
  * point is the empty state — never a flat zero.
9
9
  */
10
10
  import { type JSX, type ReactNode } from "react";
11
- import type { DeviceHistoryQueryManyEntry } from "@camstack/types";
11
+ import type { DeviceHistoryQueryManyEntry, DeviceRun } from "@camstack/types";
12
12
  import { type UiTextFn } from "../../contexts/ui-text";
13
13
  import { type HistoryChartSpec } from "./history-model";
14
14
  import type { HistoryReads } from "./use-device-history";
@@ -22,10 +22,13 @@ export interface HistoryChartProps {
22
22
  readonly compare: boolean;
23
23
  readonly syncKey: string;
24
24
  readonly actions?: ReactNode;
25
+ /** The device's runs, drawn as bands on its power chart; an open run extends to `now`. */
26
+ readonly runs?: readonly DeviceRun[];
27
+ readonly now?: number;
25
28
  }
26
29
  /** Operator words for a boolean field's two states. */
27
30
  export declare function booleanLabels(key: string, t: UiTextFn): {
28
31
  readonly on: string;
29
32
  readonly off: string;
30
33
  };
31
- export declare function HistoryChart({ spec, entryFor, reads, window, compare, syncKey, actions }: HistoryChartProps): JSX.Element;
34
+ export declare function HistoryChart({ spec, entryFor, reads, window, compare, syncKey, actions, runs, now }: HistoryChartProps): JSX.Element;
@@ -0,0 +1,29 @@
1
+ /**
2
+ * A device's runs as the History view shows them: chart bands, panel rows and
3
+ * the window a row opens. Pure: the caller supplies `now` and the text.
4
+ *
5
+ * A measurement that failed is `null` and reads `—`, never `0` (D393). An open
6
+ * run extends to `now`.
7
+ */
8
+ import type { DeviceRun, DeviceRunOutcome } from "@camstack/types";
9
+ import type { UiTextFn } from "../../contexts/ui-text";
10
+ import type { ChartBand, ChartBandTone } from "../charts/chart-bands";
11
+ import type { HistoryWindow } from "./history-window";
12
+ /** The context kept on each side of a run when a row opens it. */
13
+ export declare const RUN_WINDOW_MARGIN_MS: number;
14
+ /** The series whose chart carries the run bands. */
15
+ export declare const RUN_BANDS_SERIES_KEY = "cap:power-meter.power";
16
+ export declare const NO_VALUE: string;
17
+ export type RunStatus = DeviceRunOutcome | "running";
18
+ export declare function runStatus(run: DeviceRun): RunStatus;
19
+ export declare function runEnd(run: DeviceRun, now: number): number;
20
+ /** Elapsed time of a run; an open one counts up to `now`. `null` when a closed run has no duration. */
21
+ export declare function runDurationMs(run: DeviceRun, now: number): number | null;
22
+ export declare function formatKwh(kwh: number | null): string;
23
+ export declare function formatWatts(w: number | null): string;
24
+ export declare function formatRunDuration(ms: number | null): string;
25
+ export declare function runTone(status: RunStatus): ChartBandTone;
26
+ /** The window that frames a run: the run plus {@link RUN_WINDOW_MARGIN_MS} each side. */
27
+ export declare function runWindow(run: DeviceRun, now: number): HistoryWindow;
28
+ /** One band per run that overlaps `window`; the label states the duration and the energy. */
29
+ export declare function runBands(runs: readonly DeviceRun[], now: number, window: HistoryWindow, t: UiTextFn): readonly ChartBand[];
@@ -5,6 +5,8 @@
5
5
  */
6
6
  export { DeviceHistoryView, humanizeName, type DeviceHistoryViewProps } from "./DeviceHistoryView";
7
7
  export { HistoryChart, booleanLabels, type HistoryChartProps } from "./HistoryChart";
8
+ export { useDeviceRuns, DEVICE_RUNS_PAGE } from "./use-device-runs";
9
+ export { RUN_WINDOW_MARGIN_MS, runBands, runWindow } from "./history-runs";
8
10
  export { HistoryWindowBar, type HistoryWindowBarProps } from "./HistoryWindowBar";
9
11
  export { BOOLEAN_STATES, OCCUPANCY_KEY, chartKeys, energyBuckets, filterOccupancyLines, groupDeviceSeries, linePoints, occupancyFacets, occupancyLines, parseCapKey, parseProducerKey, shiftPoints, stateRow, type HistoryChartSpec, type HistorySection, type OccupancyFilter, type OccupancyScopeLine } from "./history-model";
10
12
  export { chunk, isRefusal, readHistory, type HistoryReader, type HistoryReadWindow } from "./history-reads";
@@ -0,0 +1,11 @@
1
+ /**
2
+ * A device's runs for the History view. `device-runs` is a per-type
3
+ * capability: a device without it, or with no run yet, answers an error or an
4
+ * empty page - both read as "no runs panel". A query still in flight is not
5
+ * an answer either (D315): `undefined` until the cap answers with rows.
6
+ */
7
+ import type { DeviceRun } from "@camstack/types";
8
+ /** How many runs the panel and the bands are given; the cap's page size. */
9
+ export declare const DEVICE_RUNS_PAGE = 50;
10
+ /** The newest runs, or `undefined` while unanswered, absent or empty. */
11
+ export declare function useDeviceRuns(deviceId: number): readonly DeviceRun[] | undefined;
@@ -82,6 +82,7 @@ export { CopyButton } from "./copy-button";
82
82
  export type { DataColumn, DataTableProps } from "./data-table";
83
83
  export * from "./data-table";
84
84
  export { DataTable } from "./data-table";
85
+ export { DeviceRunsPanel, type DeviceRunsPanelProps } from "./DeviceRunsPanel";
85
86
  export type { DataTablePage, DataTablePaginationLabels } from "./data-table-pagination";
86
87
  export { DEFAULT_PAGINATION_LABELS, paginateRows } from "./data-table-pagination";
87
88
  export type { DataTablePagerProps } from "./data-table-pager";
@@ -981,12 +981,6 @@ export declare const useIntegrationsCreate: typeof trpc.integrations.create.useM
981
981
  export declare const useIntegrationsUpdate: typeof trpc.integrations.update.useMutation;
982
982
  /** Generated alias around `trpc.integrations.delete.useMutation`. */
983
983
  export declare const useIntegrationsDelete: typeof trpc.integrations.delete.useMutation;
984
- /** Generated alias around `trpc.integrations.getSettings.useQuery`. */
985
- export declare const useIntegrationsGetSettings: typeof trpc.integrations.getSettings.useQuery;
986
- /** Generated alias around `trpc.integrations.setSettings.useMutation`. */
987
- export declare const useIntegrationsSetSettings: typeof trpc.integrations.setSettings.useMutation;
988
- /** Generated alias around `trpc.integrations.clearSettings.useMutation`. */
989
- export declare const useIntegrationsClearSettings: typeof trpc.integrations.clearSettings.useMutation;
990
984
  /** Generated alias around `trpc.integrations.getAvailableTypes.useQuery`. */
991
985
  export declare const useIntegrationsGetAvailableTypes: typeof trpc.integrations.getAvailableTypes.useQuery;
992
986
  /** Generated alias around `trpc.integrations.testConnection.useMutation`. */