@bitsandbricks/widgets 0.0.0-stage → 0.1.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 (50) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +2 -2
  3. package/dist/FitWidget.d.ts +12 -0
  4. package/dist/FitWidget.js +51 -0
  5. package/dist/TileCard.d.ts +35 -0
  6. package/dist/TileCard.js +39 -0
  7. package/dist/TimeChart.d.ts +14 -0
  8. package/dist/TimeChart.js +30 -0
  9. package/dist/WidgetBody.d.ts +4 -0
  10. package/dist/WidgetBody.js +37 -0
  11. package/dist/autoPage.d.ts +5 -0
  12. package/dist/autoPage.js +6 -0
  13. package/dist/drill.d.ts +3 -0
  14. package/dist/drill.js +4 -0
  15. package/dist/index.d.ts +22 -0
  16. package/dist/index.js +24 -0
  17. package/dist/kinds/Bars.d.ts +15 -0
  18. package/dist/kinds/Bars.js +41 -0
  19. package/dist/kinds/Columns.d.ts +19 -0
  20. package/dist/kinds/Columns.js +101 -0
  21. package/dist/kinds/Gauge.d.ts +11 -0
  22. package/dist/kinds/Gauge.js +29 -0
  23. package/dist/kinds/Graph.d.ts +36 -0
  24. package/dist/kinds/Graph.js +103 -0
  25. package/dist/kinds/Histogram.d.ts +12 -0
  26. package/dist/kinds/Histogram.js +26 -0
  27. package/dist/kinds/Pie.d.ts +12 -0
  28. package/dist/kinds/Pie.js +32 -0
  29. package/dist/kinds/Rows.d.ts +14 -0
  30. package/dist/kinds/Rows.js +81 -0
  31. package/dist/kinds/Stat.d.ts +14 -0
  32. package/dist/kinds/Stat.js +32 -0
  33. package/dist/kinds/combine.d.ts +39 -0
  34. package/dist/kinds/combine.js +161 -0
  35. package/dist/kinds/display.d.ts +64 -0
  36. package/dist/kinds/display.js +113 -0
  37. package/dist/kinds/shape.d.ts +168 -0
  38. package/dist/kinds/shape.js +296 -0
  39. package/dist/level.d.ts +18 -0
  40. package/dist/level.js +37 -0
  41. package/dist/levelReport.d.ts +15 -0
  42. package/dist/levelReport.js +2 -0
  43. package/dist/messages.d.ts +89 -0
  44. package/dist/messages.js +99 -0
  45. package/dist/styles.css +192 -0
  46. package/dist/time.d.ts +6 -0
  47. package/dist/time.js +6 -0
  48. package/dist/useBox.d.ts +5 -0
  49. package/dist/useBox.js +19 -0
  50. package/package.json +40 -3
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Mike (BitsAndBricks)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,3 @@
1
- # Temporary Holding Version
1
+ # @bitsandbricks/widgets
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ See the [repository README](../../README.md).
@@ -0,0 +1,12 @@
1
+ import type { Widget } from '@bitsandbricks/ui';
2
+ import { type KindPick, type LevelPin } from './level.js';
3
+ import { type Look } from './kinds/shape.js';
4
+ /** A widget that fits its box (issue #924): the kind the pane picked (or the data's own), at the
5
+ * level the box allows (or the pane pins). Nothing inside scrolls; what doesn't fit is "+N more". */
6
+ export declare function FitWidget({ widget, pick, pin, look, onMore }: {
7
+ widget: Widget;
8
+ pick?: KindPick;
9
+ pin?: LevelPin;
10
+ look?: Look;
11
+ onMore?: () => void;
12
+ }): import("react").JSX.Element;
@@ -0,0 +1,51 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { pickLevel, tooSmall } from './level.js';
3
+ import { BarsKind } from './kinds/Bars.js';
4
+ import { ColumnsKind } from './kinds/Columns.js';
5
+ import { GaugeKind } from './kinds/Gauge.js';
6
+ import { HistogramKind } from './kinds/Histogram.js';
7
+ import { Graph } from './kinds/Graph.js';
8
+ import { PieKind } from './kinds/Pie.js';
9
+ import { RowsKind } from './kinds/Rows.js';
10
+ import { resolveKind } from './kinds/shape.js';
11
+ import { NumberStyleContext } from './kinds/display.js';
12
+ import { StatKind } from './kinds/Stat.js';
13
+ import { useBox } from './useBox.js';
14
+ import { LevelReport } from './levelReport.js';
15
+ import { useContext, useEffect } from 'react';
16
+ import { registerWidgetMessages } from './messages.js';
17
+ registerWidgetMessages();
18
+ const NO_STYLE = {};
19
+ /** The sub line under a widget: its 12px text plus the 4px gap (widgets.css). */
20
+ const SUB_H = 20;
21
+ /** A widget that fits its box (issue #924): the kind the pane picked (or the data's own), at the
22
+ * level the box allows (or the pane pins). Nothing inside scrolls; what doesn't fit is "+N more". */
23
+ export function FitWidget({ widget, pick = 'auto', pin = 'auto', look, onMore }) {
24
+ // The level comes from the whole widget, which doesn't change with the level. Measuring only the
25
+ // drawing area flapped (issue #1010): at M the sub line takes room, the area shrinks below M,
26
+ // S hides the sub line, the area grows back to M, and so on.
27
+ const [ref, whole] = useBox();
28
+ const kind = resolveKind(widget, pick);
29
+ const level = pickLevel(kind, whole.w, whole.h, pin);
30
+ const report = useContext(LevelReport);
31
+ const tight = tooSmall(whole.w, whole.h);
32
+ useEffect(() => { if (whole.w)
33
+ report?.level(level, tight); }, [report, level, tight, whole.w]);
34
+ // A stat with nothing to show ("–") keeps its sub line even when small: it says why.
35
+ const empty = widget.type === 'stat' && widget.value === '–';
36
+ const sub = !!widget.sub && (level !== 's' || empty);
37
+ const box = { w: whole.w, h: Math.max(0, whole.h - (sub ? SUB_H : 0)) };
38
+ return (_jsx(NumberStyleContext.Provider, { value: look?.number ?? NO_STYLE, children: _jsxs("div", { className: `bnb-w bnb-w-is-${kind} bnb-w-level-${level}${look?.text ? ` bnb-w-text-${look.text}` : ''}`, "data-kind": kind, "data-level": level, ref: ref, children: [_jsx("div", { className: "bnb-w-area", children: box.w > 0 && _jsx(Kind, { kind: kind, widget: widget, level: level, box: box, look: look, onMore: onMore }) }), sub && _jsx("div", { className: "bnb-w-sub", title: widget.sub, children: widget.sub })] }) }));
39
+ }
40
+ function Kind({ kind, look, ...props }) {
41
+ switch (kind) {
42
+ case 'stat': return _jsx(StatKind, { ...props, look: look });
43
+ case 'gauge': return _jsx(GaugeKind, { ...props });
44
+ case 'graph': return _jsx(Graph, { ...props, look: look });
45
+ case 'bar': return _jsx(BarsKind, { ...props, look: look });
46
+ case 'column': return _jsx(ColumnsKind, { ...props, look: look });
47
+ case 'histogram': return _jsx(HistogramKind, { ...props });
48
+ case 'pie': return _jsx(PieKind, { ...props });
49
+ default: return _jsx(RowsKind, { kind: kind, ...props });
50
+ }
51
+ }
@@ -0,0 +1,35 @@
1
+ import { type ActionResult, type ActionTile, type Tile, type Widget, type WidgetTile } from '@bitsandbricks/ui';
2
+ import { type ReactNode } from 'react';
3
+ /** A plugin's tile: its title, which plugin it is from, and what it shows. */
4
+ export declare function TileCard({ title, from, wide, children }: {
5
+ title: ReactNode;
6
+ from?: ReactNode;
7
+ wide?: boolean;
8
+ children: ReactNode;
9
+ }): import("react").JSX.Element;
10
+ /** The state of a widget's data, however the app fetches it (TanStack Query's result fits). */
11
+ export interface WidgetData {
12
+ data?: Widget;
13
+ error?: Error | null;
14
+ isPending?: boolean;
15
+ }
16
+ /** A data widget from a plugin: loading, its error, or the widget with its line and link. */
17
+ export declare function WidgetCard({ tile, state, from, detailsLabel }: {
18
+ tile: WidgetTile;
19
+ state: WidgetData;
20
+ from?: ReactNode;
21
+ detailsLabel?: string;
22
+ }): import("react").JSX.Element;
23
+ /** A plugin's action button; it asks first when the plugin marks it as danger. */
24
+ export declare function ActionCard({ tile, run, from }: {
25
+ tile: ActionTile;
26
+ run: (tile: ActionTile) => Promise<ActionResult>;
27
+ from?: ReactNode;
28
+ }): import("react").JSX.Element;
29
+ /** A plugin page's tiles in a grid. `useWidget` loads one widget's data (the app's query hook). */
30
+ export declare function TileGrid({ tiles, columns, useWidget, run }: {
31
+ tiles: Tile[];
32
+ columns?: number;
33
+ useWidget: (tile: WidgetTile) => WidgetData;
34
+ run: (tile: ActionTile) => Promise<ActionResult>;
35
+ }): import("react").JSX.Element;
@@ -0,0 +1,39 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { Anchor, Paper, SimpleGrid, Stack, Text, Title } from '@mantine/core';
3
+ import { ConfirmButton, LoadingState, useT } from '@bitsandbricks/ui';
4
+ import { useState } from 'react';
5
+ import { WidgetBody } from './WidgetBody.js';
6
+ /** A plugin's tile: its title, which plugin it is from, and what it shows. */
7
+ export function TileCard({ title, from, wide, children }) {
8
+ return (_jsx(Paper, { withBorder: true, radius: "lg", p: "md", style: wide ? { gridColumn: '1 / -1' } : undefined, component: "section", children: _jsxs(Stack, { gap: 10, children: [_jsxs("div", { children: [_jsx(Title, { order: 3, fz: "md", children: title }), from && _jsx(Text, { size: "xs", c: "dimmed", children: from })] }), children] }) }));
9
+ }
10
+ /** A data widget from a plugin: loading, its error, or the widget with its line and link. */
11
+ export function WidgetCard({ tile, state, from, detailsLabel = 'Details' }) {
12
+ const { data, error, isPending } = state;
13
+ return (_jsx(TileCard, { title: tile.label, from: from ?? tile.plugin_name, wide: tile.size === 'wide' || tile.size === 'l', children: isPending ? _jsx(LoadingState, { lines: true })
14
+ : error && !data ? _jsxs(Text, { size: "sm", className: "bnb-tone-err", role: "alert", children: ["\u2715 ", error.message] })
15
+ : data ? (_jsxs(_Fragment, { children: [_jsx(WidgetBody, { widget: data }), data.sub && _jsx(Text, { size: "xs", c: "dimmed", children: data.sub }), data.link && _jsx(Anchor, { href: data.link, size: "sm", children: detailsLabel })] })) : null }));
16
+ }
17
+ /** A plugin's action button; it asks first when the plugin marks it as danger. */
18
+ export function ActionCard({ tile, run, from }) {
19
+ const { t } = useT();
20
+ const [busy, setBusy] = useState(false);
21
+ const [result, setResult] = useState(null);
22
+ const go = () => {
23
+ setBusy(true);
24
+ run(tile)
25
+ .then((r) => setResult({ ok: r.ok, text: r.message }))
26
+ .catch((e) => setResult({ ok: false, text: e instanceof Error ? e.message : String(e) }))
27
+ .finally(() => setBusy(false));
28
+ };
29
+ return (_jsxs(TileCard, { title: tile.label, from: from ?? tile.plugin_name, children: [_jsx(ConfirmButton, { label: tile.label, danger: tile.danger, loading: busy, onConfirm: go }), _jsx(Text, { size: "sm", role: "status", className: result ? (result.ok ? 'bnb-tone-ok' : 'bnb-tone-err') : undefined, children: busy ? t('common.loading') : result ? `${result.ok ? '✓' : '✕'} ${result.text}` : '' })] }));
30
+ }
31
+ /** A plugin page's tiles in a grid. `useWidget` loads one widget's data (the app's query hook). */
32
+ export function TileGrid({ tiles, columns = 3, useWidget, run }) {
33
+ return (_jsx(SimpleGrid, { cols: { base: 1, sm: Math.min(2, columns), lg: columns }, spacing: "md", "aria-live": "polite", children: tiles.map((tile) => tile.kind === 'action'
34
+ ? _jsx(ActionCard, { tile: tile, run: run }, `${tile.plugin}/a/${tile.id}`)
35
+ : _jsx(LoadedWidget, { tile: tile, useWidget: useWidget }, `${tile.plugin}/w/${tile.id}`)) }));
36
+ }
37
+ function LoadedWidget({ tile, useWidget }) {
38
+ return _jsx(WidgetCard, { tile: tile, state: useWidget(tile) });
39
+ }
@@ -0,0 +1,14 @@
1
+ /** [unix seconds, value], oldest first: what the series APIs answer (telemetry, agent history). */
2
+ export type TimePoint = [number, number];
3
+ /** A line over time with a soft fill, broken where samples are missing (an agent away, a restart).
4
+ * Plain SVG like the other charts here, so any page or dashboard tile can use it. */
5
+ export declare function TimeChart({ points, label, since, until, format, height }: {
6
+ points: TimePoint[];
7
+ label: string;
8
+ /** The window drawn, so a short series sits where it happened instead of filling the width. */
9
+ since: number;
10
+ until: number;
11
+ /** How the highest value is written under the chart ("max 1,317"). */
12
+ format?: (v: number) => string;
13
+ height?: number;
14
+ }): import("react").JSX.Element;
@@ -0,0 +1,30 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { clock, dayClock } from './time.js';
3
+ /** A line over time with a soft fill, broken where samples are missing (an agent away, a restart).
4
+ * Plain SVG like the other charts here, so any page or dashboard tile can use it. */
5
+ export function TimeChart({ points, label, since, until, format = String, height = 120 }) {
6
+ const W = 600, H = height;
7
+ const top = Math.max(...points.map((p) => p[1]), 1);
8
+ const x = (ts) => ((ts - since) / (until - since || 1)) * W;
9
+ const y = (v) => H - 2 - (v / top) * (H - 10);
10
+ const runs = split(points);
11
+ const when = until - since >= 86400 ? dayClock : clock;
12
+ return (_jsxs("figure", { className: "bnb-time-chart", children: [_jsxs("svg", { viewBox: `0 0 ${W} ${H}`, preserveAspectRatio: "none", role: "img", "aria-label": label, style: { height: H }, children: [_jsx("line", { className: "axis", x1: 0, x2: W, y1: H - 1, y2: H - 1, vectorEffect: "non-scaling-stroke" }), runs.map((run, i) => {
13
+ const line = run.map((p) => `${x(p[0]).toFixed(1)},${y(p[1]).toFixed(1)}`).join(' ');
14
+ return run.length > 1 ? (_jsxs("g", { children: [_jsx("polygon", { className: "area", points: `${x(run[0][0]).toFixed(1)},${H} ${line} ${x(run[run.length - 1][0]).toFixed(1)},${H}` }), _jsx("polyline", { className: "line", points: line, vectorEffect: "non-scaling-stroke" })] }, i)) : _jsx("circle", { className: "dot", cx: x(run[0][0]), cy: y(run[0][1]), r: 2.5 }, i);
15
+ })] }), _jsxs("figcaption", { children: [_jsx("span", { children: when(since) }), _jsx("span", { children: format(top) }), _jsx("span", { children: when(until) })] })] }));
16
+ }
17
+ /** Runs of samples without a hole: a gap of three steps or more is drawn as nothing. */
18
+ function split(points) {
19
+ if (points.length < 2)
20
+ return points.length ? [points] : [];
21
+ const gaps = points.slice(1).map((p, i) => p[0] - points[i][0]).sort((a, b) => a - b);
22
+ const step = gaps[Math.floor(gaps.length / 2)] || 60;
23
+ const out = [[points[0]]];
24
+ for (let i = 1; i < points.length; i++) {
25
+ if (points[i][0] - points[i - 1][0] > step * 3)
26
+ out.push([]);
27
+ out[out.length - 1].push(points[i]);
28
+ }
29
+ return out;
30
+ }
@@ -0,0 +1,4 @@
1
+ import type { Widget } from '@bitsandbricks/ui';
2
+ export declare function WidgetBody({ widget }: {
3
+ widget: Widget;
4
+ }): import("react").JSX.Element;
@@ -0,0 +1,37 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { Group, Table, Text } from '@mantine/core';
3
+ import { useT as useTranslation } from '@bitsandbricks/ui';
4
+ import { FitWidget } from './FitWidget.js';
5
+ import { Sparkline } from '@bitsandbricks/ui';
6
+ import { registerWidgetMessages } from './messages.js';
7
+ registerWidgetMessages();
8
+ // A widget is data (floorbit/plugins/widgets.py checks it on the server). Everything a plugin
9
+ // sends is drawn as text: React escapes it, and nothing here sets HTML.
10
+ // A list row never gets wider than its tile: grid items default to min-width auto, so one long
11
+ // detail used to push the tile, and on a phone the whole page, sideways.
12
+ const ROW = { minWidth: 0 };
13
+ const SIDE = { flex: '0 1 auto', minWidth: 0, maxWidth: '55%' };
14
+ const toneClass = (tone) => (tone ? `bnb-tone-${tone}` : undefined);
15
+ function Stat({ value, unit, tone }) {
16
+ return (_jsxs(Text, { fz: 28, fw: 700, lh: 1.1, className: toneClass(tone), style: { fontVariantNumeric: 'tabular-nums' }, children: [value ?? '–', unit && (_jsx(Text, { span: true, fz: "sm", fw: 500, c: "dimmed", ml: 4, children: unit }))] }));
17
+ }
18
+ export function WidgetBody({ widget }) {
19
+ const { t } = useTranslation();
20
+ switch (widget.type) {
21
+ case 'stat':
22
+ return _jsx(Stat, { value: widget.value, unit: widget.unit, tone: widget.tone });
23
+ case 'status':
24
+ return (_jsx("ul", { style: { listStyle: 'none', margin: 0, padding: 0, display: 'grid', gap: 6 }, children: widget.items.map((item, i) => (_jsx("li", { style: ROW, children: _jsxs(Group, { gap: 8, wrap: "nowrap", children: [_jsx("span", { className: `bnb-dot ${item.state}`, role: "img", "aria-label": item.state, title: item.state }), _jsx(Text, { size: "sm", style: { flex: 1, minWidth: 0 }, truncate: true, children: item.label }), _jsx(Text, { size: "sm", c: "dimmed", ff: "monospace", style: SIDE, truncate: true, title: item.detail || undefined, children: item.detail })] }) }, i))) }));
25
+ case 'list':
26
+ return (_jsx("ul", { style: { listStyle: 'none', margin: 0, padding: 0, display: 'grid', gap: 6 }, children: widget.items.map((item, i) => (_jsx("li", { style: ROW, children: _jsxs(Group, { gap: 8, justify: "space-between", wrap: "nowrap", children: [_jsx(Text, { size: "sm", style: { flex: 1, minWidth: 0 }, truncate: true, children: item.label }), _jsx(Text, { size: "sm", ff: "monospace", className: toneClass(item.tone), c: item.tone ? undefined : 'dimmed', style: SIDE, truncate: true, title: item.value || undefined, children: item.value })] }) }, i))) }));
27
+ case 'table':
28
+ return (_jsx(Table.ScrollContainer, { minWidth: 320, children: _jsxs(Table, { striped: true, highlightOnHover: true, fz: "sm", children: [_jsx(Table.Thead, { children: _jsx(Table.Tr, { children: widget.columns.map((c) => (_jsx(Table.Th, { children: c.label }, c.key))) }) }), _jsx(Table.Tbody, { children: widget.rows.map((row, i) => (_jsx(Table.Tr, { children: widget.columns.map((c) => (_jsx(Table.Td, { children: row[c.key] }, c.key))) }, i))) })] }) }));
29
+ case 'sparkline':
30
+ return (_jsxs(_Fragment, { children: [widget.value != null && _jsx(Stat, { value: widget.value, unit: widget.unit }), _jsx(Sparkline, { points: widget.points, min: widget.min, max: widget.max })] }));
31
+ case 'series':
32
+ // A card on a plugin page has no box of its own: give the graph one.
33
+ return (_jsx("div", { style: { height: 160, display: 'flex' }, children: _jsx(FitWidget, { widget: widget, pin: "m" }) }));
34
+ default:
35
+ return (_jsx(Text, { size: "sm", c: "var(--bnb-err)", children: t('dashboard.cantDraw') }));
36
+ }
37
+ }
@@ -0,0 +1,5 @@
1
+ /** Seconds a large list stays on one page before it turns to the next by itself: on a wall nobody
2
+ * clicks the pager (#925). 0 (the app) leaves paging to the viewer. */
3
+ export declare const AutoPage: import("react").Context<number>;
4
+ /** What a wall uses: long enough to read a page of names from across the hall. */
5
+ export declare const WALL_PAGE_SECONDS = 12;
@@ -0,0 +1,6 @@
1
+ import { createContext } from 'react';
2
+ /** Seconds a large list stays on one page before it turns to the next by itself: on a wall nobody
3
+ * clicks the pager (#925). 0 (the app) leaves paging to the viewer. */
4
+ export const AutoPage = createContext(0);
5
+ /** What a wall uses: long enough to read a page of names from across the hall. */
6
+ export const WALL_PAGE_SECONDS = 12;
@@ -0,0 +1,3 @@
1
+ /** In a large widget (#925), a row that names an inventory device opens its glance beside the
2
+ * widget. Null everywhere else: the dashboard itself, the editor and public walls. */
3
+ export declare const Drill: import("react").Context<((device: string) => void) | null>;
package/dist/drill.js ADDED
@@ -0,0 +1,4 @@
1
+ import { createContext } from 'react';
2
+ /** In a large widget (#925), a row that names an inventory device opens its glance beside the
3
+ * widget. Null everywhere else: the dashboard itself, the editor and public walls. */
4
+ export const Drill = createContext(null);
@@ -0,0 +1,22 @@
1
+ export { FitWidget } from './FitWidget.js';
2
+ export { WidgetBody } from './WidgetBody.js';
3
+ export { ActionCard, TileCard, TileGrid, WidgetCard, type WidgetData } from './TileCard.js';
4
+ export { TimeChart, type TimePoint } from './TimeChart.js';
5
+ export { AutoPage } from './autoPage.js';
6
+ export { Drill } from './drill.js';
7
+ export { KIND_PICKS, LEVEL_PINS, pickLevel, tooSmall, type Kind, type KindPick, type Level, type LevelPin } from './level.js';
8
+ export { LevelReport } from './levelReport.js';
9
+ export { useBox } from './useBox.js';
10
+ export { BarsKind } from './kinds/Bars.js';
11
+ export { ColumnsKind } from './kinds/Columns.js';
12
+ export { GaugeKind } from './kinds/Gauge.js';
13
+ export { Graph } from './kinds/Graph.js';
14
+ export { HistogramKind } from './kinds/Histogram.js';
15
+ export { PieKind } from './kinds/Pie.js';
16
+ export { RowsKind } from './kinds/Rows.js';
17
+ export { StatKind } from './kinds/Stat.js';
18
+ export * from './kinds/shape.js';
19
+ export * from './kinds/combine.js';
20
+ export * from './kinds/display.js';
21
+ export { clock, dayClock } from './time.js';
22
+ export { de as widgetMessagesDe, en as widgetMessagesEn, registerWidgetMessages } from './messages.js';
package/dist/index.js ADDED
@@ -0,0 +1,24 @@
1
+ // @bitsandbricks/widgets: dashboard widgets drawn from plugin data (Floorbit's widget kit). Plain
2
+ // SVG and CSS, no chart library. Import '@bitsandbricks/widgets/styles.css' once.
3
+ export { FitWidget } from './FitWidget.js';
4
+ export { WidgetBody } from './WidgetBody.js';
5
+ export { ActionCard, TileCard, TileGrid, WidgetCard } from './TileCard.js';
6
+ export { TimeChart } from './TimeChart.js';
7
+ export { AutoPage } from './autoPage.js';
8
+ export { Drill } from './drill.js';
9
+ export { KIND_PICKS, LEVEL_PINS, pickLevel, tooSmall } from './level.js';
10
+ export { LevelReport } from './levelReport.js';
11
+ export { useBox } from './useBox.js';
12
+ export { BarsKind } from './kinds/Bars.js';
13
+ export { ColumnsKind } from './kinds/Columns.js';
14
+ export { GaugeKind } from './kinds/Gauge.js';
15
+ export { Graph } from './kinds/Graph.js';
16
+ export { HistogramKind } from './kinds/Histogram.js';
17
+ export { PieKind } from './kinds/Pie.js';
18
+ export { RowsKind } from './kinds/Rows.js';
19
+ export { StatKind } from './kinds/Stat.js';
20
+ export * from './kinds/shape.js';
21
+ export * from './kinds/combine.js';
22
+ export * from './kinds/display.js';
23
+ export { clock, dayClock } from './time.js';
24
+ export { de as widgetMessagesDe, en as widgetMessagesEn, registerWidgetMessages } from './messages.js';
@@ -0,0 +1,15 @@
1
+ import type { Widget } from '@bitsandbricks/ui';
2
+ import { type Level } from '../level.js';
3
+ import { type Look } from './shape.js';
4
+ /** Horizontal bars: how many in each state, or a list's numbers. Items with their own max (seats
5
+ * out of a block) fill a track, a bar gauge; otherwise bars share the biggest number's scale. */
6
+ export declare function BarsKind({ widget, level, box, onMore, look }: {
7
+ widget: Widget;
8
+ level: Level;
9
+ box: {
10
+ w: number;
11
+ h: number;
12
+ };
13
+ onMore?: () => void;
14
+ look?: Look;
15
+ }): import("react").JSX.Element;
@@ -0,0 +1,41 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { ActionIcon, UnstyledButton } from '@mantine/core';
3
+ import { IconChevronLeft, IconChevronRight } from '@tabler/icons-react';
4
+ import { useState } from 'react';
5
+ import { useT as useTranslation } from '@bitsandbricks/ui';
6
+ import { ROW_H, rowsThatFit } from '../level.js';
7
+ import { partsOf, partTip } from './shape.js';
8
+ import { SegmentLegend } from './Columns.js';
9
+ import { StatKind } from './Stat.js';
10
+ /** Horizontal bars: how many in each state, or a list's numbers. Items with their own max (seats
11
+ * out of a block) fill a track, a bar gauge; otherwise bars share the biggest number's scale. */
12
+ export function BarsKind({ widget, level, box, onMore, look = {} }) {
13
+ const { t, i18n } = useTranslation();
14
+ const [page, setPage] = useState(0);
15
+ if (level === 's')
16
+ return _jsx(StatKind, { widget: widget, level: level, box: box });
17
+ const parts = partsOf(widget, (s) => t(`widgets.state.${s}`), i18n.language);
18
+ if (!parts.length)
19
+ return _jsx("div", { className: "bnb-w-empty", children: t('widgets.kind.noData') });
20
+ const stack = look.stack ?? 'none';
21
+ const segmented = parts.some((p) => p.segments);
22
+ const top = segmented && stack === 'none'
23
+ ? Math.max(1, ...parts.flatMap((p) => (p.segments ?? []).map((g) => g.value)))
24
+ : Math.max(...parts.map((p) => p.max ?? p.value), 1);
25
+ const room = rowsThatFit(box.h, segmented ? 20 : 0);
26
+ const fit = parts.length > room ? Math.max(1, room - 1) : room;
27
+ const pages = level === 'l' ? Math.ceil(parts.length / fit) : 1;
28
+ const at = Math.min(page, pages - 1);
29
+ const shown = parts.slice(at * fit, at * fit + fit);
30
+ const more = level === 'l' ? 0 : parts.length - shown.length;
31
+ const labelW = Math.min(160, Math.max(48, box.w * 0.28));
32
+ return (_jsxs("div", { className: "bnb-w-rows", children: [segmented && _jsx(SegmentLegend, { parts: parts }), _jsx("ul", { className: "bnb-w-bars", style: { ['--label-w']: `${labelW}px` }, children: shown.map((p, i) => {
33
+ const full = p.max ?? top;
34
+ const pct = Math.min(100, (p.value / (full || 1)) * 100);
35
+ const segs = p.segments;
36
+ return (_jsxs("li", { title: partTip(p, pct), style: { height: ROW_H }, children: [_jsx("span", { className: "bnb-w-bar-label", children: p.label }), _jsx("span", { className: `bnb-w-bar-track${p.max != null ? ' gauge' : ''}${segs && stack === 'none' ? ' grouped' : ''}`, children: !segs ? _jsx("span", { className: "bnb-w-bar-fill", style: { width: `${pct}%`, background: p.colour } })
37
+ : stack === 'none' ? (_jsx("span", { className: "bnb-w-hgroup", children: segs.map((g, k) => _jsx("span", { style: { width: `${Math.min(100, (g.value / (top || 1)) * 100)}%`, background: g.colour } }, k)) })) : (_jsx("span", { className: "bnb-w-bar-fill bnb-w-hstack", style: { width: stack === 'percent' ? '100%' : `${pct}%` }, children: segs.map((g, k) => _jsx("span", { className: "bnb-w-seg", style: { width: `${(g.value / (p.value || 1)) * 100}%`, background: g.colour } }, k)) })) }), _jsx("span", { className: "bnb-w-bar-value", children: p.text })] }, i));
38
+ }) }), more > 0 && (onMore
39
+ ? _jsx(UnstyledButton, { className: "bnb-w-more", onClick: onMore, children: t('widgets.kind.more', { count: more }) })
40
+ : _jsx("span", { className: "bnb-w-more", children: t('widgets.kind.more', { count: more }) })), pages > 1 && (_jsxs("div", { className: "bnb-w-pager", children: [_jsx("span", { children: t('widgets.kind.rowsOf', { from: at * fit + 1, to: at * fit + shown.length, count: parts.length }) }), _jsx(ActionIcon, { size: "sm", variant: "subtle", color: "gray", disabled: at === 0, "aria-label": t('widgets.kind.prev'), onClick: () => setPage(at - 1), children: _jsx(IconChevronLeft, { size: 14 }) }), _jsx(ActionIcon, { size: "sm", variant: "subtle", color: "gray", disabled: at >= pages - 1, "aria-label": t('widgets.kind.next'), onClick: () => setPage(at + 1), children: _jsx(IconChevronRight, { size: 14 }) })] }))] }));
41
+ }
@@ -0,0 +1,19 @@
1
+ import type { Widget } from '@bitsandbricks/ui';
2
+ import type { Level } from '../level.js';
3
+ import { type Look, type Part } from './shape.js';
4
+ /** Vertical bars. Parts (states, a list's numbers) stand side by side with their label below;
5
+ * time data is cut into columns, each the average of its slice of time, one bar per line. */
6
+ export declare function ColumnsKind(props: {
7
+ widget: Widget;
8
+ level: Level;
9
+ box: {
10
+ w: number;
11
+ h: number;
12
+ };
13
+ onMore?: () => void;
14
+ look?: Look;
15
+ }): import("react").JSX.Element;
16
+ /** The segments' names and colours, for bars made of a table's number columns. */
17
+ export declare function SegmentLegend({ parts }: {
18
+ parts: Part[];
19
+ }): import("react").JSX.Element;
@@ -0,0 +1,101 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { ActionIcon, UnstyledButton } from '@mantine/core';
3
+ import { IconChevronLeft, IconChevronRight } from '@tabler/icons-react';
4
+ import { useState } from 'react';
5
+ import { useT as useTranslation } from '@bitsandbricks/ui';
6
+ import { clock, dayClock } from '../time.js';
7
+ import { useNumberStyle } from './display.js';
8
+ import { bucketsOf, formatValue, lineColour, linesOf, partsOf, partTip, tipAt, trendOf } from './shape.js';
9
+ import { StatKind } from './Stat.js';
10
+ const COL_MIN = 28; // px per column: narrower can't be read or hovered
11
+ const LABEL_H = 18;
12
+ const PAGER_H = 28;
13
+ /** Vertical bars. Parts (states, a list's numbers) stand side by side with their label below;
14
+ * time data is cut into columns, each the average of its slice of time, one bar per line. */
15
+ export function ColumnsKind(props) {
16
+ const { widget, level, box } = props;
17
+ if (level === 's')
18
+ return _jsx(StatKind, { widget: widget, level: level, box: box });
19
+ return widget.type === 'series' || widget.type === 'sparkline' ? _jsx(TimeColumns, { ...props }) : _jsx(PartColumns, { ...props });
20
+ }
21
+ function PartColumns({ widget, level, box, onMore, look = {} }) {
22
+ const { t, i18n } = useTranslation();
23
+ const [page, setPage] = useState(0);
24
+ const parts = partsOf(widget, (s) => t(`widgets.state.${s}`), i18n.language);
25
+ if (!parts.length)
26
+ return _jsx("div", { className: "bnb-w-empty", children: t('widgets.kind.noData') });
27
+ const room = Math.max(1, Math.floor(box.w / COL_MIN));
28
+ const fit = parts.length > room ? Math.max(1, room - 1) : room;
29
+ const pages = level === 'l' ? Math.ceil(parts.length / fit) : 1;
30
+ const at = Math.min(page, pages - 1);
31
+ const shown = parts.slice(at * fit, at * fit + fit);
32
+ const more = level === 'l' ? 0 : parts.length - shown.length;
33
+ const stack = look.stack ?? 'none';
34
+ const segmented = parts.some((p) => p.segments);
35
+ // Side by side, the tallest single segment sets the scale; stacked, the tallest sum.
36
+ const top = segmented && stack === 'none'
37
+ ? Math.max(1, ...parts.flatMap((p) => (p.segments ?? []).map((g) => g.value)))
38
+ : Math.max(...parts.map((p) => p.max ?? p.value), 1);
39
+ const plotH = box.h - LABEL_H - (pages > 1 ? PAGER_H : 0) - 16 - (segmented ? 20 : 0);
40
+ return (_jsxs("div", { className: "bnb-w-cols-wrap", children: [segmented && _jsx(SegmentLegend, { parts: parts }), _jsxs("div", { className: "bnb-w-cols", style: { height: plotH + 16 + LABEL_H }, children: [shown.map((p, i) => _jsx(Column, { part: p, top: top, h: plotH, stack: stack }, i)), more > 0 && (onMore
41
+ ? _jsx(UnstyledButton, { className: "bnb-w-more bnb-w-col-more", onClick: onMore, children: t('widgets.kind.more', { count: more }) })
42
+ : _jsx("span", { className: "bnb-w-more bnb-w-col-more", children: t('widgets.kind.more', { count: more }) }))] }), pages > 1 && (_jsxs("div", { className: "bnb-w-pager", children: [_jsx("span", { children: t('widgets.kind.rowsOf', { from: at * fit + 1, to: at * fit + shown.length, count: parts.length }) }), _jsx(ActionIcon, { size: "sm", variant: "subtle", color: "gray", disabled: at === 0, "aria-label": t('widgets.kind.prev'), onClick: () => setPage(at - 1), children: _jsx(IconChevronLeft, { size: 14 }) }), _jsx(ActionIcon, { size: "sm", variant: "subtle", color: "gray", disabled: at >= pages - 1, "aria-label": t('widgets.kind.next'), onClick: () => setPage(at + 1), children: _jsx(IconChevronRight, { size: 14 }) })] }))] }));
43
+ }
44
+ /** The segments' names and colours, for bars made of a table's number columns. */
45
+ export function SegmentLegend({ parts }) {
46
+ const segs = parts.find((p) => p.segments)?.segments ?? [];
47
+ return (_jsx("div", { className: "bnb-w-legend bnb-w-seg-legend", children: segs.map((g, i) => _jsxs("span", { children: [_jsx("i", { style: { background: g.colour } }), g.label] }, i)) }));
48
+ }
49
+ function Column({ part, top, h, stack }) {
50
+ const full = part.max ?? top;
51
+ const pct = Math.min(100, (part.value / (full || 1)) * 100);
52
+ const segs = part.segments;
53
+ return (_jsxs("div", { className: "bnb-w-col", title: partTip(part, pct), children: [_jsx("span", { className: "bnb-w-col-value", children: part.max != null ? part.value : part.text }), _jsx("span", { className: `bnb-w-col-track${part.max != null ? ' gauge' : ''}`, style: { height: h }, children: !segs ? _jsx("span", { className: "bnb-w-col-fill", style: { height: `${pct}%`, background: part.colour } })
54
+ : stack === 'none' ? (_jsx("span", { className: "bnb-w-group", children: segs.map((g, i) => _jsx("span", { style: { height: `${Math.min(100, (g.value / (top || 1)) * 100)}%`, background: g.colour } }, i)) })) : (_jsx("span", { className: "bnb-w-col-fill bnb-w-stack", style: { height: stack === 'percent' ? '100%' : `${pct}%` }, children: [...segs].reverse().map((g, i) => _jsx("span", { className: "bnb-w-seg", style: { height: `${(g.value / (part.value || 1)) * 100}%`, background: g.colour } }, i)) })) }), _jsx("span", { className: "bnb-w-col-label", children: part.label })] }));
55
+ }
56
+ function TimeColumns({ widget, level, box, look = {} }) {
57
+ const { t, i18n } = useTranslation();
58
+ const style = useNumberStyle();
59
+ const [hot, setHot] = useState(null);
60
+ const { lines, unit, timed } = linesOf(widget);
61
+ const groupW = Math.max(6, lines.length * 6);
62
+ const buckets = bucketsOf(lines, Math.max(1, Math.min(48, Math.floor(box.w / (groupW + 4)))));
63
+ if (!buckets.length)
64
+ return _jsx("div", { className: "bnb-w-empty", children: t('widgets.kind.noData') });
65
+ const fmt = (v) => { const f = formatValue(v, unit, i18n.language, style); return `${f.value}${f.unit ? ` ${f.unit}` : ''}`; };
66
+ const span = buckets[buckets.length - 1].to - buckets[0].from;
67
+ const when = (ts) => (timed ? (span >= 86400 ? dayClock(ts) : clock(ts)) : '');
68
+ const stack = lines.length > 1 ? look.stack ?? 'none' : 'none';
69
+ const sums = buckets.map((b) => b.values.reduce((a, v) => a + Math.max(0, v ?? 0), 0));
70
+ const top = stack === 'percent' ? 100 : stack === 'stacked' ? Math.max(1, ...sums) : Math.max(1, ...buckets.flatMap((b) => b.values.map((v) => v ?? 0)));
71
+ const W = box.w, H = Math.max(30, box.h - 20 - (level === 'l' ? 18 : 0));
72
+ const slot = W / buckets.length;
73
+ const barW = stack === 'none' ? Math.max(2, (slot - 3) / lines.length) : Math.max(2, slot - 3);
74
+ const yOf = (v) => (v / top) * (H - 4);
75
+ // Bars: [line, x, y, height]. Stacked ones sit on the lines before them in the same slice.
76
+ const rects = [];
77
+ buckets.forEach((b, i) => {
78
+ let below = 0;
79
+ b.values.forEach((v, li) => {
80
+ if (v == null)
81
+ return;
82
+ const val = stack === 'percent' ? (Math.max(0, v) / (sums[i] || 1)) * 100 : Math.max(0, v);
83
+ const hgt = yOf(val);
84
+ if (stack === 'none')
85
+ rects.push([li, i * slot + 1.5 + li * barW, H - hgt, hgt]);
86
+ else {
87
+ rects.push([li, i * slot + 1.5, H - yOf(below) - hgt, hgt]);
88
+ below += val;
89
+ }
90
+ });
91
+ });
92
+ const trend = look.trend ?? 'none';
93
+ const mids = buckets.map((b) => (b.from + b.to) / 2);
94
+ const trends = trend === 'none' || stack === 'percent' ? [] : lines.map((_, li) => {
95
+ const pts = buckets.flatMap((b, i) => (b.values[li] == null ? [] : [[mids[i], stack === 'stacked' ? sums[i] : b.values[li]]]));
96
+ return stack === 'stacked' && li > 0 ? [] : trendOf(pts, trend);
97
+ });
98
+ const tx = (ts) => ((ts - mids[0]) / ((mids[mids.length - 1] - mids[0]) || 1)) * (W - slot) + slot / 2;
99
+ const focus = hot != null ? buckets[hot] : null;
100
+ return (_jsxs("div", { className: "bnb-w-graph", children: [_jsx("div", { className: "bnb-w-legend", children: lines.map((l, i) => _jsxs("span", { children: [_jsx("i", { style: { background: lineColour(l, i) } }), l.label] }, i)) }), _jsxs("div", { className: "bnb-w-plot", onPointerLeave: () => setHot(null), onPointerMove: (e) => setHot(Math.min(buckets.length - 1, Math.max(0, Math.floor((e.clientX - e.currentTarget.getBoundingClientRect().left) / slot)))), children: [_jsxs("svg", { width: W, height: H, role: "img", "aria-label": t('widgets.kind.columnsLabel', { name: widget.label || lines.map((l) => l.label).join(', ') }), children: [_jsx("line", { className: "bnb-w-base", x1: 0, x2: W, y1: H - 0.5, y2: H - 0.5 }), hot != null && _jsx("rect", { className: "bnb-w-col-hot", x: hot * slot, y: 0, width: slot, height: H }), rects.map(([li, rx, ry, rh], k) => (_jsx("rect", { x: rx, width: barW, y: ry, height: rh, rx: stack === 'none' ? 1.5 : 0, fill: lineColour(lines[li], li) }, k))), trends.map((tr, li) => tr.length > 1 && (_jsx("polyline", { className: "bnb-w-trend", style: { color: stack === 'stacked' ? 'var(--bnb-fg)' : lineColour(lines[li], li) }, points: tr.map((p) => `${tx(p[0]).toFixed(1)},${(H - yOf(p[1])).toFixed(1)}`).join(' ') }, `t${li}`)))] }), focus && (_jsxs("div", { className: "bnb-w-tip", role: "tooltip", style: tipAt(hot * slot, (hot + 1) * slot, W), children: [timed && _jsx("div", { className: "bnb-w-tip-when", children: `${when(focus.from)} – ${when(focus.to)}` }), lines.map((l, i) => (_jsxs("div", { children: [_jsx("i", { style: { background: lineColour(lines[i], i) } }), l.label, _jsxs("b", { children: [focus.values[i] == null ? '–' : fmt(focus.values[i]), stack === 'percent' && focus.values[i] != null ? ` · ${Math.round((Math.max(0, focus.values[i]) / (focus.values.reduce((a, v) => a + Math.max(0, v ?? 0), 0) || 1)) * 100)} %` : ''] })] }, i)))] }))] }), level === 'l' && (_jsxs("div", { className: "bnb-w-axis", children: [_jsx("span", { children: when(buckets[0].from) }), _jsx("span", { children: stack === 'percent' ? '100 %' : t('widgets.kind.top', { value: fmt(top) }) }), _jsx("span", { children: when(buckets[buckets.length - 1].to) })] }))] }));
101
+ }
@@ -0,0 +1,11 @@
1
+ import type { Widget } from '@bitsandbricks/ui';
2
+ import type { Level } from '../level.js';
3
+ /** A value on its scale as a dial: a stat with a max, or a sparkline's latest reading. */
4
+ export declare function GaugeKind({ widget, level, box }: {
5
+ widget: Widget;
6
+ level: Level;
7
+ box: {
8
+ w: number;
9
+ h: number;
10
+ };
11
+ }): import("react").JSX.Element;
@@ -0,0 +1,29 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useT as useTranslation } from '@bitsandbricks/ui';
3
+ import { useNumberStyle } from './display.js';
4
+ import { formatValue, scaleOf, statOf } from './shape.js';
5
+ const SWEEP = 240; // degrees: open at the bottom, like a dial
6
+ /** A value on its scale as a dial: a stat with a max, or a sparkline's latest reading. */
7
+ export function GaugeKind({ widget, level, box }) {
8
+ const { t, i18n } = useTranslation();
9
+ const style = useNumberStyle();
10
+ const scale = scaleOf(widget);
11
+ if (!scale)
12
+ return _jsx("div", { className: "bnb-w-empty", children: t('widgets.kind.noData') });
13
+ const s = statOf(widget, i18n.language, style);
14
+ const share = Math.min(1, Math.max(0, (scale.value - scale.min) / (scale.max - scale.min || 1)));
15
+ // The dial is 100 × 86 units plus half a stroke on each side: keep all of it inside the box.
16
+ const size = Math.max(40, Math.min(box.w, box.h / 0.86) * 0.9);
17
+ const r = 42, c = 50;
18
+ const arc = (from, to) => {
19
+ const p = (deg) => {
20
+ const a = ((deg - 90 - SWEEP / 2) * Math.PI) / 180;
21
+ return `${(c + r * Math.cos(a)).toFixed(2)} ${(c + r * Math.sin(a)).toFixed(2)}`;
22
+ };
23
+ return `M ${p(from)} A ${r} ${r} 0 ${to - from > 180 ? 1 : 0} 1 ${p(to)}`;
24
+ };
25
+ const tone = s.tone || (share >= 0.9 ? 'ok' : '');
26
+ const fmt = (v) => formatValue(v, '', i18n.language, style).value;
27
+ const label = t('widgets.kind.gaugeLabel', { value: s.value, max: fmt(scale.max), pct: Math.round(share * 100) });
28
+ return (_jsx("div", { className: "bnb-w-gauge", title: label, children: _jsxs("svg", { width: size, height: size * 0.86, viewBox: "0 0 100 86", role: "img", "aria-label": label, children: [_jsx("path", { className: "bnb-w-gauge-track", d: arc(0, SWEEP) }), share > 0 && _jsx("path", { className: `bnb-w-gauge-fill${tone ? ` bnb-tone-${tone}` : ''}`, d: arc(0, Math.max(1, SWEEP * share)) }), _jsx("text", { x: 50, y: level === 's' ? 56 : 52, className: "bnb-w-gauge-value", children: s.value }), level !== 's' && _jsx("text", { x: 50, y: 66, className: "bnb-w-gauge-unit", children: `${Math.round(share * 100)} %` }), level === 'l' && (_jsxs(_Fragment, { children: [_jsx("text", { x: 14, y: 84, className: "bnb-w-gauge-end", children: fmt(scale.min) }), _jsx("text", { x: 86, y: 84, className: "bnb-w-gauge-end", children: fmt(scale.max) })] }))] }) }));
29
+ }
@@ -0,0 +1,36 @@
1
+ import type { Widget } from '@bitsandbricks/ui';
2
+ import type { Level } from '../level.js';
3
+ import { type Threshold } from './display.js';
4
+ import { type Axis, type Line, type Look } from './shape.js';
5
+ /** Lines over time, drawn at the box's real size so text stays sharp: plain lines, areas, stacked
6
+ * or stacked to 100 %, with an optional dashed trend. Hover (or touch) shows the time and every
7
+ * line's value under the pointer. */
8
+ export declare function Graph({ widget, level, box, look }: {
9
+ widget: Widget;
10
+ level: Level;
11
+ box: {
12
+ w: number;
13
+ h: number;
14
+ };
15
+ look?: Look;
16
+ }): import("react").JSX.Element;
17
+ export declare function Plot({ lines, stack, area, trends, steps, ghosts, marks, w, h, t0, t1, top, axis, cross, label }: {
18
+ lines: Line[];
19
+ stack: Look['stack'];
20
+ area: boolean;
21
+ trends?: [number, number][][];
22
+ steps?: Threshold[];
23
+ ghosts?: Line[];
24
+ marks?: {
25
+ x: number;
26
+ tone: string;
27
+ }[];
28
+ w: number;
29
+ h: number;
30
+ t0?: number;
31
+ t1?: number;
32
+ top?: number;
33
+ axis?: Axis;
34
+ cross?: number | null;
35
+ label?: string;
36
+ }): import("react").JSX.Element;