@bicharts/chart-host 0.6.84 → 0.6.86

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.
@@ -0,0 +1,29 @@
1
+ import { type LegendReconcileResult } from "./legendReconcileDom";
2
+ import { type FrameFitOutcome } from "./frameFitDom";
3
+ /** "smart" acts on smaller overlaps with larger moves; "narrow" only on large, unambiguous ones. */
4
+ export type LegendFitStrictness = "smart" | "narrow";
5
+ export interface LegendFitPassOptions {
6
+ /** Run the legend reconcile (legend slide, colorbar, axis and label-row thinning, bottom-text push, content fit). Default true. */
7
+ legend?: boolean | LegendFitStrictness;
8
+ /** Run the frame fit (viewBox growth for text just past the frame, then shrink-and-cut of the labels it deferred). Default true. */
9
+ frameFit?: boolean;
10
+ /** What each run did. Counts and reasons only; the host decides what to log. */
11
+ onReport?: (report: LegendFitReport) => void;
12
+ }
13
+ export interface LegendFitReport {
14
+ legend: LegendReconcileResult | {
15
+ skipped: "off" | "no-svg";
16
+ } | {
17
+ error: string;
18
+ };
19
+ frame: FrameFitOutcome | {
20
+ skipped: "off" | "table-lane" | "nothing-to-measure";
21
+ } | {
22
+ error: string;
23
+ };
24
+ }
25
+ /**
26
+ * Build the pass once (module scope, or a memo) and hand it to createChartHost as `layoutPass`: a new function
27
+ * on every render is a new host config. Each run never throws; a pass that fails reports `{ error }`.
28
+ */
29
+ export declare function createLegendFitPass(opts?: LegendFitPassOptions): (container: HTMLElement) => void;
@@ -41,6 +41,13 @@ export interface BicChartProps {
41
41
  labelContrast?: ChartHostConfig["labelContrast"];
42
42
  /** What the label-contrast pass did after each render - counts, for a page that logs. */
43
43
  onLabelContrast?: ChartHostConfig["onLabelContrast"];
44
+ /**
45
+ * A LAYOUT PASS run after every render, after label contrast and before the fit - e.g.
46
+ * `createLegendFitPass()` from "@bicharts/chart-host/legend-fit", which slides a legend clear of
47
+ * the plot and fits text to the frame. Absent by default. Build it ONCE (module scope or useMemo):
48
+ * a new function each render rebuilds the host. See createChartHost's `layoutPass`.
49
+ */
50
+ layoutPass?: ChartHostConfig["layoutPass"];
44
51
  /**
45
52
  * THE CHART STOPPED BECAUSE THE DATA LACKS A COLUMN IT IS BUILT ON. Supplied: the chart's
46
53
  * container is left empty and this is called with the chart's reason, instead of the throw
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bicharts/chart-host",
3
- "version": "0.6.84",
3
+ "version": "0.6.86",
4
4
  "description": "Run a BIC-generated D3 chart in any web host: compiles the generated render() function, applies the shared option defaults, resolves mark clicks (through tooltip overlays), owns the selection affordance, and translates row indices between cross-filtered charts. The same contract the BIC Power BI visual implements, minus Power BI. React bindings at @bicharts/chart-host/react.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -59,6 +59,11 @@
59
59
  "import": "./dist/adapters.mjs",
60
60
  "default": "./dist/adapters.mjs"
61
61
  },
62
+ "./legend-fit": {
63
+ "types": "./dist/types/legendFit/index.d.ts",
64
+ "import": "./dist/legend-fit.mjs",
65
+ "default": "./dist/legend-fit.mjs"
66
+ },
62
67
  "./dax": {
63
68
  "types": "./dist/types/dax.d.ts",
64
69
  "import": "./dist/dax.mjs",