basalt-ui 1.30.0 → 1.30.2
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 +15 -0
- package/MIGRATING.md +284 -30
- package/dist/charts/index.d.ts +1 -1
- package/dist/charts/index.d.ts.map +1 -1
- package/dist/charts/kinds/BandStrip.d.ts +5 -3
- package/dist/charts/kinds/BandStrip.d.ts.map +1 -1
- package/dist/charts/kinds/Bars.d.ts +4 -2
- package/dist/charts/kinds/Bars.d.ts.map +1 -1
- package/dist/charts/kinds/Donut.d.ts +4 -2
- package/dist/charts/kinds/Donut.d.ts.map +1 -1
- package/dist/charts/kinds/DualPanel.d.ts +4 -2
- package/dist/charts/kinds/DualPanel.d.ts.map +1 -1
- package/dist/charts/kinds/Heatmap.d.ts +5 -2
- package/dist/charts/kinds/Heatmap.d.ts.map +1 -1
- package/dist/charts/kinds/MirroredBars.d.ts +4 -2
- package/dist/charts/kinds/MirroredBars.d.ts.map +1 -1
- package/dist/charts/kinds/MultiLine.d.ts +4 -2
- package/dist/charts/kinds/MultiLine.d.ts.map +1 -1
- package/dist/charts/kinds/StackedArea.d.ts +4 -2
- package/dist/charts/kinds/StackedArea.d.ts.map +1 -1
- package/dist/charts/kinds/ZonedLine.d.ts +4 -2
- package/dist/charts/kinds/ZonedLine.d.ts.map +1 -1
- package/dist/charts/primitives/CartesianChart.d.ts +4 -1
- package/dist/charts/primitives/CartesianChart.d.ts.map +1 -1
- package/dist/charts/primitives/ChartFrame.d.ts +20 -11
- package/dist/charts/primitives/ChartFrame.d.ts.map +1 -1
- package/dist/charts/primitives/ChartFrame.js +39 -14
- package/dist/charts/primitives/ChartLegend.d.ts +5 -3
- package/dist/charts/primitives/ChartLegend.d.ts.map +1 -1
- package/dist/charts/primitives/chart-frame-layout.d.ts +64 -9
- package/dist/charts/primitives/chart-frame-layout.d.ts.map +1 -1
- package/dist/charts/primitives/chart-frame-layout.js +35 -6
- package/dist/common/errors.d.ts +11 -0
- package/dist/common/errors.d.ts.map +1 -1
- package/dist/common/errors.js +4 -0
- package/llms.txt +2 -2
- package/package.json +1 -1
- package/src/charts/index.ts +1 -0
- package/src/charts/kinds/BandStrip.tsx +5 -3
- package/src/charts/kinds/Bars.tsx +4 -2
- package/src/charts/kinds/Donut.tsx +4 -2
- package/src/charts/kinds/DualPanel.tsx +4 -2
- package/src/charts/kinds/Heatmap.tsx +5 -2
- package/src/charts/kinds/MirroredBars.tsx +4 -2
- package/src/charts/kinds/MultiLine.tsx +4 -2
- package/src/charts/kinds/StackedArea.tsx +4 -2
- package/src/charts/kinds/ZonedLine.tsx +4 -2
- package/src/charts/primitives/CartesianChart.tsx +4 -1
- package/src/charts/primitives/ChartFrame.tsx +72 -37
- package/src/charts/primitives/ChartLegend.tsx +5 -3
- package/src/charts/primitives/chart-frame-layout.ts +123 -16
- package/src/common/errors.ts +14 -0
|
@@ -2,6 +2,7 @@ import type { BasaltProps } from '../../common/props.js';
|
|
|
2
2
|
import type { ChartMargin } from '../../tokens/index.js';
|
|
3
3
|
import type { CursorResolution } from '../cursor/resolve.js';
|
|
4
4
|
import type { BandFold, BandTooltipConfig } from '../hooks/useBandPlot.js';
|
|
5
|
+
import type { ResponsiveChartHeight } from '../primitives/ChartFrame.js';
|
|
5
6
|
import type { ChartState } from '../primitives/ChartPending.js';
|
|
6
7
|
import type { ChartLegendConfig, ChartSeries } from '../series.js';
|
|
7
8
|
/** One of the two panes. Each resolves its own domain — that is the whole point of the kind. */
|
|
@@ -56,8 +57,9 @@ export type MirroredBarsProps<T> = BasaltProps & {
|
|
|
56
57
|
/** Per-datum bar opacity — a real but qualified measurement (a short bucket, a partial interval)
|
|
57
58
|
* drawn dimmer. Default 1. */
|
|
58
59
|
getBarOpacity?: (d: T) => number;
|
|
59
|
-
/**
|
|
60
|
-
|
|
60
|
+
/** Height in px, or one per size step (`{ base, sm?, md?, lg? }`). Default 240. Forwarded
|
|
61
|
+
* unchanged; `ChartFrameProps.height` owns the law — steps resolve off the MEASURED width. */
|
|
62
|
+
height?: number | ResponsiveChartHeight;
|
|
61
63
|
fill?: boolean;
|
|
62
64
|
formatX?: (key: string) => string;
|
|
63
65
|
xTickValues?: (keys: readonly string[], plotWidth: number) => readonly string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MirroredBars.d.ts","sourceRoot":"","sources":["../../../src/charts/kinds/MirroredBars.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAErD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAEzD,OAAO,KAAK,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"MirroredBars.d.ts","sourceRoot":"","sources":["../../../src/charts/kinds/MirroredBars.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAErD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAEzD,OAAO,KAAK,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAIvE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAA;AAUrE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAA;AAE5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAG/D,gGAAgG;AAChG,MAAM,MAAM,eAAe,GAAG;IAC5B;mEAC+D;IAC/D,GAAG,EAAE,MAAM,CAAA;IACX;;;;;;;OAOG;IACH,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACrB;sBACkB;IAClB,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AAE,iBAAiB,GAAG,KAAK,CAAA;IAClC;gFAC4E;IAC5E,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAA;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB;4FACwF;IACxF,KAAK,CAAC,EAAE,UAAU,CAAA;CACnB,CAAA;AA8BD;;;;;;;;;;;;;GAaG;AACH,iBAAS,iBAAiB,CAAC,CAAC,EAAE,KAAK,EAAE,iBAAiB,CAAC,CAAC,CAAC,+BAwBxD;AAoVD,eAAO,MAAM,YAAY,EAAuB,OAAO,iBAAiB,CAAA"}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import type { BasaltProps } from '../../common/props.js';
|
|
2
2
|
import type { CursorResolution } from '../cursor/resolve.js';
|
|
3
3
|
import type { CartesianTooltipConfig, AxisConfig } from '../primitives/CartesianChart.js';
|
|
4
|
+
import type { ResponsiveChartHeight } from '../primitives/ChartFrame.js';
|
|
4
5
|
import type { XZoneSpec } from '../primitives/XZoneRects.js';
|
|
5
6
|
import type { ZoneSpec } from '../primitives/ZoneRects.js';
|
|
6
7
|
import type { ChartState } from '../primitives/ChartPending.js';
|
|
7
8
|
import type { ChartLegendConfig, ChartSeries } from '../series.js';
|
|
8
9
|
export type MultiLineProps<T> = BasaltProps & {
|
|
9
10
|
data: T[];
|
|
10
|
-
/**
|
|
11
|
-
|
|
11
|
+
/** Height in px, or one per size step (`{ base, sm?, md?, lg? }`). Default 240. Forwarded
|
|
12
|
+
* unchanged; `ChartFrameProps.height` owns the law — steps resolve off the MEASURED width. */
|
|
13
|
+
height?: number | ResponsiveChartHeight;
|
|
12
14
|
chartId: string;
|
|
13
15
|
/** Extracts the x-axis category (date string) from a data point. */
|
|
14
16
|
getX: (d: T) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MultiLine.d.ts","sourceRoot":"","sources":["../../../src/charts/kinds/MultiLine.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AACzD,OAAO,KAAK,EAAE,sBAAsB,EAAE,UAAU,EAAe,MAAM,8BAA8B,CAAA;AAEnG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AACzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AACvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAA;AAE5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAG/D,MAAM,MAAM,cAAc,CAAC,CAAC,IAAI,WAAW,GAAG;IAC5C,IAAI,EAAE,CAAC,EAAE,CAAA;IACT
|
|
1
|
+
{"version":3,"file":"MultiLine.d.ts","sourceRoot":"","sources":["../../../src/charts/kinds/MultiLine.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AACzD,OAAO,KAAK,EAAE,sBAAsB,EAAE,UAAU,EAAe,MAAM,8BAA8B,CAAA;AAEnG,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAA;AACrE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AACzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AACvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAA;AAE5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAG/D,MAAM,MAAM,cAAc,CAAC,CAAC,IAAI,WAAW,GAAG;IAC5C,IAAI,EAAE,CAAC,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AAC,EAAE,iBAAiB,GAAG,KAAK,CAAA;IAClC,qGAAqG;IACrG,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,gGAAgG;IAChG,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB;4FACwF;IACxF,KAAK,CAAC,EAAE,UAAU,CAAA;CACnB,CAAA;AA6BD;;;;;;;;;;;;;GAaG;AACH,iBAAS,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC,CAAC,+BAkElD;AA4ID,eAAO,MAAM,SAAS,EAAoB,OAAO,cAAc,CAAA"}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import type { BasaltProps } from '../../common/props.js';
|
|
2
2
|
import type { CursorResolution } from '../cursor/resolve.js';
|
|
3
3
|
import type { AxisConfig } from '../primitives/CartesianChart.js';
|
|
4
|
+
import type { ResponsiveChartHeight } from '../primitives/ChartFrame.js';
|
|
4
5
|
import type { ChartState } from '../primitives/ChartPending.js';
|
|
5
6
|
import type { ChartLegendConfig, ChartSeries } from '../series.js';
|
|
6
7
|
export type StackedAreaProps<T> = BasaltProps & {
|
|
7
8
|
data: T[];
|
|
8
|
-
/**
|
|
9
|
-
|
|
9
|
+
/** Height in px, or one per size step (`{ base, sm?, md?, lg? }`). Default 240. Forwarded
|
|
10
|
+
* unchanged; `ChartFrameProps.height` owns the law — steps resolve off the MEASURED width. */
|
|
11
|
+
height?: number | ResponsiveChartHeight;
|
|
10
12
|
chartId: string;
|
|
11
13
|
getX: (d: T) => string;
|
|
12
14
|
/** The stacked bands, bottom to top — the single source of truth for color, legend, and tooltip
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StackedArea.d.ts","sourceRoot":"","sources":["../../../src/charts/kinds/StackedArea.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAEzD,OAAO,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E,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,KAAK,SAAS,MAAM,EAAE,CAAA;IAC1E,6DAA6D;IAC7D,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAA;IACjC;iDAC6C;IAC7C,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,CAAA;IAC1B;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,gBAAgB,CAAA;IACnC;4CACwC;IACxC,MAAM,CAAC,EAAE,iBAAiB,GAAG,KAAK,CAAA;IAClC,iFAAiF;IACjF,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,gGAAgG;IAChG,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB;4FACwF;IACxF,KAAK,CAAC,EAAE,UAAU,CAAA;CACnB,CAAA;AAaD;;;;;;;;;;;;;;;;;;GAkBG;AACH,iBAAS,gBAAgB,CAAC,CAAC,EAAE,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC,+BA4GtD;AAoED,eAAO,MAAM,WAAW,EAAsB,OAAO,gBAAgB,CAAA"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { BasaltProps } from '../../common/props.js';
|
|
2
2
|
import type { CursorResolution } from '../cursor/resolve.js';
|
|
3
3
|
import type { CartesianTooltipConfig, AxisConfig } from '../primitives/CartesianChart.js';
|
|
4
|
+
import type { ResponsiveChartHeight } from '../primitives/ChartFrame.js';
|
|
4
5
|
import type { XZoneSpec } from '../primitives/XZoneRects.js';
|
|
5
6
|
import type { ZoneSpec } from '../primitives/ZoneRects.js';
|
|
6
7
|
import type { ChartState } from '../primitives/ChartPending.js';
|
|
@@ -20,8 +21,9 @@ export type ZonedLineRefLine = {
|
|
|
20
21
|
};
|
|
21
22
|
export type ZonedLineProps<T> = BasaltProps & {
|
|
22
23
|
data: T[];
|
|
23
|
-
/**
|
|
24
|
-
|
|
24
|
+
/** Height in px, or one per size step (`{ base, sm?, md?, lg? }`). Default 240. Forwarded
|
|
25
|
+
* unchanged; `ChartFrameProps.height` owns the law — steps resolve off the MEASURED width. */
|
|
26
|
+
height?: number | ResponsiveChartHeight;
|
|
25
27
|
chartId: string;
|
|
26
28
|
/** Extracts the x-axis category (date string) from a data point. */
|
|
27
29
|
getX: (d: T) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ZonedLine.d.ts","sourceRoot":"","sources":["../../../src/charts/kinds/ZonedLine.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAEzD,OAAO,KAAK,EAAE,sBAAsB,EAAE,UAAU,EAAe,MAAM,8BAA8B,CAAA;AAEnG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AACzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AACvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAA;AAE5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAG/D,mFAAmF;AACnF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,OAAO,GAAG,OAAO,CAAA;IACvB,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED,0EAA0E;AAC1E,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,oDAAoD;IACpD,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,cAAc,CAAC,CAAC,IAAI,WAAW,GAAG;IAC5C,IAAI,EAAE,CAAC,EAAE,CAAA;IACT
|
|
1
|
+
{"version":3,"file":"ZonedLine.d.ts","sourceRoot":"","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../tokens/index.js';
|
|
5
5
|
import type { CursorResolution } from '../cursor/resolve.js';
|
|
6
6
|
import type { ChartLegendConfig, ChartSeries } from '../series.js';
|
|
7
|
+
import type { ResponsiveChartHeight } from './ChartFrame.js';
|
|
7
8
|
import type { ChartState } from './ChartPending.js';
|
|
8
9
|
import type { XZoneSpec } from './XZoneRects.js';
|
|
9
10
|
import type { ZoneSpec } from './ZoneRects.js';
|
|
@@ -186,7 +187,9 @@ export type CartesianChartProps<T> = BasaltProps & {
|
|
|
186
187
|
dashed?: boolean;
|
|
187
188
|
axis?: 'left' | 'right';
|
|
188
189
|
}[];
|
|
189
|
-
|
|
190
|
+
/** Height in px, or one per size step (`{ base, sm?, md?, lg? }`). Default 240. Forwarded
|
|
191
|
+
* unchanged; `ChartFrameProps.height` owns the law — steps resolve off the MEASURED width. */
|
|
192
|
+
height?: number | ResponsiveChartHeight;
|
|
190
193
|
aspectRatio?: number;
|
|
191
194
|
fill?: boolean;
|
|
192
195
|
legend?: ChartLegendConfig | false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CartesianChart.d.ts","sourceRoot":"","sources":["../../../src/charts/primitives/CartesianChart.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAE/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAErD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAKzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"CartesianChart.d.ts","sourceRoot":"","sources":["../../../src/charts/primitives/CartesianChart.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,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CAAC,CAAC,CAAC,GAAG,SAAS,EAC9B,IAAI,EAAE,SAAS,CAAC,EAAE,EAClB,MAAM,EAAE,SAAS,WAAW,CAAC,CAAC,CAAC,EAAE;AACjC;;;;;;GAMG;AACH,WAAW,GAAE,SAAS,MAAM,EAAO,GAClC,CAAC,MAAM,EAAE,MAAM,CAAC,CAkDlB;AAmCD;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,EAChC,IAAI,EACJ,OAAO,EACP,IAAI,EACJ,MAAM,EACN,CAAC,EACD,EAAE,EACF,MAAM,EACN,WAAW,EACX,OAAqB,EACrB,YAAY,EACZ,KAAK,EACL,MAAM,EACN,QAAQ,EACR,MAAM,EACN,WAAW,EACX,IAAI,EACJ,MAAM,EACN,OAAO,EACP,MAAM,EAAE,cAAc,EACtB,WAAW,EACX,gBAAgB,EAChB,SAAS,EACT,SAAS,EACT,KAAK,EACL,SAAS,EACT,KAAK,EACL,QAAQ,GACT,EAAE,mBAAmB,CAAC,CAAC,CAAC,GAAG,SAAS,CAiDpC"}
|
|
@@ -5,7 +5,7 @@ import type { ResponsiveChartHeight } from './chart-frame-layout.js';
|
|
|
5
5
|
import type { ChartState } from './ChartPending.js';
|
|
6
6
|
/** Re-exported for `ChartFrame.test.tsx` and any other consumer that previously reached these
|
|
7
7
|
* through `ChartFrame` — the layout math itself lives in `./chart-frame-layout` (pure, DOM-free). */
|
|
8
|
-
export { legendEntryCap, resolvePlotRect, resolveChartTier } from './chart-frame-layout.js';
|
|
8
|
+
export { legendEntryCap, resolveLegendRollup, resolvePlotRect, resolveChartTier, } from './chart-frame-layout.js';
|
|
9
9
|
export type { ResponsiveChartHeight } from './chart-frame-layout.js';
|
|
10
10
|
/** Legend configuration for {@link ChartFrame}. Omit entirely (or pass `{}`) for the default
|
|
11
11
|
* bottom-placed legend; pass `false` only for the sparkline exemption. */
|
|
@@ -13,15 +13,22 @@ export type ChartFrameLegend = {
|
|
|
13
13
|
/** Default 'bottom'. */
|
|
14
14
|
placement?: LegendPlacement;
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* Rollup cap at high cardinality: the legend renders this many ENTRIES and folds the remainder
|
|
17
|
+
* into a `+N more` disclosure chip.
|
|
17
18
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* (
|
|
19
|
+
* **It counts entries, not rows** — the name is inherited and now load-bearing across
|
|
20
|
+
* `ChartTierMetrics.legendMaxRows`, so it is not renamed in a patch. `maxRows: 3` on a 7-entry
|
|
21
|
+
* legend renders three entries, which is ONE row at any width they fit on. `ChartLegend` slices
|
|
22
|
+
* (`entries.slice(0, cap)`); nothing here measures rows.
|
|
23
|
+
*
|
|
24
|
+
* An explicit value WINS OUTRIGHT — over the phone tier's two-row default (`chartTierMetrics`)
|
|
25
|
+
* AND over a `fill` frame's measured fit (`legendEntryCap`). 1.30.0 fixed only the first half:
|
|
26
|
+
* the fit still ran `Math.min(fitted, caller)` on top, so meteo's 7-entry meteogram legend in a
|
|
27
|
+
* 150px docked row rendered 2 entries at `maxRows` 3, 6 AND 99 — five series drawn in colours
|
|
28
|
+
* nothing named. Both losers are DEFAULTS (the tier's, and `VX.minPlotHeight`); this is the one
|
|
29
|
+
* number a caller stated, so under `fill` the PLOT yields the height instead
|
|
30
|
+
* ({@link resolvePlotRect}'s `legendWins`). State a number too large for the box and the plot
|
|
31
|
+
* gets what is left — visible, and yours.
|
|
25
32
|
*/
|
|
26
33
|
maxRows?: number;
|
|
27
34
|
/** Visually separate role: series | overlay | reference. */
|
|
@@ -42,7 +49,8 @@ export type ChartFrameProps = BasaltProps & {
|
|
|
42
49
|
series: readonly SeriesStyle[];
|
|
43
50
|
/**
|
|
44
51
|
* Height in pixels, or one per size step. Used when neither `aspectRatio` nor `fill` is set.
|
|
45
|
-
* Default 240.
|
|
52
|
+
* Default 240. Passing it WITH `fill` is a wiring mistake, not a fallback — `fill` wins and
|
|
53
|
+
* this is never read, which now warns once in dev (`common/errors.ts`' `ignoredProp`).
|
|
46
54
|
*
|
|
47
55
|
* `{ base: 180, md: 260 }` is the declarative escape from a page of fixed-height charts: the
|
|
48
56
|
* steps are compared against the frame's own MEASURED width, not the viewport, so a chart squeezed
|
|
@@ -50,7 +58,8 @@ export type ChartFrameProps = BasaltProps & {
|
|
|
50
58
|
* supported ({@link resolveFrameHeight}).
|
|
51
59
|
*/
|
|
52
60
|
height?: number | ResponsiveChartHeight;
|
|
53
|
-
/** height = Math.round(containerWidth / aspectRatio). Ignored when `fill` is set
|
|
61
|
+
/** height = Math.round(containerWidth / aspectRatio). Ignored when `fill` is set — which warns
|
|
62
|
+
* once in dev, for the same reason `height` does. */
|
|
54
63
|
aspectRatio?: number;
|
|
55
64
|
/** Fill the parent flex/grid cell's measured height instead of a fixed/derived one. */
|
|
56
65
|
fill?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartFrame.d.ts","sourceRoot":"","sources":["../../../src/charts/primitives/ChartFrame.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,SAAS,EAAE,MAAM,OAAO,CAAA;AAErD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"ChartFrame.d.ts","sourceRoot":"","sources":["../../../src/charts/primitives/ChartFrame.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,SAAS,EAAE,MAAM,OAAO,CAAA;AAErD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAMrD,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAOhF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AAIjE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAEhD;qGACqG;AACrG,O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SAAS,CAAA;CACxC,CAAA;AAED,0FAA0F;AAC1F,MAAM,MAAM,QAAQ,GAAG;IACrB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;CAC5B,CAAA;AAcD;oFACoF;AACpF,MAAM,MAAM,qBAAqB,GAAG;IAClC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAA;CAC1C,CAAA;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,iBAAiB,GAAG,KAAK,GAAG,SAAS,EAC7C,KAAK,CAAC,EAAE,qBAAqB,EAC7B,WAAW,CAAC,EAAE,MAAM,GACnB,gBAAgB,GAAG,KAAK,CAU1B;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,UAAU,CAAC,EACzB,MAAM,EACN,MAAM,EACN,WAAW,EACX,IAAY,EACZ,QAA4B,EAC5B,OAAO,EACP,MAAW,EACX,SAAS,EACT,SAAiB,EACjB,KAAK,EACL,SAAS,EACT,KAAK,EACL,QAAQ,GACT,EAAE,eAAe,GAAG,SAAS,CAiI7B"}
|
|
@@ -1,19 +1,25 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, useState } from "react";
|
|
3
|
+
import { ignoredProp } from "../../common/errors.js";
|
|
4
|
+
import { useValidateProps } from "../../common/validate.js";
|
|
3
5
|
import { VX } from "../../tokens/index.js";
|
|
4
6
|
import { useChartSize } from "../hooks/useChartSize.js";
|
|
5
7
|
import { deriveLegend } from "../series.js";
|
|
6
8
|
import {
|
|
7
|
-
legendEntryCap,
|
|
8
9
|
resolveChartTier,
|
|
9
10
|
resolveFrameHeight,
|
|
10
|
-
|
|
11
|
+
resolveLegendRollup,
|
|
11
12
|
resolvePlotRect
|
|
12
13
|
} from "./chart-frame-layout.js";
|
|
13
14
|
import { ChartTierProvider } from "./chart-tier.js";
|
|
14
15
|
import { ChartLegend } from "./ChartLegend.js";
|
|
15
16
|
import { ChartEmpty, ChartError, ChartPending, resolveChartState } from "./ChartPending.js";
|
|
16
|
-
import {
|
|
17
|
+
import {
|
|
18
|
+
legendEntryCap,
|
|
19
|
+
resolveLegendRollup as resolveLegendRollup2,
|
|
20
|
+
resolvePlotRect as resolvePlotRect2,
|
|
21
|
+
resolveChartTier as resolveChartTier2
|
|
22
|
+
} from "./chart-frame-layout.js";
|
|
17
23
|
const DEFAULT_HEIGHT = 240;
|
|
18
24
|
const DEFAULT_MIN_WIDTH = 200;
|
|
19
25
|
const outerStyle = (fill, vertical) => ({
|
|
@@ -63,6 +69,22 @@ function ChartFrame({
|
|
|
63
69
|
return next;
|
|
64
70
|
});
|
|
65
71
|
}, []);
|
|
72
|
+
useValidateProps(
|
|
73
|
+
"ChartFrame",
|
|
74
|
+
() => [
|
|
75
|
+
fill && height !== void 0 ? ignoredProp(
|
|
76
|
+
"ChartFrame",
|
|
77
|
+
"height",
|
|
78
|
+
"`fill` is set \u2014 a fill frame takes its parent cell's measured height. Pass one or the other."
|
|
79
|
+
) : null,
|
|
80
|
+
fill && aspectRatio !== void 0 ? ignoredProp(
|
|
81
|
+
"ChartFrame",
|
|
82
|
+
"aspectRatio",
|
|
83
|
+
"`fill` is set \u2014 a fill frame takes its parent cell's measured height. Pass one or the other."
|
|
84
|
+
) : null
|
|
85
|
+
],
|
|
86
|
+
[fill, height, aspectRatio]
|
|
87
|
+
);
|
|
66
88
|
const placement = legend === false ? "bottom" : legend.placement ?? "bottom";
|
|
67
89
|
const vertical = placement === "left" || placement === "right";
|
|
68
90
|
const resolvedState = resolveChartState({ ...state !== void 0 && { state }, isPending });
|
|
@@ -71,22 +93,24 @@ function ChartFrame({
|
|
|
71
93
|
const resolvedHeight = fill ? containerH : aspectRatio !== void 0 ? Math.round(containerW / aspectRatio) : resolveFrameHeight(height ?? DEFAULT_HEIGHT, containerW);
|
|
72
94
|
const sideLegendWidth = legendVisible && vertical ? legendW : 0;
|
|
73
95
|
const topBottomLegendHeight = legendVisible && !vertical ? legendH : 0;
|
|
96
|
+
const legendItems = legend === false ? [] : deriveLegend(series);
|
|
97
|
+
const togglable = legend !== false && (legend.toggle ?? legendItems.length > 1);
|
|
98
|
+
const { maxRows, legendWins } = resolveLegendRollup({
|
|
99
|
+
...legend !== false && legend.maxRows !== void 0 && { statedMaxRows: legend.maxRows },
|
|
100
|
+
tier,
|
|
101
|
+
fillBand: legendVisible && fill && !vertical,
|
|
102
|
+
items: legendItems,
|
|
103
|
+
containerW,
|
|
104
|
+
available: resolvedHeight - VX.minPlotHeight
|
|
105
|
+
});
|
|
74
106
|
const plot = resolvePlotRect({
|
|
75
107
|
containerW,
|
|
76
108
|
resolvedHeight,
|
|
77
109
|
minWidth,
|
|
78
110
|
sideLegendWidth,
|
|
79
|
-
topBottomLegendHeight
|
|
111
|
+
topBottomLegendHeight,
|
|
112
|
+
...legendWins && { legendWins }
|
|
80
113
|
});
|
|
81
|
-
const legendItems = legend === false ? [] : deriveLegend(series);
|
|
82
|
-
const togglable = legend !== false && (legend.toggle ?? legendItems.length > 1);
|
|
83
|
-
const callerMaxRows = legend === false ? void 0 : resolveLegendMaxRows({ callerMaxRows: legend.maxRows, tier });
|
|
84
|
-
const maxRows = legend === false ? void 0 : fill && !vertical ? legendEntryCap({
|
|
85
|
-
items: legendItems,
|
|
86
|
-
containerW,
|
|
87
|
-
available: resolvedHeight - VX.minPlotHeight,
|
|
88
|
-
...callerMaxRows !== void 0 && { callerMaxRows }
|
|
89
|
-
}) : callerMaxRows;
|
|
90
114
|
const legendNode = legend === false || resolvedState !== null ? null : /* @__PURE__ */ jsx("div", { ref: legendRef, style: legendWrapperStyle(vertical), children: /* @__PURE__ */ jsx(
|
|
91
115
|
ChartLegend,
|
|
92
116
|
{
|
|
@@ -126,8 +150,9 @@ function ChartFrame({
|
|
|
126
150
|
}
|
|
127
151
|
export {
|
|
128
152
|
ChartFrame,
|
|
129
|
-
|
|
153
|
+
legendEntryCap,
|
|
130
154
|
resolveChartTier2 as resolveChartTier,
|
|
131
155
|
resolveLegend,
|
|
156
|
+
resolveLegendRollup2 as resolveLegendRollup,
|
|
132
157
|
resolvePlotRect2 as resolvePlotRect
|
|
133
158
|
};
|
|
@@ -27,9 +27,11 @@ export type LegendEntry = {
|
|
|
27
27
|
* Shared legend for all non-sparkline charts. `highlighted`/`onHighlight` are optional — omit for
|
|
28
28
|
* static legends without hover interactivity. `chartId` namespaces `split` clipPath ids so two
|
|
29
29
|
* legends on the same page never collide. `groups` renders series → hairline divider → overlay →
|
|
30
|
-
* reference bands instead of one flat smear. `maxRows` caps the number of rendered
|
|
31
|
-
* rolls the remainder into a `+N more` chip
|
|
32
|
-
*
|
|
30
|
+
* reference bands instead of one flat smear. `maxRows` caps the number of rendered ENTRIES and
|
|
31
|
+
* rolls the remainder into a `+N more` chip — it is an entry count, not a row count, in spite of
|
|
32
|
+
* the name (`entries.slice(0, cap)` below is the whole of it, and `ChartFrame` measures rows for a
|
|
33
|
+
* different purpose in `legendEntryCap`). The name is inherited and reaches the public
|
|
34
|
+
* `ChartTierMetrics.legendMaxRows`, so it stays until a minor can rename both.
|
|
33
35
|
*
|
|
34
36
|
* `onToggle` makes an entry a real toggle: clicking it hides the series in the plot, the tooltip,
|
|
35
37
|
* and the auto y-domain together (`ChartFrame` owns the `hidden` set — see `docs/CHARTS-SPEC.md`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartLegend.d.ts","sourceRoot":"","sources":["../../../src/charts/primitives/ChartLegend.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAErD,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAG5D,MAAM,MAAM,WAAW,GAAG;IACxB,GAAG,EAAE,MA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FAC6E;IAC7E,QAAQ,CAAC,EAAE,WAAW,EAAE,CAAA;IACxB;gCAC4B;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CAAA;AAgOD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EACL,WAAkB,EAClB,WAAW,EACX,MAAkB,EAClB,QAAQ,EACR,OAAY,EACZ,SAAoB,EACpB,MAAc,EACd,OAAO,EACP,SAAS,EACT,KAAK,GACN,EAAE,WAAW,GAAG;IACf,KAAK,EAAE,WAAW,EAAE,CAAA;IACpB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAA;IAC1C,kCAAkC;IAClC,MAAM,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;IAC5B,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;IAChC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,eAAe,CAAA;IAC3B,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,+BAkFA"}
|
|
@@ -75,7 +75,7 @@ export type ChartTierMetrics = {
|
|
|
75
75
|
/** Floating tooltip `minWidth`, px. */
|
|
76
76
|
tooltipMinWidth: number;
|
|
77
77
|
/** Default entry cap on the legend, or `undefined` for no default cap. An explicit
|
|
78
|
-
* `legend.maxRows`
|
|
78
|
+
* `legend.maxRows` replaces it outright ({@link resolveLegendMaxRows}). */
|
|
79
79
|
legendMaxRows: number | undefined;
|
|
80
80
|
/** Per-side margin FLOORS (`VX.margin` is a floor, never a ceiling — §1). */
|
|
81
81
|
margin: ChartMargin;
|
|
@@ -93,14 +93,49 @@ export declare function chartTierMetrics(tier: ChartTier): ChartTierMetrics;
|
|
|
93
93
|
* panel on a 1440px desktop is "a phone", so a six-series legend rolled up to two rows + `+4 more`
|
|
94
94
|
* with no way to say no. `margin` and `xLabelRotate` always had that escape; the legend did not.
|
|
95
95
|
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
96
|
+
* The measured {@link legendEntryCap} a `fill` frame applies is NOT a second ceiling on top of
|
|
97
|
+
* this: it resolves an ABSENT cap only. 1.30.0 ran it over the caller's number as well
|
|
98
|
+
* (`Math.min(fitted, caller)`), which made "wins outright" false again in the one place it was
|
|
99
|
+
* needed — meteo measured a 7-entry legend pinned to 2 entries at `maxRows` 3, 6 AND 99, with 5
|
|
100
|
+
* series drawn in colours the legend refused to name. The fit is not physics either: it derives
|
|
101
|
+
* from `VX.minPlotHeight`, which is a framework DEFAULT about the plot. Two defaults do not
|
|
102
|
+
* outvote the one number a caller stated, so the PLOT yields the height instead
|
|
103
|
+
* ({@link resolvePlotRect}'s `legendWins`) — visibly, in the frame the caller sized.
|
|
99
104
|
*/
|
|
100
105
|
export declare function resolveLegendMaxRows(input: {
|
|
101
106
|
callerMaxRows?: number | undefined;
|
|
102
107
|
tier: ChartTier;
|
|
103
108
|
}): number | undefined;
|
|
109
|
+
/**
|
|
110
|
+
* The whole legend-cap decision in one place: which cap `ChartLegend` gets, and whether the plot
|
|
111
|
+
* pays for it.
|
|
112
|
+
*
|
|
113
|
+
* It lives here rather than inline in `ChartFrame` because the COMPOSITION is what broke. 1.30.0
|
|
114
|
+
* had both halves right on their own — {@link resolveLegendMaxRows} honoured a stated cap,
|
|
115
|
+
* {@link legendEntryCap} measured a fit — and then ran the second over the first, which no test
|
|
116
|
+
* could see because neither pure function was wrong and the frame that combined them needs a
|
|
117
|
+
* `ResizeObserver` to test. Now the combination is a pure function too.
|
|
118
|
+
*
|
|
119
|
+
* Three cases, in order:
|
|
120
|
+
* 1. The caller STATED a number → it is the cap, and on a `fill` band the plot yields
|
|
121
|
+
* (`legendWins`). Nothing measured or defaulted trims it.
|
|
122
|
+
* 2. No `fill` band → the tier's default (or none), because the frame simply grows.
|
|
123
|
+
* 3. A `fill` band with nothing stated → the measured fit, bounded by the tier's default.
|
|
124
|
+
*/
|
|
125
|
+
export declare function resolveLegendRollup(input: {
|
|
126
|
+
/** The caller's own `legend.maxRows`. */
|
|
127
|
+
statedMaxRows?: number | undefined;
|
|
128
|
+
tier: ChartTier;
|
|
129
|
+
/** A visible top/bottom legend on a `fill` frame — the one shape whose box cannot grow. */
|
|
130
|
+
fillBand: boolean;
|
|
131
|
+
items: readonly LegendEntry[];
|
|
132
|
+
containerW: number;
|
|
133
|
+
/** Frame height the legend may consume — `resolvedHeight - VX.minPlotHeight`. */
|
|
134
|
+
available: number;
|
|
135
|
+
}): {
|
|
136
|
+
maxRows: number | undefined;
|
|
137
|
+
legendWins: boolean;
|
|
138
|
+
};
|
|
104
139
|
/**
|
|
105
140
|
* Resolve the plot rect from the measured box and the measured legend band. Pure and exported so
|
|
106
141
|
* the two floors below are testable without a `ResizeObserver`.
|
|
@@ -115,9 +150,12 @@ export declare function resolveLegendMaxRows(input: {
|
|
|
115
150
|
* `height={240}` toward zero and the body stopped rendering entirely. The plot stops at
|
|
116
151
|
* `VX.minPlotHeight` and the frame's own box grows by the difference instead — it is a flex
|
|
117
152
|
* column with `height: auto`, so that growth is automatic. Under `fill` the box CANNOT grow, so
|
|
118
|
-
* the legend is capped instead ({@link legendEntryCap})
|
|
119
|
-
*
|
|
120
|
-
*
|
|
153
|
+
* the legend is capped instead ({@link legendEntryCap}) — UNLESS the caller stated
|
|
154
|
+
* `legend.maxRows`, which is `legendWins`: there the floor itself yields, because a floor is a
|
|
155
|
+
* default and the caller's number is not, but only as far as the box HAS room
|
|
156
|
+
* ({@link SELF_MEASURED_SLACK}). An unmeasured box (`resolvedHeight <= 0`, i.e. a `fill` frame
|
|
157
|
+
* before its first measurement) stays at 0 and renders nothing, exactly as before — the floor
|
|
158
|
+
* must never invent a height for a box nobody has measured.
|
|
121
159
|
*/
|
|
122
160
|
export declare function resolvePlotRect(input: {
|
|
123
161
|
containerW: number;
|
|
@@ -125,6 +163,15 @@ export declare function resolvePlotRect(input: {
|
|
|
125
163
|
minWidth: number;
|
|
126
164
|
sideLegendWidth: number;
|
|
127
165
|
topBottomLegendHeight: number;
|
|
166
|
+
/**
|
|
167
|
+
* The caller stated `legend.maxRows` on a `fill` frame, so the legend takes the rows it asked
|
|
168
|
+
* for and the plot takes what is left — `VX.minPlotHeight` stops being a floor. Without this the
|
|
169
|
+
* honoured cap would push the frame's content PAST its own cell (the plot holds 120px, the legend
|
|
170
|
+
* band adds its own) and paint over whatever sits below it; with it, the cost of the caller's
|
|
171
|
+
* number lands where they can see it. Spend the whole box on legend rows and there is no plot
|
|
172
|
+
* left to draw — that is their arithmetic, made visible rather than silently rolled up.
|
|
173
|
+
*/
|
|
174
|
+
legendWins?: boolean;
|
|
128
175
|
}): {
|
|
129
176
|
width: number;
|
|
130
177
|
height: number;
|
|
@@ -138,13 +185,21 @@ export declare function resolvePlotRect(input: {
|
|
|
138
185
|
* MEASURING the labels, not from assuming one entry per row — otherwise a five-entry legend that
|
|
139
186
|
* fits on one line would roll up to `+2 more` in every 240px cell, moving rendering for charts
|
|
140
187
|
* that never had the bug. Returns `undefined` when the whole legend already fits.
|
|
188
|
+
*
|
|
189
|
+
* This resolves an ABSENT cap. A caller who stated `legend.maxRows` never reaches here at all —
|
|
190
|
+
* `ChartFrame` routes around it — because `Math.min`-ing a stated number against this one made the
|
|
191
|
+
* documented escape inert in exactly the narrow `fill` panel it exists for
|
|
192
|
+
* ({@link resolveLegendMaxRows}).
|
|
141
193
|
*/
|
|
142
194
|
export declare function legendEntryCap(input: {
|
|
143
195
|
items: readonly LegendEntry[];
|
|
144
196
|
containerW: number;
|
|
145
197
|
/** Frame height the legend may consume — `resolvedHeight - VX.minPlotHeight`. */
|
|
146
198
|
available: number;
|
|
147
|
-
/**
|
|
148
|
-
|
|
199
|
+
/**
|
|
200
|
+
* The cap that applies when nothing explicit was stated — today only the tier's own default
|
|
201
|
+
* ({@link chartTierMetrics}). Two defaults contending: the smaller wins.
|
|
202
|
+
*/
|
|
203
|
+
defaultMaxRows?: number;
|
|
149
204
|
}): number | undefined;
|
|
150
205
|
//# sourceMappingURL=chart-frame-layout.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart-frame-layout.d.ts","sourceRoot":"","sources":["../../../src/charts/primitives/chart-frame-layout.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAUhD;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,SAAS,CAAA;AAE3C;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAE9D;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,uGAAuG;IACvG,IAAI,EAAE,MAAM,CAAA;IACZ,iDAAiD;IACjD,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,qBAAqB;IACrB,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,sBAAsB;IACtB,EAAE,CAAC,EAAE,MAAM,CAAA;CACZ,CAAA;AAiBD;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,GAAG,qBAAqB,EACtC,UAAU,EAAE,MAAM,GACjB,MAAM,CAQR;AAqBD;6FAC6F;AAC7F,MAAM,MAAM,gBAAgB,GAAG;IAC7B,2FAA2F;IAC3F,IAAI,EAAE,SAAS,CAAA;IACf;uFACmF;IACnF,QAAQ,EAAE,MAAM,CAAA;IAChB,kCAAkC;IAClC,cAAc,EAAE,MAAM,CAAA;IACtB,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,uCAAuC;IACvC,eAAe,EAAE,MAAM,CAAA;IACvB;
|
|
1
|
+
{"version":3,"file":"chart-frame-layout.d.ts","sourceRoot":"","sources":["../../../src/charts/primitives/chart-frame-layout.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAUhD;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,SAAS,CAAA;AAE3C;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAE9D;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,uGAAuG;IACvG,IAAI,EAAE,MAAM,CAAA;IACZ,iDAAiD;IACjD,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,qBAAqB;IACrB,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,sBAAsB;IACtB,EAAE,CAAC,EAAE,MAAM,CAAA;CACZ,CAAA;AAiBD;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,GAAG,qBAAqB,EACtC,UAAU,EAAE,MAAM,GACjB,MAAM,CAQR;AAqBD;6FAC6F;AAC7F,MAAM,MAAM,gBAAgB,GAAG;IAC7B,2FAA2F;IAC3F,IAAI,EAAE,SAAS,CAAA;IACf;uFACmF;IACnF,QAAQ,EAAE,MAAM,CAAA;IAChB,kCAAkC;IAClC,cAAc,EAAE,MAAM,CAAA;IACtB,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,uCAAuC;IACvC,eAAe,EAAE,MAAM,CAAA;IACvB;+EAC2E;IAC3E,aAAa,EAAE,MAAM,GAAG,SAAS,CAAA;IACjC,6EAA6E;IAC7E,MAAM,EAAE,WAAW,CAAA;CACpB,CAAA;AA6BD,gGAAgG;AAChG,wBAAgB,gBAAgB,CAAC,IAA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AAM,CAAA;CACxB,GAAG,MAAM,GAAG,SAAS,CAerB"}
|
|
@@ -52,13 +52,41 @@ function chartTierMetrics(tier) {
|
|
|
52
52
|
function resolveLegendMaxRows(input) {
|
|
53
53
|
return input.callerMaxRows ?? chartTierMetrics(input.tier).legendMaxRows;
|
|
54
54
|
}
|
|
55
|
+
function resolveLegendRollup(input) {
|
|
56
|
+
const { statedMaxRows, tier, fillBand, items, containerW, available } = input;
|
|
57
|
+
if (statedMaxRows !== void 0) return { maxRows: statedMaxRows, legendWins: fillBand };
|
|
58
|
+
const tierMaxRows = resolveLegendMaxRows({ callerMaxRows: void 0, tier });
|
|
59
|
+
if (!fillBand) return { maxRows: tierMaxRows, legendWins: false };
|
|
60
|
+
return {
|
|
61
|
+
maxRows: legendEntryCap({
|
|
62
|
+
items,
|
|
63
|
+
containerW,
|
|
64
|
+
available,
|
|
65
|
+
...tierMaxRows !== void 0 && { defaultMaxRows: tierMaxRows }
|
|
66
|
+
}),
|
|
67
|
+
legendWins: false
|
|
68
|
+
};
|
|
69
|
+
}
|
|
55
70
|
function resolvePlotRect(input) {
|
|
56
|
-
const {
|
|
71
|
+
const {
|
|
72
|
+
containerW,
|
|
73
|
+
resolvedHeight,
|
|
74
|
+
minWidth,
|
|
75
|
+
sideLegendWidth,
|
|
76
|
+
topBottomLegendHeight,
|
|
77
|
+
legendWins = false
|
|
78
|
+
} = input;
|
|
79
|
+
const room = resolvedHeight - topBottomLegendHeight;
|
|
80
|
+
const plotFloor = legendWins && !isSelfMeasured(room) ? 0 : VX.minPlotHeight;
|
|
57
81
|
return {
|
|
58
82
|
width: containerW === 0 ? minWidth : Math.max(containerW - sideLegendWidth, 1),
|
|
59
|
-
height: resolvedHeight <= 0 ? 0 : Math.max(
|
|
83
|
+
height: resolvedHeight <= 0 ? 0 : Math.max(room, plotFloor)
|
|
60
84
|
};
|
|
61
85
|
}
|
|
86
|
+
const SELF_MEASURED_SLACK = 0.5;
|
|
87
|
+
function isSelfMeasured(room) {
|
|
88
|
+
return room >= 0 && room < SELF_MEASURED_SLACK;
|
|
89
|
+
}
|
|
62
90
|
const legendBandHeight = (rows) => LEGEND_PAD_Y + rows * LEGEND_LINE_H + Math.max(rows - 1, 0) * VX.legendGap;
|
|
63
91
|
const legendEntryWidth = (item) => LEGEND_SWATCH_W + measureText(
|
|
64
92
|
item.note === void 0 ? item.label : `${item.label} ${item.note}`,
|
|
@@ -83,17 +111,17 @@ function entriesWithinRows(items, width, rows) {
|
|
|
83
111
|
return fitted;
|
|
84
112
|
}
|
|
85
113
|
function legendEntryCap(input) {
|
|
86
|
-
const { items, containerW, available,
|
|
87
|
-
if (containerW <= 0 || items.length === 0) return
|
|
114
|
+
const { items, containerW, available, defaultMaxRows } = input;
|
|
115
|
+
if (containerW <= 0 || items.length === 0) return defaultMaxRows;
|
|
88
116
|
const rows = Math.max(
|
|
89
117
|
1,
|
|
90
118
|
Math.floor((available - LEGEND_PAD_Y + VX.legendGap) / (LEGEND_LINE_H + VX.legendGap))
|
|
91
119
|
);
|
|
92
120
|
if (legendBandHeight(rows) <= available && entriesWithinRows(items, containerW, rows) >= items.length) {
|
|
93
|
-
return
|
|
121
|
+
return defaultMaxRows;
|
|
94
122
|
}
|
|
95
123
|
const fitted = Math.max(1, entriesWithinRows(items, containerW, rows));
|
|
96
|
-
return
|
|
124
|
+
return defaultMaxRows === void 0 ? fitted : Math.min(fitted, defaultMaxRows);
|
|
97
125
|
}
|
|
98
126
|
export {
|
|
99
127
|
chartTierMetrics,
|
|
@@ -101,5 +129,6 @@ export {
|
|
|
101
129
|
resolveChartTier,
|
|
102
130
|
resolveFrameHeight,
|
|
103
131
|
resolveLegendMaxRows,
|
|
132
|
+
resolveLegendRollup,
|
|
104
133
|
resolvePlotRect
|
|
105
134
|
};
|
package/dist/common/errors.d.ts
CHANGED
|
@@ -23,6 +23,17 @@ export declare function oneOf(component: string, prop: string, allowed: readonly
|
|
|
23
23
|
* Majors are banned here, so the deprecation notice IS the migration channel.
|
|
24
24
|
*/
|
|
25
25
|
export declare function deprecatedProp(component: string, oldProp: string, newProp: string, removeIn: string): string;
|
|
26
|
+
/**
|
|
27
|
+
* A prop the component ACCEPTS, reads nothing from, and cannot report as wrong — because a SECOND
|
|
28
|
+
* prop it was passed alongside decides the same thing and won.
|
|
29
|
+
*
|
|
30
|
+
* Distinct from {@link deprecatedProp} (still read, going away) and {@link oneOf} (read, and the
|
|
31
|
+
* value is out of range): this one renders something the caller did not ask for and nothing in the
|
|
32
|
+
* type system, the linter or the console says so. `ChartFrame`'s `height` under `fill` is the
|
|
33
|
+
* reference case — meteo passed both for the life of the file and never learnt that eight height
|
|
34
|
+
* constants and a whole `compact` branch changed no pixel.
|
|
35
|
+
*/
|
|
36
|
+
export declare function ignoredProp(component: string, prop: string, because: string): string;
|
|
26
37
|
/**
|
|
27
38
|
* An imperative call needs a layer that is not there — the optional peer is not installed, or the
|
|
28
39
|
* mount that subscribes to its event bus is disabled. Both halves are named because the remedy
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/common/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,yDAAyD;AACzD,eAAO,MAAM,aAAa,aAAa,CAAA;AAMvC;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAEnF;AAED,oEAAoE;AACpE,wBAAgB,KAAK,CACnB,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,SAAS,MAAM,EAAE,EAC1B,GAAG,EAAE,OAAO,GACX,MAAM,CAMR;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,GACf,MAAM,CAKR;AAED;;;;GAIG;AACH,wB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