@mechane-ai/elements 0.41.0 → 0.43.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 (92) hide show
  1. package/README.md +72 -41
  2. package/bin/catalog.d.mts +17 -0
  3. package/bin/mechane-elements-catalog.mjs +60 -0
  4. package/dist/agent.js +1 -1
  5. package/dist/ai.js +23 -23
  6. package/dist/catalog.json +1984 -0
  7. package/dist/{categorical-values-DnGR_pQx.js → categorical-values-DzhbfZ5w.js} +3 -3
  8. package/dist/{chart-frame-BsyI1Zc8.js → chart-frame-9dQQNF3F.js} +74 -22
  9. package/dist/{chart-input-r4S3-QCT.js → chart-input-DT0STflx.js} +2 -2
  10. package/dist/{chart-navigation-D7OkLdSx.js → chart-navigation-BAbb5PV9.js} +67 -32
  11. package/dist/charts/cartesian.js +1728 -559
  12. package/dist/charts/distribution.js +5 -5
  13. package/dist/charts/graph.js +443 -76
  14. package/dist/charts/hierarchy.js +5 -5
  15. package/dist/charts/matrix.js +232 -63
  16. package/dist/charts/timeline.js +3 -3
  17. package/dist/charts.js +2 -2
  18. package/dist/{code-block-C4K1sM9O.js → code-block-Cpfr7B6a.js} +1 -1
  19. package/dist/collections.js +475 -354
  20. package/dist/content/code.js +1 -1
  21. package/dist/content/diff.js +3 -3
  22. package/dist/content/link.js +1 -1
  23. package/dist/content/markdown.js +2 -2
  24. package/dist/content/tree.js +2 -2
  25. package/dist/{content-link-CBDqSvgP.js → content-link-CGeFFb9F.js} +1 -1
  26. package/dist/content.js +1 -1
  27. package/dist/feedback.js +1 -1
  28. package/dist/forms/dates.js +11 -11
  29. package/dist/{forms-I-WMHTkr.js → forms-DeU0Tiv3.js} +6 -2
  30. package/dist/forms.js +3 -3
  31. package/dist/index.js +1 -1
  32. package/dist/label-spacing-BncjePGb.js +6 -0
  33. package/dist/layout.js +275 -249
  34. package/dist/mechane-elements-catalog.mjs +4 -0
  35. package/dist/navigation.js +2 -2
  36. package/dist/packages/charts/src/cartesian/bar-chart.d.ts +15 -3
  37. package/dist/packages/charts/src/cartesian/bar-data.d.ts +43 -0
  38. package/dist/packages/charts/src/cartesian/bar-overlays.d.ts +32 -0
  39. package/dist/packages/charts/src/cartesian/bridge-chart.d.ts +29 -0
  40. package/dist/packages/charts/src/cartesian/bridge-data.d.ts +40 -0
  41. package/dist/packages/charts/src/cartesian/index.d.ts +7 -2
  42. package/dist/packages/charts/src/cartesian/reference-lines.d.ts +34 -0
  43. package/dist/packages/charts/src/cartesian/sparkline.d.ts +10 -1
  44. package/dist/packages/charts/src/cartesian/time-series-bands.d.ts +66 -0
  45. package/dist/packages/charts/src/cartesian/time-series-data.d.ts +11 -1
  46. package/dist/packages/charts/src/cartesian/time-series-overlays.d.ts +35 -0
  47. package/dist/packages/charts/src/cartesian/time-series.d.ts +6 -1
  48. package/dist/packages/charts/src/chart-inspection.d.ts +4 -1
  49. package/dist/packages/charts/src/chart-navigation.d.ts +5 -1
  50. package/dist/packages/charts/src/chart-series-marker.d.ts +8 -1
  51. package/dist/packages/charts/src/chart-surface.d.ts +4 -0
  52. package/dist/packages/charts/src/chart-theme.d.ts +26 -0
  53. package/dist/packages/charts/src/graph/flow-diagram.d.ts +26 -0
  54. package/dist/packages/charts/src/graph/flow-layout.d.ts +70 -0
  55. package/dist/packages/charts/src/graph/index.d.ts +2 -0
  56. package/dist/packages/charts/src/index.d.ts +1 -1
  57. package/dist/packages/charts/src/label-spacing.d.ts +15 -0
  58. package/dist/packages/charts/src/matrix/matrix-cells.d.ts +4 -0
  59. package/dist/packages/charts/src/matrix/matrix-strip.d.ts +20 -0
  60. package/dist/packages/charts/src/matrix/matrix-types.d.ts +21 -0
  61. package/dist/packages/charts/src/matrix/matrix.d.ts +8 -19
  62. package/dist/packages/collections/src/collection-controls.d.ts +2 -1
  63. package/dist/packages/collections/src/data-table.d.ts +12 -8
  64. package/dist/packages/collections/src/index.d.ts +1 -0
  65. package/dist/packages/collections/src/table-results.d.ts +26 -0
  66. package/dist/packages/core/src/actions.d.ts +6 -0
  67. package/dist/packages/core/src/index.d.ts +1 -1
  68. package/dist/packages/forms/src/form-status.d.ts +7 -0
  69. package/dist/packages/forms/src/forms.d.ts +3 -1
  70. package/dist/packages/forms/src/index.d.ts +2 -0
  71. package/dist/packages/foundations/src/agent/index.d.ts +2 -2
  72. package/dist/packages/layout/src/page-context.d.ts +4 -0
  73. package/dist/packages/navigation/src/index.d.ts +1 -0
  74. package/dist/packages/navigation/src/route-link.d.ts +2 -0
  75. package/dist/{pierre-diff-DJ3oOfPX.js → pierre-diff-B3tD3-6z.js} +1 -1
  76. package/dist/{plot-width-BQQS-mw9.js → plot-width-DzCmthQW.js} +28 -0
  77. package/dist/{src-D2OHco8V.js → src-Bk7M67zy.js} +3 -3
  78. package/dist/{src-DfOAlAd2.js → src-BpvnBWrF.js} +1 -1
  79. package/dist/{src-CQQvXi7a.js → src-DBNncL7_.js} +70 -50
  80. package/dist/{src-s3tWwnN4.js → src-DcW_gMX8.js} +178 -168
  81. package/dist/{src-CNV1ewzb.js → src-gqEebHEa.js} +319 -285
  82. package/dist/styles2.css +115 -0
  83. package/package.json +9 -2
  84. package/recipes/allocation-report.tsx +115 -0
  85. package/recipes/consequential-form.tsx +132 -0
  86. package/recipes/searchable-collection.tsx +106 -0
  87. package/recipes/sectioned-report.tsx +58 -0
  88. package/recipes/tabbed-workspace.tsx +84 -0
  89. package/skills/extend-elements/SKILL.md +28 -0
  90. package/skills/use-elements/SKILL.md +36 -0
  91. package/skills/{elements-presentation/SKILL.md → use-elements/references/reports.md} +0 -6
  92. package/skills/{elements-workspace/SKILL.md → use-elements/references/workspace.md} +0 -6
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import catalog from './catalog.json' with { type: 'json' };
3
+ import { runCatalog } from '../bin/mechane-elements-catalog.mjs';
4
+ runCatalog(catalog);
@@ -1,3 +1,3 @@
1
1
  import { n as e, t } from "./navigation-CveMIuXI.js";
2
- import { a as n, i as r, n as i, r as a, t as o } from "./src-CQQvXi7a.js";
3
- export { t as Breadcrumb, o as ContentTabs, e as Kbd, r as PageNavigation, n as PageNavigationPlaceholder, a as SkipLink, i as Tabs };
2
+ import { a as n, i as r, n as i, o as a, r as o, t as s } from "./src-DBNncL7_.js";
3
+ export { t as Breadcrumb, s as ContentTabs, e as Kbd, r as PageNavigation, n as PageNavigationPlaceholder, a as RouteLink, o as SkipLink, i as Tabs };
@@ -1,7 +1,8 @@
1
1
  import type { ReactNode } from 'react';
2
2
  import type { ChartSelection, ChartSeriesReport } from '../chart-frame.tsx';
3
- import type { BarComposition, BarSeries } from './bar-data.ts';
4
- export type { BarSeries, BarBucket, BarComposition } from './bar-data.ts';
3
+ import type { BarAnnotation, BarComposition, BarMarker, BarSeries } from './bar-data.ts';
4
+ import type { ChartReferenceLine } from './reference-lines.tsx';
5
+ export type { BarSeries, BarBucket, BarComposition, BarMarker, BarAnnotation } from './bar-data.ts';
5
6
  export type BarChartProps = {
6
7
  readonly title: string;
7
8
  readonly description?: ReactNode;
@@ -20,10 +21,21 @@ export type BarChartProps = {
20
21
  readonly highlightedSeriesId?: string | undefined;
21
22
  readonly selection?: ChartSelection | undefined;
22
23
  readonly height?: number | undefined;
24
+ /** Labelled values drawn across the plot, such as a target or an average. They join every category's readout. */
25
+ readonly referenceLines?: ReadonlyArray<ChartReferenceLine> | undefined;
26
+ /** Ticks or whiskers drawn on each bar of a series, listed in the legend and the readout. */
27
+ readonly markers?: ReadonlyArray<BarMarker> | undefined;
28
+ /** Short notes above chosen bars. Notes for a category also join its readout and exact values. */
29
+ readonly annotations?: ReadonlyArray<BarAnnotation> | undefined;
30
+ /**
31
+ * Recedes every other category so these stand out, without changing selection or inspection. Emphasis is visual only;
32
+ * explain it with an annotation or the description.
33
+ */
34
+ readonly emphasizedCategoryIds?: ReadonlyArray<string> | undefined;
23
35
  };
24
36
  export type BarChartPlaceholderProps = Pick<BarChartProps, 'description' | 'height' | 'report'> & {
25
37
  readonly title?: string | undefined;
26
38
  readonly series?: ReadonlyArray<Pick<BarSeries, 'id' | 'label' | 'tone'>> | undefined;
27
39
  };
28
40
  export declare function BarChartPlaceholder({ title, description, report, series, height, }: BarChartPlaceholderProps): ReactNode;
29
- export declare function BarChart({ title, description, report, categories, series, domain, mode, formatValue, formatTick, highlightedSeriesId, selection, height, composition, }: BarChartProps): ReactNode;
41
+ export declare function BarChart({ title, description, report, categories, series, domain, mode, formatValue, formatTick, highlightedSeriesId, selection, height, composition, referenceLines, markers, annotations, emphasizedCategoryIds, }: BarChartProps): ReactNode;
@@ -28,4 +28,47 @@ type CompositionInput = {
28
28
  readonly domain: readonly [number, number];
29
29
  };
30
30
  export declare function validateComposition({ composition, series, categoryIds, domain, }: CompositionInput): string | undefined;
31
+ /**
32
+ * A second value drawn on each bar of one series, on the value axis rather than the stack. A tick marks one value, such
33
+ * as the highest month against an average. A range draws a whisker between two supplied bounds.
34
+ */
35
+ export type BarMarker = {
36
+ readonly id: string;
37
+ readonly label: string;
38
+ /** The bar series whose bar width the marker spans. A stacked chart spans the whole stack. */
39
+ readonly seriesId: string;
40
+ /** Absent means the neutral tone. */
41
+ readonly tone?: ChartTone | undefined;
42
+ } & ({
43
+ readonly kind: 'tick';
44
+ readonly values: ReadonlyArray<number | null>;
45
+ } | {
46
+ readonly kind: 'range';
47
+ readonly lower: ReadonlyArray<number | null>;
48
+ readonly upper: ReadonlyArray<number | null>;
49
+ });
50
+ /** A short visible note above one bar, such as "Peak". Long text belongs in the description. */
51
+ export type BarAnnotation = {
52
+ readonly id: string;
53
+ readonly categoryId: string;
54
+ readonly label: string;
55
+ /** Places the note above this series' bar in a grouped chart. Absent means above the category's tallest mark. */
56
+ readonly seriesId?: string | undefined;
57
+ };
58
+ type OverlayInput = {
59
+ readonly markers: ReadonlyArray<BarMarker>;
60
+ readonly annotations: ReadonlyArray<BarAnnotation>;
61
+ readonly emphasizedCategoryIds: ReadonlyArray<string>;
62
+ readonly seriesIds: ReadonlyArray<string>;
63
+ readonly categoryIds: ReadonlyArray<string>;
64
+ readonly domain: readonly [number, number];
65
+ };
66
+ export declare function validateBarOverlays({ markers, annotations, emphasizedCategoryIds, seriesIds, categoryIds, domain, }: OverlayInput): string | undefined;
67
+ export declare function markerValueLabel({ marker, index, formatValue, }: {
68
+ readonly marker: BarMarker;
69
+ readonly index: number;
70
+ readonly formatValue: (value: number) => string;
71
+ }): string;
72
+ /** The highest value a marker draws at one category, so an annotation can clear it. */
73
+ export declare function markerPeak(marker: BarMarker, index: number): number | null;
31
74
  export {};
@@ -0,0 +1,32 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { BarMarker } from './bar-data.ts';
3
+ /** The horizontal extent of one series' bar within a category. */
4
+ export type BarSpan = {
5
+ readonly x: number;
6
+ readonly width: number;
7
+ };
8
+ type BarMarkersProps = {
9
+ readonly markers: ReadonlyArray<BarMarker>;
10
+ readonly categoryIds: ReadonlyArray<string>;
11
+ readonly span: (categoryId: string, seriesId: string) => BarSpan;
12
+ /** The top of the decorated bar, which a tick's stem joins. Null leaves the tick without a stem. */
13
+ readonly barTop: (categoryIndex: number, seriesId: string) => number | null;
14
+ readonly y: (value: number) => number;
15
+ readonly isReceded: (categoryId: string) => boolean;
16
+ };
17
+ export type PlacedAnnotation = {
18
+ readonly id: string;
19
+ readonly label: string;
20
+ readonly x: number;
21
+ readonly y: number;
22
+ readonly isReceded: boolean;
23
+ };
24
+ /** Draws each marker's tick or whisker over its bar with a surface halo, so it reads on the bar and on the canvas. */
25
+ export declare function BarMarkers({ markers, categoryIds, span, barTop, y, isReceded }: BarMarkersProps): ReactNode;
26
+ /** Centers each note above its anchor and keeps it inside the plot's horizontal bounds. */
27
+ export declare function BarAnnotations({ annotations, left, right, }: {
28
+ readonly annotations: ReadonlyArray<PlacedAnnotation>;
29
+ readonly left: number;
30
+ readonly right: number;
31
+ }): ReactNode;
32
+ export {};
@@ -0,0 +1,29 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { ChartReport, ChartSelection } from '../chart-frame.tsx';
3
+ import type { BridgeStep } from './bridge-data.ts';
4
+ import type { ChartReferenceLine } from './reference-lines.tsx';
5
+ export type { BridgeStep } from './bridge-data.ts';
6
+ export type BridgeChartProps = {
7
+ readonly title: string;
8
+ readonly description?: ReactNode;
9
+ readonly report?: ChartReport | undefined;
10
+ readonly steps: ReadonlyArray<BridgeStep>;
11
+ /** Formats totals and running levels exactly, for labels, inspection and accessible values. */
12
+ readonly formatValue: (value: number) => string;
13
+ /** Formats a signed change. Absent prefixes the formatted magnitude with + or −. */
14
+ readonly formatChange?: ((value: number) => string) | undefined;
15
+ /** Formats compact value-axis ticks. Absent uses `formatValue`. */
16
+ readonly formatTick?: ((value: number) => string) | undefined;
17
+ /** A fixed value domain shared with related charts. Absent fits zero and every running total. */
18
+ readonly domain?: readonly [number, number] | undefined;
19
+ /** Labelled values drawn across the plot, such as a target for the final total. */
20
+ readonly referenceLines?: ReadonlyArray<ChartReferenceLine> | undefined;
21
+ readonly selection?: ChartSelection | undefined;
22
+ readonly height?: number | undefined;
23
+ };
24
+ /**
25
+ * Explains how a starting total becomes a result through signed changes, such as an amount and the deductions that
26
+ * leave a remainder. Columns float from the running total, and dashed connectors carry it to the next step. Use
27
+ * BarChart for independent categories and BreakdownBar for parts of one total; the application supplies every change.
28
+ */
29
+ export declare function BridgeChart({ title, description, report, steps, formatValue, formatChange, formatTick, domain, referenceLines, selection, height, }: BridgeChartProps): ReactNode;
@@ -0,0 +1,40 @@
1
+ import type { ChartTone } from '../../../foundations/src/chart-tones.ts';
2
+ /**
3
+ * One column of a bridge; the first is the start total. A change adds its signed value to the running total, and a
4
+ * missing change leaves later levels unknown. A total shows the running total so far, such as a subtotal or the
5
+ * result.
6
+ */
7
+ export type BridgeStep = {
8
+ readonly id: string;
9
+ /** The full name used in inspection and exact values. */
10
+ readonly label: string;
11
+ /** A concise axis label, such as "Rent". Absent uses the label. */
12
+ readonly axisLabel?: string | undefined;
13
+ /** Absent means neutral totals, positive increases and negative decreases. */
14
+ readonly tone?: ChartTone | undefined;
15
+ } & ({
16
+ readonly kind: 'start';
17
+ readonly value: number;
18
+ } | {
19
+ readonly kind: 'change';
20
+ readonly value: number | null;
21
+ } | {
22
+ readonly kind: 'total';
23
+ readonly value?: never;
24
+ });
25
+ /** A step positioned on the value axis. A null level means an earlier missing change made it unknown. */
26
+ export type BridgeLevel = {
27
+ readonly step: BridgeStep;
28
+ readonly from: number | null;
29
+ readonly to: number | null;
30
+ readonly tone: ChartTone;
31
+ };
32
+ /** Stacks the supplied changes into running levels; totals start at zero and missing changes stay unknown. */
33
+ export declare function bridgeLevels(steps: ReadonlyArray<BridgeStep>): ReadonlyArray<BridgeLevel>;
34
+ type ValueDomain = readonly [number, number];
35
+ export declare function bridgeDomain(levels: ReadonlyArray<BridgeLevel>): ValueDomain;
36
+ export declare function validateBridge({ steps, domain, }: {
37
+ readonly steps: ReadonlyArray<BridgeStep>;
38
+ readonly domain?: ValueDomain | undefined;
39
+ }): string | undefined;
40
+ export {};
@@ -1,12 +1,17 @@
1
- export type { BarSeries, BarBucket, BarComposition, BarChartProps, BarChartPlaceholderProps } from './bar-chart.tsx';
1
+ export type { BarSeries, BarBucket, BarComposition, BarChartProps, BarChartPlaceholderProps, BarMarker, BarAnnotation, } from './bar-chart.tsx';
2
2
  export { BarChart, BarChartPlaceholder } from './bar-chart.tsx';
3
3
  export type { BreakdownBarProps } from './breakdown-bar.tsx';
4
4
  export { BreakdownBar } from './breakdown-bar.tsx';
5
+ export type { BridgeChartProps, BridgeStep } from './bridge-chart.tsx';
6
+ export { BridgeChart } from './bridge-chart.tsx';
7
+ export type { ChartReferenceLine } from './reference-lines.tsx';
5
8
  export type { ScatterPoint, ScatterRange, ScatterRangeSelection, ScatterPlotProps } from './scatter-plot.tsx';
6
9
  export { MAX_SCATTER_POINTS, ScatterPlot } from './scatter-plot.tsx';
7
- export type { SparklineProps } from './sparkline.tsx';
10
+ export type { SparklineProps, SparklinePoint } from './sparkline.tsx';
8
11
  export { Sparkline } from './sparkline.tsx';
9
12
  export type { TimeSeriesPoint, TimeSeries, TimeSeriesMarker } from './time-series-data.ts';
10
13
  export { timeSeriesLimits } from './time-series-data.ts';
14
+ export type { TimeSeriesBand, TimeSeriesBandPoint, TimeSeriesCrossing } from './time-series-bands.ts';
15
+ export { timeSeriesBandLimits } from './time-series-bands.ts';
11
16
  export type { TimeSeriesChartProps, TimeSeriesChartPlaceholderProps, AreaChartProps, SmallMultiplesProps, SmallMultiplesPlaceholderProps, } from './time-series.tsx';
12
17
  export { LineChart, AreaChart, SmallMultiples, SmallMultiplesPlaceholder, TimeSeriesChartPlaceholder, } from './time-series.tsx';
@@ -0,0 +1,34 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { ChartTone } from '../../../foundations/src/chart-tones.ts';
3
+ /**
4
+ * A labelled value drawn across the plot, such as a target or a period average. The application supplies the value and
5
+ * its meaning; the chart neither computes nor ranks it.
6
+ */
7
+ export type ChartReferenceLine = {
8
+ readonly id: string;
9
+ readonly label: string;
10
+ readonly value: number;
11
+ /** Colors the line. Absent means the neutral tone; the label always uses text colors. */
12
+ readonly tone?: ChartTone | undefined;
13
+ };
14
+ export declare function validateReferenceLines({ lines, domain, }: {
15
+ readonly lines: ReadonlyArray<ChartReferenceLine>;
16
+ readonly domain: readonly [number, number];
17
+ }): string | undefined;
18
+ /** The right gutter that holds reference labels, or zero when the plot has none. */
19
+ export declare function referenceGutterWidth({ lines, formatValue, }: {
20
+ readonly lines: ReadonlyArray<ChartReferenceLine>;
21
+ readonly formatValue: (value: number) => string;
22
+ }): number;
23
+ type ReferenceLinesProps = {
24
+ readonly lines: ReadonlyArray<ChartReferenceLine>;
25
+ readonly y: (value: number) => number;
26
+ readonly left: number;
27
+ readonly right: number;
28
+ readonly top: number;
29
+ readonly bottom: number;
30
+ readonly formatValue: (value: number) => string;
31
+ };
32
+ /** Draws dashed reference lines across the plot and names each one in the right gutter beside its line. */
33
+ export declare function ReferenceLines({ lines, y, left, right, top, bottom, formatValue }: ReferenceLinesProps): ReactNode;
34
+ export {};
@@ -1,5 +1,7 @@
1
1
  import type { ReactNode } from 'react';
2
2
  import type { TimeSeries } from './time-series-data.ts';
3
+ /** A recorded point a sparkline can mark: the lowest, the highest, or the latest present observation. */
4
+ export type SparklinePoint = 'minimum' | 'maximum' | 'last';
3
5
  export type SparklineProps = {
4
6
  readonly title: string;
5
7
  readonly summary: string;
@@ -7,5 +9,12 @@ export type SparklineProps = {
7
9
  readonly timestampUnit: 'seconds' | 'milliseconds';
8
10
  readonly series: TimeSeries;
9
11
  readonly valueDomain: readonly [number, number];
12
+ /**
13
+ * Marks these recorded points: hollow rings at the first lowest and highest values, and a solid dot at the latest.
14
+ * Their values join the accessible description. Absent marks nothing.
15
+ */
16
+ readonly markedPoints?: ReadonlyArray<SparklinePoint> | undefined;
17
+ /** Draws a faint reference value, such as a target, inside `valueDomain`. Absent draws none. */
18
+ readonly baseline?: number | undefined;
10
19
  };
11
- export declare function Sparkline({ title, summary, unit, timestampUnit, series, valueDomain }: SparklineProps): ReactNode;
20
+ export declare function Sparkline({ title, summary, unit, timestampUnit, series, valueDomain, markedPoints, baseline, }: SparklineProps): ReactNode;
@@ -0,0 +1,66 @@
1
+ import type { ChartTone } from '../../../foundations/src/chart-tones.ts';
2
+ import type { TimeSeries } from './time-series-data.ts';
3
+ /** One observation of a band. Both bounds are present or both are missing; a missing center draws no line there. */
4
+ export type TimeSeriesBandPoint = {
5
+ readonly timestamp: number;
6
+ readonly lower: number | null;
7
+ readonly center: number | null;
8
+ readonly upper: number | null;
9
+ };
10
+ /**
11
+ * A shaded range between supplied lower and upper values, with an optional center line, such as low, expected and high
12
+ * outcomes. The application computes every bound and names the range; the chart only draws and reads it.
13
+ */
14
+ export type TimeSeriesBand = {
15
+ readonly id: string;
16
+ /** Names the center line, such as "Expected". */
17
+ readonly label: string;
18
+ /** Names the shaded range in inspection and exact values, such as "Low to high". */
19
+ readonly rangeLabel: string;
20
+ readonly points: ReadonlyArray<TimeSeriesBandPoint>;
21
+ /** Absent takes the next automatic series tone after the line series. */
22
+ readonly tone?: ChartTone | undefined;
23
+ };
24
+ /**
25
+ * Marks where a drawn line first reaches a value, such as zero. The chart interpolates between the two adjacent
26
+ * recorded observations exactly as it draws the line, so the marker lands where the line meets the value. Gaps never
27
+ * cross.
28
+ */
29
+ export type TimeSeriesCrossing = {
30
+ readonly id: string;
31
+ /** A line series, or a band whose center line is tested. */
32
+ readonly seriesId: string;
33
+ readonly value: number;
34
+ readonly label: string;
35
+ /** Which way the line must pass through the value. Absent accepts either direction. */
36
+ readonly direction?: 'falling' | 'rising' | undefined;
37
+ };
38
+ export type PlotBand = Omit<TimeSeriesBand, 'tone'> & {
39
+ readonly tone: ChartTone;
40
+ };
41
+ export type FoundCrossing = {
42
+ readonly crossing: TimeSeriesCrossing;
43
+ readonly timestamp: number | undefined;
44
+ };
45
+ export declare const timeSeriesBandLimits: {
46
+ readonly bands: 4;
47
+ readonly crossings: 4;
48
+ };
49
+ export declare function validateBands({ bands, crossings, series, timestamps, }: {
50
+ readonly bands: ReadonlyArray<TimeSeriesBand>;
51
+ readonly crossings: ReadonlyArray<TimeSeriesCrossing>;
52
+ readonly series: ReadonlyArray<TimeSeries>;
53
+ readonly timestamps: ReadonlyArray<number>;
54
+ }): string | undefined;
55
+ export declare function prepareBands({ series, bands, }: {
56
+ readonly series: ReadonlyArray<TimeSeries>;
57
+ readonly bands: ReadonlyArray<TimeSeriesBand>;
58
+ }): ReadonlyArray<PlotBand>;
59
+ export declare function findCrossings({ crossings, series, bands, }: {
60
+ readonly crossings: ReadonlyArray<TimeSeriesCrossing>;
61
+ readonly series: ReadonlyArray<TimeSeries>;
62
+ readonly bands: ReadonlyArray<TimeSeriesBand>;
63
+ }): ReadonlyArray<FoundCrossing>;
64
+ /** The observation timestamp nearest an instant, which owns that instant in keyboard and pointer inspection. */
65
+ export declare function nearestTimestamp(timestamps: ReadonlyArray<number>, instant: number): number | undefined;
66
+ export declare function bandValues(bands: ReadonlyArray<TimeSeriesBand>): ReadonlyArray<number>;
@@ -9,6 +9,10 @@ export type TimeSeries = {
9
9
  readonly points: ReadonlyArray<TimeSeriesPoint>;
10
10
  readonly tone?: ChartTone | undefined;
11
11
  };
12
+ /**
13
+ * A time marker flags an observation timestamp, such as a partial period. A point marker annotates a recorded series
14
+ * value. An event marker labels a supplied instant inside the range, possibly between observations, without a value.
15
+ */
12
16
  export type TimeSeriesMarker = {
13
17
  readonly id: string;
14
18
  readonly timestamp: number;
@@ -21,6 +25,10 @@ export type TimeSeriesMarker = {
21
25
  readonly kind: 'point';
22
26
  readonly seriesId: string;
23
27
  readonly value: number;
28
+ } | {
29
+ readonly kind: 'event';
30
+ readonly seriesId?: never;
31
+ readonly value?: never;
24
32
  });
25
33
  export type PlotPoint = {
26
34
  readonly timestamp: number;
@@ -39,10 +47,12 @@ export declare const timeSeriesLimits: {
39
47
  readonly markers: 200;
40
48
  readonly panels: 12;
41
49
  };
42
- export declare function validateTimeSeries({ series, isStacked, markers, }: {
50
+ export declare function validateTimeSeries({ series, isStacked, markers, timeline, }: {
43
51
  readonly series: ReadonlyArray<TimeSeries>;
44
52
  readonly isStacked: boolean;
45
53
  readonly markers: ReadonlyArray<TimeSeriesMarker>;
54
+ /** The observation timestamps when no line series supplies them, such as a chart of bands alone. */
55
+ readonly timeline?: ReadonlyArray<number>;
46
56
  }): string | undefined;
47
57
  export declare function timeSeriesSignature({ series, markers, timestampUnit, isStacked, }: {
48
58
  readonly series: ReadonlyArray<TimeSeries>;
@@ -0,0 +1,35 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { PlotBand } from './time-series-bands.ts';
3
+ /** An instant labelled on the plot: a supplied event marker or a found crossing, which also has a value. */
4
+ export type TimeLabelledInstant = {
5
+ readonly id: string;
6
+ readonly timestamp: number;
7
+ readonly label: string;
8
+ readonly value?: number | undefined;
9
+ };
10
+ export type PlacedInstant = TimeLabelledInstant & {
11
+ readonly lane: number;
12
+ readonly anchor: 'start' | 'end';
13
+ };
14
+ type LaneInput = {
15
+ readonly instants: ReadonlyArray<TimeLabelledInstant>;
16
+ readonly x: (timestamp: number) => number;
17
+ readonly right: number;
18
+ };
19
+ /** Places each label beside its guide in the first lane where it fits, flipping before the plot's right edge. */
20
+ export declare function placeInstants({ instants, x, right }: LaneInput): ReadonlyArray<PlacedInstant>;
21
+ export declare function instantsTop(placed: ReadonlyArray<PlacedInstant>): number;
22
+ type Scales = {
23
+ readonly x: (timestamp: number) => number;
24
+ readonly y: (value: number) => number;
25
+ };
26
+ /** Shades each band between its bounds, outlines the bounds faintly, and draws its center line over the shade. */
27
+ export declare function TimeSeriesBands({ bands, x, y }: Scales & {
28
+ readonly bands: ReadonlyArray<PlotBand>;
29
+ }): ReactNode;
30
+ /** Draws each instant's guide from its label lane to the axis, with a ring where a crossing lands. */
31
+ export declare function TimeInstants({ placed, x, y, bottom, }: Scales & {
32
+ readonly placed: ReadonlyArray<PlacedInstant>;
33
+ readonly bottom: number;
34
+ }): ReactNode;
35
+ export {};
@@ -1,5 +1,6 @@
1
1
  import type { ReactNode } from 'react';
2
2
  import type { ChartSeriesReport } from '../chart-frame.tsx';
3
+ import type { TimeSeriesBand, TimeSeriesCrossing } from './time-series-bands.ts';
3
4
  import type { TimeSeries, TimeSeriesMarker } from './time-series-data.ts';
4
5
  export type TimeSeriesChartProps = {
5
6
  readonly title: string;
@@ -13,6 +14,10 @@ export type TimeSeriesChartProps = {
13
14
  readonly height?: number | undefined;
14
15
  readonly actions?: ReactNode;
15
16
  readonly report?: ChartSeriesReport | undefined;
17
+ /** Shaded ranges with optional center lines, drawn beneath the line series and listed in the legend. */
18
+ readonly bands?: ReadonlyArray<TimeSeriesBand> | undefined;
19
+ /** Where a series or band center first reaches a value. A crossing that never happens is listed as not reached. */
20
+ readonly crossings?: ReadonlyArray<TimeSeriesCrossing> | undefined;
16
21
  };
17
22
  export type AreaChartProps = TimeSeriesChartProps & {
18
23
  readonly isStacked?: boolean | undefined;
@@ -20,7 +25,7 @@ export type AreaChartProps = TimeSeriesChartProps & {
20
25
  export type TimeSeriesChartPlaceholderProps = Pick<TimeSeriesChartProps, 'title' | 'description' | 'height' | 'actions' | 'report'> & {
21
26
  readonly series: ReadonlyArray<Pick<TimeSeries, 'id' | 'label' | 'tone'>>;
22
27
  };
23
- export type SmallMultiplesProps = Omit<TimeSeriesChartProps, 'series' | 'title' | 'description' | 'actions' | 'formatValue' | 'formatTick' | 'markers' | 'report'> & {
28
+ export type SmallMultiplesProps = Omit<TimeSeriesChartProps, 'series' | 'title' | 'description' | 'actions' | 'formatValue' | 'formatTick' | 'markers' | 'report' | 'bands' | 'crossings'> & {
24
29
  readonly charts: ReadonlyArray<{
25
30
  readonly id: string;
26
31
  readonly title: string;
@@ -16,11 +16,14 @@ type ChartInspectionProps = {
16
16
  readonly source: 'pointer' | 'keyboard' | undefined;
17
17
  readonly notes?: ReadonlyArray<string> | undefined;
18
18
  readonly hasSeriesSummary?: boolean | undefined;
19
+ /** False for a plot whose axis labels name every mark, so the inspector replaces the legend at every width. */
20
+ readonly hasLegend?: boolean | undefined;
19
21
  };
20
22
  export declare function ChartLegendLoading(): ReactNode;
21
23
  export declare function ChartInspectionTitle({ title, detail, }: {
22
24
  readonly title: string;
23
25
  readonly detail: string | undefined;
24
26
  }): ReactNode;
25
- export declare function ChartInspection({ id, label, summary, legend, layoutLegend, rows, x, width, offset, source, notes, hasSeriesSummary, }: ChartInspectionProps): ReactNode;
27
+ export declare function inspectionReadout({ label, summary, rows, notes, }: Pick<ChartInspectionProps, 'label' | 'summary' | 'rows' | 'notes'>): string | undefined;
28
+ export declare function ChartInspection({ id, label, summary, legend, layoutLegend, rows, x, width, offset, source, notes, hasSeriesSummary, hasLegend, }: ChartInspectionProps): ReactNode;
26
29
  export {};
@@ -7,15 +7,19 @@ type ChartNavigationInput = {
7
7
  readonly title: string;
8
8
  readonly items: ReadonlyArray<ChartNavigationItem>;
9
9
  readonly selection: ChartSelection | undefined;
10
+ readonly columnCount?: number | undefined;
10
11
  };
11
- export declare function useChartNavigation({ title, items, selection }: ChartNavigationInput): {
12
+ export declare function useChartNavigation({ title, items, selection, columnCount }: ChartNavigationInput): {
12
13
  id: string;
13
14
  props: {
14
15
  controls: {
15
16
  items: readonly ChartNavigationItem[];
16
17
  cursor: string | undefined;
17
18
  inspected: string | undefined;
19
+ readout: string | undefined;
20
+ selected: string | undefined;
18
21
  allowVerticalNavigation: true;
22
+ columnCount: number | undefined;
19
23
  onInspect: (itemId: string) => void;
20
24
  onDismiss: () => void;
21
25
  onSelect: ((id: string) => void) | undefined;
@@ -1,7 +1,14 @@
1
1
  import type { ReactNode } from 'react';
2
2
  import type { ChartTone } from '../../foundations/src/chart-tones.ts';
3
+ /**
4
+ * The mark a legend entry stands for. A swatch is a filled area or bar, a line a drawn series, and a band a translucent
5
+ * range with its center. A tick is one value on a bar, a range a whisker, and dashed a reference line.
6
+ */
7
+ export type ChartMarkShape = 'swatch' | 'line' | 'band' | 'tick' | 'range' | 'dashed';
3
8
  export type ChartSeriesMarkerProps = {
4
9
  readonly tone: ChartTone;
10
+ /** Draws the shared glyph for this mark; supplied artwork replaces it. Absent means the square swatch. */
11
+ readonly shape?: ChartMarkShape | undefined;
5
12
  readonly children?: ReactNode;
6
13
  };
7
- export declare function ChartSeriesMarker({ tone, children }: ChartSeriesMarkerProps): ReactNode;
14
+ export declare function ChartSeriesMarker({ tone, shape, children }: ChartSeriesMarkerProps): ReactNode;
@@ -8,7 +8,11 @@ export type ChartControls = {
8
8
  readonly items: ReadonlyArray<ChartItem>;
9
9
  readonly cursor: string | undefined;
10
10
  readonly inspected: string | undefined;
11
+ readonly readout: string | undefined;
12
+ readonly selected?: string | undefined;
11
13
  readonly allowVerticalNavigation?: boolean;
14
+ /** Arranges the items row by row in a grid of this width. Up and Down change rows; Home and End stay in the row. */
15
+ readonly columnCount?: number | undefined;
12
16
  readonly onInspect: (id: string) => void;
13
17
  readonly onDismiss: () => void;
14
18
  readonly onSelect?: ((id: string) => void) | undefined;
@@ -1,9 +1,12 @@
1
1
  import * as stylex from '@stylexjs/stylex';
2
2
  import type { ChartTone } from '../../foundations/src/chart-tones.ts';
3
+ import type { ChartMarkShape } from './chart-series-marker.tsx';
3
4
  export type ChartLegendItem = {
4
5
  readonly id: string;
5
6
  readonly label: string;
6
7
  readonly tone: ChartTone;
8
+ /** The legend glyph for a mark that is not a filled area, such as a band or a tick. Absent means a swatch. */
9
+ readonly shape?: ChartMarkShape | undefined;
7
10
  };
8
11
  export declare const chartStyles: Readonly<{
9
12
  readonly plot: Readonly<{
@@ -26,6 +29,11 @@ export declare const chartStyles: Readonly<{
26
29
  readonly strokeDasharray: stylex.StyleXClassNameFor<"strokeDasharray", "3 3">;
27
30
  readonly vectorEffect: stylex.StyleXClassNameFor<"vectorEffect", "non-scaling-stroke">;
28
31
  }>;
32
+ readonly baseline: Readonly<{
33
+ readonly stroke: stylex.StyleXClassNameFor<"stroke", string>;
34
+ readonly strokeWidth: stylex.StyleXClassNameFor<"strokeWidth", 1>;
35
+ readonly vectorEffect: stylex.StyleXClassNameFor<"vectorEffect", "non-scaling-stroke">;
36
+ }>;
29
37
  readonly label: Readonly<{
30
38
  readonly fill: stylex.StyleXClassNameFor<"fill", string>;
31
39
  readonly fontFamily: stylex.StyleXClassNameFor<"fontFamily", string>;
@@ -33,6 +41,16 @@ export declare const chartStyles: Readonly<{
33
41
  readonly fontWeight: stylex.StyleXClassNameFor<"fontWeight", string>;
34
42
  readonly fontVariantNumeric: stylex.StyleXClassNameFor<"fontVariantNumeric", "tabular-nums">;
35
43
  }>;
44
+ readonly strongLabel: Readonly<{
45
+ readonly fill: stylex.StyleXClassNameFor<"fill", string>;
46
+ readonly fontWeight: stylex.StyleXClassNameFor<"fontWeight", string>;
47
+ }>;
48
+ readonly haloLabel: Readonly<{
49
+ readonly paintOrder: stylex.StyleXClassNameFor<"paintOrder", "stroke">;
50
+ readonly stroke: stylex.StyleXClassNameFor<"stroke", string>;
51
+ readonly strokeWidth: stylex.StyleXClassNameFor<"strokeWidth", 3>;
52
+ readonly strokeLinejoin: stylex.StyleXClassNameFor<"strokeLinejoin", "round">;
53
+ }>;
36
54
  readonly mark: Readonly<{
37
55
  readonly strokeWidth: stylex.StyleXClassNameFor<"strokeWidth", 1.5>;
38
56
  readonly vectorEffect: stylex.StyleXClassNameFor<"vectorEffect", "non-scaling-stroke">;
@@ -45,4 +63,12 @@ export declare const chartStyles: Readonly<{
45
63
  readonly inspectable: Readonly<{
46
64
  readonly outlineStyle: stylex.StyleXClassNameFor<"outlineStyle", "none">;
47
65
  }>;
66
+ readonly emphasis: Readonly<{
67
+ readonly transitionProperty: stylex.StyleXClassNameFor<"transitionProperty", "opacity">;
68
+ readonly transitionDuration: stylex.StyleXClassNameFor<"transitionDuration", string>;
69
+ readonly transitionTimingFunction: stylex.StyleXClassNameFor<"transitionTimingFunction", string>;
70
+ }>;
71
+ readonly receded: Readonly<{
72
+ readonly opacity: stylex.StyleXClassNameFor<"opacity", 0.32>;
73
+ }>;
48
74
  }>;
@@ -0,0 +1,26 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { ChartReport, ChartSelection } from '../chart-frame.tsx';
3
+ import type { FlowLink, FlowNode } from './flow-layout.ts';
4
+ export type { FlowLink, FlowNode } from './flow-layout.ts';
5
+ export type FlowDiagramProps = {
6
+ readonly title: string;
7
+ readonly description?: ReactNode;
8
+ readonly report?: ChartReport | undefined;
9
+ readonly nodes: ReadonlyArray<FlowNode>;
10
+ readonly links: ReadonlyArray<FlowLink>;
11
+ /** Formats every amount exactly, for labels, inspection and accessible values. */
12
+ readonly formatValue: (value: number) => string;
13
+ /** Controlled selection of a node or link identifier, activated by click, Enter or Space. */
14
+ readonly selection?: ChartSelection | undefined;
15
+ /** The plot height in pixels. Absent fits the busiest column. */
16
+ readonly height?: number | undefined;
17
+ readonly emptyLabel?: string | undefined;
18
+ };
19
+ export declare const MAX_FLOW_NODES = 64;
20
+ export declare const MAX_FLOW_LINKS = 256;
21
+ /**
22
+ * Shows how supplied amounts divide and move between stages, such as a total splitting into categories and their parts.
23
+ * Node height and ribbon width share one scale; columns follow the links and keep the supplied order. Use BreakdownBar
24
+ * for one level of parts and RelationGraph for unweighted relationships; the diagram never infers or balances a flow.
25
+ */
26
+ export declare function FlowDiagram({ title, description, report, nodes, links, formatValue, selection, height, emptyLabel, }: FlowDiagramProps): ReactNode;